Compare commits

...

141 Commits
0.0.4 ... 1.0.0

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

@@ -1,7 +1,3 @@
Roboto font:
(c)2011 Google
Distributed under the Apache License (see Resources/Fonts/Roboto/LICENSE)
Open Sans font:
(c)2011 Google
Distributed under the Apache License (see Resources/Fonts/OpenSans/LICENSE)
@@ -25,4 +21,10 @@ 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)

View File

@@ -41,88 +41,215 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bin2gp", "bin2gp\bin2gp.vcx
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MakeTimestamp", "MakeTimestamp\MakeTimestamp.vcxproj", "{9023DF2F-A33D-485A-B13D-0973348B2F9B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flattenmov", "flattenmov\flattenmov.vcxproj", "{89F8D13E-F216-4B67-8DE9-7F842D349E94}"
EndProject
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

@@ -73,6 +73,7 @@
<Import Project="..\GpMainApp.props" />
<Import Project="..\FreeTypePublic.props" />
<Import Project="..\FreeTypeImport.props" />
<Import Project="..\Release.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
@@ -91,6 +92,7 @@
<Import Project="..\GpMainApp.props" />
<Import Project="..\FreeTypePublic.props" />
<Import Project="..\FreeTypeImport.props" />
<Import Project="..\Release.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
@@ -154,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" />
@@ -170,16 +173,13 @@
<ClInclude Include="..\GpCommon\GpDisplayDriverTickStatus.h" />
<ClInclude Include="..\GpCommon\GpFileCreationDisposition.h" />
<ClInclude Include="..\GpCommon\GpInputDriverProperties.h" />
<ClInclude Include="..\GpCommon\IGpColorCursor.h" />
<ClInclude Include="..\GpCommon\IGpCursor.h" />
<ClInclude Include="..\GpCommon\IGpAudioChannelCallbacks.h" />
<ClInclude Include="..\GpCommon\GpColorCursor_Win32.h" />
<ClInclude Include="..\GpCommon\IGpDisplayDriverSurface.h" />
<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" />
@@ -187,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,6 +94,11 @@ void GpAppEnvironment::Render()
GpAppInterface_Get()->PL_Render(m_displayDriver);
}
bool GpAppEnvironment::AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY)
{
return GpAppInterface_Get()->PL_AdjustRequestedResolution(physicalWidth, physicalHeight, virtualWidth, virtualheight, pixelScaleX, pixelScaleY);
}
void GpAppEnvironment::SetDisplayDriver(IGpDisplayDriver *displayDriver)
{
m_displayDriver = displayDriver;
@@ -170,6 +175,10 @@ void GpAppEnvironment::DispatchSystemCall(PortabilityLayer::HostSuspendCallID ca
m_applicationState = ApplicationState_TimedSuspend;
m_delaySuspendTicks = args[0].m_uint;
break;
case PortabilityLayer::HostSuspendCallID_CallOnVOSThread:
args[0].m_functionPtr(static_cast<const PortabilityLayer::HostSuspendCallArgument*>(args[1].m_constPointer), static_cast<PortabilityLayer::HostSuspendCallArgument*>(args[2].m_pointer));
m_applicationState = ApplicationState_Running;
break;
default:
assert(false);
}

View File

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

View File

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

View File

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

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

@@ -1,10 +1,11 @@
#include "GpMain.h"
#include "GpAudioDriverFactory.h"
#include "GpColorCursor_Win32.h"
#include "GpCursor_Win32.h"
#include "GpDisplayDriverFactory.h"
#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,17 +396,36 @@ 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_loadColorCursorFunc = GpColorCursor_Win32::Load;
g_gpWindowsGlobals.m_loadCursorFunc = GpCursor_Win32::Load;
g_gpWindowsGlobals.m_translateWindowsMessageFunc = TranslateWindowsMessage;
g_gpGlobalConfig.m_displayDriverType = EGpDisplayDriverType_D3D11;
@@ -405,10 +440,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

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

View File

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

View File

@@ -0,0 +1,10 @@
{
"add" :
{
"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

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

View File

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

View File

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

View File

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

View File

@@ -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,51 +1,57 @@
Aerofoil is a third-party port of Glider PRO
Thank you for trying Aerofoil!
Glider PRO is (c)1994-2000 Casady & Greene, Inc., written by John Calhoun
Aerofoil is (c)2019-2020 Eric Lasota
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.
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
If you have an issue with Aerofoil, please post an issue to the Aerofoil
issue tracker on GitHub:
https://github.com/elasota/Aerofoil/issues
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
-------------------------------------------------------------------------------
Roboto font:
(c)2011 Google
Distributed under the Apache License (see license_apache.txt)
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
@@ -67,4 +73,20 @@ zlib:
3. This notice may not be removed or altered from any source distribution.
Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu
jloup@gzip.org madler@alumni.caltech.edu
FreeType:
Portions of this software are copyright (c)2020 The FreeType Project (www.freetype.org).
All rights reserved.
Distributed under the GPLv2 license (see license_gplv2.txt)
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)

View File

@@ -0,0 +1,84 @@
If you want to import an existing third-party Glider PRO house to Aerofoil,
a few steps are required.
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.
(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.)
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.
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

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

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

@@ -11,7 +11,7 @@
#include "Externs.h"
#include "Environ.h"
#include "HostDisplayDriver.h"
#include "IGpColorCursor.h"
#include "IGpCursor.h"
#include "IGpDisplayDriver.h"
#include "ResourceManager.h"
@@ -37,7 +37,7 @@ typedef struct
{
struct
{
IGpColorCursor *hwCursor;
IGpCursor *hwCursor;
} frame[1];
} compiledAcurRec;
@@ -61,7 +61,7 @@ compiledAcurHandle compiledAnimCursorH = nil;
Boolean GetColorCursors (acurHandle ballCursH, compiledAcurHandle compiledBallCursH)
{
short i, j;
IGpColorCursor *hwCursor;
IGpCursor *hwCursor;
Boolean result = true;
if (ballCursH)
@@ -70,7 +70,7 @@ Boolean GetColorCursors (acurHandle ballCursH, compiledAcurHandle compiledBallCu
HideCursor(); // Hide the cursor
for (i = 0; i < j; i++) // Walk through the acur resource
{
hwCursor = PortabilityLayer::HostDisplayDriver::GetInstance()->LoadColorCursor((*ballCursH)->frame[i].resID); // Get the cursor
hwCursor = PortabilityLayer::HostDisplayDriver::GetInstance()->LoadCursor(true, (*ballCursH)->frame[i].resID); // Get the cursor
if (hwCursor == nil) // Make sure a real cursor was returned
{ // If not, trash all cursors loaded
for (j = 0; j < i; j++)
@@ -81,7 +81,7 @@ Boolean GetColorCursors (acurHandle ballCursH, compiledAcurHandle compiledBallCu
else // But, if the cursor loaded ok
{ // add it to our list or cursor handles
(*compiledBallCursH)->frame[i].hwCursor = hwCursor;
PortabilityLayer::HostDisplayDriver::GetInstance()->SetColorCursor(hwCursor);
PortabilityLayer::HostDisplayDriver::GetInstance()->SetCursor(hwCursor);
}
}
InitCursor(); // Show the cursor again (as arrow)
@@ -168,10 +168,10 @@ void IncrementCursor (void)
(*animCursorH)->index++;
(*animCursorH)->index %= (*animCursorH)->n;
PortabilityLayer::HostDisplayDriver::GetInstance()->SetColorCursor((*compiledAnimCursorH)->frame[(*animCursorH)->index].hwCursor);
PortabilityLayer::HostDisplayDriver::GetInstance()->SetCursor((*compiledAnimCursorH)->frame[(*animCursorH)->index].hwCursor);
}
else
SetBuiltinCursor(watchCursor);
PortabilityLayer::HostDisplayDriver::GetInstance()->SetStandardCursor(EGpStandardCursors::kWait);
}
//-------------------------------------------------------------- DecrementCursor
@@ -188,10 +188,10 @@ void DecrementCursor (void)
if (((*animCursorH)->index) < 0)
(*animCursorH)->index = ((*animCursorH)->n) - 1;
PortabilityLayer::HostDisplayDriver::GetInstance()->SetColorCursor((*compiledAnimCursorH)->frame[(*animCursorH)->index].hwCursor);
PortabilityLayer::HostDisplayDriver::GetInstance()->SetCursor((*compiledAnimCursorH)->frame[(*animCursorH)->index].hwCursor);
}
else
SetBuiltinCursor(watchCursor);
PortabilityLayer::HostDisplayDriver::GetInstance()->SetStandardCursor(EGpStandardCursors::kWait);
}
//-------------------------------------------------------------- SpinCursor

View File

@@ -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,11 +53,12 @@ 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;
short i;
bool redrawMainWindow = false;
theErr = AEGetParamDesc(theAE, keyDirectObject, typeAEList, &docList);
if (theErr != PLErrors::kNone)
@@ -112,7 +115,7 @@ PLError_t DoOpenDocAE (const AppleEvent *theAE, AppleEvent *reply, UInt32 ref)
Rect updateRect;
SetRect(&updateRect, splashOriginH + 474, splashOriginV + 304, splashOriginH + 474 + 166, splashOriginV + 304 + 12);
InvalWindowRect(mainWindow, &updateRect);
redrawMainWindow = true;
}
}
}
@@ -120,6 +123,9 @@ PLError_t DoOpenDocAE (const AppleEvent *theAE, AppleEvent *reply, UInt32 ref)
}
#endif
whoCares = AEDisposeDesc(&docList);
if (redrawMainWindow)
UpdateMainWindow();
return theErr;
}
@@ -157,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.
@@ -170,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
@@ -50,7 +55,7 @@ void DrawBanner (Point *topLeft)
PLError_t theErr;
QSetRect(&wholePage, 0, 0, 330, 220);
mapBounds = thisMac.screen;
mapBounds = thisMac.fullScreen;
ZeroRectCorner(&mapBounds);
CenterRectInRect(&wholePage, &mapBounds);
topLeft->h = wholePage.left;
@@ -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.screen);
QOffsetRect(&bounds, -thisMac.screen.left, -thisMac.screen.top);
src = bounds;
InsetRect(&src, 64, 32);
CenterRectInRect(&bounds, &thisMac.fullScreen);
QOffsetRect(&bounds, -thisMac.fullScreen.left, -thisMac.fullScreen.top);
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);
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);
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,27 +46,27 @@ 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);
}
//-------------------------------------------------------------- ColorRegion
void ColorOvalMaskPattern(DrawSurface *surface, const Rect &theRect, long color, const uint8_t *pattern)
{
PortabilityLayer::ResolveCachingColor rColor = PortabilityLayer::ResolveCachingColor::FromStandardColor(color);
surface->FillEllipseWithMaskPattern(theRect, pattern, rColor);
}
//-------------------------------------------------------------- ColorRegionMaskPattern
// Given a region and color index, this function draws a solid<69>
// region in that color. Current port, pen mode, etc. assumed.
void ColorRegion (DrawSurface *surface, PortabilityLayer::ScanlineMask *scanlineMask, long colorIndex)
void ColorRegionMaskPattern (DrawSurface *surface, PortabilityLayer::ScanlineMask *scanlineMask, long colorIndex, const uint8_t *pattern)
{
const PortabilityLayer::RGBAColor &rgbaColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[colorIndex];
const PortabilityLayer::RGBAColor wasColor = surface->GetForeColor();
surface->SetForeColor(rgbaColor);
surface->FillScanlineMask(scanlineMask);
surface->SetForeColor(wasColor);
PortabilityLayer::ResolveCachingColor rColor = PortabilityLayer::ResolveCachingColor::FromStandardColor(colorIndex);
surface->FillScanlineMaskWithMaskPattern(scanlineMask, pattern, rColor);
}
//-------------------------------------------------------------- ColorLine
@@ -81,12 +76,9 @@ void ColorRegion (DrawSurface *surface, PortabilityLayer::ScanlineMask *scanline
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
@@ -115,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
@@ -147,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
@@ -160,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
@@ -170,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
@@ -180,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
}
@@ -124,18 +125,19 @@ void OpenCoordWindow (void)
Rect src, dest;
Point globalMouse;
short direction, dist;
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
if (coordWindow == nil)
{
const uint16_t windowStyle = PortabilityLayer::WindowStyleFlags::kTitleBar | PortabilityLayer::WindowStyleFlags::kMiniBar;
const uint16_t windowStyle = PortabilityLayer::WindowStyleFlags::kTitleBar | PortabilityLayer::WindowStyleFlags::kMiniBar | PortabilityLayer::WindowStyleFlags::kCloseBox;
QSetRect(&coordWindowRect, 0, 0, 50, 38);
if (thisMac.hasColor)
coordWindow = NewCWindow(nil, &coordWindowRect,
PSTR("Tools"), false, windowStyle, kPutInFront, true, 0L);
else
coordWindow = NewWindow(nil, &coordWindowRect,
PSTR("Tools"), false, windowStyle, kPutInFront, true, 0L);
{
PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(coordWindowRect, windowStyle, true, 0, 0, PSTR("Tools"));
coordWindow = wm->CreateWindow(wdef);
}
if (coordWindow == nil)
RedAlert(kErrNoMemory);
@@ -148,17 +150,14 @@ void OpenCoordWindow (void)
MoveWindow(coordWindow, isCoordH, isCoordV, true);
GetWindowRect(coordWindow, &dest);
BringToFront(coordWindow);
wm->PutWindowBehind(coordWindow, wm->GetPutInFrontSentinel());
PortabilityLayer::WindowManager::GetInstance()->ShowWindow(coordWindow);
// FlagWindowFloating(coordWindow); TEMP - use flaoting windows
HiliteAllWindows();
coordH = -1;
coordV = -1;
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,20 +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);
}
}
PenNormal();
PortabilityLayer::ButtonWidget::DrawDefaultButtonChrome(itemRect, surface);
}
//-------------------------------------------------------------- GetDialogString
@@ -397,7 +388,9 @@ void GetDialogString (Dialog *theDialog, short item, StringPtr theString)
void SetDialogString (Dialog *theDialog, short item, const PLPasStr &theString)
{
theDialog->GetItems()[item - 1].GetWidget()->SetString(theString);
PortabilityLayer::Widget *widget = theDialog->GetItems()[item - 1].GetWidget();
widget->SetString(theString);
widget->DrawControl(theDialog->GetWindow()->GetDrawSurface());
}
//-------------------------------------------------------------- GetDialogStringLen
@@ -433,18 +426,17 @@ void SetDialogItemValue (Dialog *theDialog, short item, short theState)
void ToggleDialogItemValue (Dialog *theDialog, short item)
{
Rect itemRect;
ControlHandle itemHandle;
int16_t itemType, theState;
const PortabilityLayer::DialogItem &itemRef = theDialog->GetItems()[item - 1];
int16_t theState;
theState = itemRef.GetWidget()->GetState();
PortabilityLayer::Widget *widget = theDialog->GetItems()[item - 1].GetWidget();
theState = widget->GetState();
if (theState == 0)
theState = 1;
else
theState = 0;
SetControlValue(itemHandle, theState);
widget->SetState(theState);
widget->DrawControl(theDialog->GetWindow()->GetDrawSurface());
}
//-------------------------------------------------------------- SetDialogNumToStr
@@ -583,46 +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
PL_NotYetImplemented_TODO("Clip to iRect");
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
@@ -637,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
@@ -667,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
@@ -685,36 +676,38 @@ 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
// Given a dialog item, this function draws any combination of 4 sides<65>
// of a box around it. Which sides get drawn is encoded in "sides".
void BorderDialogItem (Dialog *theDialog, short item, short sides)
void BorderDialogItem(Dialog *theDialog, short item, short sides, short thickness, const uint8_t *pattern)
{
// 1 = left
// 2 = top
// 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();
@@ -724,29 +717,57 @@ void BorderDialogItem (Dialog *theDialog, short item, short sides)
if (sides >= 8) // 8 = right
{
const Point pointA = Point::Create(itemRect.right, itemRect.top);
const Point pointB = Point::Create(itemRect.right, itemRect.bottom);
surface->DrawLine(pointA, pointB);
const Point pointB = Point::Create(itemRect.right + thickness, itemRect.bottom + 1);
const Rect rect = Rect::Create(pointA.v, pointA.h, pointB.v, pointB.h);
if (pattern)
{
surface->FillRect(rect, whiteColor);
surface->FillRectWithMaskPattern8x8(rect, pattern,blackColor);
}
else
surface->FillRect(rect, blackColor);
sides -= 8;
}
if (sides >= 4) // 4 = bottom
{
const Point pointA = Point::Create(itemRect.left, itemRect.bottom);
const Point pointB = Point::Create(itemRect.right, itemRect.bottom);
surface->DrawLine(pointA, pointB);
const Point pointB = Point::Create(itemRect.right + 1, itemRect.bottom + thickness);
const Rect rect = Rect::Create(pointA.v, pointA.h, pointB.v, pointB.h);
if (pattern)
{
surface->FillRect(rect, whiteColor);
surface->FillRectWithMaskPattern8x8(rect, pattern, blackColor);
}
else
surface->FillRect(rect, blackColor);
sides -= 4;
}
if (sides >= 2) // 2 = top
{
const Point pointA = Point::Create(itemRect.left, itemRect.top - 1);
const Point pointB = Point::Create(itemRect.right, itemRect.top - 1);
surface->DrawLine(pointA, pointB);
const Point pointB = Point::Create(itemRect.right + 1, itemRect.top + thickness);
const Rect rect = Rect::Create(pointA.v, pointA.h, pointB.v, pointB.h);
if (pattern)
{
surface->FillRect(rect, whiteColor);
surface->FillRectWithMaskPattern8x8(rect, pattern, blackColor);
}
else
surface->FillRect(rect, blackColor);
sides -= 2;
}
if (sides >= 1) // 1 = left
{
const Point pointA = Point::Create(itemRect.left - 1, itemRect.top);
const Point pointB = Point::Create(itemRect.left - 1, itemRect.bottom);
surface->DrawLine(pointA, pointB);
const Point pointB = Point::Create(itemRect.left - 1 + thickness, itemRect.bottom + 1);
const Rect rect = Rect::Create(pointA.v, pointA.h, pointB.v, pointB.h);
if (pattern)
{
surface->FillRect(rect, whiteColor);
surface->FillRectWithMaskPattern8x8(rect, pattern, blackColor);
}
else
surface->FillRect(rect, blackColor);
}
}
@@ -760,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
@@ -779,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 BorderDialogItem (Dialog *, short, 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

@@ -5,10 +5,12 @@
//============================================================================
#include "ArrayTools.h"
#include "Externs.h"
#include "Environ.h"
#include "MainWindow.h"
#include "Objects.h"
#include "QDPixMap.h"
#include "RectUtils.h"
#include "Room.h"
#include "Utilities.h"
@@ -57,6 +59,7 @@ void NilSavedMaps (void)
}
savedMaps[i].where = -1;
savedMaps[i].who = -1;
savedMaps[i].component = -1;
}
numSavedMaps = 0;
}
@@ -67,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, short where, short who)
short BackUpToSavedMap (Rect *theRect, SInt16 where, SInt16 who, SInt16 component)
{
Rect mapRect;
PLError_t theErr;
@@ -87,6 +90,7 @@ short BackUpToSavedMap (Rect *theRect, short where, short who)
savedMaps[numSavedMaps].where = where;
savedMaps[numSavedMaps].who = who;
savedMaps[numSavedMaps].component = component;
numSavedMaps++;
return (numSavedMaps - 1); // return array index
@@ -97,7 +101,7 @@ short BackUpToSavedMap (Rect *theRect, short where, short who)
// a slot in the pixmap array for the object. It re-copies the background<6E>
// and is needed when the lights in the room go on or off.
short ReBackUpSavedMap (Rect *theRect, short where, short who)
SInt16 ReBackUpSavedMap (Rect *theRect, SInt16 where, SInt16 who, SInt16 component)
{
Rect mapRect;
short i, foundIndex;
@@ -106,11 +110,13 @@ short ReBackUpSavedMap (Rect *theRect, short where, short 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;
ZeroRectCorner(&mapRect);
savedMaps[foundIndex].dest = *theRect;
CopyBits((BitMap *)*GetGWorldPixMap(backSrcMap),
GetPortBitMapForCopyBits(savedMaps[foundIndex].map),
@@ -120,7 +126,54 @@ short ReBackUpSavedMap (Rect *theRect, short where, short who)
}
}
return (foundIndex);
return BackUpToSavedMap(theRect, where, who, component);
}
//-------------------------------------------------------------- RemoveFromSavedMap
template<class T>
void RemapDynamicObject(T *arr, short &count, int removedIndex, int substituteIndex)
{
short countCopy = count;
for (int i = 0; i < countCopy; i++)
{
if (arr[i].who == removedIndex)
{
PortabilityLayer::ArrayTools::RemoveFromArray(arr, countCopy, i);
i--;
}
else if (arr[i].who == substituteIndex)
arr[i].who = removedIndex;
}
count = countCopy;
}
SInt16 RemoveFromSavedMap (SInt16 index)
{
int swappedIn = numSavedMaps - 1;
RemapDynamicObject(flames, numFlames, index, swappedIn);
RemapDynamicObject(tikiFlames, numTikiFlames, index, swappedIn);
RemapDynamicObject(bbqCoals, numCoals, index, swappedIn);
RemapDynamicObject(pendulums, numPendulums, index, swappedIn);
RemapDynamicObject(theStars, numStars, index, swappedIn);
RemapGreaseSavedMap(index, swappedIn);
// Have to do this explicitly so we don't trash the draw surface pointer
if (swappedIn != index)
{
savedType &dest = savedMaps[index];
savedType &src = savedMaps[swappedIn];
DisposeGWorld(dest.map);
dest = src;
src.map = nil;
}
numSavedMaps--;
return -1;
}
//-------------------------------------------------------------- RestoreFromSavedMap
@@ -128,14 +181,14 @@ short ReBackUpSavedMap (Rect *theRect, short where, short who)
// 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;
@@ -289,7 +342,7 @@ void BackUpFlames (Rect *src, short index)
// Like the above function but this is called when the lighting changes<65>
// in a room (lights go on or off).
void ReBackUpFlames (short where, short who)
Boolean ReBackUpFlames (short where, short who, short h, short v)
{
short i, f;
@@ -301,19 +354,22 @@ void ReBackUpFlames (short where, short who)
{
if (flames[f].who == i)
{
QOffsetRect(&flames[f].dest, h - 8 - flames[f].dest.left, v - 15 - flames[f].dest.top);
BackUpFlames(&flames[f].dest, i);
return;
return true;
}
}
}
}
return false;
}
//-------------------------------------------------------------- AddCandleFlame
// This adds a candle flame to tha array of flames.
void AddCandleFlame (short where, short who, short h, short v)
void AddCandleFlame (SInt16 where, SInt16 who, SInt16 h, SInt16 v)
{
Rect src, bounds;
short savedNum;
@@ -330,7 +386,7 @@ void AddCandleFlame (short where, short who, short h, short 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);
@@ -373,7 +429,7 @@ void BackUpTikiFlames (Rect *src, short index)
// This is like the function ReBackUpFlames() but customized for Tiki torches.
void ReBackUpTikiFlames (short where, short who)
Boolean ReBackUpTikiFlames (short where, short who, short h, short v)
{
short i, f;
@@ -385,12 +441,15 @@ void ReBackUpTikiFlames (short where, short who)
{
if (tikiFlames[f].who == i)
{
QOffsetRect(&tikiFlames[f].dest, h - tikiFlames[f].dest.left, v - tikiFlames[f].dest.top);
BackUpTikiFlames(&tikiFlames[f].dest, i);
return;
return true;
}
}
}
}
return false;
}
//-------------------------------------------------------------- AddTikiFlame
@@ -414,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);
@@ -459,7 +518,7 @@ void BackUpBBQCoals (Rect *src, short index)
// Sense a pattern here?
void ReBackUpBBQCoals (short where, short who)
Boolean ReBackUpBBQCoals (short where, short who, short h, short v)
{
short i, f;
@@ -471,12 +530,15 @@ void ReBackUpBBQCoals (short where, short who)
{
if (bbqCoals[f].who == i)
{
QOffsetRect(&bbqCoals[f].dest, h - bbqCoals[f].dest.left, v - bbqCoals[f].dest.top);
BackUpBBQCoals(&bbqCoals[f].dest, i);
return;
return true;
}
}
}
}
return false;
}
//-------------------------------------------------------------- AddBBQCoals
@@ -500,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);
@@ -543,7 +605,7 @@ void BackUpPendulum (Rect *src, short index)
// Backs up the pendulums in the event of lights going on or off.
void ReBackUpPendulum (short where, short who)
Boolean ReBackUpPendulum (short where, short who, short h, short v)
{
short i, f;
@@ -555,19 +617,26 @@ void ReBackUpPendulum (short where, short who)
{
if (pendulums[f].who == i)
{
BackUpPendulum(&pendulums[f].dest, i);
return;
Rect &pendulumDest = pendulums[f].dest;
pendulumDest.right += h - pendulumDest.left;
pendulumDest.bottom += v - pendulumDest.top;
pendulumDest.left = h;
pendulumDest.top = v;
BackUpPendulum(&pendulumDest, i);
return true;
}
}
}
}
return false;
}
//-------------------------------------------------------------- AddPendulum
// Adds a pendulum to the array of pendulums.
void AddPendulum (short where, short who, short h, short v)
void AddPendulum (SInt16 where, SInt16 who, SInt16 h, SInt16 v)
{
Rect src, bounds;
short savedNum;
@@ -577,7 +646,7 @@ void AddPendulum (short where, short who, short h, short 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);
@@ -635,7 +704,7 @@ void BackUpStar (Rect *src, short index)
// Re-backs up the stars - in the event of lighting switch.
void ReBackUpStar (short where, short who)
void ReBackUpStar (short where, short who, short h, short v)
{
short i, f;
@@ -647,6 +716,7 @@ void ReBackUpStar (short where, short who)
{
if (theStars[f].who == i)
{
QOffsetRect(&theStars[f].dest, h - theStars[f].dest.left, v - theStars[f].dest.top);
BackUpStar(&theStars[f].dest, i);
return;
}
@@ -677,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);
@@ -796,3 +866,14 @@ void ZeroFlamesAndTheLike (void)
numChimes = 0;
}
void RemoveSavedMapsNotInRoom(SInt16 where)
{
for (int i = 0; i < numSavedMaps; i++)
{
if (savedMaps[i].where != where)
{
RemoveFromSavedMap(i);
i--;
}
}
}

View File

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

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

View File

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

View File

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

View File

@@ -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,8 @@
#include "House.h"
#include "InputManager.h"
#include "ObjectEdit.h"
#include "Rect2i.h"
#include "WindowManager.h"
short BitchAboutColorDepth (void);
@@ -29,6 +29,7 @@ void HandleIdleTask (void);
void IncrementMode (void);
long lastUp, incrementModeTime;
UInt32 doubleTime;
Point lastWhere;
@@ -65,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);
@@ -74,18 +75,15 @@ void HandleMouseEvent (const GpMouseInputEvent &theEvent, uint32_t tick)
switch (thePart)
{
case inMenuBar:
case RegionIDs::kMenuBar:
menuChoice = MenuSelect(evtPoint);
DoMenuChoice(menuChoice);
break;
case inDrag:
DragWindow(whichWindow, evtPoint, &thisMac.screen);
case RegionIDs::kTitleBar:
PortabilityLayer::WindowManager::GetInstance()->DragWindow(whichWindow, evtPoint, thisMac.fullScreen);
if (whichWindow == mainWindow)
{
SendBehind(mainWindow, (WindowPtr)0L);
GetWindowLeftTop(whichWindow, &isEditH, &isEditV);
}
else if (whichWindow == mapWindow)
GetWindowLeftTop(whichWindow, &isMapH, &isMapV);
else if (whichWindow == toolsWindow)
@@ -94,10 +92,9 @@ void HandleMouseEvent (const GpMouseInputEvent &theEvent, uint32_t tick)
GetWindowLeftTop(whichWindow, &isLinkH, &isLinkV);
else if (whichWindow == coordWindow)
GetWindowLeftTop(whichWindow, &isCoordH, &isCoordV);
HiliteAllWindows();
break;
case inGoAway:
case RegionIDs::kClose:
if (TrackGoAway(whichWindow, evtPoint))
{
if (whichWindow == mapWindow)
@@ -111,21 +108,15 @@ void HandleMouseEvent (const GpMouseInputEvent &theEvent, uint32_t tick)
}
break;
case inGrow:
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;
case inZoomIn:
case inZoomOut:
if (TrackBox(whichWindow, evtPoint, thePart))
ZoomWindow(whichWindow, thePart, true);
break;
case inContent:
case RegionIDs::kContent:
if (whichWindow == mainWindow)
{
hDelta = evtPoint.h - lastWhere.h;
@@ -153,7 +144,7 @@ void HandleMouseEvent (const GpMouseInputEvent &theEvent, uint32_t tick)
HandleLinkClick(evtPoint);
break;
default:
default:
break;
}
}
@@ -322,118 +313,65 @@ 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);
}
else if ((WindowPtr)theEvent->message == menuWindow)
{
UpdateMenuBarWindow(menuWindow->GetDrawSurface());
EndUpdate(menuWindow);
}
}
//-------------------------------------------------------------- HandleOSEvent
// Handle an OS Event (MultiFinder - user has switched in or out of app).
void HandleOSEvent (EventRecord *theEvent)
//-------------------------------------------------------------- HandleSplashResolutionChange
void HandleSplashResolutionChange(void)
{
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();
}
}
FlushResolutionChange();
RecomputeInterfaceRects();
RecreateOffscreens();
CloseMainWindow();
OpenMainWindow();
UpdateMainWindow();
//ResetLocale(true);
InitScoreboardMap();
//RefreshScoreboard(wasScoreboardTitleMode);
//DumpScreenOn(&justRoomsRect);
}
//-------------------------------------------------------------- HandleHighLevelEvent
// Handle an AppleEvent (Open Document, Quit Application, etc.).
void HandleHighLevelEvent (EventRecord *theEvent)
void KeepWindowInBounds(Window *window)
{
PLError_t theErr;
theErr = AEProcessAppleEvent(theEvent);
if ((theErr != PLErrors::kNone) && (theErr != errAEEventNotHandled))
YellowAlert(kYellowAppleEventErr, theErr);
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();
RecomputeInterfaceRects();
RecreateOffscreens();
CloseMainWindow();
OpenMainWindow();
UpdateMainWindow();
//ResetLocale(true);
InitScoreboardMap();
//RefreshScoreboard(wasScoreboardTitleMode);
//DumpScreenOn(&justRoomsRect);
if (toolsWindow)
PortabilityLayer::WindowManager::GetInstance()->PutWindowBehind(toolsWindow, PortabilityLayer::WindowManager::GetInstance()->GetPutInFrontSentinel());
if (mapWindow)
PortabilityLayer::WindowManager::GetInstance()->PutWindowBehind(mapWindow, PortabilityLayer::WindowManager::GetInstance()->GetPutInFrontSentinel());
KeepWindowInBounds(mainWindow);
KeepWindowInBounds(toolsWindow);
KeepWindowInBounds(mapWindow);
}
#endif
//-------------------------------------------------------------- HandleIdleTask
// Handle some processing during event lulls.
@@ -442,7 +380,12 @@ void HandleIdleTask (void)
{
if (theMode == kEditMode)
{
SetPort((GrafPtr)mainWindow);
if (thisMac.isResolutionDirty)
{
HandleEditorResolutionChange();
}
SetPort(mainWindow->GetDrawSurface());
DoMarquee();
if ((autoRoomEdit) && (newRoomNow))
@@ -452,6 +395,14 @@ void HandleIdleTask (void)
newRoomNow = false;
}
}
if (theMode == kSplashMode)
{
if (thisMac.isResolutionDirty)
{
HandleSplashResolutionChange();
}
}
}
//-------------------------------------------------------------- HandleEvent
@@ -515,28 +466,6 @@ void HandleEvent (void)
}
}
//-------------------------------------------------------------- HiliteAllWindows
// Ugly kludge in order to keep "floating windows" (palettes) on top of<6F>
// the main window.
void HiliteAllWindows (void)
{
PL_NotYetImplemented_TODO("DeleteMe");
#if 0
if (mainWindow != nil)
HiliteWindow(mainWindow, true);
if (mapWindow != nil)
HiliteWindow(mapWindow, true);
if (toolsWindow != nil)
HiliteWindow(toolsWindow, true);
if (coordWindow != nil)
HiliteWindow(coordWindow, true);
if (linkWindow != nil)
HiliteWindow(linkWindow, true);
#endif
}
//-------------------------------------------------------------- IgnoreThisClick
// Another inelegant kludge designed to temporarily prevent an unwanted<65>

View File

@@ -13,9 +13,12 @@
namespace PortabilityLayer
{
class ResolveCachingColor;
class ResourceArchive;
class ScanlineMask;
class ResTypeID;
struct RGBAColor;
class RenderedFont;
}
#define kPreferredDepth 8
@@ -48,6 +51,7 @@ namespace PortabilityLayer
#define kErrNeed16Or256Colors 13
#define iAbout 1
#define iAboutAerofoil 3
#define iNewGame 1
#define iTwoPlayer 2
#define iOpenSavedGame 3
@@ -124,6 +128,7 @@ typedef struct
//-------------------------------------------------------------- Prototypes
void DoAbout (void); // --- About.c
void DoAboutFramework (void);
void LoadCursors (void); // --- AnimCursor.c
void DisposCursors (void);
@@ -132,19 +137,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 ColorRegion (DrawSurface *surface, PortabilityLayer::ScanlineMask *scanlineMask, long colorIndex);
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 *);
@@ -161,12 +166,12 @@ void FillScreenRed (void);
void DumpToResEditFile (Ptr, long);
void HandleEvent (void); // --- Event.c
void HiliteAllWindows (void);
void IgnoreThisClick (void);
short WhatsOurDepth (void); // --- Environs.c
void SwitchToDepth (short, Boolean);
void CheckOurEnvirons (void);
void InstallResolutionHandler (void);
//void ReflectSecondMonitorEnvirons (Boolean, Boolean, Boolean);
void HandleDepthSwitching (void);
void RestoreColorDepth (void);
@@ -187,7 +192,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);
@@ -221,7 +226,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);
@@ -102,19 +107,17 @@ void SetUpFinalScreen (void)
do
{
GetLineOfText(tempStr, count, subStr);
offset = ((thisMac.screen.right - thisMac.screen.left) -
surface->MeasureString(subStr)) / 2;
surface->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
offset = ((thisMac.constrainedScreen.right - thisMac.constrainedScreen.left) -
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);
@@ -146,6 +149,12 @@ void DoGameOverStarAnimation (void)
long nextLoop;
short which, i, count, pass;
Boolean noInteruption;
short starFallSpeed = kStarFalls;
const int kStarSpacing = 32;
const int kAngelSpeed = 2;
const int kStarsReserved = 5;
const int kMaxFramesAlive = (kStarSpacing * kStarsReserved + kAngelSpeed - 1) / kAngelSpeed;
angelDest = angelSrcRect;
QOffsetRect(&angelDest, -96, 0);
@@ -153,15 +162,20 @@ 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;
while (noInteruption)
{
if ((angelDest.left % 32) == 0) // add a star
if ((angelDest.left % kStarSpacing) == 0) // add a star
{
PlayPrioritySound(kMysticSound, kMysticPriority);
which = angelDest.left / 32;
which = which % 5;
which = angelDest.left / kStarSpacing;
which = which % kStarsReserved;
if (which < 0)
which += kStarsReserved;
ZeroRectCorner(&pages[which].dest);
QOffsetRect(&pages[which].dest, angelDest.left, angelDest.bottom);
if (count < (which + 1))
@@ -182,13 +196,13 @@ void DoGameOverStarAnimation (void)
&pages[i].dest);
pages[i].was = pages[i].dest;
pages[i].was.top -= kStarFalls;
pages[i].was.top -= starFallSpeed;
AddRectToWorkRectsWhole(&pages[i].was);
AddRectToBackRects(&pages[i].dest);
if (pages[i].dest.top < workSrcRect.bottom)
QOffsetRect(&pages[i].dest, 0, kStarFalls);
QOffsetRect(&pages[i].dest, 0, starFallSpeed);
}
if (angelDest.left <= (workSrcRect.right + 2))
@@ -197,11 +211,11 @@ void DoGameOverStarAnimation (void)
(BitMap *)*GetGWorldPixMap(angelMaskMap),
(BitMap *)*GetGWorldPixMap(workSrcMap),
&angelSrcRect, &angelSrcRect, &angelDest);
angelDest.left -= 2;
angelDest.left -= kAngelSpeed;
AddRectToWorkRectsWhole(&angelDest);
angelDest.left += 2;
angelDest.left += kAngelSpeed;
AddRectToBackRects(&angelDest);
QOffsetRect(&angelDest, 2, 0);
QOffsetRect(&angelDest, kAngelSpeed, 0);
pass = 0;
}
@@ -283,14 +297,14 @@ void InitDiedGameOver (void)
for (i = 0; i < 8; i++) // initialize dest page rects
{
QSetRect(&pages[i].dest, 0, 0, 32, 32);
CenterRectInRect(&pages[i].dest, &thisMac.screen);
QOffsetRect(&pages[i].dest, -thisMac.screen.left, -thisMac.screen.top);
CenterRectInRect(&pages[i].dest, &thisMac.constrainedScreen);
QOffsetRect(&pages[i].dest, -thisMac.constrainedScreen.left, -thisMac.constrainedScreen.top);
if (i < 4)
QOffsetRect(&pages[i].dest, -kPageSpacing * (4 - i), 0);
else
QOffsetRect(&pages[i].dest, kPageSpacing * (i - 3), 0);
QOffsetRect(&pages[i].dest, (thisMac.screen.right - thisMac.screen.left) / -2,
(thisMac.screen.right - thisMac.screen.left) / -2);
QOffsetRect(&pages[i].dest, (thisMac.constrainedScreen.right - thisMac.constrainedScreen.left) / -2,
(thisMac.constrainedScreen.right - thisMac.constrainedScreen.left) / -2);
if (pages[i].dest.left % 2 == 1)
QOffsetRect(&pages[i].dest, 1, 0);
pages[i].was = pages[i].dest;
@@ -306,7 +320,7 @@ void InitDiedGameOver (void)
}
pagesStuck = 0;
stopPages = ((thisMac.screen.bottom - thisMac.screen.top) / 2) - 16;
stopPages = ((thisMac.constrainedScreen.bottom - thisMac.constrainedScreen.top) / 2) - 16;
}
//-------------------------------------------------------------- HandlePages
@@ -450,7 +464,7 @@ void DoDiedGameOver (void)
InitDiedGameOver();
CopyRectMainToWork(&workSrcRect);
CopyRectMainToBack(&workSrcRect);
FlushEvents(everyEvent, 0);
FlushEvents();
nextLoop = TickCount() + 2;
while (pagesStuck < 8)

View File

@@ -265,7 +265,7 @@
#define kMaxDynamicObs 18
#define kMaxMasterObjects 216 // kMaxRoomObs * 9
#define kMaxViewWidth 1536
#define kMaxViewHeight 1026
#define kMaxViewHeight (kTileHigh*3+20)
#define kSelectTool 0
@@ -510,8 +510,6 @@
#define kNoCeilingLimit -10
#define kNoFloorLimit 332
#define kScoreboardHigh 0
#define kScoreboardLow 1
#define kScoreboardTall 20
#define kHouseVersion 0x0200
@@ -623,3 +621,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,26 +23,28 @@ void CloseCoordWindow (void);
void ToggleCoordinateWindow (void);
void NilSavedMaps (void); // --- DynamicMaps.c
SInt16 BackUpToSavedMap (Rect *, SInt16, SInt16);
SInt16 ReBackUpSavedMap (Rect *, SInt16, SInt16);
void RestoreFromSavedMap (SInt16, SInt16, Boolean);
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 where, SInt16 who, SInt16 component, Boolean doSparkle);
void AddSparkle (Rect *);
void AddFlyingPoint (Rect *, SInt16, SInt16, SInt16);
void ReBackUpFlames (SInt16, SInt16);
Boolean ReBackUpFlames (SInt16, SInt16, SInt16, SInt16);
void AddCandleFlame (SInt16, SInt16, SInt16, SInt16);
void ReBackUpTikiFlames (SInt16, SInt16);
Boolean ReBackUpTikiFlames (SInt16, SInt16, SInt16, SInt16);
void AddTikiFlame (SInt16, SInt16, SInt16, SInt16);
void ReBackUpBBQCoals (SInt16, SInt16);
Boolean ReBackUpBBQCoals (SInt16, SInt16, SInt16, SInt16);
void AddBBQCoals (SInt16, SInt16, SInt16, SInt16);
void ReBackUpPendulum (SInt16, SInt16);
Boolean ReBackUpPendulum (SInt16, SInt16, SInt16, SInt16);
void AddPendulum (SInt16, SInt16, SInt16, SInt16);
void ReBackUpStar (SInt16, SInt16);
void ReBackUpStar (SInt16, SInt16, SInt16, SInt16);
void AddStar (SInt16, SInt16, SInt16, SInt16);
void StopPendulum (SInt16, SInt16);
void StopStar (SInt16, SInt16);
void AddAShreddedGlider (Rect *);
void RemoveShreds (void);
void ZeroFlamesAndTheLike (void);
void RemoveSavedMapsNotInRoom (SInt16);
void CheckDynamicCollision (SInt16, gliderPtr, Boolean); // --- Dynamics.c
Boolean DidBandHitDynamic (SInt16);
@@ -73,17 +75,21 @@ void HandleFish (SInt16);
void HandleDynamics (void); // --- Dynamics3.c
void RenderDynamics (void);
void ZeroDinahs (void);
SInt16 AddDynamicObject (SInt16, Rect *, objectType *, SInt16, SInt16, Boolean);
void ZeroDinahsNotInRoom (SInt16);
SInt16 AddDynamicObject(SInt16 what, Rect *where, objectType *who, SInt16 room, SInt16 index, Boolean isOn, Boolean keepExisting);
void DoGameOver (void); // --- GameOver.c
void FlagGameOver (void);
void DoDiedGameOver (void);
void HandleGrease (void); // --- Grease.c
SInt16 ReBackUpGrease (SInt16, SInt16);
SInt16 ReBackUpGrease (SInt16 where, SInt16 who, SInt16 h, SInt16 v);
SInt16 AddGrease (SInt16, SInt16, SInt16, SInt16, SInt16, Boolean);
void SpillGrease (SInt16, SInt16);
void RedrawAllGrease (void);
void FixupFallenGrease(SInt16 where, SInt16 who, SInt16 h, SInt16 v, Boolean *isDynamic);
void RemapGreaseSavedMap(SInt16 removedItem, SInt16 substituteItem);
void DoHighScores (void); // --- HighScores.c
void SortHighScores (void);
@@ -132,6 +138,7 @@ void FlagStillOvers (gliderPtr);
void InitializeMenus (void); // --- InterfaceInit.c
void GetExtraCursors (void);
void RecomputeInterfaceRects (void);
void VariableInit (void);
void GetDemoInput (gliderPtr); // --- Input.c
@@ -147,13 +154,11 @@ void HandleLinkClick (Point);
void RedrawSplashScreen (void); // --- MainWindow.c
void UpdateMainWindow (void);
void UpdateMenuBarWindow (DrawSurface *surface);
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);
@@ -173,10 +178,10 @@ void StartMarqueeHandled (Rect *, SInt16, SInt16);
void StopMarquee (void);
void PauseMarquee (void);
void ResumeMarquee (void);
void DragOutMarqueeRect (Point, Rect *);
void DragMarqueeRect (DrawSurface *, Point, Rect *, Boolean, Boolean);
void DragMarqueeHandle (DrawSurface *, Point, SInt16 *);
void DragMarqueeCorner (DrawSurface *, Point, SInt16 *, SInt16 *, Boolean);
void DragOutMarqueeRect (Window *, Point, Rect *);
void DragMarqueeRect (Window *, DrawSurface *, Point, Rect *, Boolean, Boolean);
void DragMarqueeHandle (Window *, DrawSurface *, Point, SInt16 *);
void DragMarqueeCorner (Window *, DrawSurface *, Point, SInt16 *, SInt16 *, Boolean);
Boolean MarqueeHasHandles (SInt16 *, SInt16 *);
Boolean PtInMarqueeHandle (Point);
void SetMarqueeGliderRect (SInt16, SInt16);
@@ -257,8 +262,8 @@ void DrawBlueClock (Rect *);
void DrawYellowClock (Rect *);
void DrawCuckoo (Rect *);
void DrawSimplePrizes (SInt16, Rect *);
void DrawGreaseRt (Rect *, SInt16, Boolean);
void DrawGreaseLf (Rect *, SInt16, Boolean);
void DrawGreaseRt (Rect *, SInt16, Boolean, Boolean);
void DrawGreaseLf (Rect *, SInt16, Boolean, Boolean);
void DrawFoil (Rect *);
void DrawInvisBonus (Rect *);
void DrawSlider (Rect *);
@@ -306,7 +311,7 @@ void DrawCustPictSansWhite (SInt16, Rect *);
void DrawARoomsObjects (SInt16, Boolean); // --- ObjectDrawAll.c
void DoSelectionClick (DrawSurface *, Point, Boolean); // --- ObjectEdit.c
void DoSelectionClick (Window *, DrawSurface *, Point, Boolean); // --- ObjectEdit.c
void DoNewObjectClick (Point);
void DeleteObject (void);
void DuplicateObject (void);
@@ -407,7 +412,8 @@ Boolean DoesRoomHaveFloor (void);
Boolean DoesRoomHaveCeiling (void);
void ReadyLevel (void); // --- RoomGraphics.c
void DrawLocale (void);
void ResetLocale (Boolean soft);
void DrawLocale (Boolean soft);
void RedrawRoomLighting (void);
Boolean PictIDExists (SInt16); // --- RoomInfo.c
@@ -428,8 +434,6 @@ void QuickBatteryRefresh (Boolean);
void QuickBandsRefresh (Boolean);
void QuickFoilRefresh (Boolean);
void HandleScore (void);
void AdjustScoreboardHeight (void);
void BlackenScoreboard (DrawSurface *);
//void PutRoomScrap (void); // --- Scrap.c
//void PutObjectScrap (void);
@@ -470,6 +474,7 @@ void InitEnemies (void);
void CreateOffscreens (void); // --- StructuresInit2.c
void CreatePointers (void);
void InitSrcRects (void);
PLError_t RecreateOffscreens (void);
void UpdateToolsWindow (void); // --- Tools.c
void EraseSelectedTool (void);

View File

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

View File

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

View File

@@ -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,9 +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;
bool PL_AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY) override;
};
@@ -54,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);
@@ -79,6 +87,19 @@ void GpAppInterfaceImpl::PL_InstallHostSuspendHook(PortabilityLayer::HostSuspend
PortabilityLayer::InstallHostSuspendHook(hook, context);
}
bool GpAppInterfaceImpl::PL_AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY)
{
PortabilityLayer::DisplayDeviceManager::IResolutionChangeHandler *handler = PortabilityLayer::DisplayDeviceManager::GetInstance()->GetResolutionChangeHandler();
if (!handler)
return false;
handler->AdjustRequestedResolution(physicalWidth, physicalHeight, virtualWidth, virtualheight, pixelScaleX, pixelScaleY);
return true;
}
static GpAppInterfaceImpl gs_application;

View File

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

View File

@@ -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,9 +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
{
@@ -67,10 +70,11 @@ extern Boolean quickerTransitions, resumedSavedGame;
void DoHighScores (void)
{
Rect tempRect;
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
SpinCursor(3);
SetPort((GrafPtr)workSrcMap);
workSrcMap->FillRect(workSrcRect);
SetPort(workSrcMap);
workSrcMap->FillRect(workSrcRect, blackColor);
QSetRect(&tempRect, 0, 0, 640, 480);
QOffsetRect(&tempRect, splashOriginH, splashOriginV);
LoadScaledGraphic(workSrcMap, kStarPictID, &tempRect);
@@ -117,13 +121,13 @@ 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.screen.right - thisMac.screen.left) - kScoreWide) / 2;
scoreLeft = ((thisMac.constrainedScreen.right - thisMac.constrainedScreen.left) - kScoreWide) / 2;
dropIt = 129 + splashOriginV;
QSetRect(&tempRect, 0, 0, 332, 30);
@@ -144,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++)
{
@@ -190,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
@@ -409,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)
@@ -504,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);
@@ -513,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);
@@ -531,6 +526,11 @@ void GetHighScoreName (short place)
leaving = true;
}
}
if (doZooms)
wm->FlickerWindowOut(theDial->GetWindow(), 64);
wm->SwapExclusiveWindow(exclStack); // Pop exclusive window
theDial->Destroy();
}
@@ -608,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);
@@ -616,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);
@@ -628,6 +636,11 @@ void GetHighScoreBanner (void)
leaving = true;
}
}
if (doZooms)
wm->FlickerWindowOut(theDial->GetWindow(), 64);
wm->SwapExclusiveWindow(exclStack); // Pop exclusive window
theDial->Destroy();
}
@@ -701,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,8 @@
#include "FileManager.h"
#include "HostFileSystem.h"
#include "House.h"
#include "PLStandardColors.h"
#include "PLTimeTaggedVOSEvent.h"
#include "RectUtils.h"
#include "ResourceManager.h"
@@ -26,7 +26,9 @@
void UpdateGoToDialog (Dialog *);
Boolean GoToFilter (Dialog *, EventRecord *, short *);
int16_t GoToFilter (Dialog *dial, const TimeTaggedVOSEvent *evt);
extern PortabilityLayer::ResourceArchive *houseResFork;
houseHand thisHouse;
@@ -52,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;
@@ -241,11 +241,7 @@ void WhereDoesGliderBegin (Rect *theRect, short mode)
Boolean HouseHasOriginalPicts (void)
{
short nPicts;
PL_NotYetImplemented(); nPicts = 0;
//nPicts = Count1Resources('PICT');
return (nPicts > 0);
return houseResFork->HasAnyResourcesOfType('PICT');
}
//-------------------------------------------------------------- CountHouseLinks
@@ -596,7 +592,6 @@ void GenerateRetroLinks (void)
void UpdateGoToDialog (Dialog *theDialog)
{
DrawDialog(theDialog);
DrawDefaultButton(theDialog);
FrameDialogItemC(theDialog, 10, kRedOrangeColor8);
}
@@ -604,37 +599,27 @@ void UpdateGoToDialog (Dialog *theDialog)
//-------------------------------------------------------------- GoToFilter
// Dialog filter for the "Go To Room..." dialog.
Boolean GoToFilter (Dialog *dial, EventRecord *event, short *item)
int16_t GoToFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
{
switch (event->what)
if (!evt)
return -1;
if (evt->IsKeyDownEvent())
{
case keyDown:
switch (event->message)
const GpKeyboardInputEvent &keyEvt = evt->m_vosEvent.m_event.m_keyboardInputEvent;
switch (PackVOSKeyCode(keyEvt))
{
case PL_KEY_SPECIAL(kEnter):
case PL_KEY_NUMPAD_SPECIAL(kEnter):
case PL_KEY_SPECIAL(kEnter):
case PL_KEY_NUMPAD_SPECIAL(kEnter):
FlashDialogButton(dial, kOkayButton);
*item = kOkayButton;
return(true);
break;
default:
return(false);
}
break;
case updateEvt:
SetPortDialogPort(dial);
UpdateGoToDialog(dial);
EndUpdate(dial->GetWindow());
event->what = nullEvent;
return(false);
break;
return kOkayButton;
default:
return(false);
break;
return -1;
}
}
return -1;
}
//-------------------------------------------------------------- DoGoToDialog
@@ -666,10 +651,12 @@ Boolean GoToFilter (Dialog *dial, EventRecord *event, short *item)
leaving = false;
canceled = false;
UpdateGoToDialog(theDialog);
while (!leaving)
{
ModalDialog(GoToFilter, &item);
item = theDialog->ExecuteModal(GoToFilter);
if (item == kOkayButton)
{
@@ -740,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,8 +9,8 @@
#include "PLMovies.h"
#include "PLResources.h"
#include "PLStringCompare.h"
#include "PLTextUtils.h"
#include "PLPasStr.h"
#include "BitmapImage.h"
#include "DialogManager.h"
#include "Externs.h"
#include "Environ.h"
@@ -34,7 +34,7 @@ void CloseHouseMovie (void);
Boolean IsFileReadOnly (const VFileSpec &);
Movie theMovie;
AnimationPlayer theMovie;
Rect movieRect;
PortabilityLayer::ResourceArchive *houseResFork;
short wasHouseVersion;
@@ -52,31 +52,12 @@ extern Boolean phoneBitSet, bannerStarCountOn;
//============================================================== Functions
//-------------------------------------------------------------- LoopMovie
void LoopMovie (void)
{
THandle<long> theLoop;
UserData theUserData;
short theCount;
theLoop = NewHandle(sizeof(long)).StaticCast<long>();
(**theLoop) = 0;
theUserData = GetMovieUserData(theMovie);
theCount = CountUserDataType(theUserData, 'LOOP');
while (theCount--)
{
RemoveUserData(theUserData, 'LOOP', 1);
}
AddUserData(theUserData, theLoop.StaticCast<void>(), 'LOOP');
}
//-------------------------------------------------------------- OpenHouseMovie
void OpenHouseMovie (void)
{
#ifdef COMPILEQT
TimeBase theTime;
VFileSpec theSpec;
VFileInfo finderInfo;
Handle spaceSaver;
@@ -92,60 +73,24 @@ void OpenHouseMovie (void)
theErr = FSpGetFInfo(theSpec, finderInfo);
if (theErr != PLErrors::kNone)
return;
theErr = OpenMovieFile(theSpec, &movieRefNum, 0);
if (theErr != PLErrors::kNone)
AnimationPackage *anim = AnimationPackage::Create();
if (!anim)
return;
if (!anim->Load(theSpec.m_dir, theSpec.m_name))
{
anim->Destroy();
YellowAlert(kYellowQTMovieNotLoaded, theErr);
return;
}
theErr = NewMovieFromFile(&theMovie, movieRefNum, nil, theSpec.m_name,
newMovieActive, &dataRefWasChanged);
if (theErr != PLErrors::kNone)
{
YellowAlert(kYellowQTMovieNotLoaded, theErr);
theErr = CloseMovieFile(movieRefNum);
return;
}
theErr = CloseMovieFile(movieRefNum);
spaceSaver = NewHandle(307200L);
if (spaceSaver == nil)
{
YellowAlert(kYellowQTMovieNotLoaded, 749);
CloseHouseMovie();
return;
}
GoToBeginningOfMovie(theMovie);
theErr = LoadMovieIntoRam(theMovie,
GetMovieTime(theMovie, 0L), GetMovieDuration(theMovie), 0);
if (theErr != PLErrors::kNone)
{
YellowAlert(kYellowQTMovieNotLoaded, theErr);
spaceSaver.Dispose();
CloseHouseMovie();
return;
}
spaceSaver.Dispose();
theErr = PrerollMovie(theMovie, 0, 0x000F0000);
if (theErr != PLErrors::kNone)
{
YellowAlert(kYellowQTMovieNotLoaded, theErr);
CloseHouseMovie();
return;
}
theTime = GetMovieTimeBase(theMovie);
SetTimeBaseFlags(theTime, loopTimeBase);
SetMovieMasterTimeBase(theMovie, theTime, nil);
LoopMovie();
GetMovieBox(theMovie, &movieRect);
movieRect = (*anim->GetFrame(0))->GetRect();
hasMovie = true;
theMovie.SetPackage(anim);
AnimationManager::GetInstance()->RegisterPlayer(&theMovie);
}
#endif
}
@@ -159,9 +104,10 @@ void CloseHouseMovie (void)
if ((thisMac.hasQT) && (hasMovie))
{
theErr = LoadMovieIntoRam(theMovie,
GetMovieTime(theMovie, 0L), GetMovieDuration(theMovie), flushFromRam);
DisposeMovie(theMovie);
AnimationManager::GetInstance()->RemovePlayer(&theMovie);
theMovie.m_animPackage->Destroy();
theMovie.m_animPackage = nullptr;
}
#endif
hasMovie = false;
@@ -195,8 +141,10 @@ Boolean OpenHouse (void)
houseOpen = true;
OpenHouseResFork();
hasMovie = false;
if (hasMovie)
CloseHouseMovie();
tvInRoom = false;
tvWithMovieNumber = -1;
OpenHouseMovie();
@@ -665,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

@@ -12,6 +12,11 @@
#include "Externs.h"
#include "DialogManager.h"
#include "DialogUtils.h"
#include "HostDisplayDriver.h"
#include "IGpDisplayDriver.h"
#include "PLArrayView.h"
#include "PLEditboxWidget.h"
#include "PLTimeTaggedVOSEvent.h"
#define kHouseInfoDialogID 1001
@@ -29,7 +34,7 @@
long CountTotalHousePoints (void);
void UpdateHouseInfoDialog (Dialog *);
Boolean HouseFilter (Dialog *, EventRecord *, short *);
int16_t HouseFilter(Dialog *dial, const TimeTaggedVOSEvent *evt);
Boolean WarnLockingHouse (void);
void HowToZeroScores (void);
@@ -107,7 +112,6 @@ void UpdateHouseInfoDialog (Dialog *theDialog)
{
short nChars;
DrawDialog(theDialog);
nChars = GetDialogStringLen(theDialog, kBannerTextItem);
SetDialogNumToStr(theDialog, kBannerNCharsItem, (long)nChars);
nChars = GetDialogStringLen(theDialog, kTrailerTextItem);
@@ -119,7 +123,7 @@ void UpdateHouseInfoDialog (Dialog *theDialog)
//-------------------------------------------------------------- HouseFilter
Boolean HouseFilter (Dialog *dial, EventRecord *event, short *item)
int16_t HouseFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
{
Point mouseIs;
short nChars;
@@ -132,70 +136,66 @@ Boolean HouseFilter (Dialog *dial, EventRecord *event, short *item)
SetDialogNumToStr(dial, kTrailerNCharsItem, (long)nChars);
keyHit = false;
}
switch (event->what)
{
case keyDown:
switch (event->message)
{
case PL_KEY_SPECIAL(kEnter):
case PL_KEY_NUMPAD_SPECIAL(kEnter):
FlashDialogButton(dial, kOkayButton);
*item = kOkayButton;
return(true);
break;
case PL_KEY_SPECIAL(kEscape):
FlashDialogButton(dial, kCancelButton);
*item = kCancelButton;
return(true);
break;
default:
keyHit = true;
return(false);
}
break;
case mouseDown:
return(false);
break;
case mouseUp:
return(false);
break;
case updateEvt:
SetPortDialogPort(dial);
UpdateHouseInfoDialog(dial);
EndUpdate(dial->GetWindow());
event->what = nullEvent;
return(false);
break;
default:
mouseIs = event->where;
mouseIs -= dial->GetWindow()->TopLeftCoord();
if ((PtInRect(mouseIs, &houseEditText1)) ||
(PtInRect(mouseIs, &houseEditText2)))
if (evt)
{
if (evt->m_vosEvent.m_eventType == GpVOSEventTypes::kKeyboardInput)
{
if (houseCursorIs != kBeamCursor)
const GpKeyboardInputEvent &keyEvt = evt->m_vosEvent.m_event.m_keyboardInputEvent;
if (keyEvt.m_eventType == GpKeyboardInputEventTypes::kDown)
{
SetBuiltinCursor(iBeamCursor);
houseCursorIs = kBeamCursor;
switch (PackVOSKeyCode(keyEvt))
{
case PL_KEY_NUMPAD_SPECIAL(kEnter):
FlashDialogButton(dial, kOkayButton);
return kOkayButton;
case PL_KEY_SPECIAL(kEscape):
FlashDialogButton(dial, kCancelButton);
return kCancelButton;
default:
keyHit = true;
return -1;
}
}
else if (keyEvt.m_eventType == GpKeyboardInputEventTypes::kDownChar || keyEvt.m_eventType == GpKeyboardInputEventTypes::kAutoChar)
{
keyHit = true;
return -1;
}
}
else
else if (evt->m_vosEvent.m_eventType == GpVOSEventTypes::kMouseInput)
{
if (houseCursorIs != kArrowCursor)
const GpMouseInputEvent &mouseEvt = evt->m_vosEvent.m_event.m_mouseInputEvent;
if (mouseEvt.m_eventType == GpMouseEventTypes::kMove)
{
InitCursor();
houseCursorIs = kArrowCursor;
mouseIs = Point::Create(mouseEvt.m_x, mouseEvt.m_y);
mouseIs -= dial->GetWindow()->GetTopLeftCoord();
if ((houseEditText1.Contains(mouseIs)) ||
(houseEditText2.Contains(mouseIs)))
{
if (houseCursorIs != kBeamCursor)
{
PortabilityLayer::HostDisplayDriver::GetInstance()->SetStandardCursor(EGpStandardCursors::kIBeam);
houseCursorIs = kBeamCursor;
}
}
else
{
if (houseCursorIs != kArrowCursor)
{
InitCursor();
houseCursorIs = kArrowCursor;
}
}
}
}
return(false);
break;
}
return -1;
}
//-------------------------------------------------------------- DoHouseInfo
@@ -231,9 +231,12 @@ void DoHouseInfo (void)
houseInfoDialog = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kHouseInfoDialogID, kPutInFront, &substitutions);
if (houseInfoDialog == nil)
RedAlert(kErrDialogDidntLoad);
SetPort((GrafPtr)houseInfoDialog);
SetPort(houseInfoDialog->GetWindow()->GetDrawSurface());
ShowWindow(houseInfoDialog->GetWindow());
static_cast<PortabilityLayer::EditboxWidget*>(houseInfoDialog->GetItems()[kBannerTextItem - 1].GetWidget())->SetMultiLine(true);
static_cast<PortabilityLayer::EditboxWidget*>(houseInfoDialog->GetItems()[kTrailerTextItem - 1].GetWidget())->SetMultiLine(true);
SetDialogString(houseInfoDialog, kBannerTextItem, banner);
SetDialogString(houseInfoDialog, kTrailerTextItem, trailer);
SelectDialogItemText(houseInfoDialog, kBannerTextItem, 0, 1024);
@@ -241,10 +244,12 @@ void DoHouseInfo (void)
GetDialogItemRect(houseInfoDialog, kTrailerTextItem, &houseEditText2);
houseCursorIs = kArrowCursor;
leaving = false;
UpdateHouseInfoDialog(houseInfoDialog);
while (!leaving)
{
ModalDialog(HouseFilter, &item);
item = houseInfoDialog->ExecuteModal(HouseFilter);
if (item == kOkayButton)
{

View File

@@ -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"
@@ -648,8 +650,8 @@ void CheckDuplicateFloorSuite (void)
{
bitPlace = (((*thisHouse)->rooms[i].floor + 7) * 128) +
(*thisHouse)->rooms[i].suite;
if ((bitPlace < 0) || (bitPlace >= 8192))
DebugStr(PSTR("Blew array"));
//if ((bitPlace < 0) || (bitPlace >= 8192))
// DebugStr(PSTR("Blew array"));
if (pidgeonHoles[bitPlace] != 0)
{
houseErrors++;
@@ -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,13 +5,13 @@
//============================================================================
#include "PLToolUtils.h"
#include "PLDialogs.h"
#include "PLKeyEncoding.h"
#include "DialogManager.h"
#include "Externs.h"
#include "InputManager.h"
#include "MainWindow.h"
#include "QDPixMap.h"
#include "RectUtils.h"
@@ -118,7 +118,7 @@ void DoPause (void)
}
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
&bounds, &bounds, srcCopy);
do
@@ -467,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

@@ -8,9 +8,13 @@
#include "Externs.h"
#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"
@@ -20,17 +24,14 @@
#define kHoriCursorID 130
#define kDiagCursorID 131
struct IGpCursor;
extern THandle<Rect> mirrorRects;
extern WindowPtr mapWindow, toolsWindow, linkWindow;
extern WindowPtr menuWindow;
extern Rect shieldRect, boardSrcRect, localRoomsDest[];
extern CursHandle handCursorH, vertCursorH, horiCursorH;
extern CursHandle diagCursorH;
extern Cursor handCursor, vertCursor, horiCursor;
extern Cursor diagCursor;
extern Rect boardSrcRect, localRoomsDest[];
extern IGpCursor *handCursor, *vertCursor, *horiCursor;
extern IGpCursor *diagCursor;
extern MenuHandle appleMenu, gameMenu, optionsMenu, houseMenu;
extern Point shieldPt;
extern long incrementModeTime;
extern UInt32 doubleTime;
extern short fadeInSequence[], idleMode;
@@ -47,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);
@@ -81,25 +83,55 @@ void InitializeMenus (void)
void GetExtraCursors (void)
{
handCursorH = GetCursor(kHandCursorID);
if (handCursorH == nil)
handCursor = PortabilityLayer::HostDisplayDriver::GetInstance()->LoadCursor(false, kHandCursorID);
if (handCursor == nil)
RedAlert(kErrFailedResourceLoad);
handCursor = **handCursorH;
vertCursorH = GetCursor(kVertCursorID);
if (vertCursorH == nil)
vertCursor = PortabilityLayer::HostDisplayDriver::GetInstance()->LoadCursor(false, kVertCursorID);
if (vertCursor == nil)
RedAlert(kErrFailedResourceLoad);
vertCursor = **vertCursorH;
horiCursorH = GetCursor(kHoriCursorID);
if (horiCursorH == nil)
horiCursor = PortabilityLayer::HostDisplayDriver::GetInstance()->LoadCursor(false, kHoriCursorID);
if (horiCursor == nil)
RedAlert(kErrFailedResourceLoad);
horiCursor = **horiCursorH;
diagCursorH = GetCursor(kDiagCursorID);
if (diagCursorH == nil)
diagCursor = PortabilityLayer::HostDisplayDriver::GetInstance()->LoadCursor(false, kDiagCursorID);
if (diagCursor == nil)
RedAlert(kErrFailedResourceLoad);
diagCursor = **diagCursorH;
}
//-------------------------------------------------------------- RecomputeScreenRects
void RecomputeInterfaceRects (void)
{
houseRect = thisMac.constrainedScreen;
houseRect.bottom -= kScoreboardTall;
if (houseRect.right > kMaxViewWidth)
houseRect.right = kMaxViewWidth;
if (houseRect.bottom > kMaxViewHeight)
houseRect.bottom = kMaxViewHeight;
// NOTE: This is actually buggy, since the visible area is houseRect, not screen.
// We preserve the buggy behavior for authenticity unless the window is very tall.
short poHeight = RectTall(&thisMac.constrainedScreen);
if (poHeight > kMaxViewHeight - kScoreboardTall)
poHeight = kMaxViewHeight - kScoreboardTall;
playOriginH = (RectWide(&thisMac.constrainedScreen) - kRoomWide) / 2;
playOriginV = (poHeight - kTileHigh) / 2;
for (int i = 0; i < 9; i++)
{
QSetRect(&localRoomsDest[i], 0, 0, kRoomWide, kTileHigh);
QOffsetRect(&localRoomsDest[i], playOriginH, playOriginV);
}
QOffsetRect(&localRoomsDest[kNorthRoom], 0, -kVertLocalOffset);
QOffsetRect(&localRoomsDest[kNorthEastRoom], kRoomWide, -kVertLocalOffset);
QOffsetRect(&localRoomsDest[kEastRoom], kRoomWide, 0);
QOffsetRect(&localRoomsDest[kSouthEastRoom], kRoomWide, kVertLocalOffset);
QOffsetRect(&localRoomsDest[kSouthRoom], 0, kVertLocalOffset);
QOffsetRect(&localRoomsDest[kSouthWestRoom], -kRoomWide, kVertLocalOffset);
QOffsetRect(&localRoomsDest[kWestRoom], -kRoomWide, 0);
QOffsetRect(&localRoomsDest[kNorthWestRoom], -kRoomWide, -kVertLocalOffset);
}
//-------------------------------------------------------------- VariableInit
@@ -111,10 +143,6 @@ void VariableInit (void)
{
short i;
shieldPt.h = 0;
shieldPt.v = 0;
shieldRect = thisMac.screen;
menusUp = false;
quitting = false;
houseOpen = false;
@@ -176,7 +204,7 @@ void VariableInit (void)
fadeInSequence[14] = 9;
fadeInSequence[15] = 10;
doubleTime = GetDblTime();
doubleTime = 30; // PL_NotYetImplemented_TODO: Get this from the system settings
mirrorRects = nil;
mainWindow = nil;
@@ -187,30 +215,6 @@ void VariableInit (void)
coordWindow = nil;
toolSrcMap = nil;
nailSrcMap = nil;
menuWindow = nil;
houseRect = thisMac.screen;
houseRect.bottom -= kScoreboardTall;
if (houseRect.right > kMaxViewWidth)
houseRect.right = kMaxViewWidth;
if (houseRect.bottom > kMaxViewHeight)
houseRect.bottom = kMaxViewHeight;
playOriginH = (RectWide(&thisMac.screen) - kRoomWide) / 2;
playOriginV = (RectTall(&thisMac.screen) - kTileHigh) / 2;
for (i = 0; i < 9; i++)
{
QSetRect(&localRoomsDest[i], 0, 0, kRoomWide, kTileHigh);
QOffsetRect(&localRoomsDest[i], playOriginH, playOriginV);
}
QOffsetRect(&localRoomsDest[kNorthRoom], 0, -kVertLocalOffset);
QOffsetRect(&localRoomsDest[kNorthEastRoom], kRoomWide, -kVertLocalOffset);
QOffsetRect(&localRoomsDest[kEastRoom], kRoomWide, 0);
QOffsetRect(&localRoomsDest[kSouthEastRoom], kRoomWide, kVertLocalOffset);
QOffsetRect(&localRoomsDest[kSouthRoom], 0, kVertLocalOffset);
QOffsetRect(&localRoomsDest[kSouthWestRoom], -kRoomWide, kVertLocalOffset);
QOffsetRect(&localRoomsDest[kWestRoom], -kRoomWide, 0);
QOffsetRect(&localRoomsDest[kNorthWestRoom], -kRoomWide, -kVertLocalOffset);
RecomputeInterfaceRects();
}

View File

@@ -66,9 +66,9 @@ void UpdateLinkControl (void)
switch (linkType)
{
case kSwitchLinkOnly:
case kSwitchLinkOnly:
if (objActive == kNoObjectSelected)
HiliteControl(linkControl, kControlInactive);
linkControl->SetEnabled(false);// HiliteControl(linkControl, kControlInactive);
else
switch (thisRoom->objects[objActive].what)
{
@@ -119,18 +119,18 @@ void UpdateLinkControl (void)
case kBall:
case kDrip:
case kFish:
HiliteControl(linkControl, kControlActive);
linkControl->SetEnabled(true);
break;
default:
HiliteControl(linkControl, kControlInactive);
linkControl->SetEnabled(false);
break;
}
break;
case kTriggerLinkOnly:
if (objActive == kNoObjectSelected)
HiliteControl(linkControl, kControlInactive);
linkControl->SetEnabled(false);
else
switch (thisRoom->objects[objActive].what)
{
@@ -147,7 +147,7 @@ void UpdateLinkControl (void)
case kDartRt:
case kDrip:
case kFish:
HiliteControl(linkControl, kControlActive);
linkControl->SetEnabled(true);
break;
case kLightSwitch:
@@ -157,18 +157,18 @@ void UpdateLinkControl (void)
case kKnifeSwitch:
case kInvisSwitch:
if (linkRoom == thisRoomNumber)
HiliteControl(linkControl, kControlActive);
linkControl->SetEnabled(true);
break;
default:
HiliteControl(linkControl, kControlInactive);
linkControl->SetEnabled(false);
break;
}
break;
case kTransportLinkOnly:
if (objActive == kNoObjectSelected)
HiliteControl(linkControl, kControlInactive);
linkControl->SetEnabled(false);
else
switch (thisRoom->objects[objActive].what)
{
@@ -185,11 +185,11 @@ void UpdateLinkControl (void)
case kCalendar:
case kBulletin:
case kCloud:
HiliteControl(linkControl, kControlActive);
linkControl->SetEnabled(true);
break;
default:
HiliteControl(linkControl, kControlInactive);
linkControl->SetEnabled(false);
break;
}
break;
@@ -206,7 +206,6 @@ void UpdateLinkWindow (void)
return;
SetPortWindowPort(linkWindow);
DrawControls(linkWindow);
UpdateLinkControl();
#endif
}
@@ -218,43 +217,49 @@ void OpenLinkWindow (void)
#ifndef COMPILEDEMO
Rect src, dest;
Point globalMouse;
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
if (linkWindow == nil)
{
const uint16_t windowStyle = PortabilityLayer::WindowStyleFlags::kTitleBar | PortabilityLayer::WindowStyleFlags::kMiniBar;
const uint16_t windowStyle = PortabilityLayer::WindowStyleFlags::kTitleBar | PortabilityLayer::WindowStyleFlags::kMiniBar | PortabilityLayer::WindowStyleFlags::kCloseBox;
QSetRect(&linkWindowRect, 0, 0, 129, 30);
if (thisMac.hasColor)
linkWindow = NewCWindow(nil, &linkWindowRect,
PSTR("Link"), false, windowStyle, kPutInFront, true, 0L);
else
linkWindow = NewWindow(nil, &linkWindowRect,
PSTR("Link"), false, windowStyle, kPutInFront, true, 0L);
{
PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(linkWindowRect, windowStyle, true, 0, 0, PSTR("Link"));
linkWindow = wm->CreateWindow(wdef);
}
wm->PutWindowBehind(linkWindow, wm->GetPutInFrontSentinel());
MoveWindow(linkWindow, isLinkH, isLinkV, true);
GetWindowRect(linkWindow, &dest);
BringToFront(linkWindow);
PortabilityLayer::WindowManager::GetInstance()->ShowWindow(linkWindow);
// FlagWindowFloating(linkWindow); TEMP - use flaoting windows
HiliteAllWindows();
PortabilityLayer::WidgetBasicState basicState;
basicState.m_rect = Rect::Create(5, 70, 25, 124);
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();
linkRoom = -1;
linkObject = 255;
isLinkOpen = true;
UpdateLinkWindow();
}
#endif
}
@@ -265,7 +270,7 @@ void CloseLinkWindow (void)
{
#ifndef COMPILEDEMO
if (linkWindow != nil)
DisposeWindow(linkWindow);
PortabilityLayer::WindowManager::GetInstance()->DestroyWindow(linkWindow);
linkWindow = nil;
isLinkOpen = false;
@@ -375,12 +380,12 @@ void HandleLinkClick (Point wherePt)
return;
SetPortWindowPort(linkWindow);
wherePt -= linkWindow->TopLeftCoord();
wherePt -= linkWindow->GetTopLeftCoord();
part = FindControl(wherePt, linkWindow, &theControl);
if ((theControl != nil) && (part != 0))
{
part = TrackControl(theControl, wherePt, nil);
part = theControl->Capture(wherePt, nullptr);
if (part != 0)
{
if (theControl == linkControl)

View File

@@ -12,6 +12,7 @@
#include "Environ.h"
#include "IOStream.h"
#include "House.h"
#include "WindowManager.h"
#define kPrefsVersion 0x0035
@@ -204,7 +205,7 @@ void ReadInPrefs (void)
doBitchDialogs = true;
}
if ((numNeighbors > 1) && (thisMac.screen.right <= 512))
if ((numNeighbors > 1) && (thisMac.constrainedScreen.right <= 512))
numNeighbors = 1;
UnivGetSoundVolume(&wasVolume, thisMac.hasSM3);
@@ -315,6 +316,7 @@ int gpAppMain()
ToolBoxInit();
CheckOurEnvirons();
InstallResolutionHandler();
if (!thisMac.hasColor)
RedAlert(kErrNeedColorQD);
if (!thisMac.hasSystem7)
@@ -351,14 +353,10 @@ int gpAppMain()
InitSrcRects();
CreateOffscreens(); SpinCursor(2);
OpenMainWindow();
if (thisMac.hasQT)
{
theErr = EnterMovies();
if (theErr != PLErrors::kNone)
thisMac.hasQT = false;
}
if (isDoColorFade)
PortabilityLayer::WindowManager::GetInstance()->SetWindowDesaturation(mainWindow, 1.0);
InitSound(); SpinCursor(2);
InitMusic(); SpinCursor(2);
BuildHouseList();
@@ -373,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();
@@ -407,7 +396,7 @@ int gpAppMain()
}
WriteOutPrefs();
RestoreColorDepth();
PL_DEAD(FlushEvents(everyEvent, 0));
PL_DEAD(FlushEvents());
// theErr = LoadScrap();
return 0;

View File

@@ -6,17 +6,20 @@
#include "PLNumberFormatting.h"
#include "PLToolUtils.h"
#include "PLPasStr.h"
#include "Externs.h"
#include "Environ.h"
#include "FontFamily.h"
#include "HostDisplayDriver.h"
#include "House.h"
#include "IGpDisplayDriver.h"
#include "InputManager.h"
#include "MenuManager.h"
#include "QDPixMap.h"
#include "RectUtils.h"
#include "PLKeyEncoding.h"
#include "PLStandardColors.h"
#include "ResolveCachingColor.h"
#include "WindowDef.h"
#include "WindowManager.h"
@@ -29,20 +32,18 @@
void DrawOnSplash (DrawSurface *surface);
void SetPaletteToGrays (void);
void HardDrawMainWindow (void);
void KeepWindowInBounds(Window *window);
CTabHandle theCTab;
PixMapHandle thePMap;
ColorSpec * wasColors;
ColorSpec * newColors;
CursHandle handCursorH, vertCursorH, horiCursorH;
CursHandle diagCursorH;
Cursor handCursor, vertCursor, horiCursor;
Cursor diagCursor;
IGpCursor *handCursor, *vertCursor, *horiCursor;
IGpCursor *diagCursor;
Rect workSrcRect;
DrawSurface *workSrcMap;
Rect mainWindowRect;
WindowPtr mainWindow, menuWindow, boardWindow;
WindowPtr mainWindow, boardWindow;
short isEditH, isEditV;
short playOriginH, playOriginV;
short splashOriginH, splashOriginV;
@@ -66,22 +67,22 @@ void DrawOnSplash(DrawSurface *surface)
PasStringCopy(PSTR("House: "), houseLoadedStr);
PasStringConcat(houseLoadedStr, thisHouseName);
if ((thisMac.hasQT) && (hasMovie))
PasStringConcat(houseLoadedStr, PSTR(" (QT)"));
PasStringConcat(houseLoadedStr, PSTR(" (TV)"));
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold);
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)
@@ -105,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);
@@ -116,7 +117,7 @@ void RedrawSplashScreen (void)
SetPortWindowPort(mainWindow);
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
&workSrcRect, &workSrcRect, srcCopy);
// if (quickerTransitions)
@@ -125,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);
}
@@ -143,45 +144,31 @@ 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;
}
//-------------------------------------------------------------- UpdateMenuBarWindow
// Ugly kludge to cover over the menu bar when playing game on 2nd monitor.
void UpdateMenuBarWindow (DrawSurface *surface)
{
Rect bounds;
if (menuWindow == nil)
return;
GetLocalWindowRect(menuWindow, &bounds);
surface->SetForeColor(StdColors::Black());
surface->FillRect(bounds);
}
//-------------------------------------------------------------- OpenMainWindow
// Opens up the main window (how it does this depends on mode were in).
@@ -189,7 +176,9 @@ void OpenMainWindow (void)
{
// long wasSeed;
short whichRoom;
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
if (mainWindow != nil)
{
YellowAlert(kYellowUnaccounted, 6);
@@ -198,10 +187,8 @@ void OpenMainWindow (void)
if (theMode == kEditMode)
{
if (menuWindow != nil)
PortabilityLayer::WindowManager::GetInstance()->DestroyWindow(menuWindow);
menuWindow = nil;
PortabilityLayer::HostDisplayDriver::GetInstance()->SetBackgroundColor(51, 51, 102, 255);
QSetRect(&mainWindowRect, 0, 0, 512, 322);
mainWindow = GetNewCWindow(kEditWindowID, nil, kPutInFront);
SizeWindow(mainWindow, mainWindowRect.right,
@@ -209,74 +196,71 @@ void OpenMainWindow (void)
if (OptionKeyDown())
{
isEditH = 3;
isEditV = 41;
isEditH = 10;
isEditV = 46;
}
MoveWindow(mainWindow, isEditH, isEditV, true);
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
{
if (menuWindow == nil)
{
menuWindow = GetNewCWindow(kMenuWindowID, nil, kPutInFront);
SizeWindow(menuWindow, RectWide(&thisMac.screen), 20, false);
MoveWindow(menuWindow, thisMac.screen.left,
thisMac.screen.top, true);
ShowWindow(menuWindow);
}
#ifdef NDEBUG
PortabilityLayer::HostDisplayDriver::GetInstance()->SetBackgroundColor(0, 0, 0, 255);
#else
PortabilityLayer::HostDisplayDriver::GetInstance()->SetBackgroundColor(51, 0, 0, 255);
#endif
if (boardWindow == nil)
{
PortabilityLayer::WindowManager *windowManager = PortabilityLayer::WindowManager::GetInstance();
Rect scorebarRect = thisMac.screen;
Rect scorebarRect = thisMac.constrainedScreen;
scorebarRect.bottom = scorebarRect.top + kScoreboardTall;
PortabilityLayer::WindowDef windowDef = PortabilityLayer::WindowDef::Create(scorebarRect, PortabilityLayer::WindowStyleFlags::kBorderless, true, false, 0, 0, PSTR("Scoreboard"));
PortabilityLayer::WindowDef windowDef = PortabilityLayer::WindowDef::Create(scorebarRect, PortabilityLayer::WindowStyleFlags::kBorderless, true, 0, 0, PSTR("Scoreboard"));
boardWindow = windowManager->CreateWindow(windowDef);
if (boardWindow != nil)
windowManager->PutWindowBehind(boardWindow, PL_GetPutInFrontWindowPtr());
else
PL_NotYetImplemented_TODO("Errors");
}
mainWindowRect = thisMac.screen;
mainWindowRect = thisMac.constrainedScreen;
ZeroRectCorner(&mainWindowRect);
mainWindowRect.bottom -= 20; // thisMac.menuHigh
mainWindowRect.bottom -= kScoreboardTall; // thisMac.menuHigh
mainWindow = GetNewCWindow(kMainWindowID, nil, kPutInFront);
SizeWindow(mainWindow, mainWindowRect.right - mainWindowRect.left,
mainWindowRect.bottom - mainWindowRect.top, false);
MoveWindow(mainWindow, thisMac.screen.left,
thisMac.screen.top + 20, true); // thisMac.menuHigh
const short mainWindowLeft = (thisMac.fullScreen.left + thisMac.fullScreen.right + thisMac.constrainedScreen.left - thisMac.constrainedScreen.right) / 2;
const short mainWindowTop = (thisMac.fullScreen.top + thisMac.fullScreen.bottom + thisMac.constrainedScreen.top - thisMac.constrainedScreen.bottom) / 2 + kScoreboardTall;
MoveWindow(boardWindow, mainWindowLeft, 0, true);
MoveWindow(mainWindow, mainWindowLeft, mainWindowTop, true); // thisMac.menuHigh
ShowWindow(mainWindow);
SetPortWindowPort(mainWindow);
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.screen.right - thisMac.screen.left) - 640) / 2;
splashOriginH = ((thisMac.constrainedScreen.right - thisMac.constrainedScreen.left) - 640) / 2;
if (splashOriginH < 0)
splashOriginH = 0;
splashOriginV = ((thisMac.screen.bottom - thisMac.screen.top) - 480) / 2;
splashOriginV = ((thisMac.constrainedScreen.bottom - thisMac.constrainedScreen.top) - 480) / 2;
if (splashOriginV < 0)
splashOriginV = 0;
workSrcMap->FillRect(workSrcRect);
LoadGraphic(workSrcMap, kSplash8BitPICT);
workSrcMap->FillRect(workSrcRect, blackColor);
// if ((fadeGraysOut) && (isDoColorFade))
// {
@@ -289,13 +273,14 @@ void OpenMainWindow (void)
// }
SetPortWindowPort(mainWindow);
UpdateMainWindow();
}
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
@@ -369,7 +354,8 @@ void UpdateEditWindowTitle (void)
}
else
PasStringConcat(newTitle, PSTR("House Locked"));
SetWTitle(mainWindow, newTitle);
PortabilityLayer::WindowManager::GetInstance()->SetWindowTitle(mainWindow, newTitle);
}
#endif
@@ -385,12 +371,12 @@ void HandleMainClick (Point wherePt, Boolean isDoubleClick)
return;
SetPortWindowPort(mainWindow);
wherePt -= mainWindow->TopLeftCoord();
wherePt -= mainWindow->GetTopLeftCoord();
DrawSurface *mainWindowSurface = mainWindow->GetDrawSurface();
if (toolSelected == kSelectTool)
DoSelectionClick(mainWindowSurface, wherePt, isDoubleClick);
DoSelectionClick(mainWindow, mainWindowSurface, wherePt, isDoubleClick);
else
DoNewObjectClick(wherePt);
@@ -592,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

@@ -17,7 +17,9 @@
#include "PLWidgets.h"
#include "WindowDef.h"
#include "WindowManager.h"
#include "QDPixMap.h"
#include "RectUtils.h"
#include "ResolveCachingColor.h"
#include "Utilities.h"
@@ -34,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;
@@ -111,8 +114,7 @@ void FlagMapRoomsForUpdate (void)
return;
// SetPortWindowPort(mapWindow);
InvalWindowRect(mapWindow, &wasActiveRoomRect);
InvalWindowRect(mapWindow, &activeRoomRect);
UpdateMapWindow();
}
#endif
@@ -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,49 +246,74 @@ void RedrawMapContents (void)
}
else
{
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, *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)
@@ -307,6 +330,8 @@ void UpdateMapWindow (void)
SetPortWindowPort(mapWindow);
// PL_NotYetImplemented_TODO("Resize")
RedrawMapContents();
DrawMapResizeBox();
#endif
}
@@ -327,24 +352,24 @@ void ResizeMapWindow (short newH, short newV)
if (mapRoomsHigh < 3)
mapRoomsHigh = 3;
QSetRect(&mapWindowRect, 0, 0,
mapRoomsWide * kMapRoomWidth + kMapScrollBarWidth - 2,
mapRoomsHigh * kMapRoomHeight + kMapScrollBarWidth - 2);
mapRoomsWide * kMapRoomWidth + kMapScrollBarWidth - 1,
mapRoomsHigh * kMapRoomHeight + kMapScrollBarWidth - 1);
surface->SetForeColor(StdColors::White());
surface->FillRect(mapWindowRect);
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 + 2));
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 + 2, 0));
mapVScroll->SetPosition(Point::Create(mapWindowRect.right - kMapScrollBarWidth + 1, -1));
mapVScroll->Resize(kMapScrollBarWidth, mapWindowRect.bottom - kMapScrollBarWidth + 3);
mapTopRoom = mapVScroll->GetState();
InvalWindowRect(mapWindow, &mapWindowRect);
UpdateMapWindow();
#endif
}
@@ -359,12 +384,12 @@ void OpenMapWindow (void)
{
CreateNailOffscreen();
QSetRect(&mapWindowRect, 0, 0,
mapRoomsWide * kMapRoomWidth + kMapScrollBarWidth - 2,
mapRoomsHigh * kMapRoomHeight + kMapScrollBarWidth - 2);
mapRoomsWide * kMapRoomWidth + kMapScrollBarWidth - 1,
mapRoomsHigh * kMapRoomHeight + kMapScrollBarWidth - 1);
const uint16_t windowStyle = PortabilityLayer::WindowStyleFlags::kTitleBar | PortabilityLayer::WindowStyleFlags::kResizable | PortabilityLayer::WindowStyleFlags::kMiniBar;
const uint16_t windowStyle = PortabilityLayer::WindowStyleFlags::kTitleBar | PortabilityLayer::WindowStyleFlags::kResizable | PortabilityLayer::WindowStyleFlags::kMiniBar | PortabilityLayer::WindowStyleFlags::kCloseBox;
PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(mapWindowRect, windowStyle, false, true, 0, 0, PSTR("Map"));
PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(mapWindowRect, windowStyle, false, 0, 0, PSTR("Map"));
mapWindow = PortabilityLayer::WindowManager::GetInstance()->CreateWindow(wdef);
@@ -386,7 +411,7 @@ void OpenMapWindow (void)
PortabilityLayer::WindowManager::GetInstance()->ShowWindow(mapWindow);
// FlagWindowFloating(mapWindow); TEMP - use flaoting windows
SetPort((GrafPtr)mapWindow);
SetPort(mapWindow->GetDrawSurface());
QSetRect(&mapHScrollRect, -1, mapRoomsHigh * kMapRoomHeight,
mapRoomsWide * kMapRoomWidth + 1,
mapRoomsHigh * kMapRoomHeight + kMapScrollBarWidth);
@@ -401,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)
@@ -414,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)
@@ -425,6 +450,10 @@ void OpenMapWindow (void)
mapWindowRect.bottom + 2);
CenterMapOnRoom(thisRoom->suite, thisRoom->floor);
UpdateMapWindow();
KeepWindowInBounds(mapWindow);
}
UpdateMapCheckmark(true);
@@ -462,50 +491,50 @@ void ToggleMapWindow (void)
//-------------------------------------------------------------- LiveHScrollAction
#ifndef COMPILEDEMO
void LiveHScrollAction (ControlHandle theControl, short thePart)
void LiveHScrollAction (PortabilityLayer::Widget *theControl, int thePart)
{
short wasValue, newValue;
switch (thePart)
{
case kControlUpButtonPart:
wasValue = GetControlValue(theControl);
SetControlValue(theControl, wasValue - 1);
if (GetControlValue(theControl) != wasValue)
wasValue = theControl->GetState();
theControl->SetState(wasValue - 1);
if (theControl->GetState() != wasValue)
{
mapLeftRoom = GetControlValue(theControl);
mapLeftRoom = theControl->GetState();
RedrawMapContents();
}
break;
case kControlDownButtonPart:
wasValue = GetControlValue(theControl);
SetControlValue(theControl, wasValue + 1);
if (GetControlValue(theControl) != wasValue)
wasValue = theControl->GetState();
theControl->SetState(wasValue + 1);
if (theControl->GetState() != wasValue)
{
mapLeftRoom = GetControlValue(theControl);
mapLeftRoom = theControl->GetState();
RedrawMapContents();
}
break;
case kControlPageUpPart:
wasValue = GetControlValue(theControl);
wasValue = theControl->GetState();
newValue = wasValue - (mapRoomsWide / 2);
SetControlValue(theControl, newValue);
if (GetControlValue(theControl) != wasValue)
theControl->SetState(newValue);
if (theControl->GetState() != wasValue)
{
mapLeftRoom = GetControlValue(theControl);
mapLeftRoom = theControl->GetState();
RedrawMapContents();
}
break;
case kControlPageDownPart:
wasValue = GetControlValue(theControl);
wasValue = theControl->GetState();
newValue = wasValue + (mapRoomsWide / 2);
SetControlValue(theControl, newValue);
if (GetControlValue(theControl) != wasValue)
theControl->SetState(newValue);
if (theControl->GetState() != wasValue)
{
mapLeftRoom = GetControlValue(theControl);
mapLeftRoom = theControl->GetState();
RedrawMapContents();
}
break;
@@ -519,50 +548,50 @@ void LiveHScrollAction (ControlHandle theControl, short thePart)
//-------------------------------------------------------------- LiveVScrollAction
#ifndef COMPILEDEMO
void LiveVScrollAction (ControlHandle theControl, short thePart)
void LiveVScrollAction (PortabilityLayer::Widget *theControl, int thePart)
{
short wasValue, newValue;
switch (thePart)
{
case kControlUpButtonPart:
wasValue = GetControlValue(theControl);
SetControlValue(theControl, wasValue - 1);
if (GetControlValue(theControl) != wasValue)
wasValue = theControl->GetState();
theControl->SetState(wasValue - 1);
if (theControl->GetState() != wasValue)
{
mapTopRoom = GetControlValue(theControl);
mapTopRoom = theControl->GetState();
RedrawMapContents();
}
break;
case kControlDownButtonPart:
wasValue = GetControlValue(theControl);
SetControlValue(theControl, wasValue + 1);
if (GetControlValue(theControl) != wasValue)
wasValue = theControl->GetState();
theControl->SetState(wasValue + 1);
if (theControl->GetState() != wasValue)
{
mapTopRoom = GetControlValue(theControl);
mapTopRoom = theControl->GetState();
RedrawMapContents();
}
break;
case kControlPageUpPart:
wasValue = GetControlValue(theControl);
wasValue = theControl->GetState();
newValue = wasValue - (mapRoomsHigh / 2);
SetControlValue(theControl, newValue);
if (GetControlValue(theControl) != wasValue)
theControl->SetState(newValue);
if (theControl->GetState() != wasValue)
{
mapTopRoom = GetControlValue(theControl);
mapTopRoom = theControl->GetState();
RedrawMapContents();
}
break;
case kControlPageDownPart:
wasValue = GetControlValue(theControl);
wasValue = theControl->GetState();
newValue = wasValue + (mapRoomsHigh / 2);
SetControlValue(theControl, newValue);
if (GetControlValue(theControl) != wasValue)
theControl->SetState(newValue);
if (theControl->GetState() != wasValue)
{
mapTopRoom = GetControlValue(theControl);
mapTopRoom = theControl->GetState();
RedrawMapContents();
}
break;
@@ -579,24 +608,20 @@ void HandleMapClick (const GpMouseInputEvent &theEvent)
{
#ifndef COMPILEDEMO
Rect aRoom;
ControlHandle whichControl;
PortabilityLayer::Widget *whichControl = nullptr;
Point wherePt, globalWhere;
long controlRef;
short whichPart, localH, localV;
short roomH, roomV, itsNumber;
ControlActionUPP scrollHActionUPP, scrollVActionUPP;
wherePt = Point::Create(theEvent.m_x, theEvent.m_y);
scrollHActionUPP = NewControlActionUPP(LiveHScrollAction);
scrollVActionUPP = NewControlActionUPP(LiveVScrollAction);
if (mapWindow == nil)
return;
SetPortWindowPort(mapWindow);
globalWhere = wherePt;
wherePt -= mapWindow->TopLeftCoord();
wherePt -= mapWindow->GetTopLeftCoord();
wherePt.h -= 1;
wherePt.v -= 1;
@@ -665,7 +690,7 @@ void HandleMapClick (const GpMouseInputEvent &theEvent)
}
else
{
controlRef = GetControlReference(whichControl);
controlRef = whichControl->GetReferenceConstant();
if (controlRef == kHScrollRef)
{
switch (whichPart)
@@ -674,16 +699,13 @@ void HandleMapClick (const GpMouseInputEvent &theEvent)
case kControlDownButtonPart:
case kControlPageUpPart:
case kControlPageDownPart:
if (TrackControl(whichControl, wherePt, scrollHActionUPP))
{
}
whichControl->Capture(wherePt, LiveHScrollAction);
break;
case kControlIndicatorPart:
if (TrackControl(whichControl, wherePt, nil))
if (whichControl->Capture(wherePt, nil))
{
mapLeftRoom = GetControlValue(whichControl);
mapLeftRoom = whichControl->GetState();
RedrawMapContents();
}
break;
@@ -697,25 +719,19 @@ void HandleMapClick (const GpMouseInputEvent &theEvent)
case kControlDownButtonPart:
case kControlPageUpPart:
case kControlPageDownPart:
if (TrackControl(whichControl, wherePt, scrollVActionUPP))
{
}
whichControl->Capture(wherePt, LiveVScrollAction);
break;
case kControlIndicatorPart:
if (TrackControl(whichControl, wherePt, nil))
if (whichControl->Capture(wherePt, nil))
{
mapTopRoom = GetControlValue(whichControl);
mapTopRoom = whichControl->GetState();
RedrawMapContents();
}
break;
}
}
}
DisposeControlActionUPP(scrollHActionUPP);
DisposeControlActionUPP(scrollVActionUPP);
#endif
}

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