Compare commits

...

98 Commits

Author SHA1 Message Date
elasota
4920781619 32-bit color support 2020-06-13 04:33:41 -04:00
elasota
24f43b973a Fix build timestamp 2020-06-07 22:17:02 -04:00
elasota
649d78a61b Tag release 1.0.1 2020-06-07 21:05:08 -04:00
elasota
836fc95f4a EOL fix 2020-06-07 20:45:30 -04:00
elasota
5b95fd8c6b Use Apple RGB color profile 2020-06-07 20:42:49 -04:00
elasota
b55a508686 Use error diffusion for 24-to-8 picture draws 2020-06-07 20:42:07 -04:00
elasota
47291cbf1d Support custom pause and banner graphics 2020-06-07 19:36:53 -04:00
elasota
01e6ff4f5d Fix >16bpp images emitting color table data, causing image corruption, especially in 24bpp images 2020-06-07 17:45:29 -04:00
elasota
d828eacd38 Clean "Packaged" dir when converting resources 2020-06-07 17:20:21 -04:00
elasota
b37b0a4f8a Add MACE 6:1 decompression to fix some missing audio samples, parallelize deflate compression 2020-06-07 17:18:04 -04:00
elasota
4c3ccbd7fa Only copy PDBs that are actually in the release package 2020-06-06 02:32:05 -04:00
elasota
9624c283c8 Updated version tagging and added about dialog 2020-06-06 02:25:10 -04:00
elasota
cfb66d9c9b Fix res patch file adding not working 2020-06-06 01:49:54 -04:00
elasota
c185c8d9ec Fix filters 2020-06-05 23:33:58 -04:00
elasota
7636fd6fa8 Remove unused file 2020-06-05 23:25:08 -04:00
elasota
6c48debecd Code cleanup 2020-06-05 23:21:56 -04:00
elasota
3f55eedcf0 Remove unused header 2020-06-05 23:19:47 -04:00
elasota
856c7d5297 Remove unused header 2020-06-05 22:17:35 -04:00
elasota
d7301402c5 Fix broken release script 2020-06-04 17:26:02 -04:00
elasota
2a98bfbc8c Remove AppleEvents API 2020-06-02 20:01:16 -04:00
elasota
eac923c475 Refactoring 2020-06-01 00:38:24 -04:00
elasota
6fe0f2d964 API refactoring 2020-06-01 00:33:50 -04:00
elasota
a4abb0d95f Use XAudio 2.9 redistributable instead of 2.9 SDK. Should fix Win7 compatibility. 2020-05-31 21:19:51 -04:00
elasota
c856607f46 Fixed some documentation issues 2020-05-29 22:03:13 -04:00
elasota
611f53ef91 Fix audio driver starting in debug mode, add -diagnostics mode 2020-05-29 21:56:33 -04:00
elasota
98afd82d64 Fix missing NDEBUG flags 2020-05-29 01:45:40 -04:00
elasota
efae9cacd8 Add PDB directory to release script 2020-05-29 00:00:11 -04:00
elasota
5184d1594f Fix comment typo 2020-05-28 23:10:30 -04:00
elasota
42e124a90c Fix crash if audio init fails (especially if there are no output devices) 2020-05-28 23:05:32 -04:00
elasota
11628ddd93 Fix link crash 2020-05-27 18:06:22 -04:00
elasota
7d5f844fd4 Fix bad usage formatting 2020-05-27 18:06:12 -04:00
elasota
f5ff8eb013 Add color fade 2020-05-22 21:14:43 -04:00
elasota
482487d81c Change window title 2020-05-22 20:42:18 -04:00
elasota
2d8b6a29aa Add scroll bar highlights 2020-05-22 20:22:51 -04:00
elasota
8f433c11e8 Revert "Add menu selection flicker"
This reverts commit bd9676be40.
2020-05-22 20:22:40 -04:00
elasota
9c32a6fdd4 Add stripes to window chrome 2020-05-22 05:41:07 -04:00
elasota
bd9676be40 Add menu selection flicker 2020-05-22 05:09:59 -04:00
elasota
392c5d0583 Lighten window chrome 2020-05-22 05:09:48 -04:00
elasota
14cc4b43df Fix a bug where getting a high score in a read-only house and then opening an editable house would cause the editable house to be overwritten 2020-05-21 08:23:09 -04:00
elasota
de342cb368 Fix bad string compare function (caused houses to not appear if they started with the same name as another house) 2020-05-21 08:22:29 -04:00
elasota
b68cfab6d8 Fix wrong prompt font size 2020-05-21 05:04:41 -04:00
elasota
5869571747 Finish removing QDState 2020-05-21 05:01:16 -04:00
elasota
432cdbcc3a Refactor out clip rect 2020-05-21 03:39:33 -04:00
elasota
438e7b2138 Refactor out forecolor 2020-05-21 03:30:11 -04:00
elasota
a1c45d4fc8 Factor out back color 2020-05-20 23:51:25 -04:00
elasota
66fc278ce9 Refactor QD ports so they no longer need to be the first member of draw surfaces 2020-05-20 23:33:17 -04:00
elasota
f53dc21475 Window API refactor 2020-05-20 17:20:50 -04:00
elasota
49c438b088 Fix flicker in load house UI 2020-05-18 04:38:16 -04:00
elasota
5e6ecaf0fa EOL fixes 2020-05-18 04:23:38 -04:00
elasota
47e36f1c3c Remove dead files from VS project, fix broken filters 2020-05-18 04:23:30 -04:00
elasota
d7a769e397 Change window icon 2020-05-18 04:05:18 -04:00
elasota
1abb542301 Fix sound prefs window flickering dark when changing the volume 2020-05-18 03:51:36 -04:00
elasota
afb9474340 Improve popup menu triangle visibility 2020-05-18 03:51:20 -04:00
elasota
50ab5f5bdb Inset stars window by 1px to account for border being present in the image 2020-05-18 03:36:48 -04:00
elasota
b12151f665 Use exclusive stack to keep darken during flicker 2020-05-18 03:36:20 -04:00
elasota
8135c68c49 Add flicker effect to chrome (replaces zooms) 2020-05-18 03:30:25 -04:00
elasota
5c07ce08bb Remove dead headers 2020-05-18 02:06:07 -04:00
elasota
ea16d0ffca More window chrome improvements 2020-05-18 02:03:17 -04:00
elasota
f590613f83 Default button chrome improvement 2020-05-17 23:02:08 -04:00
elasota
c0878fe66d Moved Aerofoil package defs out of the installer project to reduce chance of people getting bad ideas 2020-05-17 22:23:28 -04:00
elasota
9c18a2ba55 Installer improvements for 1.0b3 2020-05-17 22:04:07 -04:00
elasota
0b8a5cb38c Fixed resolution changed event using physical resolution instead of virtual 2020-05-17 19:55:16 -04:00
elasota
fde390ac73 Improve button chrome 2020-05-17 19:50:34 -04:00
elasota
153213e079 Improve PICT compatibility, add batch mode to gpr2gpa 2020-05-17 17:54:58 -04:00
elasota
35308e41f3 Fix MSI installer not setting houses read-only 2020-05-11 05:35:29 -04:00
elasota
931d7e0f30 Move install package generation to MakeRelease, fix missing read-only attribute on MSI installation houses 2020-05-11 04:34:43 -04:00
elasota
539af1f9b5 Adjust formatting, recommend FTagData parameters 2020-05-11 04:18:28 -04:00
elasota
e052628ed3 Remove ReleasePackageInstaller from Build Solution.
Add resource import batches to ReleasePackageInstaller build steps.
Together, this means that Build Solution and then building ReleasePackageInstaller from clean source should produce a working installer.
2020-05-11 01:21:10 -04:00
elasota
e52735ae7f Remove warning macro 2020-05-11 00:03:36 -04:00
elasota
e539b93de9 Adjust MSI package dir 2020-05-10 20:13:53 -04:00
elasota
f952b1c63a Add MSI installer project 2020-05-10 20:04:58 -04:00
elasota
44c32a06ab EOL fix 2020-05-10 20:04:10 -04:00
elasota
e1f9e86c56 EOL fix 2020-05-10 20:03:59 -04:00
elasota
231c4b411f Update docs in line with flattenmov's new behavior 2020-05-09 23:50:34 -04:00
elasota
9ddaec8add Fix Compact Pro extractor data corruption 2020-05-09 23:11:39 -04:00
elasota
e9d65697f3 Add some missing defs, change flattenmov to use triplets 2020-05-09 23:11:16 -04:00
elasota
ebb6d7608e Add unpacktool 2020-05-09 21:05:58 -04:00
elasota
b849d23f4e Update readme 2020-05-02 16:08:52 -04:00
elasota
62d9766ee0 Add close box support to floating windows 2020-05-02 02:59:19 -04:00
elasota
e546c05ea0 Fix scroll bar SetMin/SetMax not working correctly 2020-05-02 02:14:52 -04:00
elasota
3b7858f96a Add support for map window resize in editor 2020-05-02 01:51:32 -04:00
elasota
92c4878492 Fix scaling behavior when the window size doesn't divide evenly into the pixel scale 2020-04-26 01:56:55 -04:00
elasota
e2127038ef Add fullscreen keybind to docs 2020-04-25 21:22:22 -04:00
elasota
cea0a72ebc Remove more obsolete API 2020-04-25 21:22:09 -04:00
elasota
3c5dd5f562 Manually pass dx/dy instead of using ddx/ddy, should improve interpolation somewhat 2020-04-25 18:54:56 -04:00
elasota
5bb6b074f0 Scale quads after rendering to a screen texture instead of scaling directly. Fixes discontinuities in room editor and menu edges. 2020-04-25 16:35:34 -04:00
elasota
ea217285c0 Decrease scale granularity to 2.0 2020-04-25 00:53:43 -04:00
elasota
cd4e0ae8de Use Fant filter to resize to intermediate resolutions. 2020-04-25 00:51:44 -04:00
elasota
c357ca2b7c Fix artifacts if a resize reordered the saved maps of an item.
(Happens in Slumberland if resizing the window from 1600x900 to 800x600 in the second room, then picking up the cuckoo.)
2020-04-25 00:50:28 -04:00
elasota
b5a3db860f Update license 2020-04-23 21:41:19 -04:00
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
295 changed files with 15207 additions and 3976 deletions

10
.gitignore vendored
View File

@@ -24,3 +24,13 @@
Packaged/*
DebugData/*
ReleasePkg/*
InstallerPackages/*
*.msi
*.wixpdb
*.wixobj
*.CopyComplete
ReleasePackageInstaller/obj/*
ReleasePackageInstaller/bin/*
ReleasePackageInstaller/AerofoilPackageDefs.wxi
ReleasePackageInstaller/AerofoilPackageVersion.wxi
packages/*

View File

@@ -21,4 +21,16 @@ Distributed under the MIT license (See rapidjson/license.txt)
zlib:
(C) 1995-2017 Jean-loup Gailly and Mark Adler
Distributed under zlib license (See zlib/README)
Distributed under zlib license (See zlib/README)
The Unarchiver:
Copyright (C) 2006-2013 Dag Ågren
Distributed under the LGPLv2 license (See unpacktool/LICENSE.txt)
MACE Audio decoder:
Copyright (c) 2002 Laszlo Torok <torokl@alpha.dfmk.hu>
Distributed under the LGPLv2 license (See macedec.cpp comments)

View File

@@ -43,92 +43,213 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MakeTimestamp", "MakeTimest
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flattenmov", "flattenmov\flattenmov.vcxproj", "{89F8D13E-F216-4B67-8DE9-7F842D349E94}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unpacktool", "unpacktool\unpacktool.vcxproj", "{A778D062-DE76-49F6-8D05-EB26852DD605}"
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "ReleasePackageInstaller", "ReleasePackageInstaller\ReleasePackageInstaller.wixproj", "{D26BD501-28A7-4849-8130-FB5EA0A2B82F}"
ProjectSection(ProjectDependencies) = postProject
{7EFF1E21-C375-45EA-A069-4E2232C8A72B} = {7EFF1E21-C375-45EA-A069-4E2232C8A72B}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WindowsUnicodeToolShim", "WindowsUnicodeToolShim\WindowsUnicodeToolShim.vcxproj", "{15009625-1120-405E-8BBA-69A16CD6713D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EmitWiXVersion", "EmitWiXVersion\EmitWiXVersion.vcxproj", "{7EFF1E21-C375-45EA-A069-4E2232C8A72B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{45B1B18C-C846-4044-9206-74F58DFC5E88}.Debug|x64.ActiveCfg = Debug|x64
{45B1B18C-C846-4044-9206-74F58DFC5E88}.Debug|x64.Build.0 = Debug|x64
{45B1B18C-C846-4044-9206-74F58DFC5E88}.Debug|x86.ActiveCfg = Debug|Win32
{45B1B18C-C846-4044-9206-74F58DFC5E88}.Debug|x86.Build.0 = Debug|Win32
{45B1B18C-C846-4044-9206-74F58DFC5E88}.Release|x64.ActiveCfg = Release|x64
{45B1B18C-C846-4044-9206-74F58DFC5E88}.Release|x64.Build.0 = Release|x64
{45B1B18C-C846-4044-9206-74F58DFC5E88}.Release|x86.ActiveCfg = Release|Win32
{45B1B18C-C846-4044-9206-74F58DFC5E88}.Release|x86.Build.0 = Release|Win32
{6EC62B0F-9353-40A4-A510-3788F1368B33}.Debug|x64.ActiveCfg = Debug|x64
{6EC62B0F-9353-40A4-A510-3788F1368B33}.Debug|x64.Build.0 = Debug|x64
{6EC62B0F-9353-40A4-A510-3788F1368B33}.Debug|x86.ActiveCfg = Debug|Win32
{6EC62B0F-9353-40A4-A510-3788F1368B33}.Debug|x86.Build.0 = Debug|Win32
{6EC62B0F-9353-40A4-A510-3788F1368B33}.Release|x64.ActiveCfg = Release|x64
{6EC62B0F-9353-40A4-A510-3788F1368B33}.Release|x64.Build.0 = Release|x64
{6EC62B0F-9353-40A4-A510-3788F1368B33}.Release|x86.ActiveCfg = Release|Win32
{6EC62B0F-9353-40A4-A510-3788F1368B33}.Release|x86.Build.0 = Release|Win32
{2FF15659-5C72-48B8-B55B-3C658E4125B5}.Debug|x64.ActiveCfg = Debug|x64
{2FF15659-5C72-48B8-B55B-3C658E4125B5}.Debug|x64.Build.0 = Debug|x64
{2FF15659-5C72-48B8-B55B-3C658E4125B5}.Debug|x86.ActiveCfg = Debug|Win32
{2FF15659-5C72-48B8-B55B-3C658E4125B5}.Debug|x86.Build.0 = Debug|Win32
{2FF15659-5C72-48B8-B55B-3C658E4125B5}.Release|x64.ActiveCfg = Release|x64
{2FF15659-5C72-48B8-B55B-3C658E4125B5}.Release|x64.Build.0 = Release|x64
{2FF15659-5C72-48B8-B55B-3C658E4125B5}.Release|x86.ActiveCfg = Release|Win32
{2FF15659-5C72-48B8-B55B-3C658E4125B5}.Release|x86.Build.0 = Release|Win32
{6233C3F2-5781-488E-B190-4FA8836F5A77}.Debug|x64.ActiveCfg = Debug|x64
{6233C3F2-5781-488E-B190-4FA8836F5A77}.Debug|x64.Build.0 = Debug|x64
{6233C3F2-5781-488E-B190-4FA8836F5A77}.Debug|x86.ActiveCfg = Debug|Win32
{6233C3F2-5781-488E-B190-4FA8836F5A77}.Debug|x86.Build.0 = Debug|Win32
{6233C3F2-5781-488E-B190-4FA8836F5A77}.Release|x64.ActiveCfg = Release|x64
{6233C3F2-5781-488E-B190-4FA8836F5A77}.Release|x64.Build.0 = Release|x64
{6233C3F2-5781-488E-B190-4FA8836F5A77}.Release|x86.ActiveCfg = Release|Win32
{6233C3F2-5781-488E-B190-4FA8836F5A77}.Release|x86.Build.0 = Release|Win32
{5FDE4822-C771-46A5-B6B2-FD12BACE86BF}.Debug|x64.ActiveCfg = Debug|x64
{5FDE4822-C771-46A5-B6B2-FD12BACE86BF}.Debug|x64.Build.0 = Debug|x64
{5FDE4822-C771-46A5-B6B2-FD12BACE86BF}.Debug|x86.ActiveCfg = Debug|Win32
{5FDE4822-C771-46A5-B6B2-FD12BACE86BF}.Debug|x86.Build.0 = Debug|Win32
{5FDE4822-C771-46A5-B6B2-FD12BACE86BF}.Release|x64.ActiveCfg = Release|x64
{5FDE4822-C771-46A5-B6B2-FD12BACE86BF}.Release|x64.Build.0 = Release|x64
{5FDE4822-C771-46A5-B6B2-FD12BACE86BF}.Release|x86.ActiveCfg = Release|Win32
{5FDE4822-C771-46A5-B6B2-FD12BACE86BF}.Release|x86.Build.0 = Release|Win32
{99549E56-2B3A-4B0C-9A1F-FBA6395BC96C}.Debug|x64.ActiveCfg = Debug|x64
{99549E56-2B3A-4B0C-9A1F-FBA6395BC96C}.Debug|x64.Build.0 = Debug|x64
{99549E56-2B3A-4B0C-9A1F-FBA6395BC96C}.Debug|x86.ActiveCfg = Debug|Win32
{99549E56-2B3A-4B0C-9A1F-FBA6395BC96C}.Debug|x86.Build.0 = Debug|Win32
{99549E56-2B3A-4B0C-9A1F-FBA6395BC96C}.Release|x64.ActiveCfg = Release|x64
{99549E56-2B3A-4B0C-9A1F-FBA6395BC96C}.Release|x64.Build.0 = Release|x64
{99549E56-2B3A-4B0C-9A1F-FBA6395BC96C}.Release|x86.ActiveCfg = Release|Win32
{99549E56-2B3A-4B0C-9A1F-FBA6395BC96C}.Release|x86.Build.0 = Release|Win32
{E3BDC783-8646-433E-ADF0-8B6390D36669}.Debug|x64.ActiveCfg = Debug|x64
{E3BDC783-8646-433E-ADF0-8B6390D36669}.Debug|x64.Build.0 = Debug|x64
{E3BDC783-8646-433E-ADF0-8B6390D36669}.Debug|x86.ActiveCfg = Debug|Win32
{E3BDC783-8646-433E-ADF0-8B6390D36669}.Debug|x86.Build.0 = Debug|Win32
{E3BDC783-8646-433E-ADF0-8B6390D36669}.Release|x64.ActiveCfg = Release|x64
{E3BDC783-8646-433E-ADF0-8B6390D36669}.Release|x64.Build.0 = Release|x64
{E3BDC783-8646-433E-ADF0-8B6390D36669}.Release|x86.ActiveCfg = Release|Win32
{E3BDC783-8646-433E-ADF0-8B6390D36669}.Release|x86.Build.0 = Release|Win32
{A8FCDC5E-729C-4A80-BF9F-B669C52B2AE3}.Debug|x64.ActiveCfg = Debug|x64
{A8FCDC5E-729C-4A80-BF9F-B669C52B2AE3}.Debug|x64.Build.0 = Debug|x64
{A8FCDC5E-729C-4A80-BF9F-B669C52B2AE3}.Debug|x86.ActiveCfg = Debug|Win32
{A8FCDC5E-729C-4A80-BF9F-B669C52B2AE3}.Debug|x86.Build.0 = Debug|Win32
{A8FCDC5E-729C-4A80-BF9F-B669C52B2AE3}.Release|x64.ActiveCfg = Release|x64
{A8FCDC5E-729C-4A80-BF9F-B669C52B2AE3}.Release|x64.Build.0 = Release|x64
{A8FCDC5E-729C-4A80-BF9F-B669C52B2AE3}.Release|x86.ActiveCfg = Release|Win32
{A8FCDC5E-729C-4A80-BF9F-B669C52B2AE3}.Release|x86.Build.0 = Release|Win32
{487216D8-16BA-4B4C-B5BF-43FEEDFEE03A}.Debug|x64.ActiveCfg = Debug|x64
{487216D8-16BA-4B4C-B5BF-43FEEDFEE03A}.Debug|x64.Build.0 = Debug|x64
{487216D8-16BA-4B4C-B5BF-43FEEDFEE03A}.Debug|x86.ActiveCfg = Debug|Win32
{487216D8-16BA-4B4C-B5BF-43FEEDFEE03A}.Debug|x86.Build.0 = Debug|Win32
{487216D8-16BA-4B4C-B5BF-43FEEDFEE03A}.Release|x64.ActiveCfg = Release|x64
{487216D8-16BA-4B4C-B5BF-43FEEDFEE03A}.Release|x64.Build.0 = Release|x64
{487216D8-16BA-4B4C-B5BF-43FEEDFEE03A}.Release|x86.ActiveCfg = Release|Win32
{487216D8-16BA-4B4C-B5BF-43FEEDFEE03A}.Release|x86.Build.0 = Release|Win32
{ED2F91E1-673A-4590-82B2-EB157927D3E3}.Debug|x64.ActiveCfg = Debug|x64
{ED2F91E1-673A-4590-82B2-EB157927D3E3}.Debug|x64.Build.0 = Debug|x64
{ED2F91E1-673A-4590-82B2-EB157927D3E3}.Debug|x86.ActiveCfg = Debug|Win32
{ED2F91E1-673A-4590-82B2-EB157927D3E3}.Debug|x86.Build.0 = Debug|Win32
{ED2F91E1-673A-4590-82B2-EB157927D3E3}.Release|x64.ActiveCfg = Release|x64
{ED2F91E1-673A-4590-82B2-EB157927D3E3}.Release|x64.Build.0 = Release|x64
{ED2F91E1-673A-4590-82B2-EB157927D3E3}.Release|x86.ActiveCfg = Release|Win32
{ED2F91E1-673A-4590-82B2-EB157927D3E3}.Release|x86.Build.0 = Release|Win32
{B852D549-4020-4477-8BFB-E199FF78B047}.Debug|x64.ActiveCfg = Debug|x64
{B852D549-4020-4477-8BFB-E199FF78B047}.Debug|x64.Build.0 = Debug|x64
{B852D549-4020-4477-8BFB-E199FF78B047}.Debug|x86.ActiveCfg = Debug|Win32
{B852D549-4020-4477-8BFB-E199FF78B047}.Debug|x86.Build.0 = Debug|Win32
{B852D549-4020-4477-8BFB-E199FF78B047}.Release|x64.ActiveCfg = Release|x64
{B852D549-4020-4477-8BFB-E199FF78B047}.Release|x64.Build.0 = Release|x64
{B852D549-4020-4477-8BFB-E199FF78B047}.Release|x86.ActiveCfg = Release|Win32
{B852D549-4020-4477-8BFB-E199FF78B047}.Release|x86.Build.0 = Release|Win32
{FFC961AC-55B4-4A38-A83E-06AE98F59ACC}.Debug|x64.ActiveCfg = Debug|x64
{FFC961AC-55B4-4A38-A83E-06AE98F59ACC}.Debug|x64.Build.0 = Debug|x64
{FFC961AC-55B4-4A38-A83E-06AE98F59ACC}.Debug|x86.ActiveCfg = Debug|Win32
{FFC961AC-55B4-4A38-A83E-06AE98F59ACC}.Debug|x86.Build.0 = Debug|Win32
{FFC961AC-55B4-4A38-A83E-06AE98F59ACC}.Release|x64.ActiveCfg = Release|x64
{FFC961AC-55B4-4A38-A83E-06AE98F59ACC}.Release|x64.Build.0 = Release|x64
{FFC961AC-55B4-4A38-A83E-06AE98F59ACC}.Release|x86.ActiveCfg = Release|Win32
{FFC961AC-55B4-4A38-A83E-06AE98F59ACC}.Release|x86.Build.0 = Release|Win32
{17B96F07-EF92-47CD-95A5-8E6EE38AB564}.Debug|x64.ActiveCfg = Debug|x64
{17B96F07-EF92-47CD-95A5-8E6EE38AB564}.Debug|x64.Build.0 = Debug|x64
{17B96F07-EF92-47CD-95A5-8E6EE38AB564}.Debug|x86.ActiveCfg = Debug|Win32
{17B96F07-EF92-47CD-95A5-8E6EE38AB564}.Debug|x86.Build.0 = Debug|Win32
{17B96F07-EF92-47CD-95A5-8E6EE38AB564}.Release|x64.ActiveCfg = Release|x64
{17B96F07-EF92-47CD-95A5-8E6EE38AB564}.Release|x64.Build.0 = Release|x64
{17B96F07-EF92-47CD-95A5-8E6EE38AB564}.Release|x86.ActiveCfg = Release|Win32
{17B96F07-EF92-47CD-95A5-8E6EE38AB564}.Release|x86.Build.0 = Release|Win32
{0E383EF0-CEF7-4733-87C6-5AC9844AA1EF}.Debug|x64.ActiveCfg = Debug|x64
{0E383EF0-CEF7-4733-87C6-5AC9844AA1EF}.Debug|x64.Build.0 = Debug|x64
{0E383EF0-CEF7-4733-87C6-5AC9844AA1EF}.Debug|x86.ActiveCfg = Debug|Win32
{0E383EF0-CEF7-4733-87C6-5AC9844AA1EF}.Debug|x86.Build.0 = Debug|Win32
{0E383EF0-CEF7-4733-87C6-5AC9844AA1EF}.Release|x64.ActiveCfg = Release|x64
{0E383EF0-CEF7-4733-87C6-5AC9844AA1EF}.Release|x64.Build.0 = Release|x64
{0E383EF0-CEF7-4733-87C6-5AC9844AA1EF}.Release|x86.ActiveCfg = Release|Win32
{0E383EF0-CEF7-4733-87C6-5AC9844AA1EF}.Release|x86.Build.0 = Release|Win32
{07351A8E-1F79-42C9-BBAB-31F071EAA99E}.Debug|x64.ActiveCfg = Debug|x64
{07351A8E-1F79-42C9-BBAB-31F071EAA99E}.Debug|x64.Build.0 = Debug|x64
{07351A8E-1F79-42C9-BBAB-31F071EAA99E}.Debug|x86.ActiveCfg = Debug|Win32
{07351A8E-1F79-42C9-BBAB-31F071EAA99E}.Debug|x86.Build.0 = Debug|Win32
{07351A8E-1F79-42C9-BBAB-31F071EAA99E}.Release|x64.ActiveCfg = Release|x64
{07351A8E-1F79-42C9-BBAB-31F071EAA99E}.Release|x64.Build.0 = Release|x64
{07351A8E-1F79-42C9-BBAB-31F071EAA99E}.Release|x86.ActiveCfg = Release|Win32
{07351A8E-1F79-42C9-BBAB-31F071EAA99E}.Release|x86.Build.0 = Release|Win32
{27B7CA46-ED23-45C2-BF5F-0C126D81AEBF}.Debug|x64.ActiveCfg = Debug|x64
{27B7CA46-ED23-45C2-BF5F-0C126D81AEBF}.Debug|x64.Build.0 = Debug|x64
{27B7CA46-ED23-45C2-BF5F-0C126D81AEBF}.Debug|x86.ActiveCfg = Debug|Win32
{27B7CA46-ED23-45C2-BF5F-0C126D81AEBF}.Debug|x86.Build.0 = Debug|Win32
{27B7CA46-ED23-45C2-BF5F-0C126D81AEBF}.Release|x64.ActiveCfg = Release|x64
{27B7CA46-ED23-45C2-BF5F-0C126D81AEBF}.Release|x64.Build.0 = Release|x64
{27B7CA46-ED23-45C2-BF5F-0C126D81AEBF}.Release|x86.ActiveCfg = Release|Win32
{27B7CA46-ED23-45C2-BF5F-0C126D81AEBF}.Release|x86.Build.0 = Release|Win32
{6AE5C85E-6631-4A12-97A0-A05F812FE9CA}.Debug|x64.ActiveCfg = Debug|x64
{6AE5C85E-6631-4A12-97A0-A05F812FE9CA}.Debug|x64.Build.0 = Debug|x64
{6AE5C85E-6631-4A12-97A0-A05F812FE9CA}.Debug|x86.ActiveCfg = Debug|Win32
{6AE5C85E-6631-4A12-97A0-A05F812FE9CA}.Debug|x86.Build.0 = Debug|Win32
{6AE5C85E-6631-4A12-97A0-A05F812FE9CA}.Release|x64.ActiveCfg = Release|x64
{6AE5C85E-6631-4A12-97A0-A05F812FE9CA}.Release|x64.Build.0 = Release|x64
{6AE5C85E-6631-4A12-97A0-A05F812FE9CA}.Release|x86.ActiveCfg = Release|Win32
{6AE5C85E-6631-4A12-97A0-A05F812FE9CA}.Release|x86.Build.0 = Release|Win32
{D7BFE702-0667-4155-9B0B-2A54DF9AE60B}.Debug|x64.ActiveCfg = Debug|x64
{D7BFE702-0667-4155-9B0B-2A54DF9AE60B}.Debug|x64.Build.0 = Debug|x64
{D7BFE702-0667-4155-9B0B-2A54DF9AE60B}.Debug|x86.ActiveCfg = Debug|Win32
{D7BFE702-0667-4155-9B0B-2A54DF9AE60B}.Debug|x86.Build.0 = Debug|Win32
{D7BFE702-0667-4155-9B0B-2A54DF9AE60B}.Release|x64.ActiveCfg = Release|x64
{D7BFE702-0667-4155-9B0B-2A54DF9AE60B}.Release|x64.Build.0 = Release|x64
{D7BFE702-0667-4155-9B0B-2A54DF9AE60B}.Release|x86.ActiveCfg = Release|Win32
{D7BFE702-0667-4155-9B0B-2A54DF9AE60B}.Release|x86.Build.0 = Release|Win32
{9023DF2F-A33D-485A-B13D-0973348B2F9B}.Debug|x64.ActiveCfg = Debug|x64
{9023DF2F-A33D-485A-B13D-0973348B2F9B}.Debug|x64.Build.0 = Debug|x64
{9023DF2F-A33D-485A-B13D-0973348B2F9B}.Debug|x86.ActiveCfg = Debug|Win32
{9023DF2F-A33D-485A-B13D-0973348B2F9B}.Debug|x86.Build.0 = Debug|Win32
{9023DF2F-A33D-485A-B13D-0973348B2F9B}.Release|x64.ActiveCfg = Release|x64
{9023DF2F-A33D-485A-B13D-0973348B2F9B}.Release|x64.Build.0 = Release|x64
{9023DF2F-A33D-485A-B13D-0973348B2F9B}.Release|x86.ActiveCfg = Release|Win32
{9023DF2F-A33D-485A-B13D-0973348B2F9B}.Release|x86.Build.0 = Release|Win32
{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}.Debug|x86.ActiveCfg = Debug|Win32
{89F8D13E-F216-4B67-8DE9-7F842D349E94}.Debug|x86.Build.0 = Debug|Win32
{89F8D13E-F216-4B67-8DE9-7F842D349E94}.Release|x64.ActiveCfg = Release|x64
{89F8D13E-F216-4B67-8DE9-7F842D349E94}.Release|x64.Build.0 = Release|x64
{89F8D13E-F216-4B67-8DE9-7F842D349E94}.Release|x86.ActiveCfg = Release|Win32
{89F8D13E-F216-4B67-8DE9-7F842D349E94}.Release|x86.Build.0 = Release|Win32
{A778D062-DE76-49F6-8D05-EB26852DD605}.Debug|x64.ActiveCfg = Debug|x64
{A778D062-DE76-49F6-8D05-EB26852DD605}.Debug|x64.Build.0 = Debug|x64
{A778D062-DE76-49F6-8D05-EB26852DD605}.Debug|x86.ActiveCfg = Debug|Win32
{A778D062-DE76-49F6-8D05-EB26852DD605}.Debug|x86.Build.0 = Debug|Win32
{A778D062-DE76-49F6-8D05-EB26852DD605}.Release|x64.ActiveCfg = Release|x64
{A778D062-DE76-49F6-8D05-EB26852DD605}.Release|x64.Build.0 = Release|x64
{A778D062-DE76-49F6-8D05-EB26852DD605}.Release|x86.ActiveCfg = Release|Win32
{A778D062-DE76-49F6-8D05-EB26852DD605}.Release|x86.Build.0 = Release|Win32
{D26BD501-28A7-4849-8130-FB5EA0A2B82F}.Debug|x64.ActiveCfg = Debug|x64
{D26BD501-28A7-4849-8130-FB5EA0A2B82F}.Debug|x86.ActiveCfg = Debug|x64
{D26BD501-28A7-4849-8130-FB5EA0A2B82F}.Release|x64.ActiveCfg = Release|x64
{D26BD501-28A7-4849-8130-FB5EA0A2B82F}.Release|x86.ActiveCfg = Release|x64
{15009625-1120-405E-8BBA-69A16CD6713D}.Debug|x64.ActiveCfg = Debug|x64
{15009625-1120-405E-8BBA-69A16CD6713D}.Debug|x64.Build.0 = Debug|x64
{15009625-1120-405E-8BBA-69A16CD6713D}.Debug|x86.ActiveCfg = Debug|Win32
{15009625-1120-405E-8BBA-69A16CD6713D}.Debug|x86.Build.0 = Debug|Win32
{15009625-1120-405E-8BBA-69A16CD6713D}.Release|x64.ActiveCfg = Release|x64
{15009625-1120-405E-8BBA-69A16CD6713D}.Release|x64.Build.0 = Release|x64
{15009625-1120-405E-8BBA-69A16CD6713D}.Release|x86.ActiveCfg = Release|Win32
{15009625-1120-405E-8BBA-69A16CD6713D}.Release|x86.Build.0 = Release|Win32
{7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Debug|x64.ActiveCfg = Debug|x64
{7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Debug|x64.Build.0 = Debug|x64
{7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Debug|x86.ActiveCfg = Debug|Win32
{7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Debug|x86.Build.0 = Debug|Win32
{7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Release|x64.ActiveCfg = Release|x64
{7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Release|x64.Build.0 = Release|x64
{7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Release|x86.ActiveCfg = Release|Win32
{7EFF1E21-C375-45EA-A069-4E2232C8A72B}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -156,6 +156,7 @@
<ClCompile Include="GpFontHandler_FreeType2.cpp" />
<ClCompile Include="GpGlobalConfig.cpp" />
<ClCompile Include="GpInputDriverFactory.cpp" />
<ClCompile Include="GpLogDriver_Win32.cpp" />
<ClCompile Include="GpMain.cpp" />
<ClCompile Include="GpMain_Win32.cpp" />
<ClCompile Include="GpMemoryBuffer.cpp" />
@@ -174,14 +175,11 @@
<ClInclude Include="..\GpCommon\GpInputDriverProperties.h" />
<ClInclude Include="..\GpCommon\IGpCursor.h" />
<ClInclude Include="..\GpCommon\IGpAudioChannelCallbacks.h" />
<ClInclude Include="..\GpCommon\GpColorCursor_Win32.h" />
<ClInclude Include="..\GpCommon\IGpDisplayDriverSurface.h" />
<ClInclude Include="..\GpCommon\IGpLogDriver.h" />
<ClInclude Include="GpAppEnvironment.h" />
<ClInclude Include="GpAudioDriverFactory.h" />
<ClInclude Include="GpComPtr.h" />
<ClInclude Include="GpCoreDefs.h" />
<ClInclude Include="GpDisplayDriverFactory.h" />
<ClInclude Include="GpFiber.h" />
<ClInclude Include="GpFiber_Win32.h" />
<ClInclude Include="GpFileStream_Win32.h" />
<ClInclude Include="GpFileSystem_Win32.h" />
@@ -189,18 +187,14 @@
<ClInclude Include="GpFontHandlerFactory.h" />
<ClInclude Include="GpGlobalConfig.h" />
<ClInclude Include="GpInputDriverFactory.h" />
<ClInclude Include="GpLogDriver_Win32.h" />
<ClInclude Include="GpMain.h" />
<ClInclude Include="GpMemoryBuffer.h" />
<ClInclude Include="GpMutex_Win32.h" />
<ClInclude Include="GpRingBuffer.h" />
<ClInclude Include="GpSystemServices_Win32.h" />
<ClInclude Include="GpFiberStarter.h" />
<ClInclude Include="GpThreadEvent_Win32.h" />
<ClInclude Include="GpVOSEventQueue.h" />
<ClInclude Include="GpWindows.h" />
<ClInclude Include="IGpAudioChannel.h" />
<ClInclude Include="IGpAudioDriver.h" />
<ClInclude Include="IGpDisplayDriver.h" />
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>

View File

@@ -0,0 +1,178 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="GpVOSEventQueue.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpAppEnvironment.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpAudioDriverFactory.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpColorCursor_Win32.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpDisplayDriverFactory.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpFiber_Win32.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpFiberStarter_Win32.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpFileStream_Win32.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpFileSystem_Win32.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpFontHandler_FreeType2.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpFontHandlerFactory.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpGlobalConfig.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpInputDriverFactory.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpMain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpMain_Win32.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpMemoryBuffer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpMutex_Win32.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpSystemServices_Win32.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpThreadEvent_Win32.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpLogDriver_Win32.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\GpCommon\EGpInputDriverType.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\GpCommon\EGpStandardCursor.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpAppEnvironment.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\GpCommon\GpApplicationName.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpAudioDriverFactory.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpDisplayDriverFactory.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\GpCommon\GpDisplayDriverTickStatus.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpFiber_Win32.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpFiberStarter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\GpCommon\GpFileCreationDisposition.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpFileStream_Win32.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpFileSystem_Win32.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpFontHandler_FreeType2.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpFontHandlerFactory.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpGlobalConfig.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpInputDriverFactory.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\GpCommon\GpInputDriverProperties.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpMain.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpMemoryBuffer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpMutex_Win32.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpSystemServices_Win32.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpThreadEvent_Win32.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpVOSEventQueue.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\GpCommon\IGpAudioChannelCallbacks.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\GpCommon\IGpCursor.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\GpCommon\IGpDisplayDriverSurface.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Resource Files</Filter>
</ClInclude>
<ClInclude Include="..\GpCommon\IGpLogDriver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpLogDriver_Win32.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="ConvertedResources\Large128.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="ConvertedResources\Small128.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{0db467fa-83af-4c89-b36b-2478899f4f9e}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{bdb8c57b-c9f7-443a-be30-89718b8ca3e5}</UniqueIdentifier>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{8ed8ebed-2aea-4f6d-8f2f-c18a64eb6e20}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Aerofoil.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>

View File

@@ -94,9 +94,9 @@ void GpAppEnvironment::Render()
GpAppInterface_Get()->PL_Render(m_displayDriver);
}
void GpAppEnvironment::AdjustRequestedResolution(unsigned int &width, unsigned int &height)
bool GpAppEnvironment::AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY)
{
GpAppInterface_Get()->PL_AdjustRequestedResolution(width, height);
return GpAppInterface_Get()->PL_AdjustRequestedResolution(physicalWidth, physicalHeight, virtualWidth, virtualheight, pixelScaleX, pixelScaleY);
}
void GpAppEnvironment::SetDisplayDriver(IGpDisplayDriver *displayDriver)
@@ -175,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,7 +28,7 @@ public:
GpDisplayDriverTickStatus_t Tick(IGpFiber *vosFiber);
void Render();
void AdjustRequestedResolution(unsigned int &width, unsigned int &height);
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

@@ -142,3 +142,8 @@ void GpFileStream_Win32::Close()
{
CloseHandle(m_handle);
}
void GpFileStream_Win32::Flush()
{
FlushFileBuffers(m_handle);
}

View File

@@ -20,7 +20,8 @@ public:
bool Truncate(PortabilityLayer::UFilePos_t loc) override;
PortabilityLayer::UFilePos_t Size() const override;
PortabilityLayer::UFilePos_t Tell() const override;
void Close() override;
void Close() override;
void Flush() override;
private:
HANDLE m_handle;

View File

@@ -13,6 +13,8 @@
#include <assert.h>
extern GpWindowsGlobals g_gpWindowsGlobals;
class GpDirectoryCursor_Win32 final : public PortabilityLayer::HostDirectoryCursor
{
public:
@@ -120,16 +122,19 @@ GpFileSystem_Win32::GpFileSystem_Win32()
m_userHousesDir = m_prefsDir + L"\\Houses";
m_userSavesDir = m_prefsDir + L"\\SavedGames";
m_scoresDir = m_prefsDir + L"\\Scores";
m_logsDir = m_prefsDir + L"\\Logs";
CreateDirectoryW(m_prefsDir.c_str(), nullptr);
CreateDirectoryW(m_scoresDir.c_str(), nullptr);
CreateDirectoryW(m_userHousesDir.c_str(), nullptr);
CreateDirectoryW(m_userSavesDir.c_str(), nullptr);
CreateDirectoryW(m_logsDir.c_str(), nullptr);
m_prefsDir.append(L"\\");
m_scoresDir.append(L"\\");
m_userHousesDir.append(L"\\");
m_userSavesDir.append(L"\\");
m_logsDir.append(L"\\");
}
DWORD modulePathSize = GetModuleFileNameW(nullptr, m_executablePath, MAX_PATH);
@@ -307,6 +312,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 +393,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;
@@ -510,6 +517,9 @@ bool GpFileSystem_Win32::ResolvePath(PortabilityLayer::VirtualDirectory_t virtua
case PortabilityLayer::VirtualDirectories::kHighScores:
baseDir = m_scoresDir.c_str();
break;
case PortabilityLayer::VirtualDirectories::kLogs:
baseDir = m_logsDir.c_str();
break;
default:
return false;
}

View File

@@ -34,6 +34,7 @@ private:
std::wstring m_scoresDir;
std::wstring m_packagedDir;
std::wstring m_housesDir;
std::wstring m_logsDir;
std::wstring m_userHousesDir;
std::wstring m_userSavesDir;
std::wstring m_resourcesDir;

View File

@@ -2,7 +2,9 @@
#include "EGpDisplayDriverType.h"
#include "EGpAudioDriverType.h"
#include "EGpInputDriverType.h"
#include "EGpInputDriverType.h"
struct IGpLogDriver;
struct GpGlobalConfig
{
@@ -11,6 +13,7 @@ struct GpGlobalConfig
const EGpInputDriverType *m_inputDriverTypes;
size_t m_numInputDrivers;
IGpLogDriver *m_logger;
void *m_osGlobals;
};

View File

@@ -0,0 +1,113 @@
#include "GpLogDriver_Win32.h"
#include "GpFileSystem_Win32.h"
#include "GpApplicationName.h"
#include "IOStream.h"
GpLogDriver_Win32::GpLogDriver_Win32()
: m_stream(nullptr)
, m_isInitialized(false)
{
}
void GpLogDriver_Win32::Init()
{
ms_instance.InitInternal();
}
void GpLogDriver_Win32::VPrintf(Category category, const char *fmt, va_list args)
{
size_t fmtSize = 0;
bool hasFormatting = false;
for (const char *fmtCheck = fmt; *fmtCheck; fmtCheck++)
{
if (*fmtCheck == '%')
hasFormatting = true;
fmtSize++;
}
SYSTEMTIME sysTime;
GetSystemTime(&sysTime);
char timestampBuffer[64];
sprintf(timestampBuffer, "[%02d:%02d:%02d:%03d] ", sysTime.wHour, sysTime.wMinute, sysTime.wSecond, sysTime.wMilliseconds);
m_stream->Write(timestampBuffer, strlen(timestampBuffer));
const char *debugTag = "";
switch (category)
{
case Category_Warning:
debugTag = "[WARNING] ";
break;
case Category_Error:
debugTag = "[ERROR] ";
break;
};
if (debugTag[0])
m_stream->Write(debugTag, strlen(debugTag));
if (!hasFormatting)
m_stream->Write(fmt, fmtSize);
else
{
int formattedSize = vsnprintf(nullptr, 0, fmt, args);
if (formattedSize <= 0)
return;
char *charBuff = static_cast<char*>(malloc(formattedSize + 1));
if (!charBuff)
return;
vsnprintf(charBuff, formattedSize + 1, fmt, args);
m_stream->Write(charBuff, formattedSize);
free(charBuff);
}
m_stream->Write("\n", 1);
m_stream->Flush();
}
void GpLogDriver_Win32::Shutdown()
{
if (m_stream)
m_stream->Close();
}
GpLogDriver_Win32 *GpLogDriver_Win32::GetInstance()
{
if (ms_instance.m_isInitialized)
return &ms_instance;
else
return nullptr;
}
void GpLogDriver_Win32::InitInternal()
{
SYSTEMTIME utcTime;
GetSystemTime(&utcTime);
char logFileName[256];
sprintf(logFileName, GP_APPLICATION_NAME "-%04d-%02d-%02d_%02d-%02d_%02d.txt", utcTime.wYear, utcTime.wMonth, utcTime.wDay, utcTime.wHour, utcTime.wMinute, utcTime.wSecond);
m_stream = GpFileSystem_Win32::GetInstance()->OpenFile(PortabilityLayer::VirtualDirectories::kLogs, logFileName, true, GpFileCreationDispositions::kCreateOrOverwrite);
if (m_stream)
{
this->Printf(IGpLogDriver::Category_Information, GP_APPLICATION_NAME " build " __TIMESTAMP__);
#ifdef NDEBUG
this->Printf(IGpLogDriver::Category_Information, "Configuration: Release");
#else
this->Printf(IGpLogDriver::Category_Information, "Configuration: Debug");
#endif
m_isInitialized = true;
}
}
GpLogDriver_Win32 GpLogDriver_Win32::ms_instance;

View File

@@ -0,0 +1,29 @@
#pragma once
#include "IGpLogDriver.h"
namespace PortabilityLayer
{
class IOStream;
}
class GpLogDriver_Win32 : public IGpLogDriver
{
public:
GpLogDriver_Win32();
static void Init();
void VPrintf(Category category, const char *fmt, va_list args) override;
void Shutdown() override;
static GpLogDriver_Win32 *GetInstance();
private:
void InitInternal();
PortabilityLayer::IOStream *m_stream;
bool m_isInitialized;
static GpLogDriver_Win32 ms_instance;
};

View File

@@ -28,9 +28,9 @@ namespace
static_cast<GpAppEnvironment*>(context)->Render();
}
void AdjustRequestedResolution(void *context, unsigned int &width, unsigned int &height)
bool AdjustRequestedResolution(void *context, uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY)
{
static_cast<GpAppEnvironment*>(context)->AdjustRequestedResolution(width, height);
return static_cast<GpAppEnvironment*>(context)->AdjustRequestedResolution(physicalWidth, physicalHeight, virtualWidth, virtualheight, pixelScaleX, pixelScaleY);
}
}
@@ -63,6 +63,7 @@ int GpMain::Run()
ddProps.m_type = g_gpGlobalConfig.m_displayDriverType;
ddProps.m_osGlobals = g_gpGlobalConfig.m_osGlobals;
ddProps.m_eventQueue = eventQueue;
ddProps.m_logger = g_gpGlobalConfig.m_logger;
GpAudioDriverProperties adProps;
memset(&adProps, 0, sizeof(adProps));
@@ -72,10 +73,11 @@ int GpMain::Run()
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;
#else
adProps.m_debug = true;
#endif
adProps.m_logger = g_gpGlobalConfig.m_logger;
IGpInputDriver **inputDrivers = static_cast<IGpInputDriver**>(malloc(sizeof(IGpInputDriver*) * g_gpGlobalConfig.m_numInputDrivers));

View File

@@ -5,6 +5,7 @@
#include "GpGlobalConfig.h"
#include "GpFiber_Win32.h"
#include "GpFileSystem_Win32.h"
#include "GpLogDriver_Win32.h"
#include "GpInputDriverFactory.h"
#include "GpAppInterface.h"
#include "GpSystemServices_Win32.h"
@@ -15,6 +16,9 @@
#include "GpWindows.h"
#include "resource.h"
#include <shellapi.h>
#include <stdio.h>
#include <windowsx.h>
@@ -24,7 +28,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 +39,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 +301,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 +309,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 +383,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;
}
@@ -380,20 +396,40 @@ static void TranslateWindowsMessage(const MSG *msg, IGpVOSEventQueue *eventQueue
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
LPWSTR cmdLine = GetCommandLineW();
int nArgs;
LPWSTR *cmdLineArgs = CommandLineToArgvW(cmdLine, &nArgs);
for (int i = 1; i < nArgs; i++)
{
if (!wcscmp(cmdLineArgs[i], L"-diagnostics"))
GpLogDriver_Win32::Init();
}
IGpLogDriver *logger = GpLogDriver_Win32::GetInstance();
GpAppInterface_Get()->PL_HostFileSystem_SetInstance(GpFileSystem_Win32::GetInstance());
GpAppInterface_Get()->PL_HostSystemServices_SetInstance(GpSystemServices_Win32::GetInstance());
GpAppInterface_Get()->PL_HostLogDriver_SetInstance(GpLogDriver_Win32::GetInstance());
g_gpWindowsGlobals.m_hInstance = hInstance;
g_gpWindowsGlobals.m_hPrevInstance = hPrevInstance;
g_gpWindowsGlobals.m_cmdLine = lpCmdLine;
g_gpWindowsGlobals.m_cmdLine = cmdLine;
g_gpWindowsGlobals.m_cmdLineArgc = nArgs;
g_gpWindowsGlobals.m_cmdLineArgv = cmdLineArgs;
g_gpWindowsGlobals.m_nCmdShow = nCmdShow;
g_gpWindowsGlobals.m_baseDir = GpFileSystem_Win32::GetInstance()->GetBasePath();
g_gpWindowsGlobals.m_hwnd = nullptr;
g_gpWindowsGlobals.m_hIcon = LoadIconW(hInstance, MAKEINTRESOURCEW(IDI_ICON1));
g_gpWindowsGlobals.m_hIconSm = LoadIconW(hInstance, MAKEINTRESOURCEW(IDI_ICON2));
g_gpWindowsGlobals.m_createFiberFunc = GpFiber_Win32::Create;
g_gpWindowsGlobals.m_loadCursorFunc = GpCursor_Win32::Load;
g_gpWindowsGlobals.m_translateWindowsMessageFunc = TranslateWindowsMessage;
g_gpGlobalConfig.m_displayDriverType = EGpDisplayDriverType_D3D11;
g_gpGlobalConfig.m_audioDriverType = EGpAudioDriverType_XAudio2;
EGpInputDriverType inputDrivers[] =
@@ -405,10 +441,21 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
g_gpGlobalConfig.m_numInputDrivers = sizeof(inputDrivers) / sizeof(inputDrivers[0]);
g_gpGlobalConfig.m_osGlobals = &g_gpWindowsGlobals;
g_gpGlobalConfig.m_logger = logger;
GpDisplayDriverFactory::RegisterDisplayDriverFactory(EGpDisplayDriverType_D3D11, GpDriver_CreateDisplayDriver_D3D11);
GpAudioDriverFactory::RegisterAudioDriverFactory(EGpAudioDriverType_XAudio2, GpDriver_CreateAudioDriver_XAudio2);
GpInputDriverFactory::RegisterInputDriverFactory(EGpInputDriverType_XInput, GpDriver_CreateInputDriver_XInput);
return GpMain::Run();
if (logger)
logger->Printf(IGpLogDriver::Category_Information, "Windows environment configured, starting up");
int returnCode = GpMain::Run();
if (logger)
logger->Printf(IGpLogDriver::Category_Information, "Windows environment exited with code %i, cleaning up", returnCode);
LocalFree(cmdLineArgs);
return returnCode;
}

View File

@@ -73,6 +73,14 @@
"id" : 0,
"enabled" : true
},
{
"name" : "32-bit color (Requires restart)",
"itemType" : "CheckBox",
"pos" : [ 8, 162 ],
"size" : [ 256, 18 ],
"id" : 0,
"enabled" : true
},
{
"name" : "",
"itemType" : "UserItem",

View File

@@ -0,0 +1,13 @@
{
"items" :
[
{
"name" : "Okay",
"itemType" : "Button",
"pos" : [ 376, 240 ],
"size" : [ 58, 20 ],
"id" : 1,
"enabled" : true
}
]
}

View File

@@ -1,7 +1,8 @@
{
"add" :
{
"DITL/1017.json" : "ApplicationResourcePatches/DITL/1017.json"
"DITL/1017.json" : "ApplicationResourcePatches/DITL/1017.json",
"DITL/2000.json" : "ApplicationResourcePatches/DITL/2000.json"
},
"delete" :
[

View File

@@ -7,6 +7,7 @@
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)Common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ConformanceMode>true</ConformanceMode>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup />

View File

@@ -52,6 +52,14 @@ const CompileJob kCompileJobs[] =
drawQuadDefs,
"PSMain",
"ps_4_0"
},
{
L"ShaderSrc\\ScaleQuadP.hlsl",
L"GpDisplayDriver_D3D11\\CompiledShaders\\ScaleQuadP_D3D11.cpp",
"g_scaleQuadP_D3D11",
drawQuadDefs,
"PSMain",
"ps_4_0"
}
};

View File

@@ -1,3 +1,5 @@
rmdir /S /Q Packaged
mkdir Packaged
mkdir Packaged\Houses
mkdir Packaged\WinCursors

View File

@@ -0,0 +1,28 @@
Many Glider PRO houses, including the bundled ones, contain images in QuickDraw
PICT format in the game resource data.
PICT is a very complex format, many of its features are not completely
documented, and some PICT features are impossible to support because they
require copyrighted pattern sets and fonts that are bundled with the
operating system.
My goal is to support as many community houses as possible, but there is a
point where supporting the format is more work than just manually converting
the resources on a Macintosh machine or emulator.
All of the remaining known unsupported features necessary to decode the
remaining cases are only used by one house that I'm aware of each.
Known error codes:
Code 5 subcode 25: Strange image channel layout
Code 8 subcode 145: Unsupported BitsRgn opcode.
Code 8 subcode 40960: Undocumented opcode, possibly a format parsing error.
Code 8 subcode 34: Unsupported ShortLine opcode. (PICT contains vector graphics.)
Code 8 subcode 35: Unsupported ShortLineFrom opcode. (PICT contains vector graphics.)
Code 8 subcode 49: Unsupported PaintRect opcode. (PICT contains vector graphics.)
Code 8 subcode 51: Unsupported PaintOval opcode. (PICT contains vector graphics.)
Code 8 subcode 129: paintRgn opcode. (PICT contains vector graphics.)
Code 8 subcode 33280: Unsupported CompressedQuickTime opcode. (PICT contains a QuickTime frame.)
Code 8 subcode 33281: Unsupported UncompressedQuickTime opcode. (PICT contains a QuickTime frame.)

View File

@@ -1,55 +1,57 @@
Aerofoil is a third-party port of Glider PRO
Thank you for trying Aerofoil!
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.
IMPORTANT: 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:
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:
https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
XInput gamepads are supported. Other gamepads may be supported via third-party software that maps them to XInput (i.e. PS4 gamepads are supported via DS4Windows)
Some shortcuts:
- While in-game, Ctrl-S saves the game. You can then reload the game from the main menu.
IN-GAME SHORTCUT COMMANDS
-------------------------------------------------------------------------------
- Ctrl-S saves the game. You can reload a saved game from the main menu.
- Ctrl-Q quits the game.
- Alt-Enter toggles full screen.
GAMEPAD SUPPORT
-------------------------------------------------------------------------------
XInput gamepads are supported. Other gamepads may be supported via third-party
software that maps them to XInput (i.e. PS4 gamepads are supported via DS4Windows)
LEGAL NOTICES
-------------------------------------------------------------------------------
Aerofoil is (c)2019-2020 Eric Lasota
Based on Glider PRO (c)1994-2000 Casady & Greene, Inc., written by John Calhoun
Distributed under the terms of the GNU General Public License version 2 (see license_gplv2.txt)
Aerofoil uses the following third-party software:
-------------------------------------------------------------------------------
Open Sans font:
(c)2011 Google
Distributed under the Apache License (see license_apache.txt)
-------------------------------------------------------------------------------
stb_image_write:
Created by Sean Barrett
-------------------------------------------------------------------------------
LIBICONV:
Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc.
Distributed under the LGPLv2 license (See license_lgplv2.txt)
-------------------------------------------------------------------------------
RapidJSON:
Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
Distributed under the MIT license (See license_rapidjson.txt)
-------------------------------------------------------------------------------
zlib:
(C) 1995-2017 Jean-loup Gailly and Mark Adler
@@ -74,9 +76,25 @@ zlib:
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.
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)
The Unarchiver:
The "unpacktool" utility is heavily based on code from The Unarchiver.
Copyright (C) 2006-2013 Dag Ågren
Distributed under the LGPLv2 license (See license_lgplv2.txt)
FFmpeg:
The "gpr2gpa" tool uses MACE decompression code from FFmpeg.
Copyright (c) 2002 Laszlo Torok <torokl@alpha.dfmk.hu>
Distributed under the LGPLv2 license (See license_lgplv2.txt)

View File

@@ -1,16 +1,84 @@
If you want to import an existing third-party Glider PRO house to Aerofoil, a few steps are required.
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.
You need to convert the file into Aerofoil's "triplet" format, which consists
of a metadata file (extension .gpf), and file forks (.gpd for data, .gpr for
resources). How you get these depends on the input format:
- For MacBinary files (.bin), use the "bin2gp" utility
- For BinHex files (.hqx), use the "hqx2gp" utility
- For StuffIt (.sit) and Compact Pro (.cpt) archives, use the "unpacktool"
utility to extract the contents in triplet format. The "unpacktool"
utility should support most vintage StuffIt archives made with StuffIt
Deluxe 6 or lower.
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.
(NOTE: ".sea" files are self-extracting archives, typically StuffIt or Compact
Pro archives with the self-extractor program in the resources. These will
always be distributed in a fork-grouping container like MacBinary or BinHex.
For cases like these, you need to split the self-extracting archive using
"bin2gp" or "hqx2gp" and then pass the ".sea.gpd" file (which contains the
archive data) to "unpacktool" to decompress it.)
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.
Once you've done that, if the house has custom resources (i.e. a .gpr file),
you need to convert it to an Aerofoil resource archive, which you can do using
the "gpr2gpa" tool.
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.
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.
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.
Converting QuickTime movies for displaying on in-game TVs is a bit more complex.
First, you need to convert the movie to a sequence of BMP images, which you
can do with third-party tools such as FFMPEG. Second, you need to create a
JSON file containing the movie metadata, which looks like this, for example:
{
"frameRateNumerator" : 8,
"frameRateDenominator" : 1
}
Once you've done that, create a ZIP archive where the path of the JSON file is
"muvi\0.json" and the frames are "PICT\<frame number>.bmp", where <frame
number> is the frame number, starting with 1 as the first frame, and name that
the same as the house name, but with a ".mov.gpa" extension.
Next, you need to create a metadata file for the movie, which should have a
".mov.gpf" extension. You can create the metadata file using the "FTagData"
utility, using a timestamp file created with the "MakeTimestamp" utility.
I'd recommend using "MooV" as the file type and "ozm5" as the file creator.
You do NOT need to keep the .mov.gpd file once you've done this - Aerofoil
expects all of the movie data to be in the resource archive.
Some old QuickTime movies contain movie tracking information in the movie
resource fork, in which case you need to merge them into the data for modern
utilities to read them. You can use the "flattenmov" tool to do this: Pass
it the data (.gpd) and resource (.gpr) data files for a movie, and it will
merge them into a single .mov file.
BATCH CONVERSION
------------------------------------------------------------------------------
To batch-convert house resource files, use gpr2gpa with a path that ends
with an asterisk (*) and omit the output filename.
SECURITY CONSIDERATIONS
------------------------------------------------------------------------------
Glider PRO didn't really do any validation of houses. Currently, Aerofoil
doesn't do any additional validation either, and it's possible that invalid
house data may lead to crashes or even remote code execution.
I will be doing a hardening pass on the loader for the 1.1 release. Until
then, please only load houses from trusted sources.
Also, Glider PRO houses were able to take advantage of a resource overlaying
feature of the Macintosh operating system, where a resource being present in
the house file with the same ID as an application resource would cause the
resource to override the application resource.
Aerofoil's resource loader is much more restrictive: Currently, only
backgrounds, audio triggers, and icons may load from the house data. This
restriction will be loosened in the 1.1 release to allow resources to be
overrided if I can confirm that it's safe to override them.

View File

@@ -0,0 +1,27 @@
#include "GpBuildVersion.h"
#include "WindowsUnicodeToolShim.h"
int toolMain(int argc, const char **argv)
{
if (argc != 2)
{
fprintf(stderr, "Usage: EmitWiXVersion <output>\n");
return -1;
}
FILE *f = fopen_utf8(argv[1], "wb");
if (!f)
{
fprintf(stderr, "EmitWiXVersion: Error opening output file\n");
return -1;
}
fprintf(f, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
fprintf(f, "<Include>\n");
fprintf(f, " <?define AerofoilReleaseVersion=\"%i.%i.%i.0\" ?>\n", GP_BUILD_VERSION_MAJOR, GP_BUILD_VERSION_MINOR, GP_BUILD_VERSION_UPDATE);
fprintf(f, "</Include>\n");
fclose(f);
return 0;
}

View File

@@ -0,0 +1,139 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{7EFF1E21-C375-45EA-A069-4E2232C8A72B}</ProjectGuid>
<RootNamespace>EmitWiXVersion</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\GpCommon.props" />
<Import Project="..\WindowsUnicodeToolShim.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\GpCommon.props" />
<Import Project="..\WindowsUnicodeToolShim.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" />
<Import Project="..\GpCommon.props" />
<Import Project="..\WindowsUnicodeToolShim.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\GpCommon.props" />
<Import Project="..\WindowsUnicodeToolShim.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="EmitWiXVersion.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PortabilityLayer\PortabilityLayer.vcxproj">
<Project>{6ec62b0f-9353-40a4-a510-3788f1368b33}</Project>
</ProjectReference>
<ProjectReference Include="..\WindowsUnicodeToolShim\WindowsUnicodeToolShim.vcxproj">
<Project>{15009625-1120-405e-8bba-69a16cd6713d}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="EmitWiXVersion.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -7,10 +7,14 @@
#include "PLArrayView.h"
#include "PLKeyEncoding.h"
#include "PLControlDefinitions.h"
#include "FontFamily.h"
#include "PLButtonWidget.h"
#include "PLLabelWidget.h"
#include "PLNumberFormatting.h"
#include "PLResources.h"
#include "PLSound.h"
#include "PLPasStr.h"
#include "PLStandardColors.h"
#include "PLSysCalls.h"
#include "PLTimeTaggedVOSEvent.h"
#include "PLWidgets.h"
@@ -19,15 +23,23 @@
#include "DialogUtils.h"
#include "Environ.h"
#include "Externs.h"
#include "GpApplicationName.h"
#include "GpBuildVersion.h"
#include "HostSystemServices.h"
#include "RenderedFont.h"
#include "RenderedFontMetrics.h"
#include "ResolveCachingColor.h"
#include "ResourceManager.h"
#include "ScanlineMask.h"
#include "WindowDef.h"
#include "WindowManager.h"
static void HiLiteOkayButton (DrawSurface *surface);
static void UnHiLiteOkayButton (DrawSurface *surface);
static void UpdateMainPict (Dialog *);
static int16_t AboutFilter(Dialog *, const TimeTaggedVOSEvent *evt);
static int16_t AboutFrameworkFilter(Dialog *, const TimeTaggedVOSEvent *evt);
static Point okayButtLowerV, okayButtUpperV;
@@ -86,6 +98,66 @@ void DoAbout (void)
aboutDialog->Destroy();
}
void DoAboutFramework (void)
{
#define kAboutFrameworkDialogTemplateID 2000
const Rect windowRect = Rect::Create(0, 0, 272, 450);
PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(windowRect, PortabilityLayer::WindowStyleFlags::kAlert, true, 0, 0, PSTR(""));
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
PortabilityLayer::RenderedFont *font = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
PortabilityLayer::RenderedFont *fontLight = GetApplicationFont(8, PortabilityLayer::FontFamilyFlag_None, true);
int16_t verticalPoint = 16 + font->GetMetrics().m_ascent;
int16_t horizontalOffset = 16;
const int16_t spacing = 12;
PortabilityLayer::DialogManager *dialogManager = PortabilityLayer::DialogManager::GetInstance();
Dialog *dialog = dialogManager->LoadDialogFromTemplate(kAboutFrameworkDialogTemplateID, windowRect, true, false, 0, 0, PL_GetPutInFrontWindowPtr(), PSTR(""), nullptr);
#ifdef NDEBUG
#define ABOUT_DIALOG_CONFIGURATION_TAG "Release"
#else
#define ABOUT_DIALOG_CONFIGURATION_TAG "Debug"
#endif
Window *window = dialog->GetWindow();
DrawSurface *surface = window->GetDrawSurface();
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 0), PSTR(GP_APPLICATION_NAME " " GP_APPLICATION_VERSION_STRING " \xa9" GP_APPLICATION_COPYRIGHT_STRING), blackColor, font);
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 2), PSTR(GP_APPLICATION_NAME " is an unoffical third-party port of Glider PRO\xaa."), blackColor, font);
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 4), PSTR("This software is not maintained by, supported by, endorsed by, or"), blackColor, font);
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 5), PSTR("otherwise associated with the authors and publishers of Glider PRO\xaa."), blackColor, font);
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 7), PSTR("Please do not contact any of them regarding issues that you have"), blackColor, font);
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 8), PSTR("with " GP_APPLICATION_NAME "."), blackColor, font);
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 10), PSTR("If you would like to contribute to this project, visit:"), blackColor, font);
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 11), PSTR(GP_APPLICATION_WEBSITE_STRING), blackColor, font);
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 13), PSTR("To report a problem or request support, submit an issue via"), blackColor, font);
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 14), PSTR("the website above."), blackColor, font);
surface->DrawString(Point::Create(horizontalOffset, verticalPoint + spacing * 16), PSTR("For more information, please see the accompanying documentation."), blackColor, font);
surface->DrawString(Point::Create(horizontalOffset, windowRect.bottom - 16), PSTR("Build: " __DATE__ " " __TIME__ " " ABOUT_DIALOG_CONFIGURATION_TAG), blackColor, fontLight);
DrawDefaultButton(dialog);
int16_t hit = 0;
do
{
hit = dialog->ExecuteModal(AboutFrameworkFilter);
} while (hit != kOkayButton);
dialog->Destroy();
}
//============================================================== Static Functions
//-------------------------------------------------------------- HiLiteOkayButton
// Draws my pseudo-button to appear as though it is clicked on.
@@ -253,3 +325,44 @@ static int16_t AboutFilter(Dialog *dialog, const TimeTaggedVOSEvent *evt)
return hit;
}
//-------------------------------------------------------------- AboutFrameworkFilter
// Dialog filter for the About Framework dialog.
static int16_t AboutFrameworkFilter(Dialog *dialog, const TimeTaggedVOSEvent *evt)
{
bool handledIt = false;
int16_t hit = -1;
if (!evt)
return -1;
Window *window = dialog->GetWindow();
DrawSurface *surface = window->GetDrawSurface();
if (evt->IsKeyDownEvent())
{
switch (PackVOSKeyCode(evt->m_vosEvent.m_event.m_keyboardInputEvent))
{
case PL_KEY_SPECIAL(kEnter):
case PL_KEY_NUMPAD_SPECIAL(kEnter):
dialog->GetItems()[kOkayButton - 1].GetWidget()->SetHighlightStyle(kControlButtonPart, true);
PLSysCalls::Sleep(8);
dialog->GetItems()[kOkayButton - 1].GetWidget()->SetHighlightStyle(kControlButtonPart, false);
hit = kOkayButton;
handledIt = true;
break;
default:
handledIt = false;
break;
}
}
if (!handledIt)
return -1;
return hit;
}

View File

@@ -6,7 +6,7 @@
//============================================================================
#include "PLAppleEvents.h"
#include "AppEventHandler.h"
#include "DialogManager.h"
#include "Externs.h"
#include "House.h"
@@ -14,6 +14,9 @@
#define kNoPrintingAlert 1031
extern Boolean quitting;
#if 0
PLError_t DoOpenAppAE (const AppleEvent *, AppleEvent *, UInt32);
PLError_t DoOpenDocAE (const AppleEvent *, AppleEvent *, UInt32);
@@ -27,7 +30,6 @@ AEEventHandlerUPP openAppAEUPP, openDocAEUPP, printDocAEUPP, quitAEUPP;
extern VFileSpec *theHousesSpecs;
extern long incrementModeTime;
extern short thisHouseIndex, splashOriginH, splashOriginV;
extern Boolean quitting;
//============================================================== Functions
@@ -51,7 +53,7 @@ PLError_t DoOpenDocAE (const AppleEvent *theAE, AppleEvent *reply, UInt32 ref)
VFileInfo finderInfo;
AEDescList docList;
long itemsInList;
Size actualSize;
size_t actualSize;
AEKeyword keywd;
DescType returnedType;
PLError_t theErr, whoCares;
@@ -161,12 +163,37 @@ PLError_t DoQuitAE (const AppleEvent *theAE, AppleEvent *reply, UInt32 ref)
PLError_t MyGotRequiredParams (const AppleEvent *theAE)
{
DescType returnedType;
Size actualSize;
size_t actualSize;
return (AEGetAttributePtr(theAE, keyMissedKeywordAttr, typeWildCard,
&returnedType, 0L, 0, &actualSize) == errAEDescNotFound) ? PLErrors::kNone :
PLErrors::kInvalidParameter;
}
#endif
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.
@@ -174,34 +201,7 @@ PLError_t MyGotRequiredParams (const AppleEvent *theAE)
void SetUpAppleEvents (void)
{
PLError_t theErr;
openAppAEUPP = NewAEEventHandlerProc(DoOpenAppAE);
openDocAEUPP = NewAEEventHandlerProc(DoOpenDocAE);
printDocAEUPP = NewAEEventHandlerProc(DoPrintDocAE);
quitAEUPP = NewAEEventHandlerProc(DoQuitAE);
theErr = AEInstallEventHandler(kCoreEventClass, // install oapp
kAEOpenApplication, openAppAEUPP, 0, false);
if (theErr != PLErrors::kNone)
YellowAlert(kYellowAppleEventErr, theErr);
theErr = AEInstallEventHandler(kCoreEventClass, // install odoc
kAEOpenDocuments, openDocAEUPP, 0, false);
if (theErr != PLErrors::kNone)
YellowAlert(kYellowAppleEventErr, theErr);
theErr = AEInstallEventHandler(kCoreEventClass, // install pdoc
kAEPrintDocuments, printDocAEUPP, 0, false);
if (theErr != PLErrors::kNone)
YellowAlert(kYellowAppleEventErr, theErr);
theErr = AEInstallEventHandler(kCoreEventClass, // install quit
kAEQuitApplication, quitAEUPP, 0, false);
if (theErr != PLErrors::kNone)
YellowAlert(kYellowAppleEventErr, theErr);
theErr = AESetInteractionAllowed(kAEInteractWithAll);
if (theErr != PLErrors::kNone)
YellowAlert(kYellowAppleEventErr, theErr);
PortabilityLayer::AppEventHandler::SetInstance(SystemEventHandlerImpl::GetInstance());
}

View File

@@ -14,8 +14,13 @@
#include "FontManager.h"
#include "MainWindow.h"
#include "RectUtils.h"
#include "RenderedFont.h"
#include "RenderedFontMetrics.h"
#include "ResolveCachingColor.h"
#include "Room.h"
#include "Utilities.h"
#include "WindowDef.h"
#include "WindowManager.h"
#define kBannerPageTopPICT 1993
@@ -57,17 +62,17 @@ void DrawBanner (Point *topLeft)
topLeft->v = wholePage.top;
partPage = wholePage;
partPage.bottom = partPage.top + 190;
LoadScaledGraphic(workSrcMap, kBannerPageTopPICT, &partPage);
LoadScaledGraphicCustom(workSrcMap, kBannerPageTopPICT, &partPage);
partPage = wholePage;
partPage.top = partPage.bottom - 30;
mapBounds = partPage;
ZeroRectCorner(&mapBounds);
theErr = CreateOffScreenGWorld(&tempMap, &mapBounds, kPreferredPixelFormat);
LoadGraphic(tempMap, kBannerPageBottomPICT);
theErr = CreateOffScreenGWorld(&tempMap, &mapBounds);
LoadGraphicCustom(tempMap, kBannerPageBottomPICT);
theErr = CreateOffScreenGWorld(&tempMask, &mapBounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kBannerPageBottomMask);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &mapBounds, GpPixelFormats::kBW1);
LoadGraphicCustom(tempMask, kBannerPageBottomMask);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
(BitMap *)*GetGWorldPixMap(tempMask),
@@ -117,13 +122,15 @@ void DrawBannerMessage (Point topLeft)
PasStringCopy((*thisHouse)->banner, bannerStr);
workSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
workSrcMap->SetForeColor(StdColors::Black());
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
count = 0;
do
{
GetLineOfText(bannerStr, count, subStr);
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 32 + (count * 20)), subStr, true);
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 32 + (count * 20)), subStr, blackColor, appFont);
count++;
}
while (subStr[0] > 0);
@@ -144,13 +151,12 @@ void DrawBannerMessage (Point topLeft)
GetLocalizedString(4, subStr);
PasStringConcat(bannerStr, subStr);
workSrcMap->SetForeColor(StdColors::Red());
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 164), bannerStr, true);
PortabilityLayer::ResolveCachingColor redColor = StdColors::Red();
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 164), bannerStr, redColor, appFont);
GetLocalizedString(5, subStr);
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 180), subStr, true);
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 180), subStr, redColor, appFont);
}
workSrcMap->SetForeColor(StdColors::Black());
SetGraphicsPort(wasGWorld);
}
@@ -196,35 +202,53 @@ void BringUpBanner (void)
// in a house. It comes up when the player gets a star (the game is paused<65>
// and the user informed as to how many remain).
void DisplayStarsRemaining (void)
void DisplayStarsRemaining(void)
{
Rect src, bounds;
Str255 theStr;
DrawSurface *surface = mainWindow->GetDrawSurface();
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
QSetRect(&bounds, 0, 0, 256, 64);
CenterRectInRect(&bounds, &thisMac.fullScreen);
QOffsetRect(&bounds, -thisMac.fullScreen.left, -thisMac.fullScreen.top);
src = bounds;
InsetRect(&src, 64, 32);
QOffsetRect(&bounds, 0, -20);
surface->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
// Inset by 1 because the original graphic is bordered, and we want to use the window chrome for the border because it will apply the flicker effect
Rect windowBounds = bounds.Inset(1, 1);
PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(windowBounds, 0, true, 0, 0, PSTR(""));
// Zero out
QOffsetRect(&bounds, -bounds.left - 1, -bounds.top - 1);
Window *starsWindow = wm->CreateWindow(wdef);
wm->PutWindowBehind(starsWindow, wm->GetPutInFrontSentinel());
DrawSurface *surface = starsWindow->GetDrawSurface();
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
NumToString((long)numStarsRemaining, theStr);
QOffsetRect(&bounds, 0, -20);
if (numStarsRemaining < 2)
LoadScaledGraphic(surface, kStarRemainingPICT, &bounds);
LoadScaledGraphicCustom(surface, kStarRemainingPICT, &bounds);
else
{
LoadScaledGraphic(surface, kStarsRemainingPICT, &bounds);
const Point textPoint = Point::Create(bounds.left + 102 - (surface->MeasureString(theStr) / 2), bounds.top + 23);
ColorText(surface, textPoint, theStr, 4L);
LoadScaledGraphicCustom(surface, kStarsRemainingPICT, &bounds);
const Point textPoint = Point::Create(bounds.left + 102 - (appFont->MeasurePStr(theStr) / 2), bounds.top + 23);
ColorText(surface, textPoint, theStr, 4L, appFont);
}
if (doZooms)
wm->FlickerWindowIn(starsWindow, 32);
DelayTicks(60);
if (WaitForInputEvent(30))
RestoreEntireGameScreen();
CopyRectWorkToMain(&bounds);
WaitForInputEvent(30);
if (doZooms)
wm->FlickerWindowOut(starsWindow, 32);
wm->DestroyWindow(starsWindow);
}

View File

@@ -10,6 +10,7 @@
#include "PLPalettes.h"
#include "PLPasStr.h"
#include "QDStandardPalette.h"
#include "ResolveCachingColor.h"
//============================================================== Functions
@@ -19,14 +20,11 @@
// this function draws text in that color. It assumes the current port,<2C>
// the current font, the current pen location, etc.
void ColorText (DrawSurface *surface, const Point &point, StringPtr theStr, long color)
void ColorText (DrawSurface *surface, const Point &point, StringPtr theStr, long color, PortabilityLayer::RenderedFont *font)
{
const PortabilityLayer::RGBAColor &rgbaColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[color];
PortabilityLayer::ResolveCachingColor rColor = PortabilityLayer::ResolveCachingColor::FromStandardColor(color);
const PortabilityLayer::RGBAColor wasColor = surface->GetForeColor();
surface->SetForeColor(rgbaColor);
surface->DrawString(point, theStr, true);
surface->SetForeColor(wasColor);
surface->DrawString(point, theStr, rColor, font);
}
//-------------------------------------------------------------- ColorRect
@@ -36,12 +34,9 @@ void ColorText (DrawSurface *surface, const Point &point, StringPtr theStr, long
void ColorRect (DrawSurface *surface, const Rect &theRect, long color)
{
const PortabilityLayer::RGBAColor &rgbaColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[color];
PortabilityLayer::ResolveCachingColor rColor = PortabilityLayer::ResolveCachingColor::FromStandardColor(color);
const PortabilityLayer::RGBAColor wasColor = surface->GetForeColor();
surface->SetForeColor(rgbaColor);
surface->FillRect(theRect);
surface->SetForeColor(wasColor);
surface->FillRect(theRect, rColor);
}
//-------------------------------------------------------------- ColorOval
@@ -51,22 +46,16 @@ void ColorRect (DrawSurface *surface, const Rect &theRect, long color)
void ColorOval (DrawSurface *surface, const Rect &theRect, long color)
{
const PortabilityLayer::RGBAColor &rgbaColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[color];
PortabilityLayer::ResolveCachingColor rColor = PortabilityLayer::ResolveCachingColor::FromStandardColor(color);
const PortabilityLayer::RGBAColor wasColor = surface->GetForeColor();
surface->SetForeColor(rgbaColor);
surface->FillEllipse(theRect);
surface->SetForeColor(wasColor);
surface->FillEllipse(theRect, rColor);
}
void ColorOvalMaskPattern(DrawSurface *surface, const Rect &theRect, long color, bool isMask, const uint8_t *pattern)
void ColorOvalMaskPattern(DrawSurface *surface, const Rect &theRect, long color, const uint8_t *pattern)
{
const PortabilityLayer::RGBAColor &rgbaColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[color];
PortabilityLayer::ResolveCachingColor rColor = PortabilityLayer::ResolveCachingColor::FromStandardColor(color);
const PortabilityLayer::RGBAColor wasColor = surface->GetForeColor();
surface->SetForeColor(rgbaColor);
surface->FillEllipseWithPattern(theRect, isMask, pattern);
surface->SetForeColor(wasColor);
surface->FillEllipseWithMaskPattern(theRect, pattern, rColor);
}
//-------------------------------------------------------------- ColorRegionMaskPattern
@@ -74,14 +63,10 @@ void ColorOvalMaskPattern(DrawSurface *surface, const Rect &theRect, long color,
// Given a region and color index, this function draws a solid<69>
// region in that color. Current port, pen mode, etc. assumed.
void ColorRegionMaskPattern (DrawSurface *surface, PortabilityLayer::ScanlineMask *scanlineMask, long colorIndex, bool isMask, const uint8_t *pattern)
void ColorRegionMaskPattern (DrawSurface *surface, PortabilityLayer::ScanlineMask *scanlineMask, long colorIndex, const uint8_t *pattern)
{
const PortabilityLayer::RGBAColor &rgbaColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[colorIndex];
const PortabilityLayer::RGBAColor wasColor = surface->GetForeColor();
surface->SetForeColor(rgbaColor);
surface->FillScanlineMaskWithPattern(scanlineMask, isMask, pattern);
surface->SetForeColor(wasColor);
PortabilityLayer::ResolveCachingColor rColor = PortabilityLayer::ResolveCachingColor::FromStandardColor(colorIndex);
surface->FillScanlineMaskWithMaskPattern(scanlineMask, pattern, rColor);
}
//-------------------------------------------------------------- ColorLine
@@ -91,12 +76,9 @@ void ColorRegionMaskPattern (DrawSurface *surface, PortabilityLayer::ScanlineMas
void ColorLine (DrawSurface *surface, short h0, short v0, short h1, short v1, long color)
{
const PortabilityLayer::RGBAColor &rgbaColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[color];
PortabilityLayer::ResolveCachingColor cacheColor = PortabilityLayer::ResolveCachingColor::FromStandardColor(color);
const PortabilityLayer::RGBAColor wasColor = surface->GetForeColor();
surface->SetForeColor(rgbaColor);
surface->DrawLine(Point::Create(h0, v0), Point::Create(h1, v1));
surface->SetForeColor(wasColor);
surface->DrawLine(Point::Create(h0, v0), Point::Create(h1, v1), cacheColor);
}
//-------------------------------------------------------------- HiliteRect
@@ -125,12 +107,9 @@ void HiliteRect (DrawSurface *surface, const Rect &theRect, short color1, short
void ColorFrameRect (DrawSurface *surface, const Rect &theRect, long color)
{
const PortabilityLayer::RGBAColor &rgbaColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[color];
PortabilityLayer::ResolveCachingColor rColor = PortabilityLayer::ResolveCachingColor::FromStandardColor(color);
const PortabilityLayer::RGBAColor wasColor = surface->GetForeColor();
surface->SetForeColor(rgbaColor);
surface->FrameRect(theRect);
surface->SetForeColor(wasColor);
surface->FrameRect(theRect, rColor);
}
//-------------------------------------------------------------- ColorFrameWHRect
@@ -157,12 +136,9 @@ void ColorFrameWHRect (DrawSurface *surface, short left, short top, short wide,
void ColorFrameOval (DrawSurface *surface, const Rect &theRect, long color)
{
const PortabilityLayer::RGBAColor &rgbaColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[color];
PortabilityLayer::ResolveCachingColor rColor = PortabilityLayer::ResolveCachingColor::FromStandardColor(color);
const PortabilityLayer::RGBAColor wasColor = surface->GetForeColor();
surface->SetForeColor(rgbaColor);
surface->FrameEllipse(theRect);
surface->SetForeColor(wasColor);
surface->FrameEllipse(theRect, rColor);
}
//-------------------------------------------------------------- LtGrayForeColor
@@ -170,9 +146,9 @@ void ColorFrameOval (DrawSurface *surface, const Rect &theRect, long color)
// This function finds the closest match to a "light gray" in the<68>
// current palette and sets the pen color to that.
void LtGrayForeColor (DrawSurface *surface)
PortabilityLayer::ResolveCachingColor LtGrayForeColor ()
{
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(191, 191, 191, 255));
return PortabilityLayer::RGBAColor::Create(191, 191, 191, 255);
}
//-------------------------------------------------------------- GrayForeColor
@@ -180,9 +156,9 @@ void LtGrayForeColor (DrawSurface *surface)
// This function finds the closest match to a "medium gray" in the<68>
// current palette and sets the pen color to that.
void GrayForeColor (DrawSurface *surface)
PortabilityLayer::ResolveCachingColor GrayForeColor ()
{
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(127, 127, 127, 255));
return PortabilityLayer::RGBAColor::Create(127, 127, 127, 255);
}
//-------------------------------------------------------------- DkGrayForeColor
@@ -190,7 +166,7 @@ void GrayForeColor (DrawSurface *surface)
// This function finds the closest match to a "dark gray" in the<68>
// current palette and sets the pen color to that.
void DkGrayForeColor (DrawSurface *surface)
PortabilityLayer::ResolveCachingColor DkGrayForeColor ()
{
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(63, 63, 63, 255));
return PortabilityLayer::RGBAColor::Create(63, 63, 63, 255);
}

View File

@@ -13,6 +13,7 @@
#include "Marquee.h"
#include "ObjectEdit.h"
#include "RectUtils.h"
#include "ResolveCachingColor.h"
#include "WindowDef.h"
#include "WindowManager.h"
@@ -66,17 +67,19 @@ void UpdateCoordWindow (void)
{
#ifndef COMPILEDEMO
Str255 tempStr, numStr;
GrafPtr wasPort;
if (coordWindow == nil)
return;
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
PortabilityLayer::ResolveCachingColor blueColor = StdColors::Blue();
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, 0, true);
DrawSurface *surface = coordWindow->GetDrawSurface();
surface->SetForeColor(StdColors::White());
surface->FillRect(coordWindowRect);
surface->SetForeColor(StdColors::Black());
surface->FillRect(coordWindowRect, whiteColor);
PasStringCopy(PSTR("h: "), tempStr);
if (coordH != -1)
@@ -87,7 +90,7 @@ void UpdateCoordWindow (void)
else
PasStringConcat(tempStr, PSTR("-"));
surface->DrawString(Point::Create(5, 12), tempStr, true);
surface->DrawString(Point::Create(5, 12), tempStr, blackColor, appFont);
PasStringCopy(PSTR("v: "), tempStr);
if (coordV != -1)
@@ -98,9 +101,8 @@ void UpdateCoordWindow (void)
else
PasStringConcat(tempStr, PSTR("-"));
surface->DrawString(Point::Create(4, 22), tempStr, true);
surface->DrawString(Point::Create(4, 22), tempStr, blackColor, appFont);
surface->SetForeColor(StdColors::Blue());
PasStringCopy(PSTR("d: "), tempStr);
if (coordD != -1)
{
@@ -110,8 +112,7 @@ void UpdateCoordWindow (void)
else
PasStringConcat(tempStr, PSTR("-"));
surface->DrawString(Point::Create(5, 32), tempStr, true);
surface->SetForeColor(StdColors::Black());
surface->DrawString(Point::Create(5, 32), tempStr, blueColor, appFont);
#endif
}
@@ -157,8 +158,6 @@ void OpenCoordWindow (void)
coordV = -1;
coordD = -1;
coordWindow->GetDrawSurface()->SetApplicationFont(9, 0);
if (objActive != kNoObjectSelected)
{
if (ObjectHasHandle(&direction, &dist))

View File

@@ -6,6 +6,7 @@
#include "DialogManager.h"
#include "PLArrayView.h"
#include "PLButtonWidget.h"
#include "PLControlDefinitions.h"
#include "PLNumberFormatting.h"
#include "PLPasStr.h"
@@ -16,6 +17,9 @@
#include "Externs.h"
#include "FontFamily.h"
#include "ResourceManager.h"
#include "ResolveCachingColor.h"
#include "RenderedFont.h"
#include "RenderedFontMetrics.h"
#include <algorithm>
@@ -35,7 +39,7 @@ void BringUpDialog (Dialog **theDialog, short dialogID, const DialogTextSubstitu
// CenterDialog(dialogID);
if (*theDialog == nil)
RedAlert(kErrDialogDidntLoad);
SetGraphicsPort(&(*theDialog)->GetWindow()->m_surface);
SetGraphicsPort((*theDialog)->GetWindow()->GetDrawSurface());
ShowWindow((*theDialog)->GetWindow());
DrawDefaultButton(*theDialog);
}
@@ -347,9 +351,9 @@ void FlashDialogButton (Dialog *theDialog, short itemNumber)
PortabilityLayer::Widget *widget = theDialog->GetItems()[itemNumber - 1].GetWidget();
widget->SetHighlightStyle(kControlButtonPart);
widget->SetHighlightStyle(kControlButtonPart, true);
Delay(8, &dummyLong);
widget->SetHighlightStyle(0);
widget->SetHighlightStyle(kControlButtonPart, false);
}
//-------------------------------------------------------------- DrawDefaultButton
@@ -362,18 +366,7 @@ void DrawDefaultButton (Dialog *theDialog)
Rect itemRect = firstItem.GetWidget()->GetRect();
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
InsetRect(&itemRect, -4, -4);
surface->SetForeColor(StdColors::Black());
for (int xOffset = -1; xOffset <= 1; xOffset++)
{
for (int yOffset = -1; yOffset <= 1; yOffset++)
{
const Rect offsetRect = itemRect + Point::Create(xOffset, yOffset);
surface->FrameRoundRect(offsetRect, 8, 8);
}
}
PortabilityLayer::ButtonWidget::DrawDefaultButtonChrome(itemRect, surface);
}
//-------------------------------------------------------------- GetDialogString
@@ -582,45 +575,45 @@ void DrawDialogUserText (Dialog *dial, short item, StringPtr text, Boolean inver
DrawSurface *surface = dial->GetWindow()->GetDrawSurface();
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None);
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None, true);
PasStringCopy(text, stringCopy);
Rect iRect = dial->GetItems()[item - 1].GetWidget()->GetRect();
if ((surface->MeasureString(stringCopy) + 2) > (iRect.right - iRect.left))
CollapseStringToWidth(surface, stringCopy, iRect.right - iRect.left - 2);
if ((appFont->MeasurePStr(stringCopy) + 2) > (iRect.right - iRect.left))
CollapseStringToWidth(appFont, stringCopy, iRect.right - iRect.left - 2);
surface->SetForeColor(StdColors::White());
surface->FillRect(iRect);
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
surface->FillRect(iRect, whiteColor);
short strWidth = surface->MeasureString(stringCopy);
short strWidth = appFont->MeasurePStr(stringCopy);
inset = ((iRect.right - iRect.left) - (strWidth + 2)) / 2;
iRect.left += inset;
iRect.right -= inset;
// Draw centered
const int32_t ascender = surface->MeasureFontAscender();
const int32_t ascender = appFont->GetMetrics().m_ascent;
PortabilityLayer::ResolveCachingColor backgroundColor;
PortabilityLayer::ResolveCachingColor textColor;
if (invert)
{
surface->SetForeColor(StdColors::Black());
surface->FillRect(iRect);
surface->SetForeColor(StdColors::White());
backgroundColor = StdColors::Black();
textColor = StdColors::White();
}
else
{
surface->SetForeColor(StdColors::White());
surface->FillRect(iRect);
surface->SetForeColor(StdColors::Black());
backgroundColor = StdColors::White();
textColor = StdColors::Black();
}
const Point centeredDrawPoint = Point::Create((iRect.left + iRect.right - strWidth) / 2, (iRect.top + iRect.bottom + ascender) / 2);
surface->DrawString(centeredDrawPoint, stringCopy, true);
surface->FillRect(iRect, backgroundColor);
if (invert)
surface->SetForeColor(StdColors::Black());
const Point centeredDrawPoint = Point::Create((iRect.left + iRect.right - strWidth) / 2, (iRect.top + iRect.bottom + ascender) / 2);
surface->DrawString(centeredDrawPoint, stringCopy, textColor, appFont);
}
//-------------------------------------------------------------- DrawDialogUserText
@@ -635,16 +628,16 @@ void DrawDialogUserText2 (Dialog *dial, short item, StringPtr text)
short iType;
DrawSurface *surface = dial->GetWindow()->GetDrawSurface();
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None);
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None, true);
PasStringCopy(text, stringCopy);
const Rect iRect = dial->GetItems()[item - 1].GetWidget()->GetRect();
if ((surface->MeasureString(stringCopy) + 2) > (iRect.right - iRect.left))
CollapseStringToWidth(surface, stringCopy, iRect.right - iRect.left - 2);
if ((appFont->MeasurePStr(stringCopy) + 2) > (iRect.right - iRect.left))
CollapseStringToWidth(appFont, stringCopy, iRect.right - iRect.left - 2);
surface->SetForeColor(StdColors::Black());
surface->DrawString(Point::Create(iRect.left, iRect.bottom), stringCopy, true);
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
surface->DrawString(Point::Create(iRect.left, iRect.bottom), stringCopy, blackColor, appFont);
}
//-------------------------------------------------------------- LoadDialogPICT
@@ -665,14 +658,14 @@ void LoadDialogPICT (Dialog *theDialog, short item, short theID)
//-------------------------------------------------------------- FrameDialogItem
// Given a dialog item, this function draws a box around it.
void FrameDialogItem (Dialog *theDialog, short item)
void FrameDialogItem (Dialog *theDialog, short item, PortabilityLayer::ResolveCachingColor &color)
{
const PortabilityLayer::DialogItem &itemRef = theDialog->GetItems()[item - 1];
PortabilityLayer::Widget *widget = itemRef.GetWidget();
const Rect itemRect = widget->GetRect();
theDialog->GetWindow()->GetDrawSurface()->FrameRect(itemRect);
theDialog->GetWindow()->GetDrawSurface()->FrameRect(itemRect, color);
}
//-------------------------------------------------------------- FrameDialogItemC
@@ -683,23 +676,22 @@ void FrameDialogItemC (Dialog *theDialog, short item, long color)
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
const Rect itemRect = theDialog->GetItems()[item - 1].GetWidget()->GetRect();
const PortabilityLayer::RGBAColor wasColor = surface->GetForeColor();
surface->SetForeColor(PortabilityLayer::StandardPalette::GetInstance()->GetColors()[color]);
surface->FrameRect(itemRect);
surface->SetForeColor(wasColor);
PortabilityLayer::ResolveCachingColor frameColor = PortabilityLayer::ResolveCachingColor::FromStandardColor(color);
surface->FrameRect(itemRect, frameColor);
}
//-------------------------------------------------------------- FrameOvalDialogItem
// Given a dialog item, this function draws an oval around it.
void FrameOvalDialogItem (Dialog *theDialog, short item)
void FrameOvalDialogItem (Dialog *theDialog, short item, PortabilityLayer::ResolveCachingColor &color)
{
const PortabilityLayer::DialogItem &itemRef = theDialog->GetItems()[item - 1];
PortabilityLayer::Widget *widget = itemRef.GetWidget();
const Rect itemRect = widget->GetRect();
theDialog->GetWindow()->GetDrawSurface()->FrameEllipse(itemRect);
theDialog->GetWindow()->GetDrawSurface()->FrameEllipse(itemRect, color);
}
//-------------------------------------------------------------- BorderDialogItem
@@ -713,6 +705,9 @@ void BorderDialogItem(Dialog *theDialog, short item, short sides, short thicknes
// 4 = bottom
// 8 = right ... so 6 = top & bottom, 15 = all 4 sides
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
const PortabilityLayer::DialogItem &itemRef = theDialog->GetItems()[item - 1];
PortabilityLayer::Widget *widget = itemRef.GetWidget();
const Rect itemRect = widget->GetRect();
@@ -726,13 +721,11 @@ void BorderDialogItem(Dialog *theDialog, short item, short sides, short thicknes
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);
surface->FillRect(rect, whiteColor);
surface->FillRectWithMaskPattern8x8(rect, pattern,blackColor);
}
else
surface->FillRect(rect);
surface->FillRect(rect, blackColor);
sides -= 8;
}
if (sides >= 4) // 4 = bottom
@@ -742,13 +735,11 @@ void BorderDialogItem(Dialog *theDialog, short item, short sides, short thicknes
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);
surface->FillRect(rect, whiteColor);
surface->FillRectWithMaskPattern8x8(rect, pattern, blackColor);
}
else
surface->FillRect(rect);
surface->FillRect(rect, blackColor);
sides -= 4;
}
if (sides >= 2) // 2 = top
@@ -758,13 +749,11 @@ void BorderDialogItem(Dialog *theDialog, short item, short sides, short thicknes
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);
surface->FillRect(rect, whiteColor);
surface->FillRectWithMaskPattern8x8(rect, pattern, blackColor);
}
else
surface->FillRect(rect);
surface->FillRect(rect, blackColor);
sides -= 2;
}
if (sides >= 1) // 1 = left
@@ -774,13 +763,11 @@ void BorderDialogItem(Dialog *theDialog, short item, short sides, short thicknes
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);
surface->FillRect(rect, whiteColor);
surface->FillRectWithMaskPattern8x8(rect, pattern, blackColor);
}
else
surface->FillRect(rect);
surface->FillRect(rect, blackColor);
}
}
@@ -794,13 +781,14 @@ void ShadowDialogItem (Dialog *theDialog, short item, short thickness)
const PortabilityLayer::DialogItem &itemRef = theDialog->GetItems()[item - 1];
const Rect itemRect = itemRef.GetWidget()->GetRect();
surface->SetForeColor(StdColors::Black());
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
const Point bottomLeftCorner = Point::Create(itemRect.left + thickness, itemRect.bottom);
const Point topRightCorner = Point::Create(itemRect.right, itemRect.top + thickness);
const Point bottomRightCorner = Point::Create(itemRect.right + thickness, itemRect.bottom + thickness);
surface->FillRect(Rect::Create(topRightCorner.v, topRightCorner.h, bottomRightCorner.v, bottomRightCorner.h));
surface->FillRect(Rect::Create(bottomLeftCorner.v, bottomLeftCorner.h, bottomRightCorner.v, bottomRightCorner.h));
surface->FillRect(Rect::Create(topRightCorner.v, topRightCorner.h, bottomRightCorner.v, bottomRightCorner.h), blackColor);
surface->FillRect(Rect::Create(bottomLeftCorner.v, bottomLeftCorner.h, bottomRightCorner.v, bottomRightCorner.h), blackColor);
}
//-------------------------------------------------------------- EraseDialogItem
@@ -813,9 +801,9 @@ void EraseDialogItem (Dialog *theDialog, short item)
const Rect itemRect = widget->GetRect();
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
surface->SetForeColor(StdColors::White());
surface->FillRect(itemRect);
surface->SetForeColor(StdColors::Black());
surface->FillRect(itemRect, whiteColor);
}

View File

@@ -7,6 +7,11 @@
#include "PLDialogs.h"
namespace PortabilityLayer
{
class ResolveCachingColor;
}
struct DialogTextSubstitutions;
void BringUpDialog (Dialog **theDialog, short dialogID, const DialogTextSubstitutions *);
@@ -40,9 +45,9 @@ void MyDisableControl(Dialog *, short);
void DrawDialogUserText (Dialog *, short, StringPtr, Boolean);
void DrawDialogUserText2 (Dialog *, short, StringPtr);
void LoadDialogPICT (Dialog *, short, short);
void FrameDialogItem (Dialog *, short);
void FrameDialogItem (Dialog *, short, PortabilityLayer::ResolveCachingColor &color);
void FrameDialogItemC (Dialog *, short, long);
void FrameOvalDialogItem (Dialog *, short);
void FrameOvalDialogItem (Dialog *, short, PortabilityLayer::ResolveCachingColor &color);
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

@@ -59,6 +59,7 @@ void NilSavedMaps (void)
}
savedMaps[i].where = -1;
savedMaps[i].who = -1;
savedMaps[i].component = -1;
}
numSavedMaps = 0;
}
@@ -69,7 +70,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, SInt16 where, SInt16 who)
short BackUpToSavedMap (Rect *theRect, SInt16 where, SInt16 who, SInt16 component)
{
Rect mapRect;
PLError_t theErr;
@@ -81,7 +82,7 @@ short BackUpToSavedMap (Rect *theRect, SInt16 where, SInt16 who)
ZeroRectCorner(&mapRect);
savedMaps[numSavedMaps].dest = *theRect;
// CreateOffScreenPixMap(&mapRect, &savedMaps[numSavedMaps].map);
theErr = CreateOffScreenGWorld(&savedMaps[numSavedMaps].map, &mapRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&savedMaps[numSavedMaps].map, &mapRect);
CopyBits((BitMap *)*GetGWorldPixMap(backSrcMap),
GetPortBitMapForCopyBits(savedMaps[numSavedMaps].map),
@@ -89,6 +90,7 @@ short BackUpToSavedMap (Rect *theRect, SInt16 where, SInt16 who)
savedMaps[numSavedMaps].where = where;
savedMaps[numSavedMaps].who = who;
savedMaps[numSavedMaps].component = component;
numSavedMaps++;
return (numSavedMaps - 1); // return array index
@@ -99,7 +101,7 @@ short BackUpToSavedMap (Rect *theRect, SInt16 where, SInt16 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.
SInt16 ReBackUpSavedMap (Rect *theRect, SInt16 where, SInt16 who)
SInt16 ReBackUpSavedMap (Rect *theRect, SInt16 where, SInt16 who, SInt16 component)
{
Rect mapRect;
short i, foundIndex;
@@ -108,7 +110,7 @@ SInt16 ReBackUpSavedMap (Rect *theRect, SInt16 where, SInt16 who)
for (i = 0; i < numSavedMaps; i++)
{
if ((savedMaps[i].where == where) && (savedMaps[i].who == who))
if ((savedMaps[i].where == where) && (savedMaps[i].who == who) && (savedMaps[i].component == component))
{
foundIndex = i;
mapRect = *theRect;
@@ -124,7 +126,7 @@ SInt16 ReBackUpSavedMap (Rect *theRect, SInt16 where, SInt16 who)
}
}
return BackUpToSavedMap(theRect, where, who);
return BackUpToSavedMap(theRect, where, who, component);
}
//-------------------------------------------------------------- RemoveFromSavedMap
@@ -179,14 +181,14 @@ SInt16 RemoveFromSavedMap (SInt16 index)
// This copies the saved background swatch to the screen - effectively<6C>
// covering up or "erasing" the object.
void RestoreFromSavedMap (short where, short who, Boolean doSparkle)
void RestoreFromSavedMap (SInt16 where, SInt16 who, SInt16 component, Boolean doSparkle)
{
Rect mapRect, bounds;
short i;
for (i = 0; i < numSavedMaps; i++)
{
if ((savedMaps[i].where == where) && (savedMaps[i].who == who) &&
if ((savedMaps[i].where == where) && (savedMaps[i].who == who) && (savedMaps[i].component == component) &&
(savedMaps[i].map != nil))
{
mapRect = savedMaps[i].dest;
@@ -384,7 +386,7 @@ void AddCandleFlame (SInt16 where, SInt16 who, SInt16 h, SInt16 v)
QOffsetRect(&src, 2, 0);
}
QSetRect(&bounds, 0, 0, 16, 15 * kNumCandleFlames);
savedNum = BackUpToSavedMap(&bounds, where, who);
savedNum = BackUpToSavedMap(&bounds, where, who, kCandleFlameComponent);
if (savedNum != -1)
{
BackUpFlames(&src, savedNum);
@@ -471,7 +473,7 @@ void AddTikiFlame (short where, short who, short h, short v)
}
QOffsetRect(&src, h, v);
QSetRect(&bounds, 0, 0, 8, 10 * kNumTikiFlames);
savedNum = BackUpToSavedMap(&bounds, where, who);
savedNum = BackUpToSavedMap(&bounds, where, who, kTikiFlamesComponent);
if (savedNum != -1)
{
BackUpTikiFlames(&src, savedNum);
@@ -560,7 +562,7 @@ void AddBBQCoals (short where, short who, short h, short v)
}
QOffsetRect(&src, h, v);
QSetRect(&bounds, 0, 0, 32, 9 * kNumBBQCoals);
savedNum = BackUpToSavedMap(&bounds, where, who);
savedNum = BackUpToSavedMap(&bounds, where, who, kBBQCoalsComponent);
if (savedNum != -1)
{
BackUpBBQCoals(&src, savedNum);
@@ -644,7 +646,7 @@ void AddPendulum (SInt16 where, SInt16 who, SInt16 h, SInt16 v)
clockFrame = 10;
QSetRect(&bounds, 0, 0, 32, 28 * kNumPendulums);
savedNum = BackUpToSavedMap(&bounds, where, who);
savedNum = BackUpToSavedMap(&bounds, where, who, kPendulumComponent);
if (savedNum != -1)
{
QSetRect(&src, 0, 0, 32, 28);
@@ -745,7 +747,7 @@ void AddStar (short where, short who, short h, short v)
QOffsetRect(&src, h, v);
QSetRect(&bounds, 0, 0, 32, 31 * 6);
savedNum = BackUpToSavedMap(&bounds, where, who);
savedNum = BackUpToSavedMap(&bounds, where, who, kStarComponent);
if (savedNum != -1)
{
BackUpStar(&src, savedNum);

View File

@@ -11,8 +11,10 @@
#include "MainWindow.h"
#include "Objects.h"
#include "PLHacks.h"
#include "PLStandardColors.h"
#include "RectUtils.h"
#include "Room.h"
#include "ResolveCachingColor.h"
#define kShoveVelocity 8
@@ -578,7 +580,8 @@ void HandleOutlet (short who)
}
else
{
workSrcMap->FillRect(dinahs[who].dest);
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
workSrcMap->FillRect(dinahs[who].dest, blackColor);
}
AddRectToWorkRects(&dinahs[who].dest);
}

View File

@@ -17,6 +17,8 @@
#include "IGpDisplayDriver.h"
#include "WindowManager.h"
#include <algorithm>
#define kSwitchDepthAlert 130
#define kSetMemoryAlert 180
#define kLowMemoryAlert 181
@@ -205,30 +207,6 @@ Boolean DoWeHaveDragManager (void)
return true;
}
//-------------------------------------------------------------- WhatsOurDepth
// Determines the pixel bit depth for current device (monitor).
short WhatsOurDepth (void)
{
GpPixelFormat_t pixelFormat;
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(nil, nil, &pixelFormat);
switch (pixelFormat)
{
case GpPixelFormats::k8BitCustom:
case GpPixelFormats::k8BitStandard:
return 8;
case GpPixelFormats::kRGB555:
return 16;
case GpPixelFormats::kRGB24:
case GpPixelFormats::kRGB32:
return 32;
default:
return 0;
}
}
void SwitchToDepth (short, Boolean)
{
}
@@ -319,9 +297,6 @@ void CheckOurEnvirons (void)
thisMac.can4Bit = true;
thisMac.can8Bit = true;
thisMac.numScreens = HowManyUsableScreens(false, true, true);
thisMac.wasDepth = WhatsOurDepth();
thisMac.wasColorOrGray = AreWeColorOrGrayscale();
thisMac.isResolutionDirty = true;
FlushResolutionChange();
@@ -344,8 +319,28 @@ public:
HandleResolutionChange(prevWidth, prevHeight, newWidth, newHeight);
}
void AdjustRequestedResolution(uint32_t &width, uint32_t &height) override
void AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualHeight, float &pixelScaleX, float &pixelScaleY) override
{
if (physicalWidth < 640)
physicalWidth = 640;
if (physicalHeight < 480)
physicalHeight = 480;
double xMul = static_cast<double>(physicalWidth) / 640;
double yMul = static_cast<double>(physicalHeight) / 480;
double granularity = 2.0;
xMul = floor(xMul * granularity) / granularity;
yMul = floor(yMul * granularity) / granularity;
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;
@@ -395,53 +390,21 @@ void ReflectSecondMonitorEnvirons (Boolean use1Bit, Boolean use4Bit, Boolean use
void HandleDepthSwitching (void)
{
if (thisMac.hasColor)
switch (isDepthPref)
{
switch (isDepthPref)
{
case kSwitchIfNeeded:
if ((thisMac.wasDepth != 8) &&
((thisMac.wasDepth != 4) || (thisMac.wasColorOrGray)))
SwitchDepthOrAbort();
break;
case kSwitchTo256Colors:
if (thisMac.wasDepth != 8)
{
if (thisMac.can8Bit)
SwitchToDepth(8, true);
else
SwitchDepthOrAbort();
}
break;
case kSwitchTo16Grays:
if ((thisMac.wasDepth != 4) || (thisMac.wasColorOrGray))
{
if (thisMac.can4Bit)
SwitchToDepth(4, false);
else
SwitchDepthOrAbort();
}
break;
default:
break;
}
case 32:
PortabilityLayer::DisplayDeviceManager::GetInstance()->SetPixelFormat(GpPixelFormats::kRGB32);
break;
case 8:
PortabilityLayer::DisplayDeviceManager::GetInstance()->SetPixelFormat(GpPixelFormats::k8BitStandard);
break;
default:
isDepthPref = 8;
PortabilityLayer::DisplayDeviceManager::GetInstance()->SetPixelFormat(GpPixelFormats::k8BitStandard);
break;
}
thisMac.isDepth = WhatsOurDepth();
}
//-------------------------------------------------------------- RestoreColorDepth
// Restores a monitor to its previous depth when we quit (if we changed it).
void RestoreColorDepth (void)
{
if ((thisMac.hasColor) && ((thisMac.wasDepth != thisMac.isDepth) ||
(thisMac.wasColorOrGray != AreWeColorOrGrayscale())))
SwitchToDepth(thisMac.wasDepth, true);
thisMac.isDepth = isDepthPref;
}
//-------------------------------------------------------------- CheckMemorySize
@@ -552,7 +515,7 @@ void GetDeviceRect(Rect *rect)
{
unsigned int width;
unsigned int height;
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(&width, &height, nil);
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(&width, &height);
SetRect(rect, 0, 0, static_cast<short>(width), static_cast<short>(height));
}

View File

@@ -12,7 +12,7 @@ typedef struct
{
Rect fullScreen, constrainedScreen, gray;
long dirID;
short wasDepth, isDepth;
short isDepth;
short numScreens;
short vRefNum;
Boolean can1Bit;

View File

@@ -6,10 +6,8 @@
//============================================================================
#include "PLAppleEvents.h"
#include "PLKeyEncoding.h"
#include "PLTimeTaggedVOSEvent.h"
#include "PLToolUtils.h"
#include "PLQDraw.h"
#include "DialogManager.h"
#include "Externs.h"
@@ -17,6 +15,7 @@
#include "House.h"
#include "InputManager.h"
#include "ObjectEdit.h"
#include "Rect2i.h"
#include "WindowManager.h"
@@ -30,6 +29,7 @@ void HandleIdleTask (void);
void IncrementMode (void);
long lastUp, incrementModeTime;
UInt32 doubleTime;
Point lastWhere;
@@ -66,7 +66,7 @@ short BitchAboutColorDepth (void)
void HandleMouseEvent (const GpMouseInputEvent &theEvent, uint32_t tick)
{
WindowPtr whichWindow;
long menuChoice, newSize;
long menuChoice;
short thePart, hDelta, vDelta;
Boolean isDoubleClick;
Point evtPoint = Point::Create(theEvent.m_x, theEvent.m_y);
@@ -108,11 +108,11 @@ void HandleMouseEvent (const GpMouseInputEvent &theEvent, uint32_t tick)
}
break;
case RegionIDs::kExpand:
case RegionIDs::kResize:
if (whichWindow == mapWindow)
{
newSize = GrowWindow(mapWindow, evtPoint, &thisMac.gray);
ResizeMapWindow(LoWord(newSize), HiWord(newSize));
PortabilityLayer::Vec2i newSize = TrackResize(mapWindow, evtPoint, 47, 35, &thisMac.gray);
ResizeMapWindow(newSize.m_x, newSize.m_y);
}
break;
@@ -313,115 +313,6 @@ void HandleKeyEvent (const KeyDownStates &keyStates, const GpKeyboardInputEvent
}
}
//-------------------------------------------------------------- HandleUpdateEvent
// Handle an update event.
#if 0
void HandleUpdateEvent (EventRecord *theEvent)
{
if ((WindowPtr)theEvent->message == mainWindow)
{
SetPort((GrafPtr)mainWindow);
UpdateMainWindow();
EndUpdate(mainWindow);
}
else if ((WindowPtr)theEvent->message == mapWindow)
{
SetPort((GrafPtr)mapWindow);
UpdateMapWindow();
EndUpdate(mapWindow);
}
else if ((WindowPtr)theEvent->message == toolsWindow)
{
SetPort((GrafPtr)toolsWindow);
UpdateToolsWindow();
EndUpdate(toolsWindow);
}
else if ((WindowPtr)theEvent->message == linkWindow)
{
SetPort((GrafPtr)linkWindow);
UpdateLinkWindow();
EndUpdate(linkWindow);
}
else if ((WindowPtr)theEvent->message == coordWindow)
{
SetPort((GrafPtr)coordWindow);
UpdateCoordWindow();
EndUpdate(coordWindow);
}
}
//-------------------------------------------------------------- HandleOSEvent
// Handle an OS Event (MultiFinder - user has switched in or out of app).
void HandleOSEvent (EventRecord *theEvent)
{
PLError_t theErr;
short buttonHit;
if (theEvent->message & 0x01000000) // suspend or resume event
{
if (theEvent->message & 0x00000001) // resume event
{
if (WhatsOurDepth() != thisMac.isDepth)
{
buttonHit = BitchAboutColorDepth();
if (buttonHit == 1) // player wants to Quit
{
#ifndef COMPILEDEMO
if (QuerySaveChanges())
quitting = true;
#else
quitting = true;
#endif
}
else
{
SwitchToDepth(thisMac.isDepth, thisMac.wasColorOrGray);
}
}
switchedOut = false;
InitCursor();
if ((isPlayMusicIdle) && (theMode != kEditMode))
{
theErr = StartMusic();
if (theErr != PLErrors::kNone)
{
YellowAlert(kYellowNoMusic, theErr);
failedMusic = true;
}
}
incrementModeTime = TickCount() + kIdleSplashTicks;
#ifndef COMPILEDEMO
// if (theMode == kEditMode)
// SeeIfValidScrapAvailable(true);
#endif
}
else // suspend event
{
switchedOut = true;
InitCursor();
if ((isMusicOn) && (theMode != kEditMode))
StopTheMusic();
}
}
}
//-------------------------------------------------------------- HandleHighLevelEvent
// Handle an AppleEvent (Open Document, Quit Application, etc.).
void HandleHighLevelEvent (EventRecord *theEvent)
{
PLError_t theErr;
theErr = AEProcessAppleEvent(theEvent);
if ((theErr != PLErrors::kNone) && (theErr != errAEEventNotHandled))
YellowAlert(kYellowAppleEventErr, theErr);
}
#endif
//-------------------------------------------------------------- HandleSplashResolutionChange
void HandleSplashResolutionChange(void)
{
@@ -440,6 +331,21 @@ void HandleSplashResolutionChange(void)
//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->SetPosition(window->GetPosition() + PortabilityLayer::Vec2i(leftNudge + rightNudge, topNudge + bottomNudge));
}
void HandleEditorResolutionChange(void)
{
FlushResolutionChange();
@@ -461,6 +367,10 @@ void HandleEditorResolutionChange(void)
if (mapWindow)
PortabilityLayer::WindowManager::GetInstance()->PutWindowBehind(mapWindow, PortabilityLayer::WindowManager::GetInstance()->GetPutInFrontSentinel());
KeepWindowInBounds(mainWindow);
KeepWindowInBounds(toolsWindow);
KeepWindowInBounds(mapWindow);
}
//-------------------------------------------------------------- HandleIdleTask
@@ -475,7 +385,7 @@ void HandleIdleTask (void)
HandleEditorResolutionChange();
}
SetPort(&mainWindow->GetDrawSurface()->m_port);
SetPort(mainWindow->GetDrawSurface());
DoMarquee();
if ((autoRoomEdit) && (newRoomNow))

View File

@@ -13,15 +13,14 @@
namespace PortabilityLayer
{
class ResolveCachingColor;
class ResourceArchive;
class ScanlineMask;
class ResTypeID;
struct RGBAColor;
class RenderedFont;
}
#define kPreferredDepth 8
#define kPreferredPixelFormat (GpPixelFormats::k8BitStandard)
#define kNilPointer 0L
#define kPutInFront (PL_GetPutInFrontWindowPtr())
#define kNormalUpdates TRUE
@@ -48,6 +47,7 @@ namespace PortabilityLayer
#define kErrNeed16Or256Colors 13
#define iAbout 1
#define iAboutAerofoil 3
#define iNewGame 1
#define iTwoPlayer 2
#define iOpenSavedGame 3
@@ -124,6 +124,7 @@ typedef struct
//-------------------------------------------------------------- Prototypes
void DoAbout (void); // --- About.c
void DoAboutFramework (void);
void LoadCursors (void); // --- AnimCursor.c
void DisposCursors (void);
@@ -132,20 +133,19 @@ void DecrementCursor (void);
void SpinCursor (short);
void BackSpinCursor (short);
void ColorText (DrawSurface *surface, const Point &, StringPtr, long); // --- ColorUtils.c
void ColorText (DrawSurface *surface, const Point &, StringPtr, long, PortabilityLayer::RenderedFont *font); // --- ColorUtils.c
void ColorRect (DrawSurface *surface, const Rect &, long);
void ColorOval (DrawSurface *surface, const Rect &, long);
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 ColorOvalMaskPattern (DrawSurface *surface, const Rect &, long, const uint8_t *);
void ColorRegionMaskPattern (DrawSurface *surface, PortabilityLayer::ScanlineMask *scanlineMask, long colorIndex, 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);
void ColorFrameWHRect (DrawSurface *surface, short, short, short, short, long);
void ColorFrameOval (DrawSurface *surface, const Rect &, long);
void LtGrayForeColor (DrawSurface *surface);
void GrayForeColor (DrawSurface *surface);
void DkGrayForeColor (DrawSurface *surface);
void RestoreColorsSlam (DrawSurface *surface);
PortabilityLayer::ResolveCachingColor LtGrayForeColor ();
PortabilityLayer::ResolveCachingColor GrayForeColor ();
PortabilityLayer::ResolveCachingColor DkGrayForeColor ();
void MonitorWait (void); // --- DebugUtils.c
void DisplayRect (Rect *);
@@ -164,15 +164,12 @@ void DumpToResEditFile (Ptr, long);
void HandleEvent (void); // --- Event.c
void IgnoreThisClick (void);
short WhatsOurDepth (void); // --- Environs.c
void SwitchToDepth (short, Boolean);
void SwitchToDepth (short, Boolean); // --- Environs.c
void CheckOurEnvirons (void);
void InstallResolutionHandler (void);
//void ReflectSecondMonitorEnvirons (Boolean, Boolean, Boolean);
void HandleDepthSwitching (void);
void RestoreColorDepth (void);
void CheckMemorySize (void);
void SetAppMemorySize (long);
Boolean CheckFileError (short, const PLPasStr &); // --- File Error.c
@@ -188,7 +185,7 @@ void PasStringConcat (StringPtr, const PLPasStr &);
void GetLineOfText (StringPtr, short, StringPtr);
void WrapText (StringPtr, short);
void GetFirstWordOfString (StringPtr, StringPtr);
void CollapseStringToWidth (DrawSurface *, StringPtr, short);
void CollapseStringToWidth (PortabilityLayer::RenderedFont *, StringPtr, short);
void GetChooserName (StringPtr);
StringPtr GetLocalizedString (short, StringPtr);
@@ -222,7 +219,7 @@ void GetLocalWindowRect (WindowPtr, Rect *);
//void FlagWindowFloating (WindowPtr);
//Boolean IsWindowFloating (WindowPtr);
void OpenMessageWindow (const PLPasStr&);
void SetMessageWindowMessage (StringPtr);
void SetMessageWindowMessage (StringPtr msg, const PortabilityLayer::RGBAColor &color);
void CloseMessageWindow (void);
void CloseThisWindow (WindowPtr *);

View File

@@ -7,7 +7,6 @@
#include "PLDialogs.h"
#include "PLNumberFormatting.h"
#include "PLTextUtils.h"
#include "PLPasStr.h"
#include "DialogManager.h"
#include "Externs.h"

View File

@@ -5,7 +5,6 @@
//============================================================================
#include "PLToolUtils.h"
#include "PLPasStr.h"
#include "PLEventQueue.h"
#include "PLKeyEncoding.h"
@@ -17,7 +16,10 @@
#include "InputManager.h"
#include "MainWindow.h"
#include "Objects.h"
#include "PLStandardColors.h"
#include "RectUtils.h"
#include "RenderedFont.h"
#include "ResolveCachingColor.h"
#include "Utilities.h"
@@ -68,7 +70,7 @@ void DoGameOver (void)
DrawSurface *surface = mainWindow->GetDrawSurface();
playing = false;
SetUpFinalScreen();
SetPort((GrafPtr)mainWindow);
SetPort(mainWindow->GetDrawSurface());
ColorRect(surface, mainWindowRect, 244);
DoGameOverStarAnimation();
if (!TestHighScore())
@@ -87,6 +89,9 @@ void SetUpFinalScreen (void)
short count, offset, i, textDown;
char wasState;
DrawSurface *surface = workSrcMap;
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
ColorRect(surface, workSrcRect, 244);
QSetRect(&tempRect, 0, 0, 640, 460);
@@ -103,18 +108,16 @@ void SetUpFinalScreen (void)
{
GetLineOfText(tempStr, count, subStr);
surface->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
offset = ((thisMac.constrainedScreen.right - thisMac.constrainedScreen.left) -
surface->MeasureString(subStr)) / 2;
appFont->MeasurePStr(subStr)) / 2;
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
const Point textShadowPos = Point::Create(offset + 1, textDown + 33 + (count * 20));
surface->DrawString(textShadowPos, subStr, true);
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 255, 255));
surface->DrawString(textShadowPos, subStr, blackColor, appFont);
const Point textPos = Point::Create(offset, textDown + 32 + (count * 20));
surface->DrawString(textPos, subStr, true);
surface->DrawString(textPos, subStr, whiteColor, appFont);
count++;
}
while (subStr[0] > 0);
@@ -159,7 +162,7 @@ void DoGameOverStarAnimation (void)
nextLoop = TickCount() + 2;
count = 0;
pass = 0;
FlushEvents(everyEvent, 0);
FlushEvents();
if (workSrcRect.bottom - angelDest.bottom > kMaxFramesAlive * starFallSpeed)
starFallSpeed = (workSrcRect.bottom - angelDest.bottom + kMaxFramesAlive - 1) / kMaxFramesAlive;
@@ -275,14 +278,14 @@ void InitDiedGameOver (void)
PLError_t theErr;
QSetRect(&pageSrcRect, 0, 0, 25, 32 * 8);
theErr = CreateOffScreenGWorld(&gameOverSrcMap, &pageSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&gameOverSrcMap, &pageSrcRect);
LoadGraphic(gameOverSrcMap, kLettersPictID);
QSetRect(&pageSrcRect, 0, 0, 32, 32 * kPageFrames);
theErr = CreateOffScreenGWorld(&pageSrcMap, &pageSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&pageSrcMap, &pageSrcRect);
LoadGraphic(pageSrcMap, kPagesPictID);
theErr = CreateOffScreenGWorld(&pageMaskMap, &pageSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&pageMaskMap, &pageSrcRect, GpPixelFormats::kBW1);
LoadGraphic(pageMaskMap, kPagesMaskID);
for (i = 0; i < kPageFrames; i++) // initialize src page rects
@@ -461,7 +464,7 @@ void DoDiedGameOver (void)
InitDiedGameOver();
CopyRectMainToWork(&workSrcRect);
CopyRectMainToBack(&workSrcRect);
FlushEvents(everyEvent, 0);
FlushEvents();
nextLoop = TickCount() + 2;
while (pagesStuck < 8)

View File

@@ -41,8 +41,6 @@
#define kYellowCantOrderLinks 24
#define kSwitchIfNeeded 0
#define kSwitchTo256Colors 1
#define kSwitchTo16Grays 2
#define kProdGameScoreMode -4
#define kKickGameScoreMode -3
@@ -621,3 +619,10 @@ static const Boolean kFaceLeft = FALSE; // Conflicts with GP input driver
#define kDemoLength 6702
#define kGamepadDeadzone 4096 // Out of 32768
#define kDefaultComponent 0
#define kCandleFlameComponent 1
#define kTikiFlamesComponent 1
#define kBBQCoalsComponent 1
#define kPendulumComponent 1
#define kStarComponent 1

View File

@@ -23,10 +23,10 @@ void CloseCoordWindow (void);
void ToggleCoordinateWindow (void);
void NilSavedMaps (void); // --- DynamicMaps.c
SInt16 BackUpToSavedMap (Rect *, SInt16, SInt16);
SInt16 ReBackUpSavedMap (Rect *, SInt16, SInt16);
SInt16 BackUpToSavedMap (Rect *theRect, SInt16 where, SInt16 who, SInt16 component);
SInt16 ReBackUpSavedMap (Rect *theRect, SInt16 where, SInt16 who, SInt16 component);
SInt16 RemoveFromSavedMap(SInt16);
void RestoreFromSavedMap (SInt16, SInt16, Boolean);
void RestoreFromSavedMap (SInt16 where, SInt16 who, SInt16 component, Boolean doSparkle);
void AddSparkle (Rect *);
void AddFlyingPoint (Rect *, SInt16, SInt16, SInt16);
Boolean ReBackUpFlames (SInt16, SInt16, SInt16, SInt16);
@@ -156,10 +156,9 @@ void RedrawSplashScreen (void); // --- MainWindow.c
void UpdateMainWindow (void);
void OpenMainWindow (void);
void CloseMainWindow (void);
void ZoomBetweenWindows (void);
void UpdateEditWindowTitle (void);
void HandleMainClick (Point, Boolean);
//void WashColorIn (void);
void WashColorIn (void);
void CenterMapOnRoom (SInt16, SInt16); // --- Map.c
Boolean ThisRoomVisibleOnMap (void);

View File

@@ -241,6 +241,7 @@ typedef struct
DrawSurface *map;
short where;
short who;
short component;
} savedType, *savedPtr;
typedef struct

View File

@@ -69,6 +69,7 @@
<Import Project="GpApp.props" />
<Import Project="..\Common.props" />
<Import Project="..\GpCommon.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" />

View File

@@ -5,6 +5,7 @@
#include "HostFileSystem.h"
#include "HostFontHandler.h"
#include "HostDisplayDriver.h"
#include "HostLogDriver.h"
#include "HostSystemServices.h"
#include "HostVOSEventQueue.h"
#include "MenuManager.h"
@@ -22,10 +23,11 @@ public:
void PL_HostDisplayDriver_SetInstance(IGpDisplayDriver *instance) override;
void PL_HostSystemServices_SetInstance(PortabilityLayer::HostSystemServices *instance) override;
void PL_HostAudioDriver_SetInstance(IGpAudioDriver *instance) override;
void PL_HostLogDriver_SetInstance(IGpLogDriver *instance) override;
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;
void PL_AdjustRequestedResolution(unsigned int &width, unsigned int &height) override;
bool PL_AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY) override;
};
@@ -55,6 +57,11 @@ void GpAppInterfaceImpl::PL_HostDisplayDriver_SetInstance(IGpDisplayDriver *inst
PortabilityLayer::HostDisplayDriver::SetInstance(instance);
}
void GpAppInterfaceImpl::PL_HostLogDriver_SetInstance(IGpLogDriver *instance)
{
PortabilityLayer::HostLogDriver::SetInstance(instance);
}
void GpAppInterfaceImpl::PL_HostSystemServices_SetInstance(PortabilityLayer::HostSystemServices *instance)
{
PortabilityLayer::HostSystemServices::SetInstance(instance);
@@ -80,13 +87,16 @@ void GpAppInterfaceImpl::PL_InstallHostSuspendHook(PortabilityLayer::HostSuspend
PortabilityLayer::InstallHostSuspendHook(hook, context);
}
void GpAppInterfaceImpl::PL_AdjustRequestedResolution(unsigned int &width, unsigned int &height)
bool GpAppInterfaceImpl::PL_AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY)
{
uint32_t w32 = width;
uint32_t h32 = height;
PortabilityLayer::DisplayDeviceManager::GetInstance()->GetResolutionChangeHandler()->AdjustRequestedResolution(w32, h32);
width = w32;
height = h32;
PortabilityLayer::DisplayDeviceManager::IResolutionChangeHandler *handler = PortabilityLayer::DisplayDeviceManager::GetInstance()->GetResolutionChangeHandler();
if (!handler)
return false;
handler->AdjustRequestedResolution(physicalWidth, physicalHeight, virtualWidth, virtualheight, pixelScaleX, pixelScaleY);
return true;
}

View File

@@ -10,7 +10,9 @@
#include "Environ.h"
#include "MainWindow.h"
#include "Objects.h"
#include "PLStandardColors.h"
#include "RectUtils.h"
#include "ResolveCachingColor.h"
#include "Room.h"
@@ -102,9 +104,11 @@ void HandleGrease (void)
}
{
backSrcMap->FillRect(src);
workSrcMap->FillRect(src);
PortabilityLayer::ResolveCachingColor blackColorBack = StdColors::Black();
backSrcMap->FillRect(src, blackColorBack);
PortabilityLayer::ResolveCachingColor blackColorWork = StdColors::Black();
workSrcMap->FillRect(src, blackColorWork);
AddRectToWorkRects(&src);
}
@@ -213,7 +217,7 @@ short AddGrease (short where, short who, short h, short v,
QOffsetRect(&src, h, v);
QSetRect(&bounds, 0, 0, 32, 27 * 4);
savedNum = BackUpToSavedMap(&bounds, where, who);
savedNum = BackUpToSavedMap(&bounds, where, who, kDefaultComponent);
if (savedNum != -1)
{
BackupGrease (&src, savedNum, isRight);
@@ -282,13 +286,16 @@ void RedrawAllGrease (void)
if ((grease[i].where == thisRoomNumber) &&
((src.bottom - src.top) == 2))
{
PortabilityLayer::ResolveCachingColor blackColorBack = StdColors::Black();
PortabilityLayer::ResolveCachingColor blackColorWork = StdColors::Black();
QOffsetRect(&src, playOriginH, playOriginV);
wasCPort = GetGraphicsPort();
backSrcMap->FillRect(src);
backSrcMap->FillRect(src, blackColorBack);
workSrcMap->FillRect(src);
workSrcMap->FillRect(src, blackColorWork);
AddRectToWorkRects(&src);
SetGraphicsPort(wasCPort);
@@ -332,5 +339,5 @@ void RemapGreaseSavedMap(SInt16 removedItem, SInt16 substituteItem)
grease[i].mapNum = removedItem;
return;
}
}
}
}

View File

@@ -9,7 +9,6 @@
#include "PLHacks.h"
#include "PLKeyEncoding.h"
#include "PLNumberFormatting.h"
#include "PLScript.h"
#include "PLSound.h"
#include "PLStringCompare.h"
#include "DialogUtils.h"
@@ -22,10 +21,13 @@
#include "House.h"
#include "IOStream.h"
#include "MainWindow.h"
#include "RectUtils.h"
#include "PLStandardColors.h"
#include "PLTimeTaggedVOSEvent.h"
#include "RectUtils.h"
#include "RenderedFont.h"
#include "ResolveCachingColor.h"
#include "Utilities.h"
#include "WindowManager.h"
namespace PortabilityLayer
{
@@ -68,11 +70,11 @@ extern Boolean quickerTransitions, resumedSavedGame;
void DoHighScores (void)
{
Rect tempRect;
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
SpinCursor(3);
SetPort(&workSrcMap->m_port);
workSrcMap->SetForeColor(StdColors::Black());
workSrcMap->FillRect(workSrcRect);
SetPort(workSrcMap);
workSrcMap->FillRect(workSrcRect, blackColor);
QSetRect(&tempRect, 0, 0, 640, 480);
QOffsetRect(&tempRect, splashOriginH, splashOriginV);
LoadScaledGraphic(workSrcMap, kStarPictID, &tempRect);
@@ -119,20 +121,20 @@ void DrawHighScores (DrawSurface *surface)
Str255 tempStr;
short scoreLeft, bannerWidth, i, dropIt;
char wasState;
PortabilityLayer::RGBAColor blackColor = PortabilityLayer::RGBAColor::Create(0, 0, 0, 255);
PortabilityLayer::RGBAColor yellowColor = PortabilityLayer::RGBAColor::Create(255, 255, 0, 255);
PortabilityLayer::RGBAColor cyanColor = PortabilityLayer::RGBAColor::Create(0, 255, 255, 255);
PortabilityLayer::RGBAColor whiteColor = PortabilityLayer::RGBAColor::Create(255, 255, 255, 255);
PortabilityLayer::RGBAColor blueColor = PortabilityLayer::RGBAColor::Create(0, 0, 255, 255);
PortabilityLayer::ResolveCachingColor blackColor = PortabilityLayer::RGBAColor::Create(0, 0, 0, 255);
PortabilityLayer::ResolveCachingColor yellowColor = PortabilityLayer::RGBAColor::Create(255, 255, 0, 255);
PortabilityLayer::ResolveCachingColor cyanColor = PortabilityLayer::RGBAColor::Create(0, 255, 255, 255);
PortabilityLayer::ResolveCachingColor whiteColor = PortabilityLayer::RGBAColor::Create(255, 255, 255, 255);
PortabilityLayer::ResolveCachingColor blueColor = PortabilityLayer::RGBAColor::Create(0, 0, 255, 255);
scoreLeft = ((thisMac.constrainedScreen.right - thisMac.constrainedScreen.left) - kScoreWide) / 2;
dropIt = 129 + splashOriginV;
QSetRect(&tempRect, 0, 0, 332, 30);
theErr = CreateOffScreenGWorld(&tempMap, &tempRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &tempRect);
LoadGraphic(tempMap, kHighScoresPictID);
theErr = CreateOffScreenGWorld(&tempMask, &tempRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &tempRect, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kHighScoresMaskID);
tempRect2 = tempRect;
@@ -146,43 +148,37 @@ void DrawHighScores (DrawSurface *surface)
DisposeGWorld(tempMap);
DisposeGWorld(tempMask);
surface->SetApplicationFont(14, PortabilityLayer::FontFamilyFlag_Bold);
PortabilityLayer::RenderedFont *appFont14 = GetApplicationFont(14, PortabilityLayer::FontFamilyFlag_Bold, true);
PasStringCopy(PSTR("<EFBFBD> "), tempStr);
PasStringConcat(tempStr, thisHouseName);
PasStringConcat(tempStr, PSTR(" <20>"));
const Point scoreShadowPoint = Point::Create(scoreLeft + ((kScoreWide - surface->MeasureString(tempStr)) / 2) - 1, dropIt - 66);
surface->SetForeColor(blackColor);
surface->DrawString(scoreShadowPoint, tempStr, true);
const Point scoreShadowPoint = Point::Create(scoreLeft + ((kScoreWide - appFont14->MeasurePStr(tempStr)) / 2) - 1, dropIt - 66);
surface->DrawString(scoreShadowPoint, tempStr, blackColor, appFont14);
const Point scoreTextPoint = Point::Create(scoreLeft + ((kScoreWide - surface->MeasureString(tempStr)) / 2), dropIt - 65);
surface->SetForeColor(cyanColor);
surface->DrawString(scoreTextPoint, tempStr, true);
const Point scoreTextPoint = Point::Create(scoreLeft + ((kScoreWide - appFont14->MeasurePStr(tempStr)) / 2), dropIt - 65);
surface->DrawString(scoreTextPoint, tempStr, cyanColor, appFont14);
surface->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
PortabilityLayer::RenderedFont *appFont12 = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
thisHousePtr = *thisHouse;
// message for score #1
PasStringCopy(thisHousePtr->highScores.banner, tempStr);
bannerWidth = surface->MeasureString(tempStr);
surface->SetForeColor(blackColor);
bannerWidth = appFont12->MeasurePStr(tempStr);
const Point topScoreShadowPoint = Point::Create(scoreLeft + (kScoreWide - bannerWidth) / 2, dropIt - kKimsLifted);
surface->DrawString(topScoreShadowPoint, tempStr, true);
surface->DrawString(topScoreShadowPoint, tempStr, blackColor, appFont12);
surface->SetForeColor(yellowColor);
const Point topScoreTextPoint = Point::Create(scoreLeft + (kScoreWide - bannerWidth) / 2, dropIt - kKimsLifted - 1);
surface->DrawString(topScoreTextPoint, tempStr, true);
surface->DrawString(topScoreTextPoint, tempStr, yellowColor, appFont12);
QSetRect(&tempRect, 0, 0, bannerWidth + 8, kScoreSpacing);
QOffsetRect(&tempRect, scoreLeft - 3 + (kScoreWide - bannerWidth) / 2,
dropIt + 5 - kScoreSpacing - kKimsLifted);
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
surface->FrameRect(tempRect);
surface->FrameRect(tempRect, blackColor);
QOffsetRect(&tempRect, -1, -1);
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 0, 255));
surface->FrameRect(tempRect);
surface->FrameRect(tempRect, yellowColor);
for (i = 0; i < kMaxScores; i++)
{
@@ -192,101 +188,90 @@ void DrawHighScores (DrawSurface *surface)
SpinCursor(1);
NumToString((long)i + 1L, tempStr); // draw placing number
surface->SetForeColor(blackColor);
if (i == 0)
strPos = Point::Create(scoreLeft + 1, dropIt - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 1, dropIt + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr, true);
if (i == lastHighScore)
surface->SetForeColor(whiteColor);
else
surface->SetForeColor(cyanColor);
surface->DrawString(strPos, tempStr, blackColor, appFont12);
PortabilityLayer::ResolveCachingColor *scoreColor = (i == lastHighScore) ? &whiteColor : &cyanColor;
if (i == 0)
strPos = Point::Create(scoreLeft + 0, dropIt - 1 - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 0, dropIt - 1 + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr, true);
surface->DrawString(strPos, tempStr, *scoreColor, appFont12);
// draw high score name
PasStringCopy(thisHousePtr->highScores.names[i], tempStr);
surface->SetForeColor(blackColor);
if (i == 0)
strPos = Point::Create(scoreLeft + 31, dropIt - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 31, dropIt + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr, true);
if (i == lastHighScore)
surface->SetForeColor(whiteColor);
else
surface->SetForeColor(yellowColor);
surface->DrawString(strPos, tempStr, blackColor, appFont12);
PortabilityLayer::ResolveCachingColor *nameColor = (i == lastHighScore) ? &whiteColor : &yellowColor;
if (i == 0)
strPos = Point::Create(scoreLeft + 30, dropIt - 1 - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 30, dropIt - 1 + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr, true);
surface->DrawString(strPos, tempStr, *nameColor, appFont12);
// draw level number
NumToString(thisHousePtr->highScores.levels[i], tempStr);
surface->SetForeColor(blackColor);
if (i == 0)
strPos = Point::Create(scoreLeft + 161, dropIt - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 161, dropIt + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr, true);
if (i == lastHighScore)
surface->SetForeColor(whiteColor);
else
surface->SetForeColor(yellowColor);
surface->DrawString(strPos, tempStr, blackColor, appFont12);
PortabilityLayer::ResolveCachingColor *levelColor = (i == lastHighScore) ? &whiteColor : &yellowColor;
if (i == 0)
strPos = Point::Create(scoreLeft + 160, dropIt - 1 - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 160, dropIt - 1 + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr, true);
surface->DrawString(strPos, tempStr, *levelColor, appFont12);
// draw word "rooms"
if (thisHousePtr->highScores.levels[i] == 1)
GetLocalizedString(6, tempStr);
else
GetLocalizedString(7, tempStr);
surface->SetForeColor(blackColor);
if (i == 0)
strPos = Point::Create(scoreLeft + 193, dropIt - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 193, dropIt + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr, true);
surface->SetForeColor(cyanColor);
surface->DrawString(strPos, tempStr, blackColor, appFont12);
if (i == 0)
strPos = Point::Create(scoreLeft + 192, dropIt - 1 - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 192, dropIt - 1 + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr, true);
surface->DrawString(strPos, tempStr, cyanColor, appFont12);
// draw high score points
NumToString(thisHousePtr->highScores.scores[i], tempStr);
surface->SetForeColor(blackColor);
if (i == 0)
strPos = Point::Create(scoreLeft + 291, dropIt - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 291, dropIt + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr, true);
if (i == lastHighScore)
surface->SetForeColor(whiteColor);
else
surface->SetForeColor(yellowColor);
surface->DrawString(strPos, tempStr, blackColor, appFont12);
PortabilityLayer::ResolveCachingColor *pointsColor = (i == lastHighScore) ? &whiteColor : &yellowColor;
if (i == 0)
strPos = Point::Create(scoreLeft + 290, dropIt - 1 - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 290, dropIt - 1 + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr, true);
surface->DrawString(strPos, tempStr, *pointsColor, appFont12);
}
}
surface->SetForeColor(blueColor);
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold);
PortabilityLayer::RenderedFont *appFont9 = GetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold, true);
const Point textPos = Point::Create(scoreLeft + 80, dropIt - 1 + (10 * kScoreSpacing));
GetLocalizedString(8, tempStr);
surface->DrawString(textPos, tempStr, true);
surface->SetForeColor(blackColor);
surface->DrawString(textPos, tempStr, blueColor, appFont9);
}
//-------------------------------------------------------------- SortHighScores
@@ -411,7 +396,7 @@ Boolean TestHighScore (void)
else if (scoreTimestamp > 0xffffffff)
scoreTimestamp = 0xffffffff;
FlushEvents(everyEvent, 0);
FlushEvents();
GetHighScoreName(placing + 1);
PasStringCopy(highName, thisHousePtr->highScores.names[kMaxScores - 1]);
if (placing == 0)
@@ -506,6 +491,8 @@ void GetHighScoreName (short place)
Str255 scoreStr, placeStr, tempStr;
short item;
Boolean leaving;
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
InitCursor();
NumToString(theScore, scoreStr);
@@ -515,13 +502,19 @@ void GetHighScoreName (short place)
PlayPrioritySound(kEnergizeSound, kEnergizePriority);
BringUpDialog(&theDial, kHighNameDialogID, &substitutions);
FlushEvents(everyEvent, 0);
FlushEvents();
SetDialogString(theDial, kHighNameItem, highName);
SelectDialogItemText(theDial, kHighNameItem, 0, 1024);
leaving = false;
UpdateNameDialog(theDial);
Window *exclStack = theDial->GetWindow();
wm->SwapExclusiveWindow(exclStack); // Push exclusive window for zooms
if (doZooms)
wm->FlickerWindowIn(theDial->GetWindow(), 64);
while (!leaving)
{
item = theDial->ExecuteModal(NameFilter);
@@ -533,6 +526,11 @@ void GetHighScoreName (short place)
leaving = true;
}
}
if (doZooms)
wm->FlickerWindowOut(theDial->GetWindow(), 64);
wm->SwapExclusiveWindow(exclStack); // Pop exclusive window
theDial->Destroy();
}
@@ -610,6 +608,8 @@ void GetHighScoreBanner (void)
Str255 tempStr;
short item;
Boolean leaving;
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
PlayPrioritySound(kEnergizeSound, kEnergizePriority);
BringUpDialog(&theDial, kHighBannerDialogID, nullptr);
@@ -618,7 +618,13 @@ void GetHighScoreBanner (void)
leaving = false;
UpdateBannerDialog(theDial);
Window *exclStack = theDial->GetWindow();
wm->SwapExclusiveWindow(exclStack); // Push exclusive window for zooms
if (doZooms)
wm->FlickerWindowIn(theDial->GetWindow(), 64);
while (!leaving)
{
item = theDial->ExecuteModal(BannerFilter);
@@ -630,6 +636,11 @@ void GetHighScoreBanner (void)
leaving = true;
}
}
if (doZooms)
wm->FlickerWindowOut(theDial->GetWindow(), 64);
wm->SwapExclusiveWindow(exclStack); // Pop exclusive window
theDial->Destroy();
}
@@ -703,6 +714,8 @@ Boolean WriteScoresToDisk (void)
scoresStream->Close();
gameDirty = false;
return (true);
}

View File

@@ -4,9 +4,7 @@
//----------------------------------------------------------------------------
//============================================================================
#include "PLAppleEvents.h"
#include "PLKeyEncoding.h"
#include "PLNavigation.h"
#include "PLNumberFormatting.h"
#include "PLPasStr.h"
#include "PLResources.h"
@@ -17,6 +15,7 @@
#include "FileManager.h"
#include "HostFileSystem.h"
#include "House.h"
#include "PLStandardColors.h"
#include "PLTimeTaggedVOSEvent.h"
#include "RectUtils.h"
#include "ResourceManager.h"
@@ -55,9 +54,7 @@ extern Boolean twoPlayerGame, wardBitSet, phoneBitSet;
#ifndef COMPILEDEMO
Boolean CreateNewHouse (void)
{
AEKeyword theKeyword;
DescType actualType;
Size actualSize;
size_t actualSize;
VFileSpec tempSpec;
VFileSpec theSpec;
PLError_t theErr;
@@ -730,7 +727,7 @@ void ConvertHouseVer1To2 (void)
NumToString((long)i, roomStr);
GetLocalizedString(14, message);
PasStringConcat(message, roomStr);
SetMessageWindowMessage(message);
SetMessageWindowMessage(message, StdColors::Black());
SpinCursor(1);
ForceThisRoom(i);

View File

@@ -5,7 +5,7 @@
//============================================================================
#include "PLMacTypes.h"
#include "PLCore.h"
extern Str32 thisHouseName;

View File

@@ -9,7 +9,6 @@
#include "PLMovies.h"
#include "PLResources.h"
#include "PLStringCompare.h"
#include "PLTextUtils.h"
#include "PLPasStr.h"
#include "BitmapImage.h"
#include "DialogManager.h"
@@ -614,20 +613,6 @@ Boolean ReadHouse (void)
YellowAlert(kYellowUnaccounted, 2);
return (false);
}
if (gameDirty || fileDirty)
{
if (houseIsReadOnly)
{
if (!WriteScoresToDisk())
{
YellowAlert(kYellowFailedWrite, 0);
return(false);
}
}
else if (!WriteHouse(false))
return(false);
}
byteCount = houseStream->Size();

View File

@@ -173,7 +173,7 @@ int16_t HouseFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
if (mouseEvt.m_eventType == GpMouseEventTypes::kMove)
{
mouseIs = Point::Create(mouseEvt.m_x, mouseEvt.m_y);
mouseIs -= dial->GetWindow()->TopLeftCoord();
mouseIs -= dial->GetWindow()->GetTopLeftCoord();
if ((houseEditText1.Contains(mouseIs)) ||
(houseEditText2.Contains(mouseIs)))
{
@@ -231,7 +231,7 @@ void DoHouseInfo (void)
houseInfoDialog = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kHouseInfoDialogID, kPutInFront, &substitutions);
if (houseInfoDialog == nil)
RedAlert(kErrDialogDidntLoad);
SetPort(&houseInfoDialog->GetWindow()->GetDrawSurface()->m_port);
SetPort(houseInfoDialog->GetWindow()->GetDrawSurface());
ShowWindow(houseInfoDialog->GetWindow());
static_cast<PortabilityLayer::EditboxWidget*>(houseInfoDialog->GetItems()[kBannerTextItem - 1].GetWidget())->SetMultiLine(true);

View File

@@ -8,8 +8,10 @@
#include "PLNumberFormatting.h"
#include "PLStringCompare.h"
#include "PLStandardColors.h"
#include "Externs.h"
#include "ObjectEdit.h"
#include "PLStandardColors.h"
#include "RectUtils.h"
@@ -739,9 +741,8 @@ void LopOffExtraRooms (void)
newSize = sizeof(houseType) + (sizeof(roomType) * (long)r);
if (SetHandleSize(thisHouse.StaticCast<void>(), newSize) != PLErrors::kNone) // resize house handle (shrink)
{
ForeColor(redColor);
GetLocalizedString(16, message);
SetMessageWindowMessage(message);
SetMessageWindowMessage(message, StdColors::Red());
}
(*thisHouse)->nRooms -= count;
numberRooms = (*thisHouse)->nRooms;
@@ -772,21 +773,17 @@ void ValidateRoomNumbers (void)
((*thisHouse)->rooms[i].floor < -7))
{
(*thisHouse)->rooms[i].suite = kRoomIsEmpty;
ForeColor(redColor);
GetLocalizedString(17, message);
SetMessageWindowMessage(message);
SetMessageWindowMessage(message, StdColors::Red());
houseErrors++;
ForeColor(blackColor);
}
if (((*thisHouse)->rooms[i].suite >= 128) ||
((*thisHouse)->rooms[i].suite < 0))
{
(*thisHouse)->rooms[i].suite = kRoomIsEmpty;
ForeColor(redColor);
GetLocalizedString(18, message);
SetMessageWindowMessage(message);
SetMessageWindowMessage(message, StdColors::Red());
houseErrors++;
ForeColor(blackColor);
}
}
}
@@ -885,11 +882,9 @@ void KeepAllObjectsLegal (void)
{
if (!KeepObjectLegal())
{
ForeColor(redColor);
GetLocalizedString(19, message);
SetMessageWindowMessage(message);
SetMessageWindowMessage(message, StdColors::Red());
houseErrors++;
ForeColor(blackColor);
DelayTicks(60);
}
}
@@ -923,10 +918,8 @@ void CheckForStaircasePairs (void)
neighbor = GetNeighborRoomNumber(kNorthRoom);
if (neighbor == kRoomIsEmpty)
{
ForeColor(redColor);
GetLocalizedString(20, message);
SetMessageWindowMessage(message);
ForeColor(blackColor);
SetMessageWindowMessage(message, StdColors::Red());
DelayTicks(60);
}
else
@@ -940,10 +933,8 @@ void CheckForStaircasePairs (void)
}
if (!hasStairs)
{
ForeColor(redColor);
GetLocalizedString(21, message);
SetMessageWindowMessage(message);
ForeColor(blackColor);
SetMessageWindowMessage(message, StdColors::Red());
DelayTicks(60);
}
}
@@ -954,10 +945,8 @@ void CheckForStaircasePairs (void)
neighbor = GetNeighborRoomNumber(kSouthRoom);
if (neighbor == kRoomIsEmpty)
{
ForeColor(redColor);
GetLocalizedString(22, message);
SetMessageWindowMessage(message);
ForeColor(blackColor);
SetMessageWindowMessage(message, StdColors::Red());
DelayTicks(60);
}
else
@@ -971,10 +960,8 @@ void CheckForStaircasePairs (void)
}
if (!hasStairs)
{
ForeColor(redColor);
GetLocalizedString(23, message);
SetMessageWindowMessage(message);
ForeColor(blackColor);
SetMessageWindowMessage(message, StdColors::Red());
DelayTicks(60);
}
}
@@ -1004,19 +991,19 @@ void CheckHouseForProblems (void)
SpinCursor(3);
GetLocalizedString(25, message);
SetMessageWindowMessage(message);
SetMessageWindowMessage(message, StdColors::Black());
WrapBannerAndTrailer();
if (isHouseChecks)
{
SpinCursor(3);
GetLocalizedString(26, message);
SetMessageWindowMessage(message);
SetMessageWindowMessage(message, StdColors::Black());
ValidateNumberOfRooms();
if (houseErrors != 0)
{
GetLocalizedString(27, message);
SetMessageWindowMessage(message);
SetMessageWindowMessage(message, StdColors::Black());
DelayTicks(60);
houseErrors = 0;
}
@@ -1032,9 +1019,7 @@ void CheckHouseForProblems (void)
NumToString((long)houseErrors, message);
GetLocalizedString(28, message2);
PasStringConcat(message, message2);
ForeColor(redColor);
SetMessageWindowMessage(message);
ForeColor(blackColor);
SetMessageWindowMessage(message, StdColors::Red());
DelayTicks(45);
}
}
@@ -1053,9 +1038,7 @@ void CheckHouseForProblems (void)
NumToString((long)houseErrors, message);
GetLocalizedString(29, message2);
PasStringConcat(message, message2);
ForeColor(redColor);
SetMessageWindowMessage(message);
ForeColor(blackColor);
SetMessageWindowMessage(message, StdColors::Red());
DelayTicks(60);
}
}
@@ -1070,9 +1053,7 @@ void CheckHouseForProblems (void)
NumToString((long)houseErrors, message);
GetLocalizedString(30, message2);
PasStringConcat(message, message2);
ForeColor(blueColor);
SetMessageWindowMessage(message);
ForeColor(blackColor);
SetMessageWindowMessage(message, StdColors::Blue());
DelayTicks(45);
}
}
@@ -1087,9 +1068,7 @@ void CheckHouseForProblems (void)
NumToString((long)houseErrors, message);
GetLocalizedString(31, message2);
PasStringConcat(message, message2);
ForeColor(blueColor);
SetMessageWindowMessage(message);
ForeColor(blackColor);
SetMessageWindowMessage(message, StdColors::Blue());
DelayTicks(45);
}
}
@@ -1104,9 +1083,7 @@ void CheckHouseForProblems (void)
NumToString((long)houseErrors, message);
GetLocalizedString(32, message2);
PasStringConcat(message, message2);
ForeColor(redColor);
SetMessageWindowMessage(message);
ForeColor(blackColor);
SetMessageWindowMessage(message, StdColors::Red());
DelayTicks(60);
}
}
@@ -1116,16 +1093,14 @@ void CheckHouseForProblems (void)
SpinCursor(3);
houseErrors = 0;
GetLocalizedString(33, message);
SetMessageWindowMessage(message);
SetMessageWindowMessage(message, StdColors::Black());
KeepAllObjectsLegal();
if (houseErrors != 0)
{
NumToString((long)houseErrors, message);
GetLocalizedString(34, message2);
PasStringConcat(message, message2);
ForeColor(redColor);
SetMessageWindowMessage(message);
ForeColor(blackColor);
SetMessageWindowMessage(message, StdColors::Red());
DelayTicks(60);
}
}
@@ -1142,10 +1117,8 @@ void CheckHouseForProblems (void)
SpinCursor(3);
if (CountStarsInHouse() < 1)
{
ForeColor(redColor);
GetLocalizedString(35, message);
SetMessageWindowMessage(message);
ForeColor(blackColor);
SetMessageWindowMessage(message, StdColors::Red());
DelayTicks(60);
}
}

View File

@@ -5,7 +5,6 @@
//============================================================================
#include "PLToolUtils.h"
#include "PLDialogs.h"
#include "PLKeyEncoding.h"
#include "DialogManager.h"
@@ -89,9 +88,9 @@ void DoPause (void)
QSetRect(&bounds, 0, 0, 214, 54);
CenterRectInRect(&bounds, &houseRect);
if (isEscPauseKey)
LoadScaledGraphic(surface, kEscPausePictID, &bounds);
LoadScaledGraphicCustom(surface, kEscPausePictID, &bounds);
else
LoadScaledGraphic(surface, kTabPausePictID, &bounds);
LoadScaledGraphicCustom(surface, kTabPausePictID, &bounds);
const KeyDownStates *theKeys = nullptr;
@@ -119,7 +118,7 @@ void DoPause (void)
}
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
&bounds, &bounds, srcCopy);
do
@@ -468,7 +467,7 @@ Boolean QuerySaveGame (void)
short hitWhat;
InitCursor();
FlushEvents(everyEvent, 0);
FlushEvents();
// CenterAlert(kSaveGameAlert);
hitWhat = PortabilityLayer::DialogManager::GetInstance()->DisplayAlert(kSaveGameAlert, nullptr);
if (hitWhat == kYesSaveGameButton)

View File

@@ -769,7 +769,7 @@ void HandleRewards (gliderPtr thisGlider, hotPtr who)
{
PlayPrioritySound(kBeepsSound, kBeepsPriority);
RestoreFromSavedMap(thisRoomNumber,
masterObjects[whoLinked].objectNum, false);
masterObjects[whoLinked].objectNum, kDefaultComponent, false);
AddFlyingPoint(&bounds, 100, thisGlider->hVel / 2, thisGlider->vVel / 2);
thisGlider->hVel /= 4;
thisGlider->vVel /= 4;
@@ -785,7 +785,7 @@ void HandleRewards (gliderPtr thisGlider, hotPtr who)
{
PlayPrioritySound(kBuzzerSound, kBuzzerPriority);
RestoreFromSavedMap(thisRoomNumber,
masterObjects[whoLinked].objectNum, false);
masterObjects[whoLinked].objectNum, kDefaultComponent, false);
AddFlyingPoint(&bounds, 300, thisGlider->hVel / 2, thisGlider->vVel / 2);
thisGlider->hVel /= 4;
thisGlider->vVel /= 4;
@@ -801,7 +801,7 @@ void HandleRewards (gliderPtr thisGlider, hotPtr who)
{
PlayPrioritySound(kDingSound, kDingPriority);
RestoreFromSavedMap(thisRoomNumber,
masterObjects[whoLinked].objectNum, false);
masterObjects[whoLinked].objectNum, kDefaultComponent, false);
AddFlyingPoint(&bounds, 500, thisGlider->hVel / 2, thisGlider->vVel / 2);
thisGlider->hVel /= 4;
thisGlider->vVel /= 4;
@@ -817,7 +817,7 @@ void HandleRewards (gliderPtr thisGlider, hotPtr who)
{
PlayPrioritySound(kCuckooSound, kCuckooPriority);
RestoreFromSavedMap(thisRoomNumber,
masterObjects[whoLinked].objectNum, false);
masterObjects[whoLinked].objectNum, kDefaultComponent, false);
StopPendulum(thisRoomNumber, masterObjects[whoLinked].objectNum);
AddFlyingPoint(&bounds, 1000, thisGlider->hVel / 2, thisGlider->vVel / 2);
thisGlider->hVel /= 4;
@@ -834,7 +834,7 @@ void HandleRewards (gliderPtr thisGlider, hotPtr who)
{
PlayPrioritySound(kEnergizeSound, kEnergizePriority);
RestoreFromSavedMap(thisRoomNumber,
masterObjects[whoLinked].objectNum, false);
masterObjects[whoLinked].objectNum, kDefaultComponent, false);
AddSparkle(&bounds);
thisGlider->hVel /= 2;
thisGlider->vVel /= 2;
@@ -853,7 +853,7 @@ void HandleRewards (gliderPtr thisGlider, hotPtr who)
{
PlayPrioritySound(kEnergizeSound, kEnergizePriority);
RestoreFromSavedMap(thisRoomNumber,
masterObjects[whoLinked].objectNum, false);
masterObjects[whoLinked].objectNum, kDefaultComponent, false);
AddSparkle(&bounds);
thisGlider->hVel /= 2;
thisGlider->vVel /= 2;
@@ -875,7 +875,7 @@ void HandleRewards (gliderPtr thisGlider, hotPtr who)
{
PlayPrioritySound(kEnergizeSound, kEnergizePriority);
RestoreFromSavedMap(thisRoomNumber,
masterObjects[whoLinked].objectNum, false);
masterObjects[whoLinked].objectNum, kDefaultComponent, false);
AddSparkle(&bounds);
thisGlider->hVel /= 2;
thisGlider->vVel /= 2;
@@ -903,7 +903,7 @@ void HandleRewards (gliderPtr thisGlider, hotPtr who)
{
PlayPrioritySound(kEnergizeSound, kEnergizePriority);
RestoreFromSavedMap(thisRoomNumber,
masterObjects[whoLinked].objectNum, false);
masterObjects[whoLinked].objectNum, kDefaultComponent, false);
AddSparkle(&bounds);
thisGlider->hVel /= 2;
thisGlider->vVel /= 2;
@@ -936,7 +936,7 @@ void HandleRewards (gliderPtr thisGlider, hotPtr who)
{
PlayPrioritySound(kEnergizeSound, kEnergizePriority);
RestoreFromSavedMap(thisRoomNumber,
masterObjects[whoLinked].objectNum, false);
masterObjects[whoLinked].objectNum, kDefaultComponent, false);
AddSparkle(&bounds);
StopStar(thisRoomNumber, masterObjects[whoLinked].objectNum);
numStarsRemaining--;
@@ -959,7 +959,7 @@ void HandleRewards (gliderPtr thisGlider, hotPtr who)
{
PlayPrioritySound(kEnergizeSound, kEnergizePriority);
RestoreFromSavedMap(thisRoomNumber,
masterObjects[whoLinked].objectNum, false);
masterObjects[whoLinked].objectNum, kDefaultComponent, false);
AddSparkle(&bounds);
thisGlider->hVel /= 2;
thisGlider->vVel /= 2;
@@ -1050,12 +1050,12 @@ void HandleSwitches (hotPtr who)
case kFoil:
case kStar:
case kHelium:
RestoreFromSavedMap(roomLinked, objectLinked, true);
RestoreFromSavedMap(roomLinked, objectLinked, kDefaultComponent, true);
AddSparkle(&bounds);
break;
case kCuckoo:
RestoreFromSavedMap(roomLinked, objectLinked, true);
RestoreFromSavedMap(roomLinked, objectLinked, kDefaultComponent, true);
StopPendulum(roomLinked, objectLinked);
break;

View File

@@ -10,9 +10,11 @@
#include "Environ.h"
#include "HostDisplayDriver.h"
#include "IGpDisplayDriver.h"
#include "GpApplicationName.h"
#include "Map.h"
#include "MenuManager.h"
#include "PLKeyEncoding.h"
#include "PLPasStr.h"
#include "RectUtils.h"
#include "Tools.h"
@@ -46,11 +48,12 @@ extern Boolean twoPlayerGame, paused, hasMirror, splashDrawn;
// The menus are loaded from disk and the menu bar set up and drawn.
void InitializeMenus (void)
{
{
appleMenu = GetMenu(kAppleMenuID);
if (appleMenu == nil)
RedAlert(kErrFailedResourceLoad);
//AppendResMenu(appleMenu, 'DRVR'); // GP: We don't support this
AppendMenuItem(appleMenu, 0, 0, 0, 0, true, false, PSTR("About " GP_APPLICATION_NAME "\xc9"));
InsertMenu(appleMenu, 0);
gameMenu = GetMenu(kGameMenuID);

View File

@@ -244,12 +244,13 @@ void OpenLinkWindow (void)
basicState.m_text.Set(4, "Link");
basicState.m_window = linkWindow;
linkControl = PortabilityLayer::ButtonWidget::Create(basicState);
PortabilityLayer::ButtonWidget::AdditionalData addlData;
linkControl = PortabilityLayer::ButtonWidget::Create(basicState, &addlData);
basicState.m_rect = Rect::Create(5, 5, 25, 59);
basicState.m_text.Set(6, "Unlink");
basicState.m_window = linkWindow;
unlinkControl = PortabilityLayer::ButtonWidget::Create(basicState);
unlinkControl = PortabilityLayer::ButtonWidget::Create(basicState, &addlData);
linkWindow->DrawControls();
@@ -379,7 +380,7 @@ void HandleLinkClick (Point wherePt)
return;
SetPortWindowPort(linkWindow);
wherePt -= linkWindow->TopLeftCoord();
wherePt -= linkWindow->GetTopLeftCoord();
part = FindControl(wherePt, linkWindow, &theControl);
if ((theControl != nil) && (part != 0))

View File

@@ -12,6 +12,7 @@
#include "Environ.h"
#include "IOStream.h"
#include "House.h"
#include "WindowManager.h"
#define kPrefsVersion 0x0035
@@ -352,6 +353,10 @@ int gpAppMain()
InitSrcRects();
CreateOffscreens(); SpinCursor(2);
OpenMainWindow();
if (isDoColorFade)
PortabilityLayer::WindowManager::GetInstance()->SetWindowDesaturation(mainWindow, 1.0);
InitSound(); SpinCursor(2);
InitMusic(); SpinCursor(2);
BuildHouseList();
@@ -366,17 +371,8 @@ int gpAppMain()
// HideMenuBarOld();
#endif
// if ((isDoColorFade) && (thisMac.isDepth == 8))
// {
// wasSeed = ExtractCTSeed((CGrafPtr)mainWindow);
// WashColorIn();
// ForceCTSeed((CGrafPtr)mainWindow, wasSeed);
// }
// if ((!thisMac.hasSM3) && (numSMWarnings < 3))
// {
// numSMWarnings++;
// BitchAboutSM3();
// }
if (isDoColorFade)
WashColorIn();
UpdateMainWindow();
@@ -399,8 +395,7 @@ int gpAppMain()
}
}
WriteOutPrefs();
RestoreColorDepth();
PL_DEAD(FlushEvents(everyEvent, 0));
PL_DEAD(FlushEvents());
// theErr = LoadScrap();
return 0;

View File

@@ -6,7 +6,6 @@
#include "PLNumberFormatting.h"
#include "PLToolUtils.h"
#include "PLPasStr.h"
#include "Externs.h"
#include "Environ.h"
@@ -20,6 +19,7 @@
#include "RectUtils.h"
#include "PLKeyEncoding.h"
#include "PLStandardColors.h"
#include "ResolveCachingColor.h"
#include "WindowDef.h"
#include "WindowManager.h"
@@ -32,7 +32,7 @@
void DrawOnSplash (DrawSurface *surface);
void SetPaletteToGrays (void);
void HardDrawMainWindow (void);
void KeepWindowInBounds(Window *window);
CTabHandle theCTab;
PixMapHandle thePMap;
@@ -69,20 +69,20 @@ void DrawOnSplash(DrawSurface *surface)
if ((thisMac.hasQT) && (hasMovie))
PasStringConcat(houseLoadedStr, PSTR(" (TV)"));
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold);
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold, true);
const Point textPoint = Point::Create(splashOriginH + 436, splashOriginV + 314);
if (thisMac.isDepth == 4)
{
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 255, 255));
surface->DrawString(textPoint, houseLoadedStr, true);
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
surface->DrawString(textPoint, houseLoadedStr, whiteColor, appFont);
}
else
{
if (houseIsReadOnly)
ColorText(surface, textPoint, houseLoadedStr, 5L);
ColorText(surface, textPoint, houseLoadedStr, 5L, appFont);
else
ColorText(surface, textPoint, houseLoadedStr, 28L);
ColorText(surface, textPoint, houseLoadedStr, 28L, appFont);
}
#if defined(powerc) || defined(__powerc)
@@ -106,8 +106,8 @@ void RedrawSplashScreen (void)
Rect tempRect;
DrawSurface *surface = workSrcMap;
surface->SetForeColor(StdColors::Black());
surface->FillRect(workSrcRect);
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
surface->FillRect(workSrcRect, blackColor);
QSetRect(&tempRect, 0, 0, 640, 460);
QOffsetRect(&tempRect, splashOriginH, splashOriginV);
@@ -117,7 +117,7 @@ void RedrawSplashScreen (void)
SetPortWindowPort(mainWindow);
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
&workSrcRect, &workSrcRect, srcCopy);
// if (quickerTransitions)
@@ -126,7 +126,7 @@ void RedrawSplashScreen (void)
// DissBits(&workSrcRect);
CopyRectMainToWork(&workSrcRect);
mainWindow->m_surface.m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
mainWindow->GetDrawSurface()->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
PortabilityLayer::MenuManager::GetInstance()->SetMenuVisible(true);
}
@@ -144,25 +144,27 @@ void UpdateMainWindow (void)
{
PauseMarquee();
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
&mainWindowRect, &mainWindowRect, srcCopy);
ResumeMarquee();
}
else if ((theMode == kSplashMode) || (theMode == kPlayMode))
{
workSrcMap->FillRect(workSrcRect);
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
workSrcMap->FillRect(workSrcRect, blackColor);
QSetRect(&tempRect, 0, 0, 640, 460);
QOffsetRect(&tempRect, splashOriginH, splashOriginV);
LoadScaledGraphic(workSrcMap, kSplash8BitPICT, &tempRect);
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
&workSrcRect, &mainWindowRect, srcCopy);
SetPortWindowPort(mainWindow);
DrawOnSplash(mainWindow->GetDrawSurface());
}
mainWindow->m_surface.m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
mainWindow->GetDrawSurface()->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
splashDrawn = true;
}
@@ -174,7 +176,9 @@ void OpenMainWindow (void)
{
// long wasSeed;
short whichRoom;
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
if (mainWindow != nil)
{
YellowAlert(kYellowUnaccounted, 6);
@@ -199,14 +203,12 @@ void OpenMainWindow (void)
ShowWindow(mainWindow);
DrawSurface *mainWindowSurface = mainWindow->GetDrawSurface();
mainWindowSurface->SetClipRect(mainWindowRect);
mainWindowSurface->SetForeColor(StdColors::Black());
mainWindowSurface->SetBackColor(StdColors::White());
whichRoom = GetFirstRoomNumber();
CopyRoomToThisRoom(whichRoom);
ReflectCurrentRoom(false);
KeepWindowInBounds(mainWindow);
}
else
{
@@ -247,11 +249,9 @@ void OpenMainWindow (void)
DrawSurface *mainWindowSurface = mainWindow->GetDrawSurface();
mainWindowSurface->SetClipRect(mainWindowRect);
// CopyRgn(mainWindow->clipRgn, mainWindow->visRgn);
mainWindowSurface->SetForeColor(StdColors::Black());
mainWindowSurface->SetBackColor(StdColors::White());
mainWindowSurface->FillRect(mainWindowRect);
mainWindowSurface->FillRect(mainWindowRect, blackColor);
splashOriginH = ((thisMac.constrainedScreen.right - thisMac.constrainedScreen.left) - 640) / 2;
if (splashOriginH < 0)
@@ -260,7 +260,7 @@ void OpenMainWindow (void)
if (splashOriginV < 0)
splashOriginV = 0;
workSrcMap->FillRect(workSrcRect);
workSrcMap->FillRect(workSrcRect, blackColor);
// if ((fadeGraysOut) && (isDoColorFade))
// {
@@ -277,10 +277,10 @@ void OpenMainWindow (void)
}
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
&mainWindowRect, &mainWindowRect, srcCopy);
mainWindow->m_surface.m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
mainWindow->GetDrawSurface()->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
}
//-------------------------------------------------------------- CloseMainWindow
@@ -371,7 +371,7 @@ void HandleMainClick (Point wherePt, Boolean isDoubleClick)
return;
SetPortWindowPort(mainWindow);
wherePt -= mainWindow->TopLeftCoord();
wherePt -= mainWindow->GetTopLeftCoord();
DrawSurface *mainWindowSurface = mainWindow->GetDrawSurface();
@@ -578,54 +578,20 @@ void HardDrawMainWindow (void)
//-------------------------------------------------------------- WashColorIn
// Slowly walks the palette from its gray luminance state to the full color<6F>
// palette. In this way, color appears to slowly wash in.
/*
void WashColorIn (void)
{
#define kGray2ColorSteps 180
GDHandle theDevice;
long longDelta;
short i, c;
theDevice = GetGDevice();
SetGDevice(thisGDevice);
for (i = 0; i < kGray2ColorSteps; i++)
{
for (c = 0; c < 256; c++)
{
if (c != 5)
{
longDelta = (((long)wasColors[c].rgb.red -
(long)newColors[c].rgb.red) /
(long)(kGray2ColorSteps - i)) + (long)newColors[c].rgb.red;
newColors[c].rgb.red = (unsigned short)longDelta;
longDelta = (((long)wasColors[c].rgb.green -
(long)newColors[c].rgb.green) /
(long)(kGray2ColorSteps - i)) +
(long)newColors[c].rgb.green;
newColors[c].rgb.green = (unsigned short)longDelta;
longDelta = (((long)wasColors[c].rgb.blue -
(long)newColors[c].rgb.blue) /
(long)(kGray2ColorSteps - i)) +
(long)newColors[c].rgb.blue;
newColors[c].rgb.blue = (unsigned short)longDelta;
}
}
SetEntries(0, 255, newColors);
if (Button())
PortabilityLayer::WindowManager::GetInstance()->SetWindowDesaturation(mainWindow, static_cast<float>(kGray2ColorSteps - i) / static_cast<float>(kGray2ColorSteps));
Delay(1, nullptr);
if (PortabilityLayer::InputManager::GetInstance()->GetKeys()->m_mouse.Get(GpMouseButtons::kLeft))
break;
}
SetEntries(0, 255, wasColors);
SetGDevice(theDevice);
RestoreColorsSlam();
if (wasColors != nil)
DisposePtr((Ptr)wasColors);
if (newColors != nil)
DisposePtr((Ptr)newColors);
PortabilityLayer::WindowManager::GetInstance()->SetWindowDesaturation(mainWindow, 0.0f);
}
*/

View File

@@ -19,6 +19,7 @@
#include "WindowManager.h"
#include "QDPixMap.h"
#include "RectUtils.h"
#include "ResolveCachingColor.h"
#include "Utilities.h"
@@ -35,11 +36,12 @@
void LoadGraphicPlus (DrawSurface *, short, const Rect &);
void RedrawMapContents (void);
void LiveHScrollAction (ControlHandle, short);
void LiveVScrollAction (ControlHandle, short);
void LiveHScrollAction (PortabilityLayer::Widget *theControl, int thePart);
void LiveVScrollAction (PortabilityLayer::Widget *theControl, int thePart);
Boolean QueryNewRoom (void);
void CreateNailOffscreen (void);
void KillNailOffscreen (void);
void KeepWindowInBounds (Window *window);
Rect nailSrcRect, activeRoomRect, wasActiveRoomRect;
Rect mapHScrollRect, mapVScrollRect, mapCenterRect;
@@ -204,9 +206,6 @@ void RedrawMapContents (void)
newClip.bottom = mapWindowRect.bottom + 2 - kMapScrollBarWidth;
DrawSurface *surface = mapWindow->GetDrawSurface();
const Rect wasClip = surface->GetClipRect();
surface->SetClipRect(newClip);
for (i = 0; i < mapRoomsHigh; i++)
{
@@ -226,7 +225,6 @@ void RedrawMapContents (void)
type = kNumBackgrounds; // Draw "?" thumbnail.
}
surface->SetForeColor(StdColors::Black());
if (type > kNumBackgrounds) // Do a "pretty" thumbnail.
{
LoadGraphicPlus(surface, type + kBaseBackgroundID, aRoom);
@@ -236,7 +234,7 @@ void RedrawMapContents (void)
QSetRect(&src, 0, 0, kMapRoomWidth, kMapRoomHeight);
QOffsetRect(&src, 0, type * kMapRoomHeight);
CopyBits((BitMap *)*GetGWorldPixMap(nailSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(mapWindow)),
GetPortBitMapForCopyBits(mapWindow->GetDrawSurface()),
&src, &aRoom, srcCopy);
}
@@ -248,52 +246,74 @@ void RedrawMapContents (void)
}
else
{
surface->SetForeColor(StdColors::White());
surface->FillRect(aRoom);
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
surface->FillRect(aRoom, whiteColor);
PortabilityLayer::ResolveCachingColor overlayColor;
if (i >= groundLevel)
surface->SetForeColor(StdColors::Green());
overlayColor = StdColors::Green();
else
surface->SetForeColor(StdColors::Blue());
overlayColor = StdColors::Blue();
Pattern dummyPat;
surface->FillRectWithPattern8x8(aRoom, true, *GetQDGlobalsGray(&dummyPat));
surface->FillRectWithMaskPattern8x8(aRoom, *GetQDGlobalsGray(&dummyPat), overlayColor);
}
}
}
surface->SetForeColor(StdColors::Black());
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
for (i = 1; i < mapRoomsWide; i++)
{
const Point upperPoint = Point::Create(i * kMapRoomWidth, 0);
const Point lowerPoint = Point::Create(upperPoint.h, upperPoint.v + mapRoomsHigh * kMapRoomHeight);
surface->DrawLine(upperPoint, lowerPoint);
surface->DrawLine(upperPoint, lowerPoint, blackColor);
}
for (i = 1; i < mapRoomsHigh; i++)
{
const Point leftPoint = Point::Create(0, i * kMapRoomHeight);
const Point rightPoint = leftPoint + Point::Create(mapRoomsWide * kMapRoomWidth, 0);
surface->DrawLine(leftPoint, rightPoint);
surface->DrawLine(leftPoint, rightPoint, blackColor);
}
if (activeRoomVisible)
{
surface->SetForeColor(StdColors::Red());
PortabilityLayer::ResolveCachingColor redColor = StdColors::Red();
activeRoomRect.right++;
activeRoomRect.bottom++;
surface->FrameRect(activeRoomRect);
surface->FrameRect(activeRoomRect, redColor);
InsetRect(&activeRoomRect, 1, 1);
surface->FrameRect(activeRoomRect);
surface->SetForeColor(StdColors::Black());
surface->FrameRect(activeRoomRect, redColor);
InsetRect(&activeRoomRect, -1, -1);
}
surface->SetClipRect(wasClip);
}
#endif
//-------------------------------------------------------------- UpdateMapWindow
void DrawMapResizeBox(void)
{
DrawSurface *surface = mapWindow->GetDrawSurface();
const Rect windowRect = surface->m_port.GetRect();
Rect growBoxRect = Rect::Create(windowRect.bottom - 14, windowRect.right - 14, windowRect.bottom, windowRect.right);
PortabilityLayer::ResolveCachingColor backgroundColor = PortabilityLayer::RGBAColor::Create(204, 204, 204, 255);
surface->FillRect(growBoxRect, backgroundColor);
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
surface->FillRect(Rect::Create(growBoxRect.top + 2, growBoxRect.left + 2, growBoxRect.top + 3, growBoxRect.left + 6), blackColor);
surface->FillRect(Rect::Create(growBoxRect.top + 3, growBoxRect.left + 2, growBoxRect.top + 6, growBoxRect.left + 3), blackColor);
surface->FillRect(Rect::Create(growBoxRect.top + 8, growBoxRect.left + 11, growBoxRect.top + 12, growBoxRect.left + 12), blackColor);
surface->FillRect(Rect::Create(growBoxRect.top + 11, growBoxRect.left + 8, growBoxRect.top + 12, growBoxRect.left + 11), blackColor);
for (int i = 0; i < 7; i++)
surface->FillRect(Rect::Create(growBoxRect.top + 3 + i, growBoxRect.left + 3 + i, growBoxRect.top + 5 + i, growBoxRect.left + 5 + i), blackColor);
}
//-------------------------------------------------------------- UpdateMapWindow
void UpdateMapWindow (void)
@@ -310,6 +330,8 @@ void UpdateMapWindow (void)
SetPortWindowPort(mapWindow);
// PL_NotYetImplemented_TODO("Resize")
RedrawMapContents();
DrawMapResizeBox();
#endif
}
@@ -333,17 +355,17 @@ void ResizeMapWindow (short newH, short newV)
mapRoomsWide * kMapRoomWidth + kMapScrollBarWidth - 1,
mapRoomsHigh * kMapRoomHeight + kMapScrollBarWidth - 1);
surface->SetForeColor(StdColors::White());
surface->FillRect(mapWindowRect);
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
surface->FillRect(mapWindowRect, whiteColor);
SizeWindow(mapWindow, mapWindowRect.right, mapWindowRect.bottom, true);
mapHScroll->SetMax(kMaxNumRoomsH - mapRoomsWide);
mapHScroll->SetPosition(Point::Create(0, mapWindowRect.bottom - kMapScrollBarWidth + 1));
mapHScroll->SetPosition(Point::Create(-1, 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 + 1, 0));
mapVScroll->SetPosition(Point::Create(mapWindowRect.right - kMapScrollBarWidth + 1, -1));
mapVScroll->Resize(kMapScrollBarWidth, mapWindowRect.bottom - kMapScrollBarWidth + 3);
mapTopRoom = mapVScroll->GetState();
@@ -365,7 +387,7 @@ void OpenMapWindow (void)
mapRoomsWide * kMapRoomWidth + kMapScrollBarWidth - 1,
mapRoomsHigh * kMapRoomHeight + kMapScrollBarWidth - 1);
const uint16_t windowStyle = PortabilityLayer::WindowStyleFlags::kTitleBar | PortabilityLayer::WindowStyleFlags::kResizable | PortabilityLayer::WindowStyleFlags::kMiniBar | PortabilityLayer::WindowStyleFlags::kCloseBox;;
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, 0, 0, PSTR("Map"));
@@ -389,7 +411,7 @@ void OpenMapWindow (void)
PortabilityLayer::WindowManager::GetInstance()->ShowWindow(mapWindow);
// FlagWindowFloating(mapWindow); TEMP - use flaoting windows
SetPort(&mapWindow->GetDrawSurface()->m_port);
SetPort(mapWindow->GetDrawSurface());
QSetRect(&mapHScrollRect, -1, mapRoomsHigh * kMapRoomHeight,
mapRoomsWide * kMapRoomWidth + 1,
mapRoomsHigh * kMapRoomHeight + kMapScrollBarWidth);
@@ -404,7 +426,7 @@ void OpenMapWindow (void)
state.m_window = mapWindow;
state.m_max = kMaxNumRoomsH - mapRoomsWide;
state.m_state = mapLeftRoom;
mapHScroll = PortabilityLayer::ScrollBarWidget::Create(state);
mapHScroll = PortabilityLayer::ScrollBarWidget::Create(state, nullptr);
}
if (mapHScroll == nil)
@@ -417,7 +439,7 @@ void OpenMapWindow (void)
state.m_window = mapWindow;
state.m_max = kMaxNumRoomsV - mapRoomsHigh;
state.m_state = mapTopRoom;
mapVScroll = PortabilityLayer::ScrollBarWidget::Create(state);
mapVScroll = PortabilityLayer::ScrollBarWidget::Create(state, nullptr);
}
if (mapVScroll == nil)
@@ -430,6 +452,8 @@ void OpenMapWindow (void)
CenterMapOnRoom(thisRoom->suite, thisRoom->floor);
UpdateMapWindow();
KeepWindowInBounds(mapWindow);
}
UpdateMapCheckmark(true);
@@ -597,7 +621,7 @@ void HandleMapClick (const GpMouseInputEvent &theEvent)
SetPortWindowPort(mapWindow);
globalWhere = wherePt;
wherePt -= mapWindow->TopLeftCoord();
wherePt -= mapWindow->GetTopLeftCoord();
wherePt.h -= 1;
wherePt.v -= 1;
@@ -738,7 +762,7 @@ void CreateNailOffscreen (void)
if (nailSrcMap == nil)
{
QSetRect(&nailSrcRect, 0, 0, kMapRoomWidth, kMapRoomHeight * (kNumBackgrounds + 1));
theErr = CreateOffScreenGWorld(&nailSrcMap, &nailSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&nailSrcMap, &nailSrcRect);
LoadGraphic(nailSrcMap, kThumbnailPictID);
}

View File

@@ -432,7 +432,7 @@ Boolean PtInMarqueeHandle (Point where)
void DrawGliderMarquee (void)
{
DrawSurface *surface = GetWindowPort(mainWindow);
DrawSurface *surface = mainWindow->GetDrawSurface();
ImageInvert(*GetGWorldPixMap(blowerMaskMap), GetPortBitMapForCopyBits(surface), leftStartGliderSrc, marqueeGliderRect);
surface->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
}

View File

@@ -12,7 +12,6 @@
#include "PLHacks.h"
#include "PLMenus.h"
#include "PLPasStr.h"
#include "PLToolUtils.h"
#include "DialogManager.h"
#include "DialogUtils.h"
#include "Externs.h"
@@ -294,6 +293,10 @@ void DoAppleMenu (short theItem)
DoAbout();
break;
case iAboutAerofoil:
DoAboutFramework();
break;
default:
// GetMenuItemText(appleMenu, theItem, daName);
// GetPort(&wasPort);

View File

@@ -134,7 +134,7 @@ void ToggleMusicWhilePlaying (void)
void SetMusicalMode (short newMode)
{
if (dontLoadMusic)
if (dontLoadMusic || failedMusic)
return;
musicMutex->Lock();
@@ -302,6 +302,12 @@ void InitMusic (void)
return;
}
theErr = OpenMusicChannel();
if (theErr != PLErrors::kNone)
{
YellowAlert(kYellowNoMusic, theErr);
failedMusic = true;
return;
}
musicScore[0] = 0;
musicScore[1] = 1;

View File

@@ -6,7 +6,6 @@
//============================================================================
#include "PLToolUtils.h"
#include "PLKeyEncoding.h"
#include "DialogManager.h"
#include "Externs.h"

View File

@@ -14,6 +14,7 @@
#include "Room.h"
#include "Vec2i.h"
#include "PLStandardColors.h"
#include "ResolveCachingColor.h"
#include "ScanlineMask.h"
#include "ScanlineMaskConverter.h"
@@ -164,9 +165,9 @@ void DrawTable (Rect *tableTop, short down)
GetQDGlobalsGray(&dummyPattern);
if (thisMac.isDepth == 4)
ColorOvalMaskPattern(backSrcMap, tempRect, 15, true, dummyPattern);
ColorOvalMaskPattern(backSrcMap, tempRect, 15, dummyPattern);
else
ColorOvalMaskPattern(backSrcMap, tempRect, k8DkstGrayColor, true, dummyPattern);
ColorOvalMaskPattern(backSrcMap, tempRect, k8DkstGrayColor, dummyPattern);
InsetRect(tableTop, 0, 1);
ColorRect(backSrcMap, *tableTop, brownC);
@@ -279,9 +280,9 @@ void DrawShelf (Rect *shelfTop)
{
GetQDGlobalsGray(&dummyPattern);
if (thisMac.isDepth == 4)
ColorRegionMaskPattern(backSrcMap, mask, 15, true, dummyPattern);
ColorRegionMaskPattern(backSrcMap, mask, 15, dummyPattern);
else
ColorRegionMaskPattern(backSrcMap, mask, k8DkstGrayColor, true, dummyPattern);
ColorRegionMaskPattern(backSrcMap, mask, k8DkstGrayColor, dummyPattern);
mask->Destroy();
}
@@ -367,9 +368,9 @@ void DrawCabinet (Rect *cabinet)
{
GetQDGlobalsGray(&dummyPattern);
if (thisMac.isDepth == 4)
ColorRegionMaskPattern(backSrcMap, mask, 15, true, dummyPattern);
ColorRegionMaskPattern(backSrcMap, mask, 15, dummyPattern);
else
ColorRegionMaskPattern(backSrcMap, mask, dkGrayC, true, dummyPattern);
ColorRegionMaskPattern(backSrcMap, mask, dkGrayC, dummyPattern);
mask->Destroy();
}
@@ -445,7 +446,8 @@ void DrawCabinet (Rect *cabinet)
(BitMap *)*GetGWorldPixMap(backSrcMap),
&handleSrc, &handleSrc, &tempRect);
backSrcMap->FrameRect(*cabinet);
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
backSrcMap->FrameRect(*cabinet, blackColor);
}
//-------------------------------------------------------------- DrawSimpleFurniture
@@ -504,9 +506,9 @@ void DrawCounter(Rect *counter)
{
GetQDGlobalsGray(&dummyPattern);
if (thisMac.isDepth == 4)
ColorRegionMaskPattern(backSrcMap, mask, 15, true, dummyPattern);
ColorRegionMaskPattern(backSrcMap, mask, 15, dummyPattern);
else
ColorRegionMaskPattern(backSrcMap, mask, dkGrayC, true, dummyPattern);
ColorRegionMaskPattern(backSrcMap, mask, dkGrayC, dummyPattern);
mask->Destroy();
}
@@ -747,7 +749,7 @@ void DrawDeckTable (Rect *tableTop, short down)
-HalfRectTall(&tempRect) + kTableShadowTop + down);
QOffsetRect(&tempRect, kTableShadowOffset, -kTableShadowOffset);
GetQDGlobalsGray(&dummyPattern);
ColorOvalMaskPattern(backSrcMap, tempRect, dkGrayC, true, dummyPattern);
ColorOvalMaskPattern(backSrcMap, tempRect, dkGrayC, dummyPattern);
InsetRect(tableTop, 0, 1);
ColorRect(backSrcMap, *tableTop, kGoldColor);
@@ -982,7 +984,7 @@ void DrawClockHands (Point where, short bigHand, short littleHand)
{
DrawSurface *surface = backSrcMap;
surface->SetForeColor(StdColors::Black());
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
const Point midPoint = Point::Create(where.h, where.v);
Point otherPoint = midPoint;
@@ -1037,7 +1039,7 @@ void DrawClockHands (Point where, short bigHand, short littleHand)
break;
}
surface->DrawLine(midPoint, otherPoint);
surface->DrawLine(midPoint, otherPoint, blackColor);
switch (littleHand)
{
@@ -1090,7 +1092,7 @@ void DrawClockHands (Point where, short bigHand, short littleHand)
break;
}
surface->DrawLine(midPoint, otherPoint);
surface->DrawLine(midPoint, otherPoint, blackColor);
}
//-------------------------------------------------------------- DrawClockHands
@@ -1099,7 +1101,7 @@ void DrawLargeClockHands (Point where, short bigHand, short littleHand)
{
DrawSurface *surface = backSrcMap;
surface->SetForeColor(StdColors::White());
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
const Point midPoint = Point::Create(where.h, where.v);
Point otherPoint = midPoint;
@@ -1155,7 +1157,7 @@ void DrawLargeClockHands (Point where, short bigHand, short littleHand)
break;
}
surface->DrawLine(midPoint, otherPoint);
surface->DrawLine(midPoint, otherPoint, whiteColor);
switch (littleHand)
{
@@ -1208,8 +1210,7 @@ void DrawLargeClockHands (Point where, short bigHand, short littleHand)
break;
}
surface->DrawLine(midPoint, otherPoint);
surface->SetForeColor(StdColors::Black());
surface->DrawLine(midPoint, otherPoint, whiteColor);
}
//-------------------------------------------------------------- DrawSimplePrizes
@@ -1249,8 +1250,8 @@ void DrawGreaseRt (Rect *theRect, short distance, Boolean state, Boolean drawSpi
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);
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
backSrcMap->FillRect(spill, blackColor);
}
}
}
@@ -1280,11 +1281,11 @@ void DrawGreaseLf (Rect *theRect, short distance, Boolean state, Boolean drawSpi
if (drawSpill)
{
backSrcMap->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
QSetRect(&spill, -distance + 5, -2, 0, 0);
QOffsetRect(&spill, dest.left + 1, dest.bottom);
backSrcMap->FillRect(spill);
backSrcMap->FillRect(spill, blackColor);
}
}
}
@@ -1312,6 +1313,7 @@ void DrawInvisBonus (Rect *theRect)
void DrawSlider (Rect *theRect)
{
backSrcMap->FrameRect(*theRect);
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
backSrcMap->FrameRect(*theRect, blackColor);
}

View File

@@ -7,7 +7,6 @@
#include "BitmapImage.h"
#include "PLResources.h"
#include "PLTextUtils.h"
#include "PLPasStr.h"
#include "Externs.h"
#include "FontFamily.h"
@@ -15,6 +14,8 @@
#include "Environ.h"
#include "Objects.h"
#include "RectUtils.h"
#include "RenderedFont.h"
#include "ResolveCachingColor.h"
#include "ResourceManager.h"
#include "Room.h"
#include "Utilities.h"
@@ -168,10 +169,10 @@ void DrawMailboxLeft (Rect *theRect, short down)
}
bounds = srcRects[kMailboxLf];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, kMailboxLeftPictID);
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &bounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kMailboxLeftMaskID);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
@@ -240,10 +241,10 @@ void DrawMailboxRight (Rect *theRect, short down)
}
bounds = srcRects[kMailboxRt];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, kMailboxRightPictID);
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &bounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kMailboxRightMaskID);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
@@ -578,8 +579,7 @@ void DrawMacPlus (Rect *theRect, Boolean isOn, Boolean isLit)
if (IsMacPlusGraphicBanned())
{
const PortabilityLayer::RGBAColor beigeColor = PortabilityLayer::RGBAColor::Create(255, 255, 204, 255);
const PortabilityLayer::RGBAColor wasColor = backSrcMap->GetForeColor();
PortabilityLayer::ResolveCachingColor beigeColor = PortabilityLayer::RGBAColor::Create(255, 255, 204, 255);
Rect paintOverRect = *theRect;
paintOverRect.left += 8;
@@ -587,9 +587,7 @@ void DrawMacPlus (Rect *theRect, Boolean isOn, Boolean isLit)
paintOverRect.right = paintOverRect.left + 17;
paintOverRect.bottom = paintOverRect.top + 6;
backSrcMap->SetForeColor(beigeColor);
backSrcMap->FillRect(paintOverRect);
backSrcMap->SetForeColor(wasColor);
backSrcMap->FillRect(paintOverRect, beigeColor);
}
}
@@ -606,10 +604,10 @@ void DrawTV (Rect *theRect, Boolean isOn, Boolean isLit)
if (isLit)
{
bounds = srcRects[kTV];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, kTVPictID);
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &bounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kTVMaskID);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
@@ -692,10 +690,10 @@ void DrawVCR (Rect *theRect, Boolean isOn, Boolean isLit)
if (isLit)
{
bounds = srcRects[kVCR];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, kVCRPictID);
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &bounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kVCRMaskID);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
@@ -739,10 +737,10 @@ void DrawStereo (Rect *theRect, Boolean isOn, Boolean isLit)
if (isLit)
{
bounds = srcRects[kStereo];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, kStereoPictID);
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &bounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kStereoMaskID);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
@@ -786,10 +784,10 @@ void DrawMicrowave (Rect *theRect, Boolean isOn, Boolean isLit)
if (isLit)
{
bounds = srcRects[kMicrowave];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, kMicrowavePictID);
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &bounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kMicrowaveMaskID);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
@@ -1063,13 +1061,13 @@ void DrawCalendar (Rect *theRect)
backSrcMap->DrawPicture(thePicture, bounds);
thePicture.Dispose();
backSrcMap->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold);
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold, true);
GetTime(&timeRec);
GetIndString(monthStr, kMonthStringID, timeRec.month);
const Point textPos = Point::Create(theRect->left + ((64 - backSrcMap->MeasureString(monthStr)) / 2), theRect->top + 55);
ColorText(backSrcMap, textPos, monthStr, kDarkFleshColor);
const Point textPos = Point::Create(theRect->left + ((64 - appFont->MeasurePStr(monthStr)) / 2), theRect->top + 55);
ColorText(backSrcMap, textPos, monthStr, kDarkFleshColor, appFont);
}
//-------------------------------------------------------------- DrawBulletin
@@ -1164,10 +1162,10 @@ void DrawPictWithMaskObject (short what, Rect *theRect)
}
bounds = srcRects[what];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, pictID);
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &bounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, maskID);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
@@ -1275,7 +1273,7 @@ void DrawPictSansWhiteObject (short what, Rect *theRect)
}
bounds = srcRects[what];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, pictID);
CopyBits((BitMap *)*GetGWorldPixMap(tempMap),
@@ -1295,7 +1293,7 @@ void DrawCustPictSansWhite (short pictID, Rect *theRect)
bounds = *theRect;
ZeroRectCorner(&bounds);
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphicCustom(tempMap, pictID);
CopyBits((BitMap *)*GetGWorldPixMap(tempMap),

View File

@@ -301,9 +301,9 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
if (SectRect(&itsRect, &testRect, &whoCares))
{
if (redraw)
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i);
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
else
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i);
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
if (legit != -1)
DrawRedClock(&itsRect);
}
@@ -315,9 +315,9 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
if (SectRect(&itsRect, &testRect, &whoCares))
{
if (redraw)
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i);
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
else
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i);
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
if (legit != -1)
DrawBlueClock(&itsRect);
}
@@ -329,9 +329,9 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
if (SectRect(&itsRect, &testRect, &whoCares))
{
if (redraw)
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i);
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
else
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i);
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
if (legit != -1)
DrawYellowClock(&itsRect);
}
@@ -343,9 +343,9 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
if (SectRect(&itsRect, &testRect, &whoCares))
{
if (redraw)
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i);
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
else
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i);
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
if (legit != -1)
{
DrawCuckoo(&itsRect);
@@ -369,9 +369,9 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
if (SectRect(&itsRect, &testRect, &whoCares))
{
if (redraw)
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i);
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
else
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i);
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
if (legit != -1)
DrawSimplePrizes(thisObject.what, &itsRect);
}
@@ -435,9 +435,9 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
if (SectRect(&itsRect, &testRect, &whoCares))
{
if (redraw)
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i);
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
else
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i);
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
if (legit != -1)
DrawFoil(&itsRect);
}
@@ -453,9 +453,9 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
if (SectRect(&itsRect, &testRect, &whoCares))
{
if (redraw)
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i);
legit = ReBackUpSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
else
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i);
legit = BackUpToSavedMap(&itsRect, localNumbers[neighbor], i, kDefaultComponent);
if (legit != -1)
{
if (redraw)
@@ -953,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

@@ -6,7 +6,6 @@
#include "PLKeyEncoding.h"
#include "PLSound.h"
#include "PLToolUtils.h"
#include "PLPasStr.h"
#include "BitmapImage.h"
#include "Externs.h"
@@ -17,7 +16,9 @@
#include "ObjectEdit.h"
#include "Objects.h"
#include "Play.h"
#include "PLStandardColors.h"
#include "RectUtils.h"
#include "ResolveCachingColor.h"
#include "ResourceManager.h"
#include "Room.h"
@@ -812,10 +813,8 @@ void AddObjectPairing (void)
GetLocalizedString(45, message);
OpenMessageWindow(message);
ForeColor(blueColor);
GetLocalizedString(46, message);
SetMessageWindowMessage(message);
ForeColor(blackColor);
SetMessageWindowMessage(message, StdColors::Blue());
DelayTicks(60);
CloseMessageWindow();
}
@@ -843,10 +842,8 @@ void AddObjectPairing (void)
GetLocalizedString(45, message);
OpenMessageWindow(message);
ForeColor(blueColor);
GetLocalizedString(46, message);
SetMessageWindowMessage(message);
ForeColor(blackColor);
SetMessageWindowMessage(message, StdColors::Blue());
DelayTicks(60);
CloseMessageWindow();
}
@@ -874,10 +871,8 @@ void AddObjectPairing (void)
GetLocalizedString(45, message);
OpenMessageWindow(message);
ForeColor(blueColor);
GetLocalizedString(47, message);
SetMessageWindowMessage(message);
ForeColor(blackColor);
SetMessageWindowMessage(message, StdColors::Blue());
DelayTicks(60);
CloseMessageWindow();
}
@@ -905,10 +900,8 @@ void AddObjectPairing (void)
GetLocalizedString(45, message);
OpenMessageWindow(message);
ForeColor(blueColor);
GetLocalizedString(47, message);
SetMessageWindowMessage(message);
ForeColor(blackColor);
SetMessageWindowMessage(message, StdColors::Blue());
DelayTicks(60);
CloseMessageWindow();
}
@@ -936,10 +929,8 @@ void AddObjectPairing (void)
GetLocalizedString(45, message);
OpenMessageWindow(message);
ForeColor(blueColor);
GetLocalizedString(48, message);
SetMessageWindowMessage(message);
ForeColor(blackColor);
SetMessageWindowMessage(message, StdColors::Blue());
DelayTicks(60);
CloseMessageWindow();
}
@@ -967,10 +958,8 @@ void AddObjectPairing (void)
GetLocalizedString(45, message);
OpenMessageWindow(message);
ForeColor(blueColor);
GetLocalizedString(48, message);
SetMessageWindowMessage(message);
ForeColor(blackColor);
SetMessageWindowMessage(message, StdColors::Blue());
DelayTicks(60);
CloseMessageWindow();
}
@@ -998,10 +987,8 @@ void AddObjectPairing (void)
GetLocalizedString(45, message);
OpenMessageWindow(message);
ForeColor(blueColor);
GetLocalizedString(49, message);
SetMessageWindowMessage(message);
ForeColor(blackColor);
SetMessageWindowMessage(message, StdColors::Blue());
DelayTicks(60);
CloseMessageWindow();
}
@@ -1029,10 +1016,8 @@ void AddObjectPairing (void)
GetLocalizedString(45, message);
OpenMessageWindow(message);
ForeColor(blueColor);
GetLocalizedString(49, message);
SetMessageWindowMessage(message);
ForeColor(blackColor);
SetMessageWindowMessage(message, StdColors::Blue());
DelayTicks(60);
CloseMessageWindow();
}
@@ -1061,10 +1046,8 @@ void AddObjectPairing (void)
GetLocalizedString(45, message);
OpenMessageWindow(message);
ForeColor(blueColor);
GetLocalizedString(50, message);
SetMessageWindowMessage(message);
ForeColor(blackColor);
SetMessageWindowMessage(message, StdColors::Blue());
DelayTicks(60);
CloseMessageWindow();
}
@@ -1093,10 +1076,8 @@ void AddObjectPairing (void)
GetLocalizedString(45, message);
OpenMessageWindow(message);
ForeColor(blueColor);
GetLocalizedString(51, message);
SetMessageWindowMessage(message);
ForeColor(blackColor);
SetMessageWindowMessage(message, StdColors::Blue());
DelayTicks(60);
CloseMessageWindow();
}
@@ -2270,7 +2251,8 @@ void DrawThisRoomsObjects (void)
{
if (GetNumberOfLights(thisRoomNumber) <= 0)
{
surface->FillRectWithPattern8x8(backSrcRect, true, *GetQDGlobalsGray(&dummyPattern));
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
surface->FillRectWithMaskPattern8x8(backSrcRect, *GetQDGlobalsGray(&dummyPattern), blackColor);
}
for (i = 0; i < kMaxRoomObs; i++)

View File

@@ -8,7 +8,6 @@
#include "PLKeyEncoding.h"
#include "PLNumberFormatting.h"
#include "PLSound.h"
#include "PLTextUtils.h"
#include "PLPasStr.h"
#include "DialogManager.h"
#include "DialogUtils.h"
@@ -18,6 +17,7 @@
#include "PLTimeTaggedVOSEvent.h"
#include "QDPixMap.h"
#include "RectUtils.h"
#include "ResolveCachingColor.h"
#define kBlowerInfoDialogID 1007
@@ -126,11 +126,12 @@ void UpdateBlowerInfo (Dialog *theDialog)
{
#define kArrowheadLength 4
Rect bounds;
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
Window *window = theDialog->GetWindow();
DrawSurface *surface = window->GetDrawSurface();
surface->SetForeColor(StdColors::White());
surface->FillRect((*surface->m_port.GetPixMap())->m_rect);
surface->FillRect((*surface->m_port.GetPixMap())->m_rect, whiteColor);
window->DrawControls();
@@ -140,19 +141,20 @@ void UpdateBlowerInfo (Dialog *theDialog)
if ((thisRoom->objects[objActive].what != kLeftFan) &&
(thisRoom->objects[objActive].what != kRightFan))
{
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
GetDialogItemRect(theDialog, 8, &bounds);
bounds.right += 2;
bounds.bottom += 2;
surface->SetForeColor(StdColors::White());
surface->FillRect(bounds);
surface->FillRect(bounds, whiteColor);
bounds.right -= 2;
bounds.bottom -= 2;
surface->SetForeColor(StdColors::Black());
for (int16_t offsetChunk = 0; offsetChunk < 4; offsetChunk++)
{
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
const int16_t xOffset = offsetChunk & 1;
const int16_t yOffset = (offsetChunk >> 1) & 1;
@@ -163,36 +165,36 @@ void UpdateBlowerInfo (Dialog *theDialog)
case 1: // up
{
const Point basePoint = offset + Point::Create(bounds.left + HalfRectWide(&bounds), bounds.top);
surface->DrawLine(basePoint, basePoint + Point::Create(0, RectTall(&bounds)));
surface->DrawLine(basePoint, basePoint + Point::Create(kArrowheadLength, kArrowheadLength));
surface->DrawLine(basePoint, basePoint + Point::Create(-kArrowheadLength, kArrowheadLength));
surface->DrawLine(basePoint, basePoint + Point::Create(0, RectTall(&bounds)), blackColor);
surface->DrawLine(basePoint, basePoint + Point::Create(kArrowheadLength, kArrowheadLength), blackColor);
surface->DrawLine(basePoint, basePoint + Point::Create(-kArrowheadLength, kArrowheadLength), blackColor);
}
break;
case 2: // right
{
const Point basePoint = offset + Point::Create(bounds.right, bounds.top + HalfRectTall(&bounds));
surface->DrawLine(basePoint, basePoint + Point::Create(-RectWide(&bounds), 0));
surface->DrawLine(basePoint, basePoint + Point::Create(-kArrowheadLength, kArrowheadLength));
surface->DrawLine(basePoint, basePoint + Point::Create(-kArrowheadLength, -kArrowheadLength));
surface->DrawLine(basePoint, basePoint + Point::Create(-RectWide(&bounds), 0), blackColor);
surface->DrawLine(basePoint, basePoint + Point::Create(-kArrowheadLength, kArrowheadLength), blackColor);
surface->DrawLine(basePoint, basePoint + Point::Create(-kArrowheadLength, -kArrowheadLength), blackColor);
}
break;
case 4: // down
{
const Point basePoint = offset + Point::Create(bounds.left + HalfRectWide(&bounds), bounds.bottom);
surface->DrawLine(basePoint, basePoint + Point::Create(0, -RectTall(&bounds)));
surface->DrawLine(basePoint, basePoint + Point::Create(kArrowheadLength, -kArrowheadLength));
surface->DrawLine(basePoint, basePoint + Point::Create(-kArrowheadLength, -kArrowheadLength));
surface->DrawLine(basePoint, basePoint + Point::Create(0, -RectTall(&bounds)), blackColor);
surface->DrawLine(basePoint, basePoint + Point::Create(kArrowheadLength, -kArrowheadLength), blackColor);
surface->DrawLine(basePoint, basePoint + Point::Create(-kArrowheadLength, -kArrowheadLength), blackColor);
}
break;
case 8: // left
{
const Point basePoint = offset + Point::Create(bounds.left, bounds.top + HalfRectTall(&bounds));
surface->DrawLine(basePoint, basePoint + Point::Create(RectWide(&bounds), 0));
surface->DrawLine(basePoint, basePoint + Point::Create(kArrowheadLength, -kArrowheadLength));
surface->DrawLine(basePoint, basePoint + Point::Create(kArrowheadLength, kArrowheadLength));
surface->DrawLine(basePoint, basePoint + Point::Create(RectWide(&bounds), 0), blackColor);
surface->DrawLine(basePoint, basePoint + Point::Create(kArrowheadLength, -kArrowheadLength), blackColor);
surface->DrawLine(basePoint, basePoint + Point::Create(kArrowheadLength, kArrowheadLength), blackColor);
}
break;
@@ -204,33 +206,35 @@ void UpdateBlowerInfo (Dialog *theDialog)
if ((thisRoom->objects[objActive].what == kInvisBlower) ||
(thisRoom->objects[objActive].what == kLiftArea))
{
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
switch (newDirection)
{
case 1: // up
EraseDialogItem(theDialog, 11);
FrameOvalDialogItem(theDialog, 12);
FrameOvalDialogItem(theDialog, 13);
FrameOvalDialogItem(theDialog, 14);
FrameOvalDialogItem(theDialog, 12, blackColor);
FrameOvalDialogItem(theDialog, 13, blackColor);
FrameOvalDialogItem(theDialog, 14, blackColor);
break;
case 2: // right
FrameOvalDialogItem(theDialog, 11);
FrameOvalDialogItem(theDialog, 11, blackColor);
EraseDialogItem(theDialog, 12);
FrameOvalDialogItem(theDialog, 13);
FrameOvalDialogItem(theDialog, 14);
FrameOvalDialogItem(theDialog, 13, blackColor);
FrameOvalDialogItem(theDialog, 14, blackColor);
break;
case 4: // down
FrameOvalDialogItem(theDialog, 11);
FrameOvalDialogItem(theDialog, 12);
FrameOvalDialogItem(theDialog, 11, blackColor);
FrameOvalDialogItem(theDialog, 12, blackColor);
EraseDialogItem(theDialog, 13);
FrameOvalDialogItem(theDialog, 14);
FrameOvalDialogItem(theDialog, 14, blackColor);
break;
case 8: // left
FrameOvalDialogItem(theDialog, 11);
FrameOvalDialogItem(theDialog, 12);
FrameOvalDialogItem(theDialog, 13);
FrameOvalDialogItem(theDialog, 11, blackColor);
FrameOvalDialogItem(theDialog, 12, blackColor);
FrameOvalDialogItem(theDialog, 13, blackColor);
EraseDialogItem(theDialog, 14);
break;
}
@@ -732,7 +736,7 @@ void DoBlowerObjectInfo (short what)
infoDial = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kBlowerInfoDialogID, kPutInFront, &substitutions);
if (infoDial == nil)
RedAlert(kErrDialogDidntLoad);
SetPort(&infoDial->GetWindow()->GetDrawSurface()->m_port);
SetPort(infoDial->GetWindow()->GetDrawSurface());
newDirection = thisRoom->objects[objActive].data.a.vector & 0x0F;
if (thisRoom->objects[objActive].data.a.initial)
@@ -1349,7 +1353,7 @@ void DoLightObjectInfo (void)
infoDial = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kLightInfoDialogID, kPutInFront, &substitutions);
if (infoDial == nil)
RedAlert(kErrDialogDidntLoad);
SetPort(&infoDial->GetWindow()->GetDrawSurface()->m_port);
SetPort(infoDial->GetWindow()->GetDrawSurface());
if (thisRoom->objects[objActive].data.f.initial)
SetDialogItemValue(infoDial, kInitialStateCheckbox, 1);

View File

@@ -14,6 +14,7 @@
#include "House.h"
#include "MainWindow.h"
#include "RectUtils.h"
#include "ResolveCachingColor.h"
#include "Scoreboard.h"
@@ -136,19 +137,21 @@ void NewGame (short mode)
DrawSurface *mainWindowSurface = mainWindow->GetDrawSurface();
PortabilityLayer::ResolveCachingColor blackColorMain = StdColors::Black();
tempRect = thisMac.constrainedScreen;
tempRect.top = tempRect.bottom - 20; // thisMac.menuHigh
mainWindowSurface->FillRect(tempRect);
mainWindowSurface->FillRect(tempRect, blackColorMain);
#ifdef COMPILEQT
if ((thisMac.hasQT) && (hasMovie))
{
theMovie.m_surface = &mainWindow->m_surface;
theMovie.m_surface = mainWindow->GetDrawSurface();
}
#endif
workSrcMap->SetForeColor(StdColors::Black());
workSrcMap->FillRect(workSrcRect);
PortabilityLayer::ResolveCachingColor blackColorWork = StdColors::Black();
workSrcMap->FillRect(workSrcRect, blackColorWork);
// if (quickerTransitions)
// DissBitsChunky(&workSrcRect);
// else
@@ -374,7 +377,7 @@ void HandleGameResolutionChange(void)
OpenMainWindow();
if (hasMovie)
theMovie.m_surface = &mainWindow->m_surface;
theMovie.m_surface = mainWindow->GetDrawSurface();
ResetLocale(true);
InitScoreboardMap();
@@ -752,8 +755,8 @@ void RestoreEntireGameScreen (void)
DrawSurface *surface = mainWindow->GetDrawSurface();
tempRect = thisMac.constrainedScreen;
surface->SetForeColor(StdColors::Black());
surface->FillRect(tempRect);
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
surface->FillRect(tempRect, blackColor);
ResetLocale(false);
RefreshScoreboard(kNormalTitleMode);

View File

@@ -16,7 +16,7 @@
// Given the top left corner and a width and height, this function<6F>
// simply creates the necessary rectangle and frames it.
void FrameWHRect (DrawSurface *surface, short left, short top, short wide, short high)
void FrameWHRect (DrawSurface *surface, short left, short top, short wide, short high, PortabilityLayer::ResolveCachingColor &color)
{
Rect theRect;
@@ -24,7 +24,7 @@ void FrameWHRect (DrawSurface *surface, short left, short top, short wide, short
theRect.top = top;
theRect.right = left + wide;
theRect.bottom = top + high;
surface->FrameRect(theRect);
surface->FrameRect(theRect, color);
}
//-------------------------------------------------------------- NormalizeRect

View File

@@ -10,8 +10,13 @@
#include "PLQDraw.h"
namespace PortabilityLayer
{
class ResolveCachingColor;
}
void FrameWHRect (short, short, short, short);
void FrameWHRect (short, short, short, short, PortabilityLayer::ResolveCachingColor &color);
void NormalizeRect (Rect *);
void ZeroRectCorner (Rect *);
void CenterRectOnPoint (Rect *, Point);

View File

@@ -147,7 +147,7 @@ void DrawReflection (gliderPtr thisGlider, Boolean oneOrTwo)
dest = thisGlider->dest;
QOffsetRect(&dest, playOriginH - 20, playOriginV - 16);
SetPort(&workSrcMap->m_port);
SetPort(workSrcMap);
long numMirrorRects = GetHandleSize(mirrorRects.StaticCast<void>()) / sizeof(Rect);
@@ -612,7 +612,7 @@ void CopyRectsQD (void)
{
short i;
DrawSurface *mainWindowGraf = GetWindowPort(mainWindow);
DrawSurface *mainWindowGraf = mainWindow->GetDrawSurface();
for (i = 0; i < numWork2Main; i++)
{
@@ -713,7 +713,7 @@ void CopyRectWorkToBack (Rect *theRect)
void CopyRectWorkToMain (Rect *theRect)
{
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
theRect, theRect, srcCopy);
}
@@ -721,7 +721,7 @@ void CopyRectWorkToMain (Rect *theRect)
void CopyRectMainToWork (Rect *theRect)
{
CopyBits(GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
CopyBits(GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
(BitMap *)*GetGWorldPixMap(workSrcMap),
theRect, theRect, srcCopy);
}
@@ -730,7 +730,7 @@ void CopyRectMainToWork (Rect *theRect)
void CopyRectMainToBack (Rect *theRect)
{
CopyBits(GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
CopyBits(GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
(BitMap *)*GetGWorldPixMap(backSrcMap),
theRect, theRect, srcCopy);
}

View File

@@ -6,7 +6,6 @@
#include "PLKeyEncoding.h"
#include "PLResources.h"
#include "PLToolUtils.h"
#include "PLPasStr.h"
#include "PLStandardColors.h"
#include "BitmapImage.h"
@@ -18,6 +17,7 @@
#include "MainWindow.h"
#include "MemoryManager.h"
#include "RectUtils.h"
#include "ResolveCachingColor.h"
#define kDeleteRoomAlert 1005
@@ -246,16 +246,18 @@ void ReadyBackground (short theID, short *theTiles)
if ((noRoomAtAll) || (!houseUnlocked))
{
LtGrayForeColor(workSrcMap);
workSrcMap->FillRect(workSrcRect);
workSrcMap->SetForeColor(StdColors::Black());
workSrcMap->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None);
PortabilityLayer::ResolveCachingColor ltGrayColor = LtGrayForeColor();
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
workSrcMap->FillRect(workSrcRect, ltGrayColor);
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None, true);
const Point textPoint = Point::Create(10, 20);
if (houseUnlocked)
workSrcMap->DrawString(textPoint, PSTR("No rooms"), true);
workSrcMap->DrawString(textPoint, PSTR("No rooms"), blackColor, appFont);
else
workSrcMap->DrawString(textPoint, PSTR("Nothing to show"), true);
workSrcMap->DrawString(textPoint, PSTR("Nothing to show"), blackColor, appFont);
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
(BitMap *)*GetGWorldPixMap(backSrcMap),

View File

@@ -11,6 +11,7 @@
#include "Environ.h"
#include "MainWindow.h"
#include "RectUtils.h"
#include "ResolveCachingColor.h"
#include "Room.h"
#include "BitmapImage.h"
@@ -50,6 +51,10 @@ void ResetLocale (Boolean soft)
{
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;
}
else
{
@@ -78,8 +83,8 @@ void ResetLocale (Boolean soft)
DrawSurface *wasCPort = GetGraphicsPort();
const short roomV = (*thisHouse)->rooms[thisRoomNumber].floor;
backSrcMap->SetForeColor(StdColors::Black());
backSrcMap->FillRect(backSrcRect);
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
backSrcMap->FillRect(backSrcRect, blackColor);
if (numNeighbors > 3)
{
@@ -181,8 +186,8 @@ void DrawRoomBackground (short who, short where, short elevation)
if ((numLights == 0) && (who != kRoomIsEmpty))
{
backSrcMap->SetForeColor(StdColors::Black());
backSrcMap->FillRect(localRoomsDest[where]);
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
backSrcMap->FillRect(localRoomsDest[where], blackColor);
return;
}
@@ -191,8 +196,8 @@ void DrawRoomBackground (short who, short where, short elevation)
{
if (wardBitSet)
{
backSrcMap->SetForeColor(StdColors::Black());
backSrcMap->FillRect(localRoomsDest[where]);
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
backSrcMap->FillRect(localRoomsDest[where], blackColor);
return;
}
@@ -428,9 +433,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

@@ -20,6 +20,7 @@
#include "PLPopupMenuWidget.h"
#include "PLTimeTaggedVOSEvent.h"
#include "QDPixMap.h"
#include "ResolveCachingColor.h"
#include "ResourceCompiledRef.h"
#include "ResourceManager.h"
#include "Utilities.h"
@@ -117,11 +118,13 @@ void UpdateRoomInfoDialog (Dialog *theDialog)
SetDialogString(theDialog, kLitUnlitText, PSTR("(Room Is Dark)"));
else
SetDialogString(theDialog, kLitUnlitText, PSTR("(Room Is Lit)"));
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
FrameDialogItemC(theDialog, kRoomLocationBox, kRedOrangeColor8);
FrameDialogItem(theDialog, kRoomTilesBox);
FrameDialogItem(theDialog, kRoomTilesBox, blackColor);
FrameDialogItemC(theDialog, kRoomDividerLine, kRedOrangeColor8);
FrameDialogItem(theDialog, kRoomTilesBox2);
FrameDialogItem(theDialog, kRoomTilesBox2, blackColor);
}
#endif
@@ -134,6 +137,9 @@ void DragMiniTile (Window *window, DrawSurface *surface, Point mouseIs, short *n
Point mouseWas;
short wasTileOver;
Pattern dummyPattern;
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
PortabilityLayer::ResolveCachingColor blueColor = StdColors::Blue();
tileOver = (mouseIs.h - tileSrc.left) / kMiniTileWide;
wasTileOver = -1;
@@ -161,14 +167,13 @@ void DragMiniTile (Window *window, DrawSurface *surface, Point mouseIs, short *n
*newTileOver = (mouseIs.h - tileDest.left) / kMiniTileWide;
if (*newTileOver != wasTileOver)
{
surface->SetForeColor(StdColors::Blue());
for (int offset = 0; offset < 2; offset++)
{
Point pointA = Point::Create(tileDest.left + (*newTileOver * kMiniTileWide), tileDest.top - 3 + offset);
Point pointB = Point::Create(pointA.h + kMiniTileWide, pointA.v);
surface->DrawLine(pointA, pointB);
surface->DrawLine(pointA, pointB, blueColor);
}
for (int offset = 0; offset < 2; offset++)
@@ -176,19 +181,17 @@ void DragMiniTile (Window *window, DrawSurface *surface, Point mouseIs, short *n
Point pointA = Point::Create(tileDest.left + (*newTileOver * kMiniTileWide), tileDest.bottom + 1 + offset);
Point pointB = Point::Create(pointA.h + kMiniTileWide, pointA.v);
surface->DrawLine(pointA, pointB);
surface->DrawLine(pointA, pointB, blueColor);
}
if (wasTileOver != -1)
{
surface->SetForeColor(StdColors::White());
for (int offset = 0; offset < 2; offset++)
{
Point pointA = Point::Create(tileDest.left + (wasTileOver * kMiniTileWide), tileDest.top - 3 + offset);
Point pointB = Point::Create(pointA.h + kMiniTileWide, pointA.v);
surface->DrawLine(pointA, pointB);
surface->DrawLine(pointA, pointB, whiteColor);
}
for (int offset = 0; offset < 2; offset++)
@@ -196,7 +199,7 @@ void DragMiniTile (Window *window, DrawSurface *surface, Point mouseIs, short *n
Point pointA = Point::Create(tileDest.left + (wasTileOver * kMiniTileWide), tileDest.bottom + 1 + offset);
Point pointB = Point::Create(pointA.h + kMiniTileWide, pointA.v);
surface->DrawLine(pointA, pointB);
surface->DrawLine(pointA, pointB, whiteColor);
}
}
@@ -208,14 +211,12 @@ void DragMiniTile (Window *window, DrawSurface *surface, Point mouseIs, short *n
*newTileOver = -1; // we're not in the drop zone
if (wasTileOver != -1)
{
surface->SetForeColor(StdColors::White());
for (int offset = 0; offset < 2; offset++)
{
Point pointA = Point::Create(tileDest.left + (wasTileOver * kMiniTileWide), tileDest.top - 3 + offset);
Point pointB = Point::Create(pointA.h + kMiniTileWide, pointA.v);
surface->DrawLine(pointA, pointB);
surface->DrawLine(pointA, pointB, whiteColor);
}
for (int offset = 0; offset < 2; offset++)
@@ -223,7 +224,7 @@ void DragMiniTile (Window *window, DrawSurface *surface, Point mouseIs, short *n
Point pointA = Point::Create(tileDest.left + (wasTileOver * kMiniTileWide), tileDest.bottom + 1 + offset);
Point pointB = Point::Create(pointA.h + kMiniTileWide, pointA.v);
surface->DrawLine(pointA, pointB);
surface->DrawLine(pointA, pointB, whiteColor);
}
wasTileOver = -1;
@@ -235,14 +236,12 @@ void DragMiniTile (Window *window, DrawSurface *surface, Point mouseIs, short *n
}
if (wasTileOver != -1)
{
surface->SetForeColor(StdColors::White());
for (int offset = 0; offset < 2; offset++)
{
Point pointA = Point::Create(tileDest.left + (wasTileOver * kMiniTileWide), tileDest.top - 3 + offset);
Point pointB = Point::Create(pointA.h + kMiniTileWide, pointA.v);
surface->DrawLine(pointA, pointB);
surface->DrawLine(pointA, pointB, whiteColor);
}
for (int offset = 0; offset < 2; offset++)
@@ -250,7 +249,7 @@ void DragMiniTile (Window *window, DrawSurface *surface, Point mouseIs, short *n
Point pointA = Point::Create(tileDest.left + (wasTileOver * kMiniTileWide), tileDest.bottom + 1 + offset);
Point pointB = Point::Create(pointA.h + kMiniTileWide, pointA.v);
surface->DrawLine(pointA, pointB);
surface->DrawLine(pointA, pointB, whiteColor);
}
wasTileOver = -1;
@@ -265,6 +264,8 @@ void DragMiniTile (Window *window, DrawSurface *surface, Point mouseIs, short *n
void HiliteTileOver (DrawSurface *surface, Point mouseIs)
{
short newTileOver;
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
PortabilityLayer::ResolveCachingColor redColor = StdColors::Red();
if (tileSrc.Contains(mouseIs))
{
@@ -277,33 +278,27 @@ void HiliteTileOver (DrawSurface *surface, Point mouseIs)
newTileOver = (mouseIs.h - tileSrc.left) / kMiniTileWide;
if (newTileOver != tileOver)
{
surface->SetForeColor(StdColors::Red());
{
const Point tileLineTopLeft = Point::Create(tileSrc.left + (newTileOver * kMiniTileWide), tileSrc.top - 3);
const Point tileLineBottomRight = Point::Create(tileLineTopLeft.h + kMiniTileWide + 1, tileLineTopLeft.v + 2);
surface->FillRect(Rect::Create(tileLineTopLeft.v, tileLineTopLeft.h, tileLineBottomRight.v, tileLineBottomRight.h));
surface->FillRect(Rect::Create(tileLineTopLeft.v, tileLineTopLeft.h, tileLineBottomRight.v, tileLineBottomRight.h), redColor);
}
if (tileOver != -1)
{
surface->SetForeColor(StdColors::White());
{
const Point tileLineTopLeft = Point::Create(tileSrc.left + (tileOver * kMiniTileWide), tileSrc.top - 3);
const Point tileLineBottomRight = Point::Create(tileLineTopLeft.h + kMiniTileWide + 1, tileLineTopLeft.v + 2);
surface->FillRect(Rect::Create(tileLineTopLeft.v, tileLineTopLeft.h, tileLineBottomRight.v, tileLineBottomRight.h));
surface->FillRect(Rect::Create(tileLineTopLeft.v, tileLineTopLeft.h, tileLineBottomRight.v, tileLineBottomRight.h), whiteColor);
}
{
const Point tileLineTopLeft = Point::Create(tileSrc.left + (tileOver * kMiniTileWide), tileSrc.bottom + 1);
const Point tileLineBottomRight = Point::Create(tileLineTopLeft.h + kMiniTileWide + 1, tileLineTopLeft.v + 2);
surface->FillRect(Rect::Create(tileLineTopLeft.v, tileLineTopLeft.h, tileLineBottomRight.v, tileLineBottomRight.h));
surface->FillRect(Rect::Create(tileLineTopLeft.v, tileLineTopLeft.h, tileLineBottomRight.v, tileLineBottomRight.h), whiteColor);
}
}
surface->SetForeColor(StdColors::Black());
tileOver = newTileOver;
}
}
@@ -311,21 +306,18 @@ void HiliteTileOver (DrawSurface *surface, Point mouseIs)
{
if (tileOver != -1)
{
surface->SetForeColor(StdColors::White());
{
const Point tileLineTopLeft = Point::Create(tileSrc.left + (tileOver * kMiniTileWide), tileSrc.top - 3);
const Point tileLineBottomRight = Point::Create(tileLineTopLeft.h + kMiniTileWide + 1, tileLineTopLeft.v + 2);
surface->FillRect(Rect::Create(tileLineTopLeft.v, tileLineTopLeft.h, tileLineBottomRight.v, tileLineBottomRight.h));
surface->FillRect(Rect::Create(tileLineTopLeft.v, tileLineTopLeft.h, tileLineBottomRight.v, tileLineBottomRight.h), whiteColor);
}
{
const Point tileLineTopLeft = Point::Create(tileSrc.left + (tileOver * kMiniTileWide), tileSrc.bottom + 1);
const Point tileLineBottomRight = Point::Create(tileLineTopLeft.h + kMiniTileWide + 1, tileLineTopLeft.v + 2);
surface->FillRect(Rect::Create(tileLineTopLeft.v, tileLineTopLeft.h, tileLineBottomRight.v, tileLineBottomRight.h));
surface->FillRect(Rect::Create(tileLineTopLeft.v, tileLineTopLeft.h, tileLineBottomRight.v, tileLineBottomRight.h), whiteColor);
}
surface->SetForeColor(StdColors::Black());
tileOver = -1;
}
@@ -391,7 +383,7 @@ int16_t RoomFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
if (evt->IsLMouseDownEvent())
{
mouseIs = Point::Create(mouseEvent.m_x, mouseEvent.m_y);
mouseIs -= dial->GetWindow()->TopLeftCoord();
mouseIs -= dial->GetWindow()->GetTopLeftCoord();
if (tileSrc.Contains(mouseIs))
{
if (StillDown())
@@ -444,7 +436,7 @@ void DoRoomInfo(void)
NumToString(thisRoom->numObjects, objectsStr);
DialogTextSubstitutions substitutions(floorStr, suiteStr, objectsStr);
theErr = CreateOffScreenGWorld(&tileSrcMap, &tileSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tileSrcMap, &tileSrcRect);
// CreateOffScreenPixMap(&tileSrcRect, &tileSrcMap);
// SetPort((GrafPtr)tileSrcMap);
if ((tempBack > kStars) && (!PictIDExists(tempBack)))
@@ -465,7 +457,7 @@ void DoRoomInfo(void)
roomInfoDialog = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kRoomInfoDialogID, kPutInFront, &substitutions);
if (roomInfoDialog == nil)
RedAlert(kErrDialogDidntLoad);
SetPort(&roomInfoDialog->GetWindow()->GetDrawSurface()->m_port);
SetPort(roomInfoDialog->GetWindow()->GetDrawSurface());
{
PortabilityLayer::WidgetBasicState state;
@@ -474,7 +466,7 @@ void DoRoomInfo(void)
state.m_resID = kBackgroundsMenuID;
state.m_enabled = true;
PortabilityLayer::PopupMenuWidget *roomPopupWidget = PortabilityLayer::PopupMenuWidget::Create(state);
PortabilityLayer::PopupMenuWidget *roomPopupWidget = PortabilityLayer::PopupMenuWidget::Create(state, nullptr);
roomInfoDialog->ReplaceWidget(kRoomPopupItem - 1, roomPopupWidget);
if (HouseHasOriginalPicts())
@@ -681,7 +673,7 @@ int16_t OriginalArtFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
const GpMouseInputEvent &mouseEvt = evt->m_vosEvent.m_event.m_mouseInputEvent;
mouseIs = Point::Create(mouseEvt.m_x, mouseEvt.m_y);
mouseIs -= dial->GetWindow()->TopLeftCoord();
mouseIs -= dial->GetWindow()->GetTopLeftCoord();
if (leftBound.Contains(mouseIs))
return 7;
else if (topBound.Contains(mouseIs))

View File

@@ -42,7 +42,7 @@ void SaveGame2 (void)
PortabilityLayer::InputManager::GetInstance()->ClearState();
Str255 gameNameStr;
Size byteCount;
size_t byteCount;
houseType *thisHousePtr;
roomType *srcRoom;
savedRoom *destRoom;
@@ -54,7 +54,7 @@ void SaveGame2 (void)
PortabilityLayer::MemoryManager *mm = PortabilityLayer::MemoryManager::GetInstance();
PortabilityLayer::FileManager *fm = PortabilityLayer::FileManager::GetInstance();
FlushEvents(everyEvent, 0);
FlushEvents();
thisHousePtr = *thisHouse;

View File

@@ -10,10 +10,14 @@
#include "PLPasStr.h"
#include "Externs.h"
#include "Environ.h"
#include "FontFamily.h"
#include "MenuManager.h"
#include "PLStandardColors.h"
#include "QDPixMap.h"
#include "QDStandardPalette.h"
#include "RectUtils.h"
#include "RenderedFont.h"
#include "ResolveCachingColor.h"
#define kGrayBackgroundColor 251
@@ -56,7 +60,7 @@ extern Boolean evenFrame, onePlayerLeft;
void MarkScoreboardPortDirty(void)
{
GetWindowPort(boardWindow)->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
boardWindow->GetDrawSurface()->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
}
//-------------------------------------------------------------- RefreshScoreboard
@@ -71,7 +75,7 @@ void RefreshScoreboard (SInt16 mode)
RefreshPoints();
CopyBits((BitMap *)*GetGWorldPixMap(boardSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
&boardSrcRect, &boardDestRect, srcCopy);
MarkScoreboardPortDirty();
@@ -153,48 +157,44 @@ void RefreshRoomTitle (short mode)
{
DrawSurface *surface = boardTSrcMap;
PortabilityLayer::RGBAColor theRGBColor, wasColor;
PortabilityLayer::ResolveCachingColor theRGBColor = PortabilityLayer::ResolveCachingColor::FromStandardColor(kGrayBackgroundColor);
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
wasColor = surface->GetForeColor();
theRGBColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[kGrayBackgroundColor];
surface->SetForeColor(theRGBColor);
surface->FillRect(boardTSrcRect);
surface->SetForeColor(wasColor);
surface->FillRect(boardTSrcRect, theRGBColor);
const Point strShadowPoint = Point::Create(1, 10);
const Point strPoint = Point::Create(0, 9);
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
switch (mode)
{
case kEscapedTitleMode:
surface->DrawString(strShadowPoint, PSTR("Hit Delete key if unable to Follow"), true);
surface->DrawString(strShadowPoint, PSTR("Hit Delete key if unable to Follow"), blackColor, appFont);
break;
case kSavingTitleMode:
surface->DrawString(strShadowPoint, PSTR("Saving Game<6D>"), true);
surface->DrawString(strShadowPoint, PSTR("Saving Game<6D>"), blackColor, appFont);
break;
default:
surface->DrawString(strShadowPoint, thisRoom->name, true);
surface->DrawString(strShadowPoint, thisRoom->name, blackColor, appFont);
break;
}
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 255, 255));
switch (mode)
{
case kEscapedTitleMode:
surface->DrawString(strPoint, PSTR("Hit Delete key if unable to Follow"), true);
surface->DrawString(strPoint, PSTR("Hit Delete key if unable to Follow"), whiteColor, appFont);
break;
case kSavingTitleMode:
surface->DrawString(strPoint, PSTR("Saving Game<6D>"), true);
surface->DrawString(strPoint, PSTR("Saving Game<6D>"), whiteColor, appFont);
break;
default:
surface->DrawString(strPoint, thisRoom->name, true);
surface->DrawString(strPoint, thisRoom->name, whiteColor, appFont);
break;
}
@@ -207,16 +207,17 @@ void RefreshRoomTitle (short mode)
void RefreshNumGliders (void)
{
PortabilityLayer::RGBAColor theRGBColor, wasColor;
Str255 nGlidersStr;
long displayMortals;
DrawSurface *surface = boardGSrcMap;
theRGBColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[kGrayBackgroundColor];
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
wasColor = surface->GetForeColor();
surface->SetForeColor(theRGBColor);
surface->FillRect(boardGSrcRect);
PortabilityLayer::ResolveCachingColor theRGBColor = PortabilityLayer::ResolveCachingColor::FromStandardColor(kGrayBackgroundColor);
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
surface->FillRect(boardGSrcRect, theRGBColor);
displayMortals = mortals;
if (displayMortals < 0)
@@ -226,11 +227,8 @@ void RefreshNumGliders (void)
const Point shadowPoint = Point::Create(1, 10);
const Point textPoint = Point::Create(0, 9);
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
surface->DrawString(shadowPoint, nGlidersStr, true);
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 255, 255));
surface->DrawString(textPoint, nGlidersStr, true);
surface->DrawString(shadowPoint, nGlidersStr, blackColor, appFont);
surface->DrawString(textPoint, nGlidersStr, whiteColor, appFont);
CopyBits((BitMap *)*GetGWorldPixMap(boardGSrcMap),
(BitMap *)*GetGWorldPixMap(boardSrcMap),
@@ -241,25 +239,24 @@ void RefreshNumGliders (void)
void RefreshPoints (void)
{
PortabilityLayer::RGBAColor theRGBColor, wasColor;
Str255 scoreStr;
DrawSurface *surface = boardPSrcMap;
theRGBColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[kGrayBackgroundColor];
PortabilityLayer::ResolveCachingColor theRGBColor = PortabilityLayer::ResolveCachingColor::FromStandardColor(kGrayBackgroundColor);
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
surface->SetForeColor(theRGBColor);
surface->FillRect(boardPSrcRect);
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
surface->FillRect(boardPSrcRect, theRGBColor);
NumToString(theScore, scoreStr);
const Point shadowPoint = Point::Create(1, 10);
const Point textPoint = Point::Create(0, 9);
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
surface->DrawString(shadowPoint, scoreStr, true);
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 255, 255));
surface->DrawString(textPoint, scoreStr, true);
surface->DrawString(shadowPoint, scoreStr, blackColor, appFont);
surface->DrawString(textPoint, scoreStr, whiteColor, appFont);
CopyBits((BitMap *)*GetGWorldPixMap(boardPSrcMap),
(BitMap *)*GetGWorldPixMap(boardSrcMap),
@@ -272,28 +269,27 @@ void RefreshPoints (void)
void QuickGlidersRefresh (void)
{
PortabilityLayer::RGBAColor theRGBColor, wasColor;
Str255 nGlidersStr;
DrawSurface *surface = boardGSrcMap;
theRGBColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[kGrayBackgroundColor];
PortabilityLayer::ResolveCachingColor theRGBColor = PortabilityLayer::ResolveCachingColor::FromStandardColor(kGrayBackgroundColor);
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
surface->SetForeColor(theRGBColor);
surface->FillRect(boardGSrcRect);
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
surface->FillRect(boardGSrcRect, theRGBColor);
NumToString((long)mortals, nGlidersStr);
const Point shadowPoint = Point::Create(1, 10);
const Point textPoint = Point::Create(0, 9);
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
surface->DrawString(shadowPoint, nGlidersStr, true);
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 255, 255));
surface->DrawString(textPoint, nGlidersStr, true);
surface->DrawString(shadowPoint, nGlidersStr, blackColor, appFont);
surface->DrawString(textPoint, nGlidersStr, whiteColor, appFont);
CopyBits((BitMap *)*GetGWorldPixMap(boardGSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
&boardGSrcRect, &boardGQDestRect, srcCopy);
MarkScoreboardPortDirty();
@@ -303,27 +299,27 @@ void QuickGlidersRefresh (void)
void QuickScoreRefresh (void)
{
PortabilityLayer::RGBAColor theRGBColor, wasColor;
Str255 scoreStr;
DrawSurface *surface = boardPSrcMap;
theRGBColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[kGrayBackgroundColor];
surface->SetForeColor(theRGBColor);
surface->FillRect(boardPSrcRect);
PortabilityLayer::ResolveCachingColor theRGBColor = PortabilityLayer::ResolveCachingColor::FromStandardColor(kGrayBackgroundColor);
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
surface->FillRect(boardPSrcRect, theRGBColor);
NumToString(displayedScore, scoreStr);
const Point shadowPoint = Point::Create(1, 10);
const Point textPoint = Point::Create(0, 9);
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
surface->DrawString(shadowPoint, scoreStr, true);
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 255, 255));
surface->DrawString(textPoint, scoreStr, true);
surface->DrawString(shadowPoint, scoreStr, blackColor, appFont);
surface->DrawString(textPoint, scoreStr, whiteColor, appFont);
CopyBits((BitMap *)*GetGWorldPixMap(boardPSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
&boardPSrcRect, &boardPQDestRect, srcCopy);
MarkScoreboardPortDirty();
@@ -336,7 +332,7 @@ void QuickBatteryRefresh (Boolean flash)
if ((batteryTotal > 0) && (!flash))
{
CopyBits((BitMap *)*GetGWorldPixMap(badgeSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
&badgesBadgesRects[kBatteryBadge],
&badgesDestRects[kBatteryBadge],
srcCopy);
@@ -344,7 +340,7 @@ void QuickBatteryRefresh (Boolean flash)
else if ((batteryTotal < 0) && (!flash))
{
CopyBits((BitMap *)*GetGWorldPixMap(badgeSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
&badgesBadgesRects[kHeliumBadge],
&badgesDestRects[kHeliumBadge],
srcCopy);
@@ -352,7 +348,7 @@ void QuickBatteryRefresh (Boolean flash)
else
{
CopyBits((BitMap *)*GetGWorldPixMap(badgeSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
&badgesBlankRects[kBatteryBadge],
&badgesDestRects[kBatteryBadge],
srcCopy);
@@ -368,7 +364,7 @@ void QuickBandsRefresh (Boolean flash)
if ((bandsTotal > 0) && (!flash))
{
CopyBits((BitMap *)*GetGWorldPixMap(badgeSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
&badgesBadgesRects[kBandsBadge],
&badgesDestRects[kBandsBadge],
srcCopy);
@@ -376,7 +372,7 @@ void QuickBandsRefresh (Boolean flash)
else
{
CopyBits((BitMap *)*GetGWorldPixMap(badgeSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
&badgesBlankRects[kBandsBadge],
&badgesDestRects[kBandsBadge],
srcCopy);
@@ -392,7 +388,7 @@ void QuickFoilRefresh (Boolean flash)
if ((foilTotal > 0) && (!flash))
{
CopyBits((BitMap *)*GetGWorldPixMap(badgeSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
&badgesBadgesRects[kFoilBadge],
&badgesDestRects[kFoilBadge],
srcCopy);
@@ -400,7 +396,7 @@ void QuickFoilRefresh (Boolean flash)
else
{
CopyBits((BitMap *)*GetGWorldPixMap(badgeSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
&badgesBlankRects[kFoilBadge],
&badgesDestRects[kFoilBadge],
srcCopy);

View File

@@ -17,10 +17,12 @@
#include "FileManager.h"
#include "House.h"
#include "RectUtils.h"
#include "ResolveCachingColor.h"
#include "ResourceFile.h"
#include "ResourceManager.h"
#include "PLTimeTaggedVOSEvent.h"
#include "VirtualDirectory.h"
#include "WindowManager.h"
#define kLoadHouseDialogID 1000
@@ -156,9 +158,8 @@ void PageUpHouses (Dialog *theDial)
QSetRect(&tempRect, 8, 39, 421, 223);
surface->SetForeColor(StdColors::White());
surface->FillRect(tempRect);
surface->SetForeColor(StdColors::Black());
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
surface->FillRect(tempRect, whiteColor);
UpdateLoadDialog(theDial);
}
@@ -190,9 +191,8 @@ void PageDownHouses (Dialog *theDial)
}
QSetRect(&tempRect, 8, 39, 421, 223);
surface->SetForeColor(StdColors::White());
surface->FillRect(tempRect);
surface->SetForeColor(StdColors::Black());
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
surface->FillRect(tempRect, whiteColor);
UpdateLoadDialog(theDial);
}
@@ -343,6 +343,8 @@ void DoLoadHouse (void)
Dialog *theDial;
short i, wasIndex, screenCount;
Boolean leaving, whoCares;
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
BringUpDialog(&theDial, kLoadHouseDialogID, nullptr);
@@ -389,6 +391,9 @@ void DoLoadHouse (void)
leaving = false;
Window *exclWindow = theDial->GetWindow();
wm->SwapExclusiveWindow(exclWindow); // Push exclusive window
UpdateLoadDialog(theDial);
while (!leaving)
@@ -496,6 +501,8 @@ void DoLoadHouse (void)
UpdateLoadDialog(theDial);
}
wm->SwapExclusiveWindow(exclWindow); // Pop exclusive window
theDial->Destroy();
}
#endif

View File

@@ -9,14 +9,15 @@
#include "PLKeyEncoding.h"
#include "PLSound.h"
#include "PLStandardColors.h"
#include "PLTextUtils.h"
#include "PLTimeTaggedVOSEvent.h"
#include "PLWidgets.h"
#include "ResolveCachingColor.h"
#include "DialogManager.h"
#include "DialogUtils.h"
#include "Externs.h"
#include "Environ.h"
#include "House.h"
#include "WindowManager.h"
#define kMainPrefsDialID 1012
@@ -33,12 +34,12 @@
#define kDisplay9Item 5
#define kBorder1Item 8
#define kDoColorFadeItem 9
//#define kCurrentDepth 10
#define k32BitColorItem 10
//#define k256Depth 11
//#define k16Depth 12
#define kBorder2Item 10
#define kBorder3Item 11
#define kDispDefault 12
#define kBorder2Item 11
#define kBorder3Item 12
#define kDispDefault 13
//#define kUseQDItem 13
//#define kUseScreen2Item 14
#define kSofterItem 4
@@ -347,27 +348,26 @@ void UpdateSettingsControl (Dialog *theDialog)
{
short i;
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 255, 255));
for (i = 0; i < 4; i++)
{
Rect rect = controlRects[i];
surface->FrameRect(rect);
surface->FrameRect(rect, whiteColor);
InsetRect(&rect, 1, 1);
surface->FrameRect(rect);
surface->FrameRect(rect, whiteColor);
}
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 0, 0, 255));
PortabilityLayer::ResolveCachingColor redColor = StdColors::Red();
{
Rect rect = controlRects[whichCtrl];
surface->FrameRect(rect);
surface->FrameRect(rect, redColor);
InsetRect(&rect, 1, 1);
surface->FrameRect(rect);
surface->FrameRect(rect, redColor);
}
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
UpdateControlKeyName(theDialog);
FrameDialogItemC(theDialog, 3, kRedOrangeColor8);
}
@@ -493,7 +493,7 @@ void DoControlPrefs (void)
prefDlg = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kControlPrefsDialID, kPutInFront, nullptr);
if (prefDlg == nil)
RedAlert(kErrDialogDidntLoad);
SetGraphicsPort(&prefDlg->GetWindow()->m_surface);
SetGraphicsPort(prefDlg->GetWindow()->GetDrawSurface());
for (i = 0; i < 4; i++)
{
GetDialogItemRect(prefDlg, i + kRightControl, &controlRects[i]);
@@ -554,18 +554,20 @@ void DoControlPrefs (void)
{
Rect ctrlRect = controlRects[whichCtrl];
surface->SetForeColor(StdColors::White());
surface->FrameRect(ctrlRect);
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
surface->FrameRect(ctrlRect, whiteColor);
InsetRect(&ctrlRect, 1, 1);
surface->FrameRect(ctrlRect);
surface->FrameRect(ctrlRect, whiteColor);
whichCtrl = itemHit - kRightControl;
ctrlRect = controlRects[whichCtrl];
surface->SetForeColor(StdColors::Red());
surface->FrameRect(ctrlRect);
PortabilityLayer::ResolveCachingColor redColor = StdColors::Red();
surface->FrameRect(ctrlRect, redColor);
InsetRect(&ctrlRect, 1, 1);
surface->FrameRect(ctrlRect);
surface->FrameRect(ctrlRect, redColor);
}
UpdateControlKeyName(prefDlg);
@@ -725,6 +727,8 @@ void DoSoundPrefs (void)
PLError_t theErr;
short itemHit;
Boolean leaving;
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
BringUpDialog(&prefDlg, kSoundPrefsDialID, nullptr);
@@ -740,6 +744,9 @@ void DoSoundPrefs (void)
SetDialogItemValue(prefDlg, kPlayMusicItem, (short)wasPlay);
leaving = false;
Window *exclStack = prefDlg->GetWindow();
wm->SwapExclusiveWindow(exclStack); // Push exclusive window
while (!leaving)
{
itemHit = prefDlg->ExecuteModal(SoundFilter);
@@ -843,6 +850,8 @@ void DoSoundPrefs (void)
}
}
wm->SwapExclusiveWindow(exclStack); // Pop exclusive window
prefDlg->Destroy();
}
@@ -879,15 +888,15 @@ void FrameDisplayIcon (Dialog *theDialog, const PortabilityLayer::RGBAColor &col
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
surface->SetForeColor(color);
PortabilityLayer::ResolveCachingColor cacheColor = color;
theRect.left -= 3;
theRect.top += 0;
theRect.right += 3;
theRect.bottom -= 1;
surface->FrameRect(theRect);
surface->FrameRect(theRect, cacheColor);
InsetRect(&theRect, 1, 1);
surface->FrameRect(theRect);
surface->FrameRect(theRect, cacheColor);
}
//-------------------------------------------------------------- DisplayUpdate
@@ -897,10 +906,9 @@ void DisplayUpdate (Dialog *theDialog)
DrawDefaultButton(theDialog);
SetDialogItemValue(theDialog, kDoColorFadeItem, (short)wasFade);
SetDialogItemValue(theDialog, k32BitColorItem, wasDepthPref == 32);
ForeColor(redColor);
FrameDisplayIcon(theDialog, StdColors::Red());
ForeColor(blackColor);
FrameDialogItemC(theDialog, kBorder1Item, kRedOrangeColor8);
FrameDialogItemC(theDialog, kBorder2Item, kRedOrangeColor8);
FrameDialogItemC(theDialog, kBorder3Item, kRedOrangeColor8);
@@ -994,9 +1002,6 @@ void DoDisplayPrefs (void)
BringUpDialog(&prefDlg, kDisplayPrefsDialID, nullptr);
if (!thisMac.can8Bit)
MyDisableControl(prefDlg, kDoColorFadeItem);
wasNeighbors = numNeighbors;
wasFade = isDoColorFade;
wasDepthPref = isDepthPref;
@@ -1053,9 +1058,16 @@ void DoDisplayPrefs (void)
SetDialogItemValue(prefDlg, kDoColorFadeItem, (short)wasFade);
break;
case k32BitColorItem:
if (wasDepthPref == 32)
wasDepthPref = 8;
else
wasDepthPref = 32;
SetDialogItemValue(prefDlg, k32BitColorItem, wasDepthPref == 32);
break;
case kDispDefault:
FrameDisplayIcon(prefDlg, StdColors::White());
ForeColor(blackColor);
DisplayDefaults();
DisplayUpdate(prefDlg);
break;
@@ -1197,7 +1209,7 @@ int16_t PrefsFilter (Dialog *dial, const TimeTaggedVOSEvent *evt)
const Window *window = dial->GetWindow();
const GpMouseInputEvent &mouseEvent = evt->m_vosEvent.m_event.m_mouseInputEvent;
const Point testPt = Point::Create(mouseEvent.m_x - window->m_wmX, mouseEvent.m_y - window->m_wmY);
const Point testPt = window->MouseToLocal(evt->m_vosEvent.m_event.m_mouseInputEvent);
int16_t hitCode = -1;
@@ -1238,6 +1250,10 @@ void DoSettingsMain (void)
leaving = false;
nextRestartChange = false;
Window* exclWindow = prefDlg->GetWindow();
PortabilityLayer::WindowManager::GetInstance()->SwapExclusiveWindow(exclWindow); // Push exclusive window
while (!leaving)
{
@@ -1252,20 +1268,20 @@ void DoSettingsMain (void)
case kDisplayButton:
FlashSettingsButton(surface, 0);
DoDisplayPrefs();
SetGraphicsPort(&prefDlg->GetWindow()->m_surface);
SetGraphicsPort(prefDlg->GetWindow()->GetDrawSurface());
break;
case kSoundButton:
FlashSettingsButton(surface, 1);
DoSoundPrefs();
SetGraphicsPort(&prefDlg->GetWindow()->m_surface);
FlushEvents(everyEvent, 0);
SetGraphicsPort(prefDlg->GetWindow()->GetDrawSurface());
FlushEvents();
break;
case kControlsButton:
FlashSettingsButton(surface, 2);
DoControlPrefs();
SetGraphicsPort(&prefDlg->GetWindow()->m_surface);
SetGraphicsPort(prefDlg->GetWindow()->GetDrawSurface());
break;
case kBrainsButton:
@@ -1277,7 +1293,7 @@ void DoSettingsMain (void)
}
FlashSettingsButton(surface, 3);
DoBrainsPrefs();
SetGraphicsPort(&prefDlg->GetWindow()->m_surface);
SetGraphicsPort(prefDlg->GetWindow()->GetDrawSurface());
break;
case kAllDefaultsButton:
@@ -1285,7 +1301,9 @@ void DoSettingsMain (void)
break;
}
}
PortabilityLayer::WindowManager::GetInstance()->SwapExclusiveWindow(exclWindow); // Pop exclusive window
prefDlg->Destroy();
if (nextRestartChange)

View File

@@ -7,6 +7,7 @@
#include "PLPasStr.h"
#include "Externs.h"
#include "RenderedFont.h"
#include <string.h>
@@ -275,17 +276,17 @@ void GetFirstWordOfString (StringPtr stringIn, StringPtr stringOut)
// font. If the text would exceed our width limit, characters<72>
// are dropped off the end of the string and "<22>" appended.
void CollapseStringToWidth (DrawSurface *surface, StringPtr theStr, short wide)
void CollapseStringToWidth (PortabilityLayer::RenderedFont *font, StringPtr theStr, short wide)
{
short dotsWide;
Boolean tooWide;
dotsWide = surface->MeasureString(PSTR("<EFBFBD>"));
tooWide = surface->MeasureString(theStr) > wide;
while (tooWide)
dotsWide = font->MeasurePStr(PSTR("<EFBFBD>"));
tooWide = font->MeasurePStr(theStr) > wide;
while (tooWide && theStr[0] > 0)
{
theStr[0]--;
tooWide = ((surface->MeasureString(theStr) + dotsWide) > wide);
tooWide = ((font->MeasurePStr(theStr) + dotsWide) > wide);
if (!tooWide)
PasStringConcat(theStr, PSTR("<EFBFBD>"));
}

View File

@@ -73,7 +73,7 @@ void InitScoreboardMap(void)
boardSrcRect = houseRect;
ZeroRectCorner(&boardSrcRect);
boardSrcRect.bottom = kScoreboardTall;
theErr = CreateOffScreenGWorld(&boardSrcMap, &boardSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&boardSrcMap, &boardSrcRect);
if (boardSrcRect.right >= 640)
hOffset = (RectWide(&boardSrcRect) - kMaxViewWidth) / 2;
@@ -91,7 +91,7 @@ void InitScoreboardMap(void)
QSetRect(&badgeSrcRect, 0, 0, 32, 66); // 2144 pixels
if (!badgeSrcMap)
{
theErr = CreateOffScreenGWorld(&badgeSrcMap, &badgeSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&badgeSrcMap, &badgeSrcRect);
LoadGraphic(badgeSrcMap, kBadgePictID);
}
@@ -104,8 +104,7 @@ void InitScoreboardMap(void)
QSetRect(&boardTSrcRect, 0, 0, 256, 12); // room title
if (!boardTSrcMap)
{
theErr = CreateOffScreenGWorld(&boardTSrcMap, &boardTSrcRect, kPreferredPixelFormat);
boardTSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
theErr = CreateOffScreenGWorld(&boardTSrcMap, &boardTSrcRect);
}
boardTDestRect = boardTSrcRect;
QOffsetRect(&boardTDestRect, 137 + hOffset, 5);
@@ -113,8 +112,7 @@ void InitScoreboardMap(void)
QSetRect(&boardGSrcRect, 0, 0, 20, 10); // # gliders
if (!boardGSrcMap)
{
theErr = CreateOffScreenGWorld(&boardGSrcMap, &boardGSrcRect, kPreferredPixelFormat);
boardGSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
theErr = CreateOffScreenGWorld(&boardGSrcMap, &boardGSrcRect);
}
boardGDestRect = boardGSrcRect;
QOffsetRect(&boardGDestRect, 526 + hOffset, 5);
@@ -123,8 +121,7 @@ void InitScoreboardMap(void)
QSetRect(&boardPSrcRect, 0, 0, 64, 10); // points
if (!boardPSrcMap)
{
theErr = CreateOffScreenGWorld(&boardPSrcMap, &boardPSrcRect, kPreferredPixelFormat);
boardPSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
theErr = CreateOffScreenGWorld(&boardPSrcMap, &boardPSrcRect);
}
boardPDestRect = boardPSrcRect;
QOffsetRect(&boardPDestRect, 570 + hOffset, 5); // total = 6396 pixels
@@ -169,13 +166,13 @@ void InitGliderMap (void)
short i;
QSetRect(&glidSrcRect, 0, 0, kGliderWide, 668); // 32112 pixels
theErr = CreateOffScreenGWorld(&glidSrcMap, &glidSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&glidSrcMap, &glidSrcRect);
LoadGraphic(glidSrcMap, kGliderPictID);
theErr = CreateOffScreenGWorld(&glid2SrcMap, &glidSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&glid2SrcMap, &glidSrcRect);
LoadGraphic(glid2SrcMap, kGlider2PictID);
theErr = CreateOffScreenGWorld(&glidMaskMap, &glidSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&glidMaskMap, &glidSrcRect, GpPixelFormats::kBW1);
LoadGraphic(glidMaskMap, kGliderPictID + 1000);
for (i = 0; i <= 20; i++)
@@ -195,10 +192,10 @@ void InitGliderMap (void)
QOffsetRect(&gliderSrc[30], 0, 648);
QSetRect(&shadowSrcRect, 0, 0, kGliderWide, kShadowHigh * kNumShadowSrcRects);
theErr = CreateOffScreenGWorld(&shadowSrcMap, &shadowSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&shadowSrcMap, &shadowSrcRect);
LoadGraphic(shadowSrcMap, kShadowPictID);
theErr = CreateOffScreenGWorld(&shadowMaskMap, &shadowSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&shadowMaskMap, &shadowSrcRect, GpPixelFormats::kBW1);
LoadGraphic(shadowMaskMap, kShadowPictID + 1000);
for (i = 0; i < kNumShadowSrcRects; i++)
@@ -208,10 +205,10 @@ void InitGliderMap (void)
}
QSetRect(&bandsSrcRect, 0, 0, 16, 18); // 304 pixels
theErr = CreateOffScreenGWorld(&bandsSrcMap, &bandsSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&bandsSrcMap, &bandsSrcRect);
LoadGraphic(bandsSrcMap, kRubberBandsPictID);
theErr = CreateOffScreenGWorld(&bandsMaskMap, &bandsSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&bandsMaskMap, &bandsSrcRect, GpPixelFormats::kBW1);
LoadGraphic(bandsMaskMap, kRubberBandsPictID + 1000);
for (i = 0; i < 3; i++)
@@ -231,10 +228,10 @@ void InitBlowers (void)
PLError_t theErr;
QSetRect(&blowerSrcRect, 0, 0, 48, 402); // 19344 pixels
theErr = CreateOffScreenGWorld(&blowerSrcMap, &blowerSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&blowerSrcMap, &blowerSrcRect);
LoadGraphic(blowerSrcMap, kBlowerPictID);
theErr = CreateOffScreenGWorld(&blowerMaskMap, &blowerSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&blowerMaskMap, &blowerSrcRect, GpPixelFormats::kBW1);
LoadGraphic(blowerMaskMap, kBlowerPictID + 1000);
for (i = 0; i < kNumCandleFlames; i++)
@@ -274,10 +271,10 @@ void InitFurniture (void)
wasCPort = GetGraphicsPort();
QSetRect(&furnitureSrcRect, 0, 0, 64, 278); // 17856 pixels
theErr = CreateOffScreenGWorld(&furnitureSrcMap, &furnitureSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&furnitureSrcMap, &furnitureSrcRect);
LoadGraphic(furnitureSrcMap, kFurniturePictID);
theErr = CreateOffScreenGWorld(&furnitureMaskMap, &furnitureSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&furnitureMaskMap, &furnitureSrcRect, GpPixelFormats::kBW1);
LoadGraphic(furnitureMaskMap, kFurniturePictID + 1000);
QSetRect(&tableSrc, 0, 0, 64, 22);
@@ -317,10 +314,10 @@ void InitPrizes (void)
PLError_t theErr;
QSetRect(&bonusSrcRect, 0, 0, 88, 378); // 33264 pixels
theErr = CreateOffScreenGWorld(&bonusSrcMap, &bonusSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&bonusSrcMap, &bonusSrcRect);
LoadGraphic(bonusSrcMap, kBonusPictID);
theErr = CreateOffScreenGWorld(&bonusMaskMap, &bonusSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&bonusMaskMap, &bonusSrcRect, GpPixelFormats::kBW1);
LoadGraphic(bonusMaskMap, kBonusPictID + 1000);
for (i = 0; i < 11; i++)
@@ -368,10 +365,10 @@ void InitPrizes (void)
sparkleSrc[1] = sparkleSrc[3];
QSetRect(&pointsSrcRect, 0, 0, 24, 120); // 2880 pixels
theErr = CreateOffScreenGWorld(&pointsSrcMap, &pointsSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&pointsSrcMap, &pointsSrcRect);
LoadGraphic(pointsSrcMap, kPointsPictID);
theErr = CreateOffScreenGWorld(&pointsMaskMap, &pointsSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&pointsMaskMap, &pointsSrcRect, GpPixelFormats::kBW1);
LoadGraphic(pointsMaskMap, kPointsPictID + 1000);
for (i = 0; i < 15; i++)
@@ -390,10 +387,10 @@ void InitTransports (void)
PLError_t theErr;
QSetRect(&transSrcRect, 0, 0, 56, 32); // 1848 pixels
theErr = CreateOffScreenGWorld(&transSrcMap, &transSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&transSrcMap, &transSrcRect);
LoadGraphic(transSrcMap, kTransportPictID);
theErr = CreateOffScreenGWorld(&transMaskMap, &transSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&transMaskMap, &transSrcRect, GpPixelFormats::kBW1);
LoadGraphic(transMaskMap, kTransportPictID + 1000);
}
@@ -406,7 +403,7 @@ void InitSwitches (void)
PLError_t theErr;
QSetRect(&switchSrcRect, 0, 0, 32, 104); // 3360 pixels
theErr = CreateOffScreenGWorld(&switchSrcMap, &switchSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&switchSrcMap, &switchSrcRect);
LoadGraphic(switchSrcMap, kSwitchPictID);
QSetRect(&lightSwitchSrc[0], 0, 0, 15, 24);
@@ -445,10 +442,10 @@ void InitLights (void)
PLError_t theErr;
QSetRect(&lightSrcRect, 0, 0, 72, 126); // 9144 pixels
theErr = CreateOffScreenGWorld(&lightSrcMap, &lightSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&lightSrcMap, &lightSrcRect);
LoadGraphic(lightSrcMap, kLightPictID);
theErr = CreateOffScreenGWorld(&lightMaskMap, &lightSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&lightMaskMap, &lightSrcRect, GpPixelFormats::kBW1);
LoadGraphic(lightMaskMap, kLightPictID + 1000);
QSetRect(&flourescentSrc1, 0, 0, 16, 12);
@@ -474,24 +471,24 @@ void InitAppliances (void)
PLError_t theErr;
QSetRect(&applianceSrcRect, 0, 0, 80, 269); // 21600 pixels
theErr = CreateOffScreenGWorld(&applianceSrcMap, &applianceSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&applianceSrcMap, &applianceSrcRect);
LoadGraphic(applianceSrcMap, kAppliancePictID);
theErr = CreateOffScreenGWorld(&applianceMaskMap, &applianceSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&applianceMaskMap, &applianceSrcRect, GpPixelFormats::kBW1);
LoadGraphic(applianceMaskMap, kAppliancePictID + 1000);
QSetRect(&toastSrcRect, 0, 0, 32, 174); // 5600 pixels
theErr = CreateOffScreenGWorld(&toastSrcMap, &toastSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&toastSrcMap, &toastSrcRect);
LoadGraphic(toastSrcMap, kToastPictID);
theErr = CreateOffScreenGWorld(&toastMaskMap, &toastSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&toastMaskMap, &toastSrcRect, GpPixelFormats::kBW1);
LoadGraphic(toastMaskMap, kToastPictID + 1000);
QSetRect(&shredSrcRect, 0, 0, 40, 35); // 1440 pixels
theErr = CreateOffScreenGWorld(&shredSrcMap, &shredSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&shredSrcMap, &shredSrcRect);
LoadGraphic(shredSrcMap, kShreddedPictID);
theErr = CreateOffScreenGWorld(&shredMaskMap, &shredSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&shredMaskMap, &shredSrcRect, GpPixelFormats::kBW1);
LoadGraphic(shredMaskMap, kShreddedPictID + 1000);
QSetRect(&plusScreen1, 0, 0, 32, 22);
@@ -547,52 +544,52 @@ void InitEnemies (void)
PLError_t theErr;
QSetRect(&balloonSrcRect, 0, 0, 24, 30 * kNumBalloonFrames);
theErr = CreateOffScreenGWorld(&balloonSrcMap, &balloonSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&balloonSrcMap, &balloonSrcRect);
LoadGraphic(balloonSrcMap, kBalloonPictID);
theErr = CreateOffScreenGWorld(&balloonMaskMap, &balloonSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&balloonMaskMap, &balloonSrcRect, GpPixelFormats::kBW1);
LoadGraphic(balloonMaskMap, kBalloonPictID + 1000);
QSetRect(&copterSrcRect, 0, 0, 32, 30 * kNumCopterFrames);
theErr = CreateOffScreenGWorld(&copterSrcMap, &copterSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&copterSrcMap, &copterSrcRect);
LoadGraphic(copterSrcMap, kCopterPictID);
theErr = CreateOffScreenGWorld(&copterMaskMap, &copterSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&copterMaskMap, &copterSrcRect, GpPixelFormats::kBW1);
LoadGraphic(copterMaskMap, kCopterPictID + 1000);
QSetRect(&dartSrcRect, 0, 0, 64, 19 * kNumDartFrames);
theErr = CreateOffScreenGWorld(&dartSrcMap, &dartSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&dartSrcMap, &dartSrcRect);
LoadGraphic(dartSrcMap, kDartPictID);
theErr = CreateOffScreenGWorld(&dartMaskMap, &dartSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&dartMaskMap, &dartSrcRect, GpPixelFormats::kBW1);
LoadGraphic(dartMaskMap, kDartPictID + 1000);
QSetRect(&ballSrcRect, 0, 0, 32, 32 * kNumBallFrames);
theErr = CreateOffScreenGWorld(&ballSrcMap, &ballSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&ballSrcMap, &ballSrcRect);
LoadGraphic(ballSrcMap, kBallPictID);
theErr = CreateOffScreenGWorld(&ballMaskMap, &ballSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&ballMaskMap, &ballSrcRect, GpPixelFormats::kBW1);
LoadGraphic(ballMaskMap, kBallPictID + 1000);
QSetRect(&dripSrcRect, 0, 0, 16, 12 * kNumDripFrames);
theErr = CreateOffScreenGWorld(&dripSrcMap, &dripSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&dripSrcMap, &dripSrcRect);
LoadGraphic(dripSrcMap, kDripPictID);
theErr = CreateOffScreenGWorld(&dripMaskMap, &dripSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&dripMaskMap, &dripSrcRect, GpPixelFormats::kBW1);
LoadGraphic(dripMaskMap, kDripPictID + 1000);
QSetRect(&enemySrcRect, 0, 0, 36, 33);
theErr = CreateOffScreenGWorld(&enemySrcMap, &enemySrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&enemySrcMap, &enemySrcRect);
LoadGraphic(enemySrcMap, kEnemyPictID);
theErr = CreateOffScreenGWorld(&enemyMaskMap, &enemySrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&enemyMaskMap, &enemySrcRect, GpPixelFormats::kBW1);
LoadGraphic(enemyMaskMap, kEnemyPictID + 1000);
QSetRect(&fishSrcRect, 0, 0, 16, 16 * kNumFishFrames);
theErr = CreateOffScreenGWorld(&fishSrcMap, &fishSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&fishSrcMap, &fishSrcRect);
LoadGraphic(fishSrcMap, kFishPictID);
theErr = CreateOffScreenGWorld(&fishMaskMap, &fishSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&fishMaskMap, &fishSrcRect, GpPixelFormats::kBW1);
LoadGraphic(fishMaskMap, kFishPictID + 1000);
for (i = 0; i < kNumBalloonFrames; i++)

View File

@@ -57,10 +57,10 @@ void InitClutter (void)
PLError_t theErr;
QSetRect(&clutterSrcRect, 0, 0, 128, 69);
theErr = CreateOffScreenGWorld(&clutterSrcMap, &clutterSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&clutterSrcMap, &clutterSrcRect);
LoadGraphic(clutterSrcMap, kClutterPictID);
theErr = CreateOffScreenGWorld(&clutterMaskMap, &clutterSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&clutterMaskMap, &clutterSrcRect, GpPixelFormats::kBW1);
LoadGraphic(clutterMaskMap, kClutterPictID + 1000);
QSetRect(&flowerSrc[0], 0, 0, 10, 28);
@@ -92,7 +92,7 @@ void InitSupport (void)
PLError_t theErr;
QSetRect(&suppSrcRect, 0, 0, kRoomWide, kFloorSupportTall); // 44
theErr = CreateOffScreenGWorld(&suppSrcMap, &suppSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&suppSrcMap, &suppSrcRect);
LoadGraphic(suppSrcMap, kSupportPictID);
}
@@ -106,10 +106,10 @@ void InitAngel (void)
PLError_t theErr;
QSetRect(&angelSrcRect, 0, 0, 96, 44);
theErr = CreateOffScreenGWorld(&angelSrcMap, &angelSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&angelSrcMap, &angelSrcRect);
LoadGraphic(angelSrcMap, kAngelPictID);
theErr = CreateOffScreenGWorld(&angelMaskMap, &angelSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&angelMaskMap, &angelSrcRect, GpPixelFormats::kBW1);
LoadGraphic(angelMaskMap, kAngelPictID + 1);
}
@@ -132,11 +132,11 @@ PLError_t RecreateOffscreens(void)
workSrcRect = houseRect; // Set up work map
ZeroRectCorner(&workSrcRect);
theErr = CreateOffScreenGWorld(&workSrcMap, &workSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&workSrcMap, &workSrcRect);
backSrcRect = houseRect; // Set up background map
ZeroRectCorner(&backSrcRect);
theErr = CreateOffScreenGWorld(&backSrcMap, &backSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&backSrcMap, &backSrcRect);
return PLErrors::kNone;
}

View File

@@ -5,7 +5,6 @@
//============================================================================
#include "PLTextUtils.h"
#include "PLControlDefinitions.h"
#include "PLPasStr.h"
#include "PLStandardColors.h"
@@ -16,6 +15,7 @@
#include "PLPopupMenuWidget.h"
#include "QDPixMap.h"
#include "RectUtils.h"
#include "ResolveCachingColor.h"
#include "Utilities.h"
#include "WindowDef.h"
#include "WindowManager.h"
@@ -61,6 +61,7 @@ void FrameSelectedTool (DrawSurface *);
void DrawToolName (DrawSurface *);
void DrawToolTiles (DrawSurface *);
void SwitchToolModes (short);
void KeepWindowInBounds (Window *window);
Rect toolsWindowRect, toolSrcRect, toolTextRect;
@@ -86,7 +87,7 @@ void CreateToolsOffscreen (void)
if (toolSrcMap == nil)
{
QSetRect(&toolSrcRect, 0, 0, 360, 216);
theErr = CreateOffScreenGWorld(&toolSrcMap, &toolSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&toolSrcMap, &toolSrcRect);
LoadGraphic(toolSrcMap, kToolsPictID);
}
}
@@ -128,13 +129,12 @@ void FrameSelectedTool (DrawSurface *surface)
}
theRect = toolRects[toolIcon];
surface->SetForeColor(StdColors::Red());
surface->FrameRect(theRect);
PortabilityLayer::ResolveCachingColor redColor = StdColors::Red();
surface->FrameRect(theRect, redColor);
InsetRect(&theRect, 1, 1);
surface->FrameRect(theRect);
ForeColor(blackColor);
surface->FrameRect(theRect, redColor);
}
#endif
@@ -151,14 +151,13 @@ void DrawToolName (DrawSurface *surface)
GetIndString(theString, kObjectNameStrings,
toolSelected + ((toolMode - 1) * 0x0010));
surface->SetForeColor(StdColors::White());
surface->FillRect(toolTextRect);
surface->SetForeColor(StdColors::Black());
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
surface->FillRect(toolTextRect, whiteColor);
const Point textPoint = Point::Create(toolTextRect.left + 3, toolTextRect.bottom - 6);
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold);
ColorText(surface, textPoint, theString, 171L);
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold, true);
ColorText(surface, textPoint, theString, 171L, appFont);
}
#endif
@@ -181,7 +180,7 @@ void DrawToolTiles (DrawSurface *surface)
QOffsetRect(&destRect, toolRects[i + 1].left + 2, toolRects[i + 1].top + 2);
CopyBits((BitMap *)*GetGWorldPixMap(toolSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(toolsWindow)),
GetPortBitMapForCopyBits(toolsWindow->GetDrawSurface()),
&srcRect, &destRect, srcCopy);
}
}
@@ -199,7 +198,7 @@ void EraseSelectedTool (void)
if (toolsWindow == nil)
return;
SetPort(&toolsWindow->GetDrawSurface()->m_port);
SetPort(toolsWindow->GetDrawSurface());
toolIcon = toolSelected;
if ((toolMode == kBlowerMode) && (toolIcon >= 7))
@@ -215,10 +214,11 @@ void EraseSelectedTool (void)
}
theRect = toolRects[toolIcon];
surface->SetForeColor(StdColors::White());
surface->FrameRect(theRect);
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
surface->FrameRect(theRect, whiteColor);
InsetRect(&theRect, 1, 1);
surface->FrameRect(theRect);
surface->FrameRect(theRect, whiteColor);
#endif
}
@@ -249,11 +249,12 @@ void SelectTool (short which)
}
theRect = toolRects[toolIcon];
surface->SetForeColor(StdColors::Red());
surface->FrameRect(theRect);
PortabilityLayer::ResolveCachingColor redColor = StdColors::Red();
surface->FrameRect(theRect, redColor);
InsetRect(&theRect, 1, 1);
surface->FrameRect(theRect);
surface->FrameRect(theRect, redColor);
toolSelected = which;
DrawToolName(surface);
@@ -270,9 +271,8 @@ void UpdateToolsWindow (void)
DrawSurface *surface = toolsWindow->GetDrawSurface();
DkGrayForeColor(surface);
surface->DrawLine(Point::Create(4, 25), Point::Create(112, 25));
surface->SetForeColor(StdColors::Black());
PortabilityLayer::ResolveCachingColor lineColor = DkGrayForeColor();
surface->DrawLine(Point::Create(4, 25), Point::Create(112, 25), lineColor);
DrawToolTiles(surface);
FrameSelectedTool(surface);
@@ -329,7 +329,7 @@ void OpenToolsWindow (void)
state.m_resID = 141;
state.m_window = toolsWindow;
classPopUp = PortabilityLayer::PopupMenuWidget::Create(state);
classPopUp = PortabilityLayer::PopupMenuWidget::Create(state, nullptr);
}
toolsWindow->DrawControls();
@@ -350,6 +350,8 @@ void OpenToolsWindow (void)
SwitchToolModes(toolMode);
toolSelected = kSelectTool;
KeepWindowInBounds(toolsWindow);
}
UpdateToolsCheckmark(true);
@@ -469,7 +471,7 @@ void HandleToolsClick (Point wherePt)
return;
SetPortWindowPort(toolsWindow);
wherePt -= toolsWindow->TopLeftCoord();
wherePt -= toolsWindow->GetTopLeftCoord();
part = FindControl(wherePt, toolsWindow, &theControl);
if ((theControl != nil) && (part != 0))

View File

@@ -57,7 +57,7 @@ void PourScreenOn (Rect *theRect)
columnRects[i].bottom = theRect->bottom;
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
&columnRects[i], &columnRects[i], srcCopy);
QOffsetRect(&columnRects[i], 0, kChipHigh);
@@ -115,7 +115,7 @@ void WipeScreenOn (short direction, Rect *theRect)
for (i = 0; i < count; i++)
{
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
&wipeRect, &wipeRect, srcCopy);
QOffsetRect(&wipeRect, hOffset, vOffset);
@@ -135,7 +135,7 @@ void WipeScreenOn (short direction, Rect *theRect)
void DumpScreenOn (Rect *theRect)
{
DrawSurface *graf = GetWindowPort(mainWindow);
DrawSurface *graf = mainWindow->GetDrawSurface();
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
GetPortBitMapForCopyBits(graf),

View File

@@ -15,6 +15,7 @@
#include "QDPixMap.h"
#include "BitmapImage.h"
#include "DialogManager.h"
#include "DisplayDeviceManager.h"
#include "Externs.h"
#include "HostSystemServices.h"
#include "IconLoader.h"
@@ -211,13 +212,17 @@ void CreateOffScreenPixMap (Rect *theRect, CGrafPtr *offScreen)
//-------------------------------------------------------------------- CreateOffScreenGWorld
// Creates an offscreen GWorld<6C>using the depth passed in.
PLError_t CreateOffScreenGWorld (DrawSurface **theGWorld, Rect *bounds, GpPixelFormat_t pixelFormat)
PLError_t CreateOffScreenGWorld (DrawSurface **theGWorld, Rect *bounds)
{
PLError_t theErr;
GpPixelFormat_t pixelFormat = PortabilityLayer::DisplayDeviceManager::GetInstance()->GetPixelFormat();
theErr = NewGWorld(theGWorld, pixelFormat, bounds, nil);
return theErr;
return NewGWorld(theGWorld, pixelFormat, bounds, nil);
}
PLError_t CreateOffScreenGWorldCustomDepth(DrawSurface **theGWorld, Rect *bounds, GpPixelFormat_t pixelFormat)
{
return NewGWorld(theGWorld, pixelFormat, bounds, nil);
}
//-------------------------------------------------------------- KillOffScreenPixMap
@@ -424,7 +429,7 @@ Boolean WaitForInputEvent (short seconds)
Boolean waiting, didResume;
timeToBail = TickCount() + 60L * (long)seconds;
FlushEvents(everyEvent, 0);
FlushEvents();
waiting = true;
didResume = false;
@@ -446,7 +451,7 @@ Boolean WaitForInputEvent (short seconds)
Delay(1, nullptr);
}
FlushEvents(everyEvent, 0);
FlushEvents();
return (didResume);
}
@@ -469,7 +474,7 @@ void WaitCommandQReleased (void)
Delay(1, nullptr);
}
FlushEvents(everyEvent, 0);
FlushEvents();
}
//-------------------------------------------------------------- KeyMapOffsetFromRawKey

View File

@@ -9,4 +9,5 @@
#include "GpPixelFormat.h"
PLError_t CreateOffScreenGWorld (DrawSurface **surface, Rect *bounds, GpPixelFormat_t pixelFormat);
PLError_t CreateOffScreenGWorld (DrawSurface **surface, Rect *bounds);
PLError_t CreateOffScreenGWorldCustomDepth (DrawSurface **surface, Rect *bounds, GpPixelFormat_t pixelFormat);

View File

@@ -8,8 +8,10 @@
#include "PLPasStr.h"
#include "Externs.h"
#include "Environ.h"
#include "FontFamily.h"
#include "PLStandardColors.h"
#include "RectUtils.h"
#include "ResolveCachingColor.h"
#include "WindowDef.h"
#include "WindowManager.h"
@@ -18,6 +20,7 @@
WindowPtr mssgWindow;
WindowPtr mssgWindowExclusiveStack;
//============================================================== Functions
@@ -35,8 +38,9 @@ void GetWindowLeftTop (WindowPtr theWindow, short *left, short *top)
}
else
{
*left = static_cast<short>(theWindow->m_wmX);
*top = static_cast<short>(theWindow->m_wmY);
const Point windowPos = theWindow->GetTopLeftCoord();
*left = windowPos.h;
*top = windowPos.v;
}
}
@@ -50,7 +54,7 @@ void GetWindowRect (WindowPtr theWindow, Rect *bounds)
{
Point upperLeft;
GetWindowLeftTop(theWindow, &upperLeft.h, &upperLeft.v);
*bounds = theWindow->m_surface.m_port.GetRect() + upperLeft;
*bounds = theWindow->GetSurfaceRect() + upperLeft;
}
}
@@ -122,13 +126,14 @@ void OpenMessageWindow (const PLPasStr &title)
ShowWindow(mssgWindow);
DrawSurface *surface = mssgWindow->GetDrawSurface();
surface->SetClipRect(mssgWindowRect);
surface->SetForeColor(StdColors::Black());
surface->SetBackColor(StdColors::White());
surface->SetSystemFont(12, 0);
}
mssgWindowExclusiveStack = mssgWindow;
wm->SwapExclusiveWindow(mssgWindowExclusiveStack); // Push exclusive window
if (doZooms)
wm->FlickerWindowIn(mssgWindow, 32);
}
//-------------------------------------------------------------- SetMessageWindowMessage
@@ -136,7 +141,7 @@ void OpenMessageWindow (const PLPasStr &title)
// For the above message window, this function displays a string of text<78>
// in the center of the window.
void SetMessageWindowMessage (StringPtr message)
void SetMessageWindowMessage (StringPtr message, const PortabilityLayer::RGBAColor &color)
{
Rect mssgWindowRect;
@@ -144,14 +149,18 @@ void SetMessageWindowMessage (StringPtr message)
{
DrawSurface *surface = mssgWindow->GetDrawSurface();
PortabilityLayer::RenderedFont *sysFont = GetSystemFont(12, PortabilityLayer::FontFamilyFlag_None, true);
SetRect(&mssgWindowRect, 0, 0, 256, kMessageWindowTall);
InsetRect(&mssgWindowRect, 16, 16);
surface->SetForeColor(StdColors::White());
surface->FillRect(mssgWindowRect);
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
surface->FillRect(mssgWindowRect, whiteColor);
const Point textPoint = Point::Create(mssgWindowRect.left, mssgWindowRect.bottom - 6);
surface->SetForeColor(StdColors::Black());
surface->DrawString(textPoint, message, true);
PortabilityLayer::ResolveCachingColor specifiedColor = color;
surface->DrawString(textPoint, message, specifiedColor, sysFont);
}
}
@@ -161,6 +170,16 @@ void SetMessageWindowMessage (StringPtr message)
void CloseMessageWindow (void)
{
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
if (doZooms)
wm->FlickerWindowOut(mssgWindow, 32);
wm->SwapExclusiveWindow(mssgWindowExclusiveStack); // Pop exclusive window
assert(mssgWindowExclusiveStack == mssgWindow);
mssgWindowExclusiveStack = nullptr;
CloseThisWindow(&mssgWindow);
}

View File

@@ -1,19 +1,30 @@
#include "GpAudioChannelXAudio2.h"
#include "GpAudioDriverXAudio2.h"
#include "IGpAudioChannelCallbacks.h"
#include "IGpLogDriver.h"
#include <stdlib.h>
#include <new>
GpAudioChannelXAudio2 *GpAudioChannelXAudio2::Create(GpAudioDriverXAudio2 *driver)
{
IGpLogDriver *logger = driver->GetProperties().m_logger;
void *storage = malloc(sizeof(GpAudioChannelXAudio2));
if (!storage)
{
if (!logger)
logger->Printf(IGpLogDriver::Category_Error, "GpAudioChannelXAudio2::Create failed, malloc failed");
return nullptr;
}
GpAudioChannelXAudio2 *channel = new (storage) GpAudioChannelXAudio2(driver);
if (!channel->Init())
{
if (!logger)
logger->Printf(IGpLogDriver::Category_Error, "GpAudioChannelXAudio2::Init failed");
channel->Destroy();
return nullptr;
}
@@ -23,6 +34,8 @@ GpAudioChannelXAudio2 *GpAudioChannelXAudio2::Create(GpAudioDriverXAudio2 *drive
bool GpAudioChannelXAudio2::Init()
{
IGpLogDriver *logger = m_driver->GetProperties().m_logger;
const unsigned int sampleRate = m_driver->GetRealSampleRate();
IXAudio2 *const xa2 = m_driver->GetXA2();
@@ -49,7 +62,12 @@ bool GpAudioChannelXAudio2::Init()
HRESULT hr = xa2->CreateSourceVoice(&m_sourceVoice, &format, XAUDIO2_VOICE_NOPITCH | XAUDIO2_VOICE_NOSRC, 1.0f, &m_xAudioCallbacks, nullptr, nullptr);
if (hr != S_OK)
{
if (!logger)
logger->Printf(IGpLogDriver::Category_Error, "CreateSourceVoice failed with code %lx", hr);
return false;
}
return true;
}

View File

@@ -1,5 +1,6 @@
#include "GpAudioDriverXAudio2.h"
#include "IGpLogDriver.h"
#include "GpAudioChannelXAudio2.h"
#include <xaudio2.h>
@@ -31,34 +32,62 @@ unsigned int GpAudioDriverXAudio2::GetRealSampleRate() const
GpAudioDriverXAudio2 *GpAudioDriverXAudio2::Create(const GpAudioDriverProperties &properties)
{
IGpLogDriver *logger = properties.m_logger;
IXAudio2 *xa = nullptr;
IXAudio2MasteringVoice *mv = nullptr;
const unsigned int realSampleRate = (properties.m_sampleRate + 50) / XAUDIO2_QUANTUM_DENOMINATOR * XAUDIO2_QUANTUM_DENOMINATOR;
if (CoInitializeEx(nullptr, COINIT_MULTITHREADED) != S_OK)
if (logger)
{
logger->Printf(IGpLogDriver::Category_Information, "XAudio2 Driver starting");
logger->Printf(IGpLogDriver::Category_Information, "Real sample rate: %u", realSampleRate);
}
HRESULT result = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
if (result != S_OK)
{
if (logger)
logger->Printf(IGpLogDriver::Category_Error, "CoInitializeEx failed with code %lx", result);
CoUninitialize();
return nullptr;
}
UINT flags = 0;
if (properties.m_debug)
flags |= XAUDIO2_DEBUG_ENGINE;
if (FAILED(XAudio2Create(&xa, flags, XAUDIO2_DEFAULT_PROCESSOR)))
{
if (logger)
logger->Printf(IGpLogDriver::Category_Information, "Starting XAudio in debug mode");
flags |= XAUDIO2_DEBUG_ENGINE;
}
result = XAudio2Create(&xa, flags, XAUDIO2_DEFAULT_PROCESSOR);
if (FAILED(result))
{
if (logger)
logger->Printf(IGpLogDriver::Category_Error, "XAudio2Create failed with code %lx", result);
CoUninitialize();
return nullptr;
}
if (FAILED(xa->CreateMasteringVoice(&mv, 2, realSampleRate, 0, nullptr, nullptr, AudioCategory_GameEffects)))
result = xa->CreateMasteringVoice(&mv, 2, realSampleRate, 0, nullptr, nullptr, AudioCategory_GameEffects);
if (FAILED(result))
{
if (logger)
logger->Printf(IGpLogDriver::Category_Error, "CreateMasteringVoice failed with code %lx", result);
CoUninitialize();
xa->Release();
return nullptr;
}
if (logger)
logger->Printf(IGpLogDriver::Category_Information, "XAudio2 started OK", result);
return new GpAudioDriverXAudio2(properties, realSampleRate, xa, mv);
}

View File

@@ -63,6 +63,7 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\GpCommon.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" />
@@ -71,6 +72,7 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\GpCommon.props" />
<Import Project="..\Release.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
@@ -130,7 +132,17 @@
<ClCompile Include="GpAudioDriverFactoryXAudio2.cpp" />
<ClCompile Include="GpAudioDriverXAudio2.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\Microsoft.XAudio2.Redist.1.2.1\build\native\Microsoft.XAudio2.Redist.targets" Condition="Exists('..\packages\Microsoft.XAudio2.Redist.1.2.1\build\native\Microsoft.XAudio2.Redist.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.XAudio2.Redist.1.2.1\build\native\Microsoft.XAudio2.Redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.XAudio2.Redist.1.2.1\build\native\Microsoft.XAudio2.Redist.targets'))" />
</Target>
</Project>

View File

@@ -42,4 +42,7 @@
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.XAudio2.Redist" version="1.2.1" targetFramework="native" />
</packages>

View File

@@ -1,7 +1,7 @@
#pragma once
#pragma once
namespace EGpStandardCursors
{
{
enum EGpStandardCursor
{
kArrow,

View File

@@ -3,6 +3,7 @@
#include "EGpAudioDriverType.h"
struct IGpAudioDriver;
struct IGpLogDriver;
struct GpAudioDriverProperties
{
@@ -10,4 +11,6 @@ struct GpAudioDriverProperties
unsigned int m_sampleRate;
bool m_debug;
IGpLogDriver *m_logger;
};

View File

@@ -0,0 +1,9 @@
#pragma once
#define GP_BUILD_VERSION_MAJOR 1
#define GP_BUILD_VERSION_MINOR 0
#define GP_BUILD_VERSION_UPDATE 2
#define GP_APPLICATION_VERSION_STRING "1.0.2"
#define GP_APPLICATION_COPYRIGHT_STRING "2020 Eric Lasota"
#define GP_APPLICATION_WEBSITE_STRING "https://github.com/elasota/Aerofoil"

View File

@@ -3,15 +3,18 @@
#include "EGpDisplayDriverType.h"
#include "GpDisplayDriverTickStatus.h"
#include <stdint.h>
struct IGpDisplayDriver;
struct IGpFiber;
struct IGpVOSEventQueue;
struct IGpLogDriver;
struct GpDisplayDriverProperties
{
typedef GpDisplayDriverTickStatus_t (*TickFunc_t)(void *context, IGpFiber *vosFiber);
typedef void(*RenderFunc_t)(void *context);
typedef void(*AdjustRequestedResolutionFunc_t)(void *context, unsigned int &width, unsigned int &height);
typedef bool(*AdjustRequestedResolutionFunc_t)(void *context, uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY);
EGpDisplayDriverType m_type;
@@ -37,4 +40,5 @@ struct GpDisplayDriverProperties
void *m_adjustRequestedResolutionFuncContext;
IGpVOSEventQueue *m_eventQueue;
IGpLogDriver *m_logger;
};

View File

@@ -251,6 +251,7 @@ namespace GpVOSEventTypes
kMouseInput,
kGamepadInput,
kVideoResolutionChanged,
kQuit
};
}

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