Compare commits

...

174 commits

Author SHA1 Message Date
RandomityGuy
3590951459 typo that kills me 2023-10-09 22:36:25 +05:30
RandomityGuy
fcaff505aa compile this stuff too pls 2023-10-09 00:37:55 +05:30
RandomityGuy
beb301a511 update ci mac 2023-10-09 00:12:59 +05:30
RandomityGuy
e12708f8f9 update zlib for mac compile 2023-10-08 23:48:39 +05:30
RandomityGuy
c520ebe7ea verup and add redirection to mbp for customs 2023-10-03 19:27:25 +05:30
RandomityGuy
4fdb6f88e9 github buttons 2023-10-03 19:19:00 +05:30
RandomityGuy
81a39a6f7f more mkt and ver up 2023-10-03 19:18:55 +05:30
RandomityGuy
62c85140b5 fixes 2023-10-02 23:44:04 +05:30
RandomityGuy
44ac9e3ce8 optimize heap 2023-10-02 23:25:18 +05:30
RandomityGuy
8df3bcee49 fix bugs 2023-10-02 23:23:53 +05:30
RandomityGuy
1f3255a6a2 non-user identifying analytics 2023-10-02 23:23:47 +05:30
RandomityGuy
41848c97ec fix more memory leak 2023-10-02 23:22:15 +05:30
RandomityGuy
0ae13d5acc fix memory leaks caused by world not being properly disposed 2023-10-02 23:21:52 +05:30
RandomityGuy
628a2627ff rewind optimize memory 2023-10-02 23:20:23 +05:30
RandomityGuy
dedb1cf810 match mbg collision callback code and add deadzone to touch camera 2023-09-22 23:17:56 +05:30
RandomityGuy
70984e8c8d better touch controls camera 2023-07-25 22:29:35 +05:30
RandomityGuy
5c2dca74cc fix camera 2023-07-21 21:26:00 +05:30
RandomityGuy
a1378c2caa finally fix camera 2023-07-21 21:25:57 +05:30
RandomityGuy
4549647dc9 fix camera 2023-07-21 21:25:53 +05:30
RandomityGuy
035a62dfc8 do all the backport fixes 2023-07-21 21:03:16 +05:30
RandomityGuy
d10ef86dcf fix broken MP collisions 2023-06-04 22:50:38 +05:30
RandomityGuy
ee4ad8dbcd don't rewind if finished 2023-06-04 22:50:17 +05:30
RandomityGuy
7717a0f08d ver update 2023-06-04 22:25:53 +05:30
RandomityGuy
2d3a63e3d8 actually fix those bugs- 2023-06-04 22:23:01 +05:30
RandomityGuy
b4deb7e699 limit iters pls 2023-06-04 20:54:09 +05:30
RandomityGuy
51f7dfb75b syntax 2023-05-26 23:19:04 +05:30
RandomityGuy
15c32d6f17 fix timescale option not actually doing anything 2023-05-26 23:17:32 +05:30
RandomityGuy
72b8952e8a fix ui positions 2023-05-26 00:53:23 +05:30
RandomityGuy
82f7287653 ver update 2023-05-26 00:42:18 +05:30
RandomityGuy
ceb641ddd9 slider fix 2023-05-25 23:03:33 +05:30
RandomityGuy
45b11aa19b rewind options 2023-05-25 22:55:07 +05:30
RandomityGuy
dba7ff7328 fix initialState bugs in replay 2023-05-25 01:02:53 +05:30
RandomityGuy
207002cbdb fix traplaunches, like really 2023-05-25 01:02:34 +05:30
RandomityGuy
5b8b802dfd use fast transforms for colliders 2023-05-25 01:00:57 +05:30
RandomityGuy
b5a1d5af6b work on rewind touch controls 2023-05-17 01:35:03 +05:30
RandomityGuy
cee4731766 fix compile 2023-05-17 01:22:32 +05:30
RandomityGuy
b73fe67c04 rewind controller support 2023-05-17 01:05:36 +05:30
RandomityGuy
8bf03486c8 bumper rewind proper 2023-05-17 01:02:16 +05:30
RandomityGuy
ca94cf6b72 fix SS inaccuracy 2023-05-17 01:02:11 +05:30
RandomityGuy
e581be7c08 fix some rewind bugs and add replay support for rewind 2023-05-17 00:57:39 +05:30
RandomityGuy
4974586c31 rewind support for everything else 2023-05-17 00:54:28 +05:30
RandomityGuy
533037f95b fix rewind particles 2023-05-17 00:54:04 +05:30
RandomityGuy
7818fb8bb5 rewind barebones 2023-05-17 00:52:14 +05:30
RandomityGuy
3265f873c5 fix synch issue 2023-05-04 14:30:53 +05:30
RandomityGuy
58b7c13ee9 kofi button 2023-03-28 14:29:35 +05:30
RandomityGuy
422577404f fixed marble powerups on web touch 2023-03-16 23:58:04 +05:30
RandomityGuy
516a18ce71 modify ci to use artifact storage 2023-02-20 18:54:16 +05:30
RandomityGuy
af10499480 find customs in subfolders 2023-02-20 17:43:53 +05:30
RandomityGuy
02f084a94a fix endgame 2023-02-20 17:40:06 +05:30
RandomityGuy
95fcefc2d9 fix marble and endgame bugs 2023-02-20 17:40:02 +05:30
RandomityGuy
fd837715de fix finish pad bugs 2023-02-20 17:39:59 +05:30
RandomityGuy
29dc89f9d5 ISO 8859-1 2023-02-20 17:39:55 +05:30
RandomityGuy
46147a857e fix iso-8859-1 2023-02-20 17:39:50 +05:30
RandomityGuy
c7b9ae2825 by default mission type is custom if non existent 2023-02-20 17:39:45 +05:30
RandomityGuy
d7407f19f2 fix backport pt2 2023-02-20 14:11:52 +05:30
RandomityGuy
5d511d2bd9 fix backport 2023-02-20 14:11:35 +05:30
RandomityGuy
402e7a9893 don't collide with tiny triangles 2023-02-20 13:51:57 +05:30
RandomityGuy
92fd215fa0 make cgl 10 load atleast 2023-02-20 13:51:03 +05:30
RandomityGuy
ed2926a575 sky color things 2023-02-20 13:50:03 +05:30
RandomityGuy
8f727b144c nudge things lol 2023-02-20 13:48:29 +05:30
RandomityGuy
0c689f678e pushbutton 2023-02-20 13:48:18 +05:30
RandomityGuy
96b0af7108 fix some CCD and trigger bugs 2023-02-20 13:46:49 +05:30
RandomityGuy
2b5b5ce326 tsstatic things 2023-02-20 13:45:58 +05:30
RandomityGuy
26b1aad189 fix bad collision normals 2023-02-20 13:42:45 +05:30
RandomityGuy
c4ae0a4933 fix TSStatic frictions 2023-02-20 13:41:57 +05:30
RandomityGuy
936342c6b6 make DA HOUSE work mostly 2023-02-20 13:41:16 +05:30
RandomityGuy
c377a296e4 fix few more parsing bugs 2023-02-20 13:40:08 +05:30
RandomityGuy
b98a3f9cd8 fix wrong TRS order 2023-02-20 13:36:00 +05:30
RandomityGuy
7ffd63f47c ver update 2023-02-17 00:47:23 +05:30
RandomityGuy
2b337d9bb0 fix name input not working in js 2023-02-16 22:59:00 +05:30
RandomityGuy
e7fb5221e9 Fix time travel hitboxes being too small 2023-02-16 22:25:11 +05:30
RandomityGuy
60c2f186a6 attempt improve CCD 2023-02-16 22:25:07 +05:30
RandomityGuy
0662356d16 fix MP broadphase 2023-02-16 22:23:46 +05:30
RandomityGuy
f5c44a3e00
Merge pull request #10 from thearst3rd/mbg-gamepad
MBG - Add gamepad support
2023-02-14 12:58:22 +05:30
RandomityGuy
21283ce850
Merge pull request #14 from thearst3rd/mbg-restart-improvement
MBG - Don't pause when hitting restart button from EndGameGui on js
2023-02-14 12:57:27 +05:30
Terry Hearst
b178f23885 Don't pause when hitting restart button from EndGameGui on js 2023-02-14 00:52:04 -05:00
RandomityGuy
c9a1843edd fix marble bounces 2023-02-13 20:31:25 -05:00
Terry Hearst
85e9ff0c0c Cherry-pick gamepad support to MBG branch 2023-02-13 20:30:45 -05:00
Terry Hearst
855fe096c9 Control remap fixes 2023-02-08 18:38:01 +05:30
RandomityGuy
4065f089ad fix zero scale interior collision bug 2023-02-07 22:05:39 +05:30
RandomityGuy
ef9e235269 fix tornado rendering finally 2023-02-06 23:22:52 +05:30
RandomityGuy
f155eccd3c fix bounce physics 2023-02-06 23:22:44 +05:30
RandomityGuy
cb462f9dea
Merge pull request #4 from thearst3rd/mbg-natural-recordings
MBG - More natural replay saving, and cleanups/linux
2023-02-06 08:31:13 +05:30
Terry Hearst
06200f1c22 Slightly nicer name for replays 2023-02-05 18:44:11 -05:00
Terry Hearst
6b1fa90f85 Cleanup commit, and add linux build scripts to MBG branch 2023-02-05 18:42:20 -05:00
Terry Hearst
ed0d4fa9c1 More natual replay saving system 2023-02-05 15:58:56 -05:00
RandomityGuy
7059a63ab8 fix level order 2023-02-05 22:04:22 +05:30
RandomityGuy
e738bf7c97 update ver 2023-02-05 21:14:13 +05:30
RandomityGuy
3c54f8ff59 fix broke dpi 2023-02-05 20:48:30 +05:30
RandomityGuy
12b505fe7c change fov mode 2023-02-05 20:45:07 +05:30
RandomityGuy
34da65ea6d fix marble getting stuck on corners 2023-02-05 20:44:20 +05:30
RandomityGuy
fbed9848ef
Merge pull request #3 from thearst3rd/mbg-fix-h
MBG - Don't quit to menu when pressing H key while not recording
2023-02-05 10:10:06 +05:30
Terry Hearst
749565a3b9 Don't quit to menu when pressing H key while not recording 2023-02-04 18:54:30 -05:00
RandomityGuy
00bc3e17fb ver update 2023-01-08 12:39:42 +05:30
RandomityGuy
83b22458fc highdpi the gold badge 2023-01-08 12:38:50 +05:30
RandomityGuy
c457b4bc75 fix gold badge for ui scaling 2023-01-08 00:15:13 +05:30
RandomityGuy
434de4db1c fix mac ci 2023-01-07 23:53:05 +05:30
RandomityGuy
6a7353c070 update config 2023-01-07 23:44:29 +05:30
RandomityGuy
4eadf91a14 update ci for mbg 2023-01-07 23:35:57 +05:30
RandomityGuy
7e89808e70 add the fonts 2023-01-07 23:33:08 +05:30
RandomityGuy
131e14644a change font cache path, and also include that in the repo. attempt to make it work on mac without proper certs 2023-01-07 23:21:29 +05:30
RandomityGuy
0523bb946b undo mbp port 2023-01-07 23:19:47 +05:30
RandomityGuy
295901f951 fix typo 2023-01-07 23:06:04 +05:30
RandomityGuy
eb5321c84f sign osx 2023-01-07 23:06:00 +05:30
RandomityGuy
66a1457153 limit nudge iterations 2023-01-07 23:05:56 +05:30
RandomityGuy
6e578323ec transformed point caching 2023-01-07 23:05:54 +05:30
RandomityGuy
b2be7d14d3 fix ci 2023-01-07 23:05:52 +05:30
RandomityGuy
085dc8a1fc fix syntax 2023-01-07 23:05:50 +05:30
RandomityGuy
1d30fe30b8 windows build test 2023-01-07 23:05:46 +05:30
RandomityGuy
fa72ad4d2c improved collision 2023-01-07 22:30:45 +05:30
RandomityGuy
50c169892a improve testMove 2023-01-07 22:30:26 +05:30
RandomityGuy
7954642bfa fix tornado 2023-01-07 22:29:14 +05:30
RandomityGuy
5c961ba1da fix half pipes bug brought by previous commit 2023-01-07 22:28:53 +05:30
RandomityGuy
6883e6ba53 reduce bounces when high speed, still not a perfect fix 2023-01-07 22:28:49 +05:30
RandomityGuy
7228dcfa8d fix minor bugs and improve moving platform broadphase 2023-01-07 22:28:42 +05:30
RandomityGuy
76a26db37d attempt fix clipping and fix onscreen text 2023-01-07 22:27:28 +05:30
RandomityGuy
5cb0abcd80 fix ui scaling 2023-01-07 22:26:33 +05:30
RandomityGuy
41677fccc3 fix ui text alphas 2023-01-07 22:24:43 +05:30
RandomityGuy
93f0f73bba fix ui scaling and alarm sound 2023-01-07 22:24:40 +05:30
RandomityGuy
9edd1a1fcb ui scale??? 2023-01-07 22:24:37 +05:30
RandomityGuy
a913bded14 fix screeeen 2023-01-07 22:24:33 +05:30
RandomityGuy
e64082a609 fix clipping 2023-01-07 22:24:27 +05:30
RandomityGuy
a548b15d69 text selection color fix 2023-01-07 22:23:32 +05:30
RandomityGuy
a11ab7a4eb fix marble teleporterr teleporting in wrong direction and fix finish animation while gyro 2023-01-07 22:22:32 +05:30
RandomityGuy
4b65191776 fix ci 2023-01-07 22:22:13 +05:30
RandomityGuy
b43bc792a2 update CI 2023-01-07 22:22:10 +05:30
RandomityGuy
e3a867eb77 highdpi support test 2023-01-07 22:21:51 +05:30
RandomityGuy
ba6a0141ba Merge remote-tracking branch 'nullobsi/mbg' into mbg 2023-01-07 22:18:09 +05:30
RandomityGuy
7bbdea4d37 remove mbp backport 2022-12-19 22:31:16 +05:30
RandomityGuy
fece873cae use mb method for end pad collision 2022-12-19 22:30:54 +05:30
RandomityGuy
180883a0f2 fix rounding bug for bonus time 2022-12-19 22:30:27 +05:30
RandomityGuy
3437c09fdc fix oob sequence 2022-12-19 22:29:52 +05:30
RandomityGuy
774836dbd0 stop time travel and alarm sounds 2022-12-19 22:29:37 +05:30
RandomityGuy
ef546d375a disabled buttons don't have hover sounds 2022-12-19 22:29:34 +05:30
RandomityGuy
d9f4a1d9d4 fix item collection i guess?? 2022-12-19 22:29:29 +05:30
RandomityGuy
27a6f964a6 fix dumb lag issue 2022-12-19 22:29:23 +05:30
Kayden Tebau
641eb235e6
Fix bad copy 2022-12-18 14:31:57 -08:00
Kayden Tebau
6e011ad799
Use MACOS_BUNDLE def properly 2022-12-18 14:23:34 -08:00
Kayden Tebau
c1b98e6a32
Mac build 2022-12-18 14:19:13 -08:00
Kayden Tebau
fb32db9685
Use macOS Dirs 2022-12-18 14:09:03 -08:00
RandomityGuy
d86af0b31a android build fixes 2022-12-19 01:02:32 +05:30
RandomityGuy
d7fa0869d7 finish backport 2022-12-18 01:51:30 +05:30
RandomityGuy
6a4e93ba94 slider 2022-12-18 01:48:29 +05:30
RandomityGuy
c9a1c47dea fix endgame 2022-12-18 01:48:22 +05:30
RandomityGuy
08e3c6ad23 improve gjk a bit to reduce some lag 2022-12-18 01:47:07 +05:30
RandomityGuy
3878dc946d attempt fix filtering??? 2022-12-18 01:46:46 +05:30
RandomityGuy
5e613d18a2 use the hitbox of the rotated marble hitbox 2022-12-18 01:46:21 +05:30
RandomityGuy
5b766c8dc0 accelerator key fixes and fix camera on unpause 2022-12-18 01:45:49 +05:30
RandomityGuy
d974d14d1e accelerator keys 2022-12-18 01:44:38 +05:30
RandomityGuy
194ccc6b6a fix camera buttons not working 2022-12-18 01:41:09 +05:30
RandomityGuy
a4402ab05c marble finish animation match to original 2022-12-18 01:41:06 +05:30
RandomityGuy
aea3ca8858 fix marble collider transform things 2022-12-18 01:41:02 +05:30
RandomityGuy
2a24ee8bc2 fix powerup being picked up when you're at its position when you restart 2022-12-18 01:40:57 +05:30
RandomityGuy
9984de59cd fix pad animation not working 2022-12-18 01:40:27 +05:30
RandomityGuy
7cf29dee51 ver update 2022-12-14 20:16:09 +05:30
RandomityGuy
4a75c5f169 remove more mbp 2022-12-14 20:15:23 +05:30
RandomityGuy
02e05dadf9 revert MBP 2022-12-14 20:10:44 +05:30
RandomityGuy
728ac46367 fix minor marble bugs on first tick 2022-12-14 20:10:33 +05:30
RandomityGuy
9c37c010e2 fix so much internal edges using new logic 2022-12-14 20:10:31 +05:30
RandomityGuy
e5fa86524f fix CCD and internal edges again this time by using mb methods, and other small lag fixes 2022-12-14 20:04:22 +05:30
RandomityGuy
61b37c04e9 make marble shaders better match original, attempt fix internal edge collisions 2022-12-14 20:03:45 +05:30
RandomityGuy
461b81d529 attempt fix internal edge collisions 2022-12-14 20:02:05 +05:30
RandomityGuy
f3fdc4c52a fix some bugs 2022-12-14 20:02:02 +05:30
RandomityGuy
dac04ceb7c fix broken SJ sound 2022-12-14 19:38:54 +05:30
RandomityGuy
b5837e2d6d attempt fix on pad texture loading 2022-12-14 19:38:39 +05:30
RandomityGuy
e7b4289d12 fix noise by magnets, tornadoes and ductfans 2022-12-14 19:38:06 +05:30
RandomityGuy
454dae7c16 fix magnet sound persist, use BVH for interior CD (cleaner, similar perf), cull instances not in frustum, overall FPS improvements 2022-12-14 19:37:56 +05:30
RandomityGuy
9e3c86d276 particle thing 2022-12-14 19:36:48 +05:30
RandomityGuy
083357d79a remove mbp files 2022-12-14 19:36:00 +05:30
RandomityGuy
16939ccc44 attempt make work on js, and much faster particles 2022-12-14 19:35:34 +05:30
RandomityGuy
ee73aacdba fix pathedinterior bug 2022-12-14 19:32:40 +05:30
RandomityGuy
f89e557662 speedup bounds calcs 2022-12-14 19:32:28 +05:30
RandomityGuy
cf3b6f5ac2 some more bugfixes and speedups 2022-12-14 19:31:42 +05:30
RandomityGuy
cfd1a6a139 fixed morph being really slow 2022-12-14 19:30:53 +05:30
148 changed files with 6171 additions and 1141 deletions

393
.circleci/config.yml Normal file
View file

@ -0,0 +1,393 @@
# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1
orbs:
win: circleci/windows@4.1.1 # The Windows orb give you everything you need to start using the Windows executor.
# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:
build:
macos:
xcode: 14.1.0 # Specify the Xcode version to use
resource_class: macos.x86.medium.gen2
environment:
HOMEBREW_NO_AUTO_UPDATE: 1
NPROC: 4
COMMIT_TAG: pipeline.git.tag
steps:
- add_ssh_keys:
fingerprints:
- "82:42:56:a0:57:43:95:4e:00:c0:8c:c1:7f:70:74:47"
- checkout:
path: ~/MBHaxe
- run:
name: Install brew dependencies
command: |
brew install cmake
brew install pkg-config
brew install libpthread-stubs
brew install neko
brew install nasm
- run:
name: Install Haxe
command: |
set -eux
download_url="https://github.com/HaxeFoundation/haxe/releases/download/4.2.5/haxe-4.2.5-osx.tar.gz"
echo "Downloading [$download_url]..."
mkdir /tmp/haxe
curl -fsSL --retry 3 --retry-delay 5 "$download_url" -o /tmp/haxe.tar.gz
tar xzvf /tmp/haxe.tar.gz -C /tmp/haxe --strip-components=1
export PATH=/tmp/haxe/:"$PATH"
export HAXE_STD_PATH=/tmp/haxe/std
haxelib setup ~/haxelib
haxelib list
haxelib install hashlink
- run:
name: Compile zlib
command: |
mkdir -p ~/deps
cd ~/deps
curl https://www.zlib.net/zlib-1.3.tar.xz | tar xz
cd zlib-1.3
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DCMAKE_MACOSX_RPATH=TRUE
cmake --build build --config Release -j$NPROC
sudo cmake --install build
- run:
name: Compile alsoft
command: |
mkdir -p ~/deps
cd ~/deps
curl https://openal-soft.org/openal-releases/openal-soft-1.22.2.tar.bz2 | tar xz
cd openal-soft-1.22.2
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DALSOFT_BACKEND_SNDIO=NO -DALSOFT_BACKEND_PORTAUDIO=NO -DALSOFT_BACKEND_WAVE=NO -DALSOFT_UTILS=NO -DALSOFT_EXAMPLES=NO -DCMAKE_MACOSX_RPATH=TRUE
cmake --build build --config Release -j$NPROC
sudo cmake --install build
- run:
name: Compile jpeg-turbo (x86)
command: |
mkdir -p ~/deps
cd ~/deps
curl -L https://downloads.sourceforge.net/project/libjpeg-turbo/2.1.4/libjpeg-turbo-2.1.4.tar.gz | tar xz
cd libjpeg-turbo-2.1.4
cmake -S. -Bbuild-x86 -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DCMAKE_MACOSX_RPATH=TRUE -DCMAKE_INSTALL_PREFIX=/usr/local
cmake --build build-x86 --config release -j$NPROC
- run:
name: Compile jpeg-turbo (ARM64)
command: |
cd ~/deps/libjpeg-turbo-2.1.4
cmake -S. -Bbuild-arm64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DCMAKE_MACOSX_RPATH=TRUE -DCMAKE_INSTALL_PREFIX=/usr/local
cmake --build build-arm64 --config release -j$NPROC
- run:
name: Install jpeg-turbo (Universal)
command: |
cd ~/deps/libjpeg-turbo-2.1.4/build-arm64
for i in libjpeg.62.3.0.dylib cjpeg cjpeg-static djpeg djpeg-static jcstest jpegtran jpegtran-static libjpeg.a libturbojpeg.a libturbojpeg.0.2.0.dylib rdjpgcom strtest tjbench tjbench-static tjexample tjunittest tjunittest-static wrjpgcom
do
lipo -create -output $i ../build-x86/$i $i
done
sudo cmake --install .
- run:
name: Compile libogg
command: |
mkdir -p ~/deps
cd ~/deps
curl -L https://downloads.xiph.org/releases/ogg/libogg-1.3.5.tar.xz | tar xz
cd libogg-1.3.5
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DBUILD_SHARED_LIBS=ON -DCMAKE_MACOSX_RPATH=TRUE
cmake --build build --config Release -j$NPROC
sudo cmake --install build
- run:
name: Compile libvorbis
command: |
mkdir -p ~/deps
cd ~/deps
curl -L https://downloads.xiph.org/releases/vorbis/libvorbis-1.3.7.tar.xz | tar xz
cd libvorbis-1.3.7
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DBUILD_SHARED_LIBS=ON -DCMAKE_MACOSX_RPATH=TRUE
cmake --build build --config Release -j$NPROC
sudo cmake --install build
- run:
name: Compile libpng (x86)
command: |
mkdir -p ~/deps
cd ~/deps
curl -L https://download.sourceforge.net/libpng/libpng-1.6.39.tar.xz | tar xz
cd libpng-1.6.39
cmake -S. -Bbuild-x86 -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DCMAKE_MACOSX_RPATH=TRUE
cmake --build build-x86 --config release -j$NPROC
- run:
name: Compile libpng (arm64)
command: |
mkdir -p ~/deps
cd ~/deps
cd libpng-1.6.39
cmake -S. -Bbuild-arm64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DCMAKE_MACOSX_RPATH=TRUE
cmake --build build-arm64 --config release -j$NPROC
- run:
name: Install libpng (Universal)
command: |
cd ~/deps/libpng-1.6.39/build-arm64
for i in libpng16.16.39.0.dylib libpng16.a png-fix-itxt pngfix pngimage pngstest pngtest pngunknown pngvalid
do
lipo -create -output $i ../build-x86/$i $i
done
sudo cmake --install .
- run:
name: Compile SDL2
command: |
mkdir -p ~/deps
cd ~/deps
curl -L https://github.com/libsdl-org/SDL/releases/download/release-2.26.1/SDL2-2.26.1.tar.gz | tar xz
cd SDL2-2.26.1
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DBUILD_SHARED_LIBS=ON -DCMAKE_MACOSX_RPATH=TRUE
cmake --build build --config Release -j$NPROC
sudo cmake --install build
- run:
name: Compile libuv
command: |
mkdir -p ~/deps
cd ~/deps
curl -fsSL https://github.com/libuv/libuv/archive/refs/tags/v1.44.2.tar.gz | tar xz
cd libuv-1.44.2
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DCMAKE_MACOSX_RPATH=TRUE
cmake --build build --config Release -j$NPROC
sudo cmake --install build
- run:
name: Install hashlink
command: |
mkdir -p ~/deps
cd ~/deps
git clone --depth=1 https://github.com/RandomityGuy/hashlink
cd hashlink
# Fix OpenAL
# curl -L https://github.com/nullobsi/hashlink/commit/a09491918cc4b83c2cb9fcded855fe967857385f.diff | git apply
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DCMAKE_FIND_FRAMEWORK=LAST -DWITH_SQLITE=OFF -DBUILD_TESTING=OFF -DCMAKE_MACOSX_RPATH=TRUE
cmake --build build --config Release -j$NPROC
sudo cmake --install build
- run:
name: Install haxe dependencies
command: |
export PATH=/tmp/haxe/:"$PATH"
export HAXE_STD_PATH=/tmp/haxe/std
haxelib git heaps https://github.com/RandomityGuy/heaps
haxelib dev hlopenal ~/deps/hashlink/libs/openal
haxelib dev hlsdl ~/deps/hashlink/libs/sdl
- run:
name: Compile MBHaxe
command: |
export PATH=/tmp/haxe/:"$PATH"
export HAXE_STD_PATH=/tmp/haxe/std
cd ~/MBHaxe
haxe compile-macos.hxml
cd native
cp ~/deps/hashlink/src/hlc_main.c .
clang -mmacosx-version-min=10.15 -arch x86_64 -arch arm64 -o marblegame -I . -L /usr/local/lib/ -std=c11 marblegame.c /usr/local/lib/{ui.hdll,openal.hdll,fmt.hdll,sdl.hdll,uv.hdll,ssl.hdll} -lsdl2 -lhl -luv
- run:
name: Package app bundle
command: |
cd ~/MBHaxe
./package-macos.sh v$COMMIT_TAG
cd "macos-dist/MarbleBlast Gold.app/Contents/MacOS"
otool -L marblegame
cd ../Frameworks
cp /usr/local/lib/{ui.hdll,openal.hdll,fmt.hdll,sdl.hdll,libSDL2-2.0.0.dylib,ssl.hdll,uv.hdll} .
cp /usr/local/lib/libhl.1.13.0.dylib libhl.1.dylib
cp /usr/local/lib/libogg.0.8.5.dylib libogg.0.dylib
cp /usr/local/lib/libopenal.1.22.2.dylib libopenal.1.dylib
cp /usr/local/lib/libpng16.16.dylib libpng16.16.dylib
cp /usr/local/lib/libturbojpeg.0.2.0.dylib libturbojpeg.0.dylib
cp /usr/local/lib/libvorbis.0.4.9.dylib libvorbis.0.4.9.dylib
cp /usr/local/lib/libvorbisfile.3.3.8.dylib libvorbisfile.3.3.8.dylib
cp /usr/local/lib/libvorbisenc.2.0.12.dylib libvorbisenc.2.0.12.dylib
cp /usr/local/lib/libz.1.3.dylib libz.1.dylib
cp /usr/local/lib/libuv.1.dylib libuv.1.dylib
# These libraries have dangling RPATHs
install_name_tool -delete_rpath /usr/local/lib libturbojpeg.0.dylib
for i in fmt.hdll libpng16.16.dylib
do
install_name_tool -change /usr/lib/libz.1.dylib @rpath/libz.1.dylib $i
done
- run:
name: Sign app bundle
command: |
cd ~/MBHaxe/macos-dist
xattr -rc "MarbleBlast Gold.app"
cp "MarbleBlast Gold.app/Contents/Entitlements.plist" .
codesign --deep --entitlements Entitlements.plist -fs - "MarbleBlast Gold.app"
- run:
name: ZIP Bundle
command: |
cd ~/MBHaxe
rm -rf "macos-dist/MarbleBlast Gold.app.in"
zip -r MBHaxe-Gold-Mac.zip macos-dist/
- run:
name: Upload to Artifact Storage
command: |
scp -o StrictHostKeyChecking=no -i $KEYPATH -P $PORT ~/MBHaxe/MBHaxe-Gold-Mac.zip $REMOTEDIR/MBHaxe-Gold-Mac.zip
# - store_artifacts:
# path: ~/MBHaxe/MBHaxe-Gold.zip
build-win:
executor:
name: win/server-2022
shell: bash.exe # executor type
# Checkout the code as the first step. This is a dedicated CircleCI step.
# The python orb's install-packages step will install the dependencies from a Pipfile via Pipenv by default.
# Here we're making sure we use just use the system-wide pip. By default it uses the project root's requirements.txt.
# Then run your tests!
# CircleCI will report the results back to your VCS provider.
steps:
- add_ssh_keys:
fingerprints:
- "82:42:56:a0:57:43:95:4e:00:c0:8c:c1:7f:70:74:47"
- checkout
- run:
name: Install dependencies
command: |
curl -fsSL --retry 3 --retry-delay 5 -o /tmp/sdl.zip https://www.libsdl.org/release/SDL2-devel-2.0.5-VC.zip
curl -fsSL --retry 3 --retry-delay 5 -o /tmp/openal.zip https://openal-soft.org/openal-binaries/openal-soft-1.17.2-bin.zip
curl -fsSL --retry 3 --retry-delay 5 -o /tmp/ffmpeg.zip https://github.com/HaxeFoundation/hashlink/files/5648056/ffmpeg-3.4.2-win64-dev.zip
cd /tmp
7z x /tmp/sdl.zip -oinclude; mv /tmp/include/SDL2* /tmp/include/sdl
7z x /tmp/openal.zip -oinclude; mv /tmp/include/openal* /tmp/include/openal
7z x /tmp/ffmpeg.zip -oinclude; mv /tmp/include/ffmpeg* /tmp/include/ffmpeg
- run:
name: Install Neko
command: |
choco install --no-progress neko -y
nekopath=$(/bin/find /c/ProgramData/chocolatey/lib/neko -name neko.dll -printf '%h\n')
set NEKOPATH=$nekopath
export PATH=$nekopath:"$PATH"
- run:
name: Install Haxe
command: |
download_url="https://github.com/HaxeFoundation/haxe/releases/download/4.2.5/haxe-4.2.5-win64.zip"
echo "Downloading [$download_url]..."
mkdir /tmp/haxe
curl -fsSL --retry 3 --retry-delay 5 "$download_url" -o /tmp/haxe.zip
7z x /tmp/haxe.zip -o/tmp
mv -v /tmp/haxe_* /tmp/haxe
cd /tmp/haxe
mv haxe_* haxe
export PATH=/tmp/haxe/haxe:"$PATH"
export HAXE_STD_PATH=/tmp/haxe/haxe/std
nekopath=$(/bin/find /c/ProgramData/chocolatey/lib/neko -name neko.dll -printf '%h\n')
set NEKOPATH=$nekopath
export PATH=$nekopath:"$PATH"
haxelib setup ~/haxelib
haxelib list
- run:
name: Build Hashlink
command: |
mkdir ~/deps
cd ~/deps
git clone https://github.com/RandomityGuy/hashlink
cd hashlink
mv /tmp/include/sdl include/sdl
mv /tmp/include/openal include/openal
MSBuild.exe hl.sln -m -nologo -p:Configuration=Release -p:Platform=x64
- run:
name: Install haxe dependencies
command: |
export PATH=/tmp/haxe/haxe:"$PATH"
export HAXE_STD_PATH=/tmp/haxe/haxe/std
nekopath=$(/bin/find /c/ProgramData/chocolatey/lib/neko -name neko.dll -printf '%h\n')
set NEKOPATH=$nekopath
export PATH=$nekopath:"$PATH"
haxelib git heaps https://github.com/RandomityGuy/heaps
haxelib dev hlopenal ~/deps/hashlink/libs/openal
haxelib dev hlsdl ~/deps/hashlink/libs/sdl
haxelib dev hashlink ~/deps/hashlink/other/haxelib
- run:
name: Compile MBHaxe
command: |
export PATH=/tmp/haxe/haxe:"$PATH"
export HAXE_STD_PATH=/tmp/haxe/haxe/std
nekopath=$(/bin/find /c/ProgramData/chocolatey/lib/neko -name neko.dll -printf '%h\n')
set NEKOPATH=$nekopath
export PATH=$nekopath:"$PATH"
cd ~/project
haxe compile-c.hxml
cd native
sed -i -e 's/MaxSpeed/Disabled/g' marblegame.vcxproj
sed -i -e 's/<FunctionLevelLinking>true<\/FunctionLevelLinking>//g' marblegame.vcxproj
sed -i -e 's/<IntrinsicFunctions>true<\/IntrinsicFunctions>//g' marblegame.vcxproj
sed -i -e 's/<EnableCOMDATFolding>true<\/EnableCOMDATFolding>//g' marblegame.vcxproj
sed -i -e 's/<OptimizeReferences>true<\/OptimizeReferences>//g' marblegame.vcxproj
sed -i -e 's/HL_MAKE;//g' marblegame.vcxproj
sed -i -e 's/<ClInclude Include=".*" \/>//g' marblegame.vcxproj
sed -i -e 's/<ClCompile Include=".*" \/>//g' marblegame.vcxproj
perl -0777 -i.marblegame.vcxproj -pe 's/<ItemGroup>[^.]*<\/ItemGroup>/<ItemGroup><ClCompile Include="marblegame.c" \/><\/ItemGroup>/g' marblegame.vcxproj
HASHLINKPATH=~/deps/hashlink
MSBuild.exe marblegame.sln -m -nologo -p:Configuration=Release -p:Platform=x64 -p:PlatformToolset=v142 -p:HASHLINK=$HASHLINKPATH
- run:
name: Package app bundle
command: |
cd ~/project
mkdir release
cd release
cp ../native/x64/Release/marblegame.exe .
mv marblegame.exe marbleblast.exe
cp -r ../data .
cp ~/deps/hashlink/x64/Release/libhl.dll .
cp ~/deps/hashlink/x64/Release/fmt.hdll .
cp ~/deps/hashlink/x64/Release/ui.hdll .
cp ~/deps/hashlink/x64/Release/openal.hdll .
cp ~/deps/hashlink/x64/Release/sdl.hdll .
cp ~/deps/hashlink/x64/Release/ssl.hdll .
cp ~/deps/hashlink/x64/Release/uv.hdll .
cp ~/deps/hashlink/include/sdl/lib/x64/SDL2.dll .
cp ~/deps/hashlink/include/openal/bin/Win64/soft_oal.dll ./OpenAL32.dll
- run:
name: Zip bundle
command: |
cd ~/project
7z a MBHaxe-Gold-Win.zip release/
- run:
name: Upload to Artifact Storage
command: |
scp -o StrictHostKeyChecking=no -i $KEYPATH -P $PORT ~/project/MBHaxe-Gold-Win.zip $REMOTEDIR/MBHaxe-Gold-Win.zip
# - store_artifacts:
# path: ~/project/MBHaxe-Gold-Win.zip
# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows:
build-mac:
jobs:
- build:
filters:
tags:
only: /^\d+.\d+.\d+$/
build-windows:
jobs:
- build-win:
filters:
tags:
only: /^\d+.\d+.\d+$/

10
.gitignore vendored
View file

@ -5,6 +5,14 @@
native
*.exe
*.obj
marblegame.hl
marblegame
settings.json
release
Export
Export
macos-dist/MarbleBlast Gold.app/
macos-dist/data/
.DS_Store
**/.DS_Store

10
compile-android.hxml Normal file
View file

@ -0,0 +1,10 @@
-cp src
-lib heaps
-lib hlsdl
-lib zyheaps
-hl marblegame.hl
-D android
-D windowSize=1280x720
-D keep-inline-positions
--main Main
-debug

View file

@ -1,5 +1,7 @@
-cp src
-lib heaps
-lib hlsdl
-D highDPI
-D hlgen.makefile=vs2019
-hl native/marblegame.c
--main Main

11
compile-js-rel.hxml Normal file
View file

@ -0,0 +1,11 @@
-cp src
-lib heaps
-lib stb_ogg_sound
-lib zip
-lib uglifyjs
--js marblegame.js
-D windowSize=1280x720
-D js-es=6
-D highDPI
--dce full
--main Main

View file

@ -6,5 +6,6 @@
-D windowSize=1280x720
-D js-es=6
-D keep-inline-positions
-D highDPI
--main Main
-debug

6
compile-linux.hxml Normal file
View file

@ -0,0 +1,6 @@
-cp src
-lib heaps
-lib hlsdl
-D highDPI
-hl native/marblegame.c
--main Main

6
compile-linux.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
haxe compile-linux.hxml
cd native
gcc -o marblegame -g -I . -L /usr/local/lib marblegame.c /usr/local/lib/{ui.hdll,openal.hdll,fmt.hdll,sdl.hdll} -lSDL2 -lhl -lm
cp marblegame ..

7
compile-macos.hxml Normal file
View file

@ -0,0 +1,7 @@
-cp src
-lib heaps
-lib hlsdl
-D highDPI
-hl native/marblegame.c
-D MACOS_BUNDLE
--main Main

View file

@ -1,9 +1,9 @@
-cp src
-lib heaps
-lib hlsdl
-lib zyheaps
-hl marblegame.hl
-D windowSize=1280x720
-D keep-inline-positions
-D highDPI
--main Main
-debug

204
data/font/EXPON.fnt Normal file
View file

@ -0,0 +1,204 @@
<?xml version="1.0"?>
<font>
<info face="EXPON" size="42" bold="0" italic="0" charset="" unicode="1" stretchH="100" smooth="1" aa="1" padding="2,2,2,2" spacing="0,0" outline="0"/>
<common lineHeight="47" base="36" scaleW="512" scaleH="256" pages="1" packed="0" alphaChnl="0" redChnl="0" greenChnl="0" blueChnl="0"/>
<pages>
<page id="0" file="ExpoSDF.png"/>
</pages>
<distanceField fieldType="msdf" distanceRange="4"/>
<chars count="95">
<char id="87" index="61" char="W" width="52" height="37" xoffset="0" yoffset="3" xadvance="50" chnl="15" x="0" y="0" page="0"/>
<char id="77" index="51" char="M" width="49" height="36" xoffset="-1" yoffset="4" xadvance="47" chnl="15" x="0" y="38" page="0"/>
<char id="106" index="80" char="j" width="17" height="48" xoffset="-1" yoffset="3" xadvance="15" chnl="15" x="0" y="75" page="0"/>
<char id="124" index="98" char="|" width="7" height="46" xoffset="-1" yoffset="4" xadvance="6" chnl="15" x="0" y="124" page="0"/>
<char id="91" index="65" char="[" width="13" height="44" xoffset="-1" yoffset="0" xadvance="11" chnl="15" x="0" y="171" page="0"/>
<char id="93" index="67" char="]" width="13" height="44" xoffset="-2" yoffset="0" xadvance="10" chnl="15" x="8" y="124" page="0"/>
<char id="109" index="83" char="m" width="44" height="27" xoffset="-1" yoffset="14" xadvance="41" chnl="15" x="0" y="216" page="0"/>
<char id="78" index="52" char="N" width="41" height="36" xoffset="-1" yoffset="4" xadvance="39" chnl="15" x="14" y="169" page="0"/>
<char id="88" index="62" char="X" width="41" height="37" xoffset="-1" yoffset="4" xadvance="39" chnl="15" x="18" y="75" page="0"/>
<char id="119" index="93" char="w" width="41" height="26" xoffset="-1" yoffset="14" xadvance="39" chnl="15" x="50" y="38" page="0"/>
<char id="36" index="10" char="$" width="32" height="40" xoffset="-1" yoffset="2" xadvance="30" chnl="15" x="45" y="206" page="0"/>
<char id="74" index="48" char="J" width="23" height="40" xoffset="-2" yoffset="3" xadvance="20" chnl="15" x="22" y="113" page="0"/>
<char id="123" index="97" char="{" width="15" height="40" xoffset="-1" yoffset="3" xadvance="12" chnl="15" x="46" y="113" page="0"/>
<char id="125" index="99" char="}" width="15" height="40" xoffset="-2" yoffset="3" xadvance="12" chnl="15" x="60" y="65" page="0"/>
<char id="38" index="12" char="&amp;" width="39" height="37" xoffset="-1" yoffset="5" xadvance="37" chnl="15" x="53" y="0" page="0"/>
<char id="65" index="39" char="A" width="39" height="37" xoffset="-1" yoffset="2" xadvance="37" chnl="15" x="56" y="154" page="0"/>
<char id="72" index="46" char="H" width="39" height="36" xoffset="-1" yoffset="4" xadvance="37" chnl="15" x="62" y="106" page="0"/>
<char id="103" index="77" char="g" width="28" height="39" xoffset="-1" yoffset="14" xadvance="26" chnl="15" x="76" y="65" page="0"/>
<char id="35" index="9" char="#" width="38" height="36" xoffset="-1" yoffset="4" xadvance="36" chnl="15" x="78" y="192" page="0"/>
<char id="40" index="14" char="(" width="15" height="38" xoffset="-1" yoffset="3" xadvance="14" chnl="15" x="96" y="143" page="0"/>
<char id="41" index="15" char=")" width="15" height="38" xoffset="-1" yoffset="3" xadvance="14" chnl="15" x="93" y="0" page="0"/>
<char id="63" index="37" char="?" width="24" height="38" xoffset="-1" yoffset="3" xadvance="22" chnl="15" x="105" y="39" page="0"/>
<char id="64" index="38" char="@" width="37" height="38" xoffset="-1" yoffset="4" xadvance="35" chnl="15" x="109" y="0" page="0"/>
<char id="67" index="41" char="C" width="35" height="38" xoffset="-1" yoffset="2" xadvance="33" chnl="15" x="105" y="78" page="0"/>
<char id="71" index="45" char="G" width="35" height="38" xoffset="-1" yoffset="3" xadvance="33" chnl="15" x="130" y="39" page="0"/>
<char id="79" index="53" char="O" width="35" height="38" xoffset="-1" yoffset="3" xadvance="33" chnl="15" x="147" y="0" page="0"/>
<char id="80" index="54" char="P" width="35" height="38" xoffset="-1" yoffset="3" xadvance="33" chnl="15" x="112" y="117" page="0"/>
<char id="81" index="55" char="Q" width="38" height="38" xoffset="-1" yoffset="3" xadvance="36" chnl="15" x="141" y="78" page="0"/>
<char id="82" index="56" char="R" width="37" height="38" xoffset="-1" yoffset="3" xadvance="35" chnl="15" x="166" y="39" page="0"/>
<char id="85" index="59" char="U" width="38" height="37" xoffset="-1" yoffset="4" xadvance="36" chnl="15" x="183" y="0" page="0"/>
<char id="89" index="63" char="Y" width="38" height="36" xoffset="-1" yoffset="4" xadvance="36" chnl="15" x="117" y="156" page="0"/>
<char id="98" index="72" char="b" width="30" height="38" xoffset="-1" yoffset="2" xadvance="28" chnl="15" x="148" y="117" page="0"/>
<char id="100" index="74" char="d" width="32" height="38" xoffset="-1" yoffset="2" xadvance="30" chnl="15" x="117" y="193" page="0"/>
<char id="104" index="78" char="h" width="32" height="38" xoffset="-1" yoffset="3" xadvance="30" chnl="15" x="150" y="193" page="0"/>
<char id="112" index="86" char="p" width="31" height="38" xoffset="-1" yoffset="14" xadvance="29" chnl="15" x="179" y="117" page="0"/>
<char id="113" index="87" char="q" width="29" height="38" xoffset="-1" yoffset="14" xadvance="25" chnl="15" x="180" y="78" page="0"/>
<char id="33" index="7" char="!" width="15" height="37" xoffset="-1" yoffset="3" xadvance="14" chnl="15" x="204" y="38" page="0"/>
<char id="48" index="22" char="0" width="29" height="37" xoffset="-1" yoffset="3" xadvance="27" chnl="15" x="210" y="76" page="0"/>
<char id="49" index="23" char="1" width="20" height="37" xoffset="-1" yoffset="4" xadvance="19" chnl="15" x="220" y="38" page="0"/>
<char id="54" index="28" char="6" width="27" height="37" xoffset="-1" yoffset="4" xadvance="25" chnl="15" x="222" y="0" page="0"/>
<char id="55" index="29" char="7" width="26" height="37" xoffset="-1" yoffset="4" xadvance="24" chnl="15" x="183" y="156" page="0"/>
<char id="56" index="30" char="8" width="30" height="37" xoffset="-1" yoffset="4" xadvance="29" chnl="15" x="183" y="194" page="0"/>
<char id="57" index="31" char="9" width="27" height="37" xoffset="-1" yoffset="3" xadvance="25" chnl="15" x="210" y="156" page="0"/>
<char id="66" index="40" char="B" width="35" height="37" xoffset="-1" yoffset="2" xadvance="33" chnl="15" x="211" y="114" page="0"/>
<char id="68" index="42" char="D" width="36" height="37" xoffset="-1" yoffset="2" xadvance="34" chnl="15" x="240" y="76" page="0"/>
<char id="69" index="43" char="E" width="33" height="37" xoffset="-1" yoffset="3" xadvance="31" chnl="15" x="241" y="38" page="0"/>
<char id="73" index="47" char="I" width="20" height="37" xoffset="-1" yoffset="4" xadvance="18" chnl="15" x="250" y="0" page="0"/>
<char id="75" index="49" char="K" width="36" height="37" xoffset="-1" yoffset="3" xadvance="34" chnl="15" x="271" y="0" page="0"/>
<char id="76" index="50" char="L" width="31" height="37" xoffset="-1" yoffset="3" xadvance="29" chnl="15" x="275" y="38" page="0"/>
<char id="83" index="57" char="S" width="34" height="37" xoffset="-1" yoffset="3" xadvance="33" chnl="15" x="214" y="194" page="0"/>
<char id="84" index="58" char="T" width="34" height="37" xoffset="-1" yoffset="4" xadvance="32" chnl="15" x="238" y="152" page="0"/>
<char id="86" index="60" char="V" width="37" height="36" xoffset="-1" yoffset="4" xadvance="36" chnl="15" x="247" y="114" page="0"/>
<char id="90" index="64" char="Z" width="34" height="37" xoffset="-1" yoffset="4" xadvance="32" chnl="15" x="277" y="76" page="0"/>
<char id="105" index="79" char="i" width="17" height="37" xoffset="-1" yoffset="3" xadvance="16" chnl="15" x="307" y="38" page="0"/>
<char id="107" index="81" char="k" width="30" height="37" xoffset="-1" yoffset="4" xadvance="29" chnl="15" x="308" y="0" page="0"/>
<char id="108" index="82" char="l" width="16" height="37" xoffset="-1" yoffset="3" xadvance="15" chnl="15" x="249" y="190" page="0"/>
<char id="37" index="11" char="%" width="34" height="36" xoffset="-1" yoffset="4" xadvance="32" chnl="15" x="266" y="190" page="0"/>
<char id="47" index="21" char="/" width="28" height="36" xoffset="-1" yoffset="4" xadvance="27" chnl="15" x="273" y="151" page="0"/>
<char id="50" index="24" char="2" width="26" height="36" xoffset="-1" yoffset="4" xadvance="24" chnl="15" x="156" y="156" page="0"/>
<char id="51" index="25" char="3" width="28" height="36" xoffset="-1" yoffset="4" xadvance="26" chnl="15" x="285" y="114" page="0"/>
<char id="52" index="26" char="4" width="30" height="36" xoffset="-1" yoffset="4" xadvance="28" chnl="15" x="312" y="76" page="0"/>
<char id="53" index="27" char="5" width="25" height="36" xoffset="-1" yoffset="4" xadvance="24" chnl="15" x="325" y="38" page="0"/>
<char id="70" index="44" char="F" width="31" height="36" xoffset="-1" yoffset="4" xadvance="30" chnl="15" x="339" y="0" page="0"/>
<char id="92" index="66" char="\" width="28" height="36" xoffset="-1" yoffset="4" xadvance="26" chnl="15" x="301" y="188" page="0"/>
<char id="102" index="76" char="f" width="22" height="36" xoffset="-1" yoffset="4" xadvance="19" chnl="15" x="302" y="151" page="0"/>
<char id="121" index="95" char="y" width="28" height="36" xoffset="-1" yoffset="14" xadvance="27" chnl="15" x="314" y="113" page="0"/>
<char id="95" index="69" char="_" width="34" height="5" xoffset="-1" yoffset="35" xadvance="32" chnl="15" x="0" y="247" page="0"/>
<char id="116" index="90" char="t" width="19" height="33" xoffset="-1" yoffset="8" xadvance="17" chnl="15" x="325" y="150" page="0"/>
<char id="117" index="91" char="u" width="32" height="26" xoffset="-1" yoffset="14" xadvance="30" chnl="15" x="78" y="229" page="0"/>
<char id="120" index="94" char="x" width="32" height="26" xoffset="-1" yoffset="14" xadvance="30" chnl="15" x="249" y="228" page="0"/>
<char id="59" index="33" char=";" width="13" height="31" xoffset="-1" yoffset="15" xadvance="10" chnl="15" x="301" y="225" page="0"/>
<char id="97" index="71" char="a" width="31" height="27" xoffset="-1" yoffset="14" xadvance="29" chnl="15" x="315" y="225" page="0"/>
<char id="110" index="84" char="n" width="31" height="26" xoffset="-1" yoffset="14" xadvance="29" chnl="15" x="330" y="184" page="0"/>
<char id="118" index="92" char="v" width="29" height="26" xoffset="-1" yoffset="14" xadvance="27" chnl="15" x="347" y="211" page="0"/>
<char id="101" index="75" char="e" width="26" height="28" xoffset="-1" yoffset="14" xadvance="24" chnl="15" x="343" y="75" page="0"/>
<char id="99" index="73" char="c" width="26" height="27" xoffset="-1" yoffset="14" xadvance="24" chnl="15" x="351" y="37" page="0"/>
<char id="111" index="85" char="o" width="26" height="27" xoffset="-1" yoffset="14" xadvance="24" chnl="15" x="371" y="0" page="0"/>
<char id="43" index="17" char="+" width="22" height="26" xoffset="-1" yoffset="14" xadvance="20" chnl="15" x="343" y="104" page="0"/>
<char id="58" index="32" char=":" width="12" height="26" xoffset="-1" yoffset="14" xadvance="10" chnl="15" x="282" y="227" page="0"/>
<char id="114" index="88" char="r" width="24" height="26" xoffset="-1" yoffset="14" xadvance="23" chnl="15" x="345" y="131" page="0"/>
<char id="115" index="89" char="s" width="23" height="26" xoffset="-1" yoffset="14" xadvance="22" chnl="15" x="366" y="104" page="0"/>
<char id="122" index="96" char="z" width="25" height="26" xoffset="-1" yoffset="14" xadvance="23" chnl="15" x="370" y="65" page="0"/>
<char id="60" index="34" char="&lt;" width="23" height="25" xoffset="-1" yoffset="15" xadvance="21" chnl="15" x="345" y="158" page="0"/>
<char id="62" index="36" char=">" width="23" height="25" xoffset="-1" yoffset="15" xadvance="21" chnl="15" x="362" y="184" page="0"/>
<char id="126" index="100" char="~" width="25" height="14" xoffset="-1" yoffset="3" xadvance="23" chnl="15" x="22" y="154" page="0"/>
<char id="94" index="68" char="^" width="23" height="12" xoffset="-1" yoffset="3" xadvance="21" chnl="15" x="347" y="238" page="0"/>
<char id="42" index="16" char="*" width="21" height="22" xoffset="-1" yoffset="4" xadvance="19" chnl="15" x="111" y="232" page="0"/>
<char id="61" index="35" char="=" width="21" height="13" xoffset="-1" yoffset="20" xadvance="19" chnl="15" x="56" y="192" page="0"/>
<char id="34" index="8" char="&quot;" width="19" height="16" xoffset="-1" yoffset="2" xadvance="18" chnl="15" x="371" y="238" page="0"/>
<char id="45" index="19" char="-" width="19" height="10" xoffset="-1" yoffset="21" xadvance="18" chnl="15" x="62" y="143" page="0"/>
<char id="44" index="18" char="," width="13" height="16" xoffset="-2" yoffset="29" xadvance="10" chnl="15" x="133" y="232" page="0"/>
<char id="39" index="13" char="'" width="12" height="15" xoffset="-1" yoffset="3" xadvance="10" chnl="15" x="92" y="39" page="0"/>
<char id="96" index="70" char="`" width="14" height="15" xoffset="-1" yoffset="3" xadvance="12" chnl="15" x="147" y="232" page="0"/>
<char id="46" index="20" char="." width="12" height="11" xoffset="-1" yoffset="29" xadvance="10" chnl="15" x="370" y="92" page="0"/>
<char id="32" index="6" char=" " width="0" height="0" xoffset="-2" yoffset="36" xadvance="15" chnl="15" x="76" y="105" page="0"/>
</chars>
<kernings count="96">
<kerning first="39" second="115" amount="-4"/>
<kerning first="39" second="116" amount="-2"/>
<kerning first="65" second="34" amount="-4"/>
<kerning first="65" second="39" amount="-4"/>
<kerning first="65" second="84" amount="-3"/>
<kerning first="65" second="86" amount="-4"/>
<kerning first="65" second="87" amount="-5"/>
<kerning first="65" second="89" amount="-4"/>
<kerning first="65" second="118" amount="-4"/>
<kerning first="65" second="119" amount="-3"/>
<kerning first="65" second="121" amount="-2"/>
<kerning first="70" second="44" amount="-5"/>
<kerning first="70" second="46" amount="-5"/>
<kerning first="70" second="65" amount="-3"/>
<kerning first="76" second="39" amount="-2"/>
<kerning first="76" second="84" amount="-2"/>
<kerning first="76" second="86" amount="-3"/>
<kerning first="76" second="87" amount="-3"/>
<kerning first="76" second="89" amount="-3"/>
<kerning first="80" second="44" amount="-6"/>
<kerning first="80" second="46" amount="-6"/>
<kerning first="80" second="65" amount="-4"/>
<kerning first="84" second="44" amount="-5"/>
<kerning first="84" second="45" amount="-5"/>
<kerning first="84" second="46" amount="-6"/>
<kerning first="84" second="65" amount="-4"/>
<kerning first="84" second="79" amount="-1"/>
<kerning first="84" second="97" amount="-3"/>
<kerning first="84" second="99" amount="-3"/>
<kerning first="84" second="101" amount="-2"/>
<kerning first="84" second="105" amount="-1"/>
<kerning first="84" second="111" amount="-2"/>
<kerning first="84" second="114" amount="-1"/>
<kerning first="84" second="115" amount="-2"/>
<kerning first="84" second="117" amount="-1"/>
<kerning first="84" second="119" amount="-1"/>
<kerning first="86" second="44" amount="-4"/>
<kerning first="86" second="45" amount="-6"/>
<kerning first="86" second="46" amount="-5"/>
<kerning first="86" second="58" amount="-2"/>
<kerning first="86" second="59" amount="-3"/>
<kerning first="86" second="65" amount="-4"/>
<kerning first="86" second="67" amount="-2"/>
<kerning first="86" second="79" amount="-1"/>
<kerning first="86" second="97" amount="-6"/>
<kerning first="86" second="99" amount="-6"/>
<kerning first="86" second="101" amount="-5"/>
<kerning first="86" second="105" amount="-3"/>
<kerning first="86" second="111" amount="-5"/>
<kerning first="86" second="114" amount="-4"/>
<kerning first="86" second="117" amount="-3"/>
<kerning first="86" second="121" amount="-4"/>
<kerning first="87" second="44" amount="-6"/>
<kerning first="87" second="45" amount="-5"/>
<kerning first="87" second="46" amount="-7"/>
<kerning first="87" second="58" amount="-3"/>
<kerning first="87" second="59" amount="-3"/>
<kerning first="87" second="65" amount="-5"/>
<kerning first="87" second="67" amount="-2"/>
<kerning first="87" second="79" amount="-1"/>
<kerning first="87" second="97" amount="-5"/>
<kerning first="87" second="99" amount="-5"/>
<kerning first="87" second="101" amount="-5"/>
<kerning first="87" second="105" amount="-3"/>
<kerning first="87" second="111" amount="-5"/>
<kerning first="87" second="114" amount="-3"/>
<kerning first="87" second="117" amount="-3"/>
<kerning first="87" second="121" amount="-3"/>
<kerning first="89" second="44" amount="-6"/>
<kerning first="89" second="45" amount="-6"/>
<kerning first="89" second="46" amount="-6"/>
<kerning first="89" second="58" amount="-2"/>
<kerning first="89" second="59" amount="-3"/>
<kerning first="89" second="65" amount="-4"/>
<kerning first="89" second="97" amount="-6"/>
<kerning first="89" second="101" amount="-6"/>
<kerning first="89" second="105" amount="-3"/>
<kerning first="89" second="111" amount="-5"/>
<kerning first="89" second="112" amount="-4"/>
<kerning first="89" second="113" amount="-6"/>
<kerning first="89" second="114" amount="-3"/>
<kerning first="89" second="117" amount="-4"/>
<kerning first="89" second="118" amount="-4"/>
<kerning first="96" second="65" amount="-3"/>
<kerning first="102" second="39" amount="2"/>
<kerning first="114" second="44" amount="-2"/>
<kerning first="114" second="46" amount="-3"/>
<kerning first="114" second="103" amount="-1"/>
<kerning first="114" second="104" amount="-3"/>
<kerning first="114" second="120" amount="-1"/>
<kerning first="118" second="44" amount="-3"/>
<kerning first="118" second="46" amount="-4"/>
<kerning first="119" second="44" amount="-4"/>
<kerning first="119" second="46" amount="-4"/>
<kerning first="121" second="44" amount="-5"/>
<kerning first="121" second="46" amount="-5"/>
</kernings>
</font>

View file

@ -5,7 +5,7 @@ new SimGroup(MissionGroup) {
desc = "You need to take both the high road and the low road to collect both of the gems.";
name = "Take the High Road";
startHelpText = "You need to take both the high road and the low road to collect both of the gems.";
level = "13";
level = "14";
type = "Intermediate";
artist = "Kevin Ryan";
time = "90000";

View file

@ -6,7 +6,7 @@ new SimGroup(MissionGroup) {
name = "Hop Skip and a Jump";
desc = "Master your aerial skills!";
type = "Intermediate";
level = "12";
level = "13";
artist = "Alex Swanson";
goldTime = "12000";
};

View file

@ -6,7 +6,7 @@ new SimGroup(MissionGroup) {
goldTime = "28000";
desc = "Surf the waves to collect all the gems before time runs out!";
startHelpText = "Grab all the gems!";
level = "20";
level = "21";
name = "The Wave";
type = "intermediate";
artist = "Kevin Ryan";

View file

@ -1 +1 @@
by17:font%2FExpo50.fntaoy3:veri1y4:timei1626163037y4:hashy40:f2bb3df897a1cbe1bc70650168d9ecf7de1195f1y3:outy24:tmp%2Ffont%2FExpo50.bfntghy17:font%2FExpo32.fntaoR1i1R2i1626163037R3y40:d3397b6efedac7bfa90be848901a0167dfd32e7eR5y24:tmp%2Ffont%2FExpo32.bfntghy24:font%2FDomCasual32px.fntaoR1i1R2i1626163037R3y40:f9ae7ff4e7b94f78bd6a050e51a9f92fbfdbb40cR5y31:tmp%2Ffont%2FDomCasual32px.bfntghy24:font%2FDomCasual24px.fntaoR1i1R2i1626163037R3y40:f5f86d351ba84a7e1a5f1a459463a4eaf66ca893R5y31:tmp%2Ffont%2FDomCasual24px.bfntghy24:font%2FArialBold14px.fntaoR1i1R2i1626163037R3y40:4f58a547a119d447806129c12b660d267212a382R5y31:tmp%2Ffont%2FArialBold14px.bfntghy18:font%2FArial14.fntaoR1i1R2i1626163037R3y40:5433840b11f487315b7372dd95a79eda5986d558R5y25:tmp%2Ffont%2FArial14.bfntghh
by27:font%2FLucida%20Console.fntaoy3:outy34:tmp%2Ffont%2FLucida%20Console.bfnty3:veri1y4:hashy40:b56483df1b8f3d8472856b51459d5ce8f3cdfa09y4:timei1672239804ghy16:font%2FEXPON.fntaoR1y23:tmp%2Ffont%2FEXPON.bfntR3i1R4y40:ba8ecd55d9475ee0f9d20c9a5189fe6a9c9ff727R6i1659272757ghy21:font%2FDomCasualD.fntaoR1y28:tmp%2Ffont%2FDomCasualD.bfntR3i1R4y40:ea40ffbf969a51d3e653a3d09b450143a814c7eeR6i1659272757ghy30:data%2Ffont%2FArial%20Bold.fntaoR1y44:data%2Ftmp%2Fdata%2Ffont%2FArial%20Bold.bfntR3i1R4y40:dce4a5edf92262f9ea5540d55271f8423683d064R6i1670297462ghy23:font%2FArial%20Bold.fntaoR1y30:tmp%2Ffont%2FArial%20Bold.bfntR3i1R4R15R6i1659272757ghy28:data%2Ffont%2FMarkerFelt.fntaoR1y42:data%2Ftmp%2Fdata%2Ffont%2FMarkerFelt.bfntR3i1R4y40:eb239790210478413cc111da54400b3d38aba041R6i1672239219ghy16:font%2Farial.fntaoR1y23:tmp%2Ffont%2Farial.bfntR3i1R4y40:dc7f069d72e0d1b6b7edfd5b9e6af9c22f9c641cR6i1659272757ghy21:font%2FMarkerFelt.fntaoR1y28:tmp%2Ffont%2FMarkerFelt.bfntR3i1R4R20R6i1672239219ghy34:data%2Ffont%2FLucida%20Console.fntaoR1y48:data%2Ftmp%2Fdata%2Ffont%2FLucida%20Console.bfntR3i1R4R5R6i1672239804ghy28:data%2Ffont%2FDomCasualD.fntaoR1y42:data%2Ftmp%2Fdata%2Ffont%2FDomCasualD.bfntR3i1R4R12R6i1670297462ghy23:data%2Ffont%2Farial.fntaoR1y37:data%2Ftmp%2Fdata%2Ffont%2Farial.bfntR3i1R4R23R6i1670297462ghy23:data%2Ffont%2FEXPON.fntaoR1y37:data%2Ftmp%2Fdata%2Ffont%2FEXPON.bfntR3i1R4R9R6i1674008352ghh

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.

BIN
data/tmp/font/EXPON.bfnt Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
data/tmp/font/arial.bfnt Normal file

Binary file not shown.

BIN
data/ui/github_d.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
data/ui/github_h.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
data/ui/github_i.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
data/ui/github_n.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
data/ui/kofi1_d.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
data/ui/kofi1_h.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
data/ui/kofi1_i.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
data/ui/kofi1_n.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
data/ui/touch/rewind.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<false/>
</dict>
</plist>

View file

@ -0,0 +1,22 @@
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
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
https://www.zlib.net/zlib_license.html

View file

@ -0,0 +1,93 @@
Copyright 2008 The Bungee Project Authors (david@djr.com)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

View file

@ -0,0 +1,93 @@
Copyright 2020 The Gluten Project Authors (https://github.com/Etcetera-Type-Co/Gluten)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

View file

@ -0,0 +1,21 @@
Copyright (C)2015-2018 Haxe Foundation
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
https://github.com/HaxeFoundation/hashlink/blob/master/LICENSE

View file

@ -0,0 +1,313 @@
Haxe Licenses
-------------
For details about Haxe Licenses, please read http://haxe.org/foundation/open-source.html
The Haxe Standard Library MIT License :
--------------------------
Copyright (C)2005-2016 Haxe Foundation
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
The Haxe compiler GPL License :
-------------------------------
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
https://github.com/HaxeFoundation/haxe/blob/development/extra/LICENSE.txt

View file

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2013 Nicolas Cannasse
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
https://github.com/HeapsIO/heaps/blob/master/LICENSE

View file

@ -0,0 +1,7 @@
Midnight Tale by Kevin MacLeod
Link: https://incompetech.filmmusic.io/song/4710-midnight-tale
License: https://filmmusic.io/standard-license
Relent by Kevin MacLeod
Link: https://incompetech.filmmusic.io/song/4274-relent
License: https://filmmusic.io/standard-license

View file

@ -0,0 +1,15 @@
This software is based in part on the work of the Independent JPEG Group.
Copyright (C)2009-2022 D. R. Commander. All Rights Reserved.
Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the libjpeg-turbo Project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/LICENSE.md

View file

@ -0,0 +1,30 @@
Copyright (c) 2002, Xiph.org Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
https://gitlab.xiph.org/xiph/ogg/-/blob/master/COPYING

View file

@ -0,0 +1,136 @@
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
=========================================
PNG Reference Library License version 2
---------------------------------------
* Copyright (c) 1995-2019 The PNG Reference Library Authors.
* Copyright (c) 2018-2019 Cosmin Truta.
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
* Copyright (c) 1996-1997 Andreas Dilger.
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
The software is supplied "as is", without warranty of any kind,
express or implied, including, without limitation, the warranties
of merchantability, fitness for a particular purpose, title, and
non-infringement. In no event shall the Copyright owners, or
anyone distributing the software, be liable for any damages or
other liability, whether in contract, tort or otherwise, arising
from, out of, or in connection with the software, or the use or
other dealings in the software, even if advised of the possibility
of such damage.
Permission is hereby granted to use, copy, modify, and distribute
this software, or portions hereof, for any purpose, without fee,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you
must not claim that you wrote the original software. If you
use this software in a product, an acknowledgment in the product
documentation would be appreciated, but is not required.
2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software.
3. This Copyright notice may not be removed or altered from any
source or altered source distribution.
PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35)
-----------------------------------------------------------------------
libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are
Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
derived from libpng-1.0.6, and are distributed according to the same
disclaimer and license as libpng-1.0.6 with the following individuals
added to the list of Contributing Authors:
Simon-Pierre Cadieux
Eric S. Raymond
Mans Rullgard
Cosmin Truta
Gilles Vollant
James Yu
Mandar Sahastrabuddhe
Google Inc.
Vadim Barkov
and with the following additions to the disclaimer:
There is no warranty against interference with your enjoyment of
the library or against infringement. There is no warranty that our
efforts or the library will fulfill any of your particular purposes
or needs. This library is provided with all faults, and the entire
risk of satisfactory quality, performance, accuracy, and effort is
with the user.
Some files in the "contrib" directory and some configure-generated
files that are distributed with libpng have other copyright owners, and
are released under other open source licenses.
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
libpng-0.96, and are distributed according to the same disclaimer and
license as libpng-0.96, with the following individuals added to the
list of Contributing Authors:
Tom Lane
Glenn Randers-Pehrson
Willem van Schaik
libpng versions 0.89, June 1996, through 0.96, May 1997, are
Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
and are distributed according to the same disclaimer and license as
libpng-0.88, with the following individuals added to the list of
Contributing Authors:
John Bowler
Kevin Bracey
Sam Bushell
Magnus Holmgren
Greg Roelofs
Tom Tanner
Some files in the "scripts" directory have other copyright owners,
but are released under this license.
libpng versions 0.5, May 1995, through 0.88, January 1996, are
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
For the purposes of this copyright and license, "Contributing Authors"
is defined as the following set of individuals:
Andreas Dilger
Dave Martindale
Guy Eric Schalnat
Paul Schmidt
Tim Wegner
The PNG Reference Library is supplied "AS IS". The Contributing
Authors and Group 42, Inc. disclaim all warranties, expressed or
implied, including, without limitation, the warranties of
merchantability and of fitness for any purpose. The Contributing
Authors and Group 42, Inc. assume no liability for direct, indirect,
incidental, special, exemplary, or consequential damages, which may
result from the use of the PNG Reference Library, even if advised of
the possibility of such damage.
Permission is hereby granted to use, copy, modify, and distribute this
source code, or portions hereof, for any purpose, without fee, subject
to the following restrictions:
1. The origin of this source code must not be misrepresented.
2. Altered versions must be plainly marked as such and must not
be misrepresented as being the original source.
3. This Copyright notice may not be removed or altered from any
source or altered source distribution.
The Contributing Authors and Group 42, Inc. specifically permit,
without fee, and encourage the use of this source code as a component
to supporting the PNG file format in commercial products. If you use
this source code in a product, acknowledgment is not required but would
be appreciated.
http://www.libpng.org/pub/png/src/libpng-LICENSE.txt

View file

@ -0,0 +1,68 @@
libuv is licensed for use as follows:
====
Copyright (c) 2015-present libuv project contributors.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
====
This license applies to parts of libuv originating from the
https://github.com/joyent/libuv repository:
====
Copyright Joyent, Inc. and other Node contributors. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
====
This license applies to all parts of libuv that are not externally
maintained libraries.
The externally maintained libraries used by libuv are:
- tree.h (from FreeBSD), copyright Niels Provos. Two clause BSD license.
- inet_pton and inet_ntop implementations, contained in src/inet.c, are
copyright the Internet Systems Consortium, Inc., and licensed under the ISC
license.
- stdint-msvc2008.h (from msinttypes), copyright Alexander Chemeris. Three
clause BSD license.
- pthread-fixes.c, copyright Google Inc. and Sony Mobile Communications AB.
Three clause BSD license.
https://github.com/libuv/libuv/blob/v1.x/LICENSE

View file

@ -0,0 +1,30 @@
Copyright (c) 2002-2020 Xiph.org Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
https://gitlab.xiph.org/xiph/vorbis/-/blob/master/COPYING

View file

@ -0,0 +1,437 @@
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for
your libraries, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if
you distribute copies of the library, or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link a program with the library, you must provide
complete object files to the recipients so that they can relink them
with the library, after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.
Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, so that any problems introduced by others will not reflect on
the original authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.
However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.) The hope is that this
will lead to faster development of free libraries.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, while the latter only
works together with the library.
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
GNU LIBRARY GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
General Public License (also called "this License"). Each licensee is
addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also compile or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
c) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
d) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the source code distributed need not include anything that is normally
distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Library General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS

View file

@ -0,0 +1,27 @@
/* zlib.h -- interface of the 'zlib' general purpose compression library
version 1.2.11, January 15th, 2017
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
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
*/
https://www.zlib.net/zlib_license.html

View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>marblegame</string>
<key>CFBundleIconFile</key>
<string>icon.icns</string>
<key>CFBundleIdentifier</key>
<string>com.randomityguy.mbhaxe.mbg</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>marblegame</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>@VERSION@</string>
<key>CFBundleSignature</key>
<string>hxmg</string>
<key>CFBundleVersion</key>
<string>@VERSION@</string>
<key>NSAppleScriptEnabled</key>
<string>NO</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.games</string>
<key>NSHighResolutionCapable</key>
<string>True</string>
<key>NSPrincipalClass</key>
<string>ShellScript</string>
</dict>
</plist>

5
macos-dist/README.txt Normal file
View file

@ -0,0 +1,5 @@
If you get error saying that the app is "damaged,"
please remove the quarantine flag.
sudo xattr -r -d com.apple.quarantine "MarbleBlast Platinum.app"

Binary file not shown.

36
package-macos.sh Executable file
View file

@ -0,0 +1,36 @@
#!/bin/sh
if [ -z "$1" ]; then
echo "Please pass version string as the first argument.\nEx:\n$0 v1.3.1"
exit 1
fi
if [ ! -d "macos-dist/MarbleBlast Gold.app" ]; then
cp -r "macos-dist/MarbleBlast Gold.app.in" "macos-dist/MarbleBlast Gold.app" || exit $?
else
cp "macos-dist/MarbleBlast Gold.app.in/Contents/Info.plist" "macos-dist/MarbleBlast Gold.app/Contents/Info.plist" || exit $?
fi
# Replace version string
sed -i "" -e "s/@VERSION@/$1/" "macos-dist/MarbleBlast Gold.app/Contents/Info.plist" || exit $?
# Copy binary
cp native/marblegame "macos-dist/MarbleBlast Gold.app/Contents/MacOS/marblegame" || exit $?
# Copy data
cp -r data "macos-dist/MarbleBlast Gold.app/Contents/Resources/" || exit $?
cd "macos-dist/MarbleBlast Gold.app/Contents/MacOS/"
install_name_tool -change ui.hdll @rpath/ui.hdll \
-change openal.hdll @rpath/openal.hdll \
-change fmt.hdll @rpath/fmt.hdll \
-change sdl.hdll @rpath/sdl.hdll \
-change libhl.dylib @rpath/libhl.dylib \
-change libSDL2-2.0.0.dylib @rpath/libSDL2-2.0.0.dylib \
-add_rpath @executable_path/../Frameworks marblegame
echo "Tried to update dylib references in executable."
echo "Please use otool -L to ensure that the libraries are referenced as @rpath. This is usually an issue with libSDL2-2.0.0.dylib"
echo
echo "Please fill macos-dist/MarbleBlast Gold.app/Contents/Frameworks with the dylibs,"
echo "and use install_name_tool to update their IDs to match with marblegame executable."

148
src/Analytics.hx Normal file
View file

@ -0,0 +1,148 @@
package src;
import haxe.Json;
import src.Util;
import src.Settings;
import src.Http;
typedef PayloadData = {
type:String,
payload:{
hostname:String, language:String, referrer:String, screen:String, title:String, url:String, website:String, name:String, ?data:Dynamic
}
};
// I'm sorry to add this
// Your data is private and anonymous and we don't track you at all, I promise!
// The analytics are stored in a self hosted Umami instance inside EU.
class Analytics {
static var umami = "https://analytics.randomityguy.me/api/send";
public static function trackSingle(eventName:String) {
var p = payload(eventName, null);
var json = Json.stringify(p);
Http.post(umami, json, (b) -> {
// Console.log("Analytics suceeded: " + b.toString());
}, (e) -> {
// Console.log("Analytics failed: " + e);
});
}
public static function trackLevelPlay(levelName:String, levelFile:String) {
var p = payload("level-play", {
level: {
name: levelName,
file: levelFile
}
});
var json = Json.stringify(p);
Http.post(umami, json, (b) -> {
// Console.log("Analytics suceeded: " + b.toString());
}, (e) -> {
// Console.log("Analytics failed: " + e);
});
}
public static function trackLevelScore(levelName:String, levelFile:String, time:Int, rewind:Bool) {
var p = payload("level-score", {
level_play: Json.stringify({
name: levelName,
file: levelFile,
time: time,
rewind: rewind
})
});
var json = Json.stringify(p);
Http.post(umami, json, (b) -> {
// Console.log("Analytics suceeded: " + b.toString());
}, (e) -> {
// Console.log("Analytics failed: " + e);
});
}
public static function trackLevelQuit(levelName:String, levelFile:String, time:Int, rewind:Bool) {
var p = payload("level-quit", {
level_quit: Json.stringify({
name: levelName,
file: levelFile,
time: time,
rewind: rewind
})
});
var json = Json.stringify(p);
Http.post(umami, json, (b) -> {
// Console.log("Analytics suceeded: " + b.toString());
}, (e) -> {
// Console.log("Analytics failed: " + e);
});
}
public static function trackPlatformInfo() {
var p = payload("device-telemetry", {
platform: Util.getPlatform(),
screen: screen(),
});
var json = Json.stringify(p);
Http.post(umami, json, (b) -> {
// Console.log("Analytics suceeded: " + b.toString());
}, (e) -> {
// Console.log("Analytics failed: " + e);
});
}
static function payload(eventName:String, eventData:Dynamic):PayloadData {
var p:PayloadData = {
type: "event",
payload: {
hostname: hostname(),
language: language(),
referrer: referrer(),
screen: screen(),
title: "MBHaxe Gold",
url: "/",
website: "737bbe05-ad2e-43a5-820b-4e3014f5683e",
name: eventName
}
};
if (eventData == null)
return p;
p.payload.data = eventData;
return p;
}
static function hostname() {
#if js
return js.Browser.window.location.hostname;
#end
#if hl
return "marbleblastgold.randomityguy.me";
#end
}
static function language() {
#if js
return js.Browser.window.navigator.language;
#end
#if hl
return "en-us";
#end
}
static function referrer() {
#if js
return js.Browser.window.document.referrer;
#end
#if hl
return "";
#end
}
static function screen() {
#if js
return '${js.Browser.window.screen.width}x${js.Browser.window.screen.height}';
#end
#if hl
return '${Settings.optionsSettings.screenWidth}x${Settings.optionsSettings.screenHeight}';
#end
}
}

View file

@ -26,6 +26,7 @@ import h3d.Camera;
import h3d.Vector;
import hxsl.Types.Matrix;
import h3d.scene.Scene;
import src.Gamepad;
enum CameraMode {
FreeOrbit;
@ -36,9 +37,6 @@ class CameraController extends Object {
var marble:Marble;
var level:MarbleWorld;
var view:Matrix;
var projection:Matrix;
public var Position:Vector;
public var Direction:Vector;
public var Up:Vector;
@ -71,6 +69,8 @@ class CameraController extends Object {
public var oob:Bool = false;
public var finish:Bool = false;
var _ignoreCursor:Bool = false;
public function new(marble:Marble) {
super();
this.marble = marble;
@ -80,7 +80,7 @@ class CameraController extends Object {
this.level = level;
// level.scene.addEventListener(onEvent);
// Sdl.setRelativeMouseMode(true);
level.scene.camera.fovY = Settings.optionsSettings.fov;
level.scene.camera.setFovX(Settings.optionsSettings.fovX, Settings.optionsSettings.screenWidth / Settings.optionsSettings.screenHeight);
lockCursor();
}
@ -91,6 +91,7 @@ class CameraController extends Object {
var pointercontainer = js.Browser.document.querySelector("#pointercontainer");
pointercontainer.hidden = true;
#end
_ignoreCursor = true;
Window.getInstance().lockPointer((x, y) -> orbit(x, y));
#if hl
Cursor.show(false);
@ -111,25 +112,40 @@ class CameraController extends Object {
}
public function orbit(mouseX:Float, mouseY:Float, isTouch:Bool = false) {
var scaleFactor = 1.0;
if (_ignoreCursor) {
_ignoreCursor = false;
return;
}
var scaleFactor = 1.0 / Window.getInstance().windowToPixelRatio;
#if js
scaleFactor = 1 / js.Browser.window.devicePixelRatio;
#end
var deltaposX = mouseX * scaleFactor;
var deltaposY = mouseY * (Settings.controlsSettings.invertYAxis ? -1 : 1) * scaleFactor;
if (deltaposX != 0 || deltaposY != 0) {
var absX = Math.abs(deltaposX);
var absY = Math.abs(deltaposY);
var len = Math.sqrt(deltaposX * deltaposX + deltaposY * deltaposY);
var max = Math.max(absX, absY);
if (max > 0.01) {
deltaposX *= len / max;
deltaposY *= len / max;
}
}
if (!Settings.controlsSettings.alwaysFreeLook && !Key.isDown(Settings.controlsSettings.freelook)) {
deltaposY = 0;
}
var factor = isTouch ? Util.lerp(1 / 250, 1 / 25,
var factor = isTouch ? Util.lerp(1 / 25, 1 / 15,
Settings.controlsSettings.cameraSensitivity) : Util.lerp(1 / 2500, 1 / 100, Settings.controlsSettings.cameraSensitivity);
// CameraPitch += deltaposY * factor;
// CameraYaw += deltaposX * factor;
nextCameraPitch = CameraPitch + deltaposY * factor;
nextCameraYaw = CameraYaw + deltaposX * factor;
nextCameraPitch += deltaposY * factor;
nextCameraYaw += deltaposX * factor;
// var rotX = deltaposX * 0.001 * Settings.controlsSettings.cameraSensitivity * Math.PI * 2;
// var rotY = deltaposY * 0.001 * Settings.controlsSettings.cameraSensitivity * Math.PI * 2;
@ -154,24 +170,25 @@ class CameraController extends Object {
// camera.position.add(cameraVerticalTranslation);
var camera = level.scene.camera;
var lerpt = hxd.Math.min(1, 1 - Math.pow(0.6, dt * 600));
var lerpt = Math.pow(0.5, dt / 0.032); // Math.min(1, 1 - Math.pow(0.6, dt / 0.032)); // hxd.Math.min(1, 1 - Math.pow(0.6, dt * 600));
var cameraPitchDelta = (Key.isDown(Settings.controlsSettings.camBackward) ? 1 : 0)
- (Key.isDown(Settings.controlsSettings.camForward) ? 1 : 0)
+ Gamepad.getAxis(Settings.gamepadSettings.cameraYAxis);
if (Settings.gamepadSettings.invertYAxis)
cameraPitchDelta = -cameraPitchDelta;
nextCameraPitch += 0.75 * 5 * cameraPitchDelta * dt * Settings.gamepadSettings.cameraSensitivity;
var cameraYawDelta = (Key.isDown(Settings.controlsSettings.camRight) ? 1 : 0) - (Key.isDown(Settings.controlsSettings.camLeft) ? 1 : 0)
+ Gamepad.getAxis(Settings.gamepadSettings.cameraXAxis);
if (Settings.gamepadSettings.invertXAxis)
cameraYawDelta = -cameraYawDelta;
nextCameraYaw += 0.75 * 5 * cameraYawDelta * dt * Settings.gamepadSettings.cameraSensitivity;
nextCameraPitch = Math.max(-Math.PI / 2 + Math.PI / 4, Math.min(Math.PI / 2 - 0.0001, nextCameraPitch));
CameraYaw = Util.lerp(CameraYaw, nextCameraYaw, lerpt);
CameraPitch = Util.lerp(CameraPitch, nextCameraPitch, lerpt);
if (Key.isDown(Settings.controlsSettings.camForward)) {
CameraPitch += 0.75 * 5 * dt;
}
if (Key.isDown(Settings.controlsSettings.camBackward)) {
CameraPitch -= 0.75 * 5 * dt;
}
if (Key.isDown(Settings.controlsSettings.camLeft)) {
CameraYaw -= 0.75 * 5 * dt;
}
if (Key.isDown(Settings.controlsSettings.camRight)) {
CameraYaw += 0.75 * 5 * dt;
}
CameraPitch = Math.max(-Math.PI / 2 + Math.PI / 4,
Math.min(Math.PI / 2 - 0.0001, CameraPitch)); // Util.clamp(CameraPitch, -Math.PI / 12, Math.PI / 2);

View file

@ -45,10 +45,11 @@ class DifBuilderTriangle {
class TriangleEdge {
public var index1:Int;
public var index2:Int;
public var farPoint:Int;
public var surfaceIndex:Int;
public function new(i1:Int, i2:Int, surfaceIndex:Int) {
public function new(i1:Int, i2:Int, farPoint:Int, surfaceIndex:Int) {
if (i2 < i1) {
index1 = i2;
index2 = i1;
@ -56,6 +57,7 @@ class TriangleEdge {
index1 = i1;
index2 = i2;
}
this.farPoint = farPoint;
this.surfaceIndex = surfaceIndex;
}
}
@ -164,8 +166,7 @@ class DifBuilder {
colliderSurface.points = [];
colliderSurface.normals = [];
colliderSurface.indices = [];
colliderSurface.edgeData = [];
colliderSurface.edgeDots = [];
colliderSurface.transformKeys = [];
colliderSurface.originalIndices = [];
colliderSurface.originalSurfaceIndex = surfaceindex;
@ -186,11 +187,9 @@ class DifBuilder {
colliderSurface.originalIndices.push(geo.windings[k - 1]);
colliderSurface.originalIndices.push(geo.windings[k]);
}
var e1 = new TriangleEdge(geo.windings[k], geo.windings[k - 1], surfaceindex);
var e2 = new TriangleEdge(geo.windings[k - 1], geo.windings[k - 2], surfaceindex);
var e3 = new TriangleEdge(geo.windings[k], geo.windings[k - 2], surfaceindex);
var e1 = new TriangleEdge(geo.windings[k], geo.windings[k - 1], geo.windings[k - 2], surfaceindex);
var e2 = new TriangleEdge(geo.windings[k - 1], geo.windings[k - 2], geo.windings[k], surfaceindex);
var e3 = new TriangleEdge(geo.windings[k], geo.windings[k - 2], geo.windings[k - 1], surfaceindex);
edges.push(e1);
edges.push(e2);
edges.push(e3);
@ -242,16 +241,18 @@ class DifBuilder {
colliderSurface.friction = minfo.friction;
colliderSurface.restitution = minfo.restitution;
}
colliderSurface.points.push(new Vector(-p1.x, p1.y, p1.z));
colliderSurface.points.push(new Vector(-p2.x, p2.y, p2.z));
colliderSurface.points.push(new Vector(-p3.x, p3.y, p3.z));
colliderSurface.normals.push(new Vector(-normal.x, normal.y, normal.z));
colliderSurface.normals.push(new Vector(-normal.x, normal.y, normal.z));
colliderSurface.normals.push(new Vector(-normal.x, normal.y, normal.z));
colliderSurface.addPoint(-p1.x, p1.y, p1.z);
colliderSurface.addPoint(-p2.x, p2.y, p2.z);
colliderSurface.addPoint(-p3.x, p3.y, p3.z);
colliderSurface.addNormal(-normal.x, normal.y, normal.z);
colliderSurface.addNormal(-normal.x, normal.y, normal.z);
colliderSurface.addNormal(-normal.x, normal.y, normal.z);
colliderSurface.indices.push(colliderSurface.indices.length);
colliderSurface.indices.push(colliderSurface.indices.length);
colliderSurface.indices.push(colliderSurface.indices.length);
colliderSurface.transformKeys.push(0);
colliderSurface.transformKeys.push(0);
colliderSurface.transformKeys.push(0);
for (v in [p1, p2, p3]) {
var buckets = vertexBuckets.get(v);
if (buckets == null) {
@ -305,6 +306,8 @@ class DifBuilder {
// trace('Removing internal edge: ${edge.index1} ${edge.index2}');
} else {
var difEdge = new Edge(edge.index1, edge.index2, edge.surfaceIndex, edgeMap[edgeHash].surfaceIndex);
difEdge.farPoint0 = edge.farPoint;
difEdge.farPoint1 = edgeMap[edgeHash].farPoint;
difEdges.set(edgeHash, difEdge); // Literal edge
}
} else {
@ -315,8 +318,7 @@ class DifBuilder {
function hashEdge(i1:Int, i2:Int) {
return i1 >= i2 ? i1 * i1 + i1 + i2 : i1 + i2 * i2;
}
function getEdgeDot(edge:Edge) {
function getEdgeConcavity(edge:Edge) {
var edgeSurface0 = edge.surfaceIndex0;
var surface0 = geo.surfaces[edgeSurface0];
@ -349,9 +351,20 @@ class DifBuilder {
var dot = normal0.dot(normal1);
return dot;
}
if (Math.abs(dot) < 0.1)
return false;
var farP0 = geo.points[edge.farPoint0];
var farP1 = geo.points[edge.farPoint1];
var diff = farP1.sub(farP0);
var cdot0 = normal0.dot(diff);
if (cdot0 > -0.1) {
return true;
}
return false;
}
function getEdgeNormal(edge:Edge) {
var edgeSurface0 = edge.surfaceIndex0;
var surface0 = geo.surfaces[edgeSurface0];
@ -390,52 +403,6 @@ class DifBuilder {
return vec;
}
for (colliderSurface in colliderSurfaces) {
var i = 0;
while (i < colliderSurface.indices.length) {
var e1e2 = hashEdge(colliderSurface.originalIndices[i], colliderSurface.originalIndices[i + 1]);
var e2e3 = hashEdge(colliderSurface.originalIndices[i + 1], colliderSurface.originalIndices[i + 2]);
var e1e3 = hashEdge(colliderSurface.originalIndices[i], colliderSurface.originalIndices[i + 2]);
var edgeData = 0;
if (difEdges.exists(e1e2)) {
if (getEdgeDot(difEdges[e1e2]) < Math.cos(Math.PI / 12)) {
edgeData |= 1;
}
colliderSurface.edgeDots.push(getEdgeDot(difEdges[e1e2]));
// colliderSurface.edgeNormals.push(getEdgeNormal(difEdges[e1e2]));
} else {
colliderSurface.edgeDots.push(0);
// colliderSurface.edgeNormals.push(new Vector(0, 0, 0));
}
if (difEdges.exists(e2e3)) {
if (getEdgeDot(difEdges[e2e3]) < Math.cos(Math.PI / 12)) {
edgeData |= 2;
}
colliderSurface.edgeDots.push(getEdgeDot(difEdges[e2e3]));
// colliderSurface.edgeNormals.push(getEdgeNormal(difEdges[e2e3]));
// colliderSurface.edgeDots.push(dot);
} else {
colliderSurface.edgeDots.push(0);
// colliderSurface.edgeNormals.push(new Vector(0, 0, 0));
}
if (difEdges.exists(e1e3)) {
if (getEdgeDot(difEdges[e1e3]) < Math.cos(Math.PI / 12)) {
edgeData |= 4;
}
colliderSurface.edgeDots.push(getEdgeDot(difEdges[e1e3]));
// colliderSurface.edgeNormals.push(getEdgeNormal(difEdges[e1e3]));
// colliderSurface.edgeDots.push(dot);
} else {
colliderSurface.edgeDots.push(0);
// colliderSurface.edgeNormals.push(new Vector(0, 0, 0));
}
colliderSurface.edgeData.push(edgeData);
i += 3;
}
}
for (vtex => buckets in vertexBuckets) {
for (i in 0...buckets.length) {
var bucket = buckets[i];
@ -468,7 +435,6 @@ class DifBuilder {
}
}
collider.difEdgeMap = difEdges;
collider.finalize();
itr.collider = collider;

View file

@ -1,5 +1,6 @@
package src;
import dts.TSDrawPrimitive;
import hxd.res.Sound;
import h3d.col.Bounds;
import src.TimeState;
@ -330,8 +331,14 @@ class DtsObject extends GameObject {
rootObject.scaleX = -1;
if (this.level != null) {
if (this.level != null && this.isBoundingBoxCollideable) {
var boundthing = new Bounds();
for (mesh in this.dts.meshes) {
if (mesh == null)
continue;
for (pt in mesh.vertices)
boundthing.addPoint(new h3d.col.Point(-pt.x, pt.y, pt.z));
}
boundthing.addPoint(new h3d.col.Point(this.dts.bounds.minX, this.dts.bounds.minY, this.dts.bounds.minZ));
boundthing.addPoint(new h3d.col.Point(this.dts.bounds.maxX, this.dts.bounds.maxY, this.dts.bounds.maxZ));
this.boundingCollider = new BoxCollisionEntity(boundthing, cast this);
@ -380,6 +387,8 @@ class DtsObject extends GameObject {
var dtsshader = new DtsTexture();
dtsshader.texture = texture;
dtsshader.currentOpacity = 1;
if (this.identifier == "Tornado")
dtsshader.normalizeNormals = false; // These arent normalized
material.mainPass.removeShader(material.textureShader);
material.mainPass.addShader(dtsshader);
}
@ -391,6 +400,8 @@ class DtsObject extends GameObject {
if (material.texture == null && !iflMaterial) {
var dtsshader = new DtsTexture();
dtsshader.currentOpacity = 1;
if (this.identifier == "Tornado")
dtsshader.normalizeNormals = false; // These arent normalized
// Make a 1x1 white texture
#if hl
var bitmap = new hxd.BitmapData(1, 1);
@ -415,6 +426,7 @@ class DtsObject extends GameObject {
material.blendMode = BlendMode.Alpha;
material.mainPass.culling = h3d.mat.Data.Face.None;
material.receiveShadows = false;
material.mainPass.depthWrite = false;
}
// // TODO TRANSPARENCY SHIT
if (flags & 8 > 0) {
@ -448,7 +460,26 @@ class DtsObject extends GameObject {
}
if (this.materials.length == 0) {
#if hl
var bitmap = new hxd.BitmapData(1, 1);
bitmap.lock();
bitmap.setPixel(0, 0, 0xFFFFFF);
bitmap.unlock();
var texture = new Texture(1, 1);
texture.uploadBitmap(bitmap);
texture.wrap = Wrap.Repeat;
#end
// Apparently creating these bitmap datas dont work so we'll just get the snag a white texture in the filesystem
#if js
var texture:Texture = ResourceLoader.getResource("data/shapes/pads/white.jpg", ResourceLoader.getTexture, this.textureResources);
texture.wrap = Wrap.Repeat;
#end
var dtsshader = new DtsTexture();
var mat = Material.create();
mat.texture = texture;
dtsshader.texture = texture;
mat.mainPass.addShader(dtsshader);
mat.shadows = false;
this.materials.push(mat);
// TODO THIS
}
@ -505,9 +536,10 @@ class DtsObject extends GameObject {
hs.points = [];
hs.normals = [];
hs.indices = [];
hs.transformKeys = [];
var material = this.dts.matNames[primitive.matIndex];
if (dtsMaterials.exists(material)) {
var material = this.dts.matNames[primitive.matIndex & TSDrawPrimitive.MaterialMask];
if (dtsMaterials.exists(material) && !this.isTSStatic) {
var data = dtsMaterials.get(material);
hs.friction = data.friction;
hs.force = data.force;
@ -528,10 +560,11 @@ class DtsObject extends GameObject {
for (index in [i1, i2, i3]) {
var vertex = vertices[index];
hs.points.push(new Vector(vertex.x, vertex.y, vertex.z));
hs.addPoint(vertex.x, vertex.y, vertex.z);
hs.transformKeys.push(0);
var normal = vertexNormals[index];
hs.normals.push(new Vector(normal.x, normal.y, normal.z));
hs.addNormal(normal.x, normal.y, normal.z);
}
hs.indices.push(hs.indices.length);
@ -544,6 +577,7 @@ class DtsObject extends GameObject {
hs.generateBoundingBox();
chull.addSurface(hs);
chull.generateBoundingBox();
chull.finalize();
hulls.push(chull);
}
return hulls;
@ -556,6 +590,14 @@ class DtsObject extends GameObject {
uvs: [],
indices: []
});
if (materialGeometry.length == 0 && dtsMesh.primitives.length > 0) {
materialGeometry.push({
vertices: [],
normals: [],
uvs: [],
indices: []
});
}
for (primitive in dtsMesh.primitives) {
var k = 0;
@ -632,8 +674,10 @@ class DtsObject extends GameObject {
public override function setTransform(mat:Matrix) {
super.setTransform(mat);
this.boundingCollider.setTransform(mat);
this.level.collisionWorld.updateTransform(this.boundingCollider);
if (this.isBoundingBoxCollideable) {
this.boundingCollider.setTransform(mat);
this.level.collisionWorld.updateTransform(this.boundingCollider);
}
for (i in 0...this.dirtyTransforms.length) {
this.dirtyTransforms[i] = true;
}
@ -846,7 +890,7 @@ class DtsObject extends GameObject {
}
}
if (!this.isInstanced) {
if (!this.isInstanced && !this.isTSStatic) {
for (i in 0...this.materials.length) {
var info = this.materialInfos.get(this.materials[i]);
if (info == null)
@ -945,6 +989,9 @@ class DtsObject extends GameObject {
public override function dispose() {
super.dispose();
this.level = null;
boundingCollider = null;
colliders = null;
this.dtsResource.release();
}
}

View file

@ -11,7 +11,8 @@ class GameObject extends Object {
public var identifier:String;
public var currentOpacity:Float = 1;
public var isCollideable:Bool = false;
public var isBoundingBoxCollideable:Bool = true;
public var isBoundingBoxCollideable:Bool = false;
public var enableCollideCallbacks:Bool = false;
var textureResources:Array<Resource<Texture>> = [];
var soundResources:Array<Resource<Sound>> = [];

113
src/Gamepad.hx Normal file
View file

@ -0,0 +1,113 @@
package src;
import hxd.Pad;
import src.Settings;
class Gamepad {
public static var gamepad:Pad = Pad.createDummy();
public static function init() {
Pad.wait(onPad);
}
public static function onPad(pad:Pad) {
pad.axisDeadZone = Settings.gamepadSettings.axisDeadzone;
pad.onDisconnect = function() {
gamepad = Pad.createDummy();
}
gamepad = pad;
}
public static function getId(name:String) {
switch (name) {
case "start":
return gamepad.config.start;
case "ranalogY":
return gamepad.config.ranalogY;
case "ranalogX":
return gamepad.config.ranalogX;
case "ranalogClick":
return gamepad.config.ranalogClick;
case "dpadUp":
return gamepad.config.dpadUp;
case "dpadRight":
return gamepad.config.dpadRight;
case "dpadLeft":
return gamepad.config.dpadLeft;
case "dpadDown":
return gamepad.config.dpadDown;
case "back":
return gamepad.config.back;
case "analogY":
return gamepad.config.analogY;
case "analogX":
return gamepad.config.analogX;
case "analogClick":
return gamepad.config.analogClick;
case "Y":
return gamepad.config.Y;
case "X":
return gamepad.config.X;
case "RT":
return gamepad.config.RT;
case "RB":
return gamepad.config.RB;
case "LT":
return gamepad.config.LT;
case "LB":
return gamepad.config.LB;
case "B":
return gamepad.config.B;
case "A":
return gamepad.config.A;
}
return -1;
}
public static function isDown(buttons:Array<String>) {
for (button in buttons) {
var buttonId = getId(button);
if (buttonId < 0 || buttonId > gamepad.buttons.length)
continue;
if (gamepad.isDown(buttonId))
return true;
}
return false;
}
public static function isPressed(buttons:Array<String>) {
for (button in buttons) {
var buttonId = getId(button);
if (buttonId < 0 || buttonId > gamepad.buttons.length)
continue;
if (gamepad.isPressed(buttonId))
return true;
}
return false;
}
public static function isReleased(buttons:Array<String>) {
for (button in buttons) {
var buttonId = getId(button);
if (buttonId < 0 || buttonId > gamepad.buttons.length)
continue;
if (gamepad.isReleased(buttonId))
return true;
}
return false;
}
public static function getAxis(axis:String) {
switch (axis) {
case "analogX":
return gamepad.xAxis;
case "analogY":
return gamepad.yAxis;
case "ranalogX":
return gamepad.rxAxis;
case "ranalogY":
return gamepad.ryAxis;
}
return 0.0;
}
}

136
src/Http.hx Normal file
View file

@ -0,0 +1,136 @@
package src;
import src.Util;
typedef HttpRequest = {
var url:String;
var callback:haxe.io.Bytes->Void;
var errCallback:String->Void;
var cancelled:Bool;
var fulfilled:Bool;
var post:Bool;
var postData:String;
};
class Http {
#if sys
static var threadPool:sys.thread.FixedThreadPool;
static var requests:sys.thread.Deque<HttpRequest> = new sys.thread.Deque<HttpRequest>();
static var responses:sys.thread.Deque<() -> Void> = new sys.thread.Deque<() -> Void>();
static var cancellationMutex:sys.thread.Mutex = new sys.thread.Mutex();
#end
public static function init() {
#if sys
threadPool = new sys.thread.FixedThreadPool(4);
threadPool.run(() -> threadLoop());
threadPool.run(() -> threadLoop());
threadPool.run(() -> threadLoop());
threadPool.run(() -> threadLoop());
#end
}
#if sys
static function threadLoop() {
while (true) {
var req = requests.pop(true);
cancellationMutex.acquire();
if (req.cancelled) {
cancellationMutex.release();
continue;
}
cancellationMutex.release();
var http = new sys.Http(req.url);
http.onError = (e) -> {
responses.add(() -> req.errCallback(e + ":" + http.responseBytes.toString()));
req.fulfilled = true;
};
http.onBytes = (b) -> {
responses.add(() -> req.callback(b));
req.fulfilled = true;
};
hl.Gc.enable(false);
hl.Gc.blocking(true); // Wtf is this shit
if (req.post) {
http.setHeader('User-Agent', 'MBHaxe/1.0 ${Util.getPlatform()}');
http.setHeader('Content-Type', "application/json"); // support json data only (for now)
http.setPostData(req.postData);
}
http.request(req.post);
hl.Gc.blocking(false);
hl.Gc.enable(true);
}
}
#end
// Returns HTTPRequest on sys, Int on js
public static function get(url:String, callback:haxe.io.Bytes->Void, errCallback:String->Void) {
var req = {
url: url,
callback: callback,
errCallback: errCallback,
cancelled: false,
fulfilled: false,
post: false,
postData: null,
};
#if sys
requests.add(req);
return req;
#else
return js.Browser.window.setTimeout(() -> {
js.Browser.window.fetch(url).then(r -> r.arrayBuffer().then(b -> callback(haxe.io.Bytes.ofData(b))), e -> errCallback(e.toString()));
}, 75);
#end
}
// Returns HTTPRequest on sys, Int on js
public static function post(url:String, postData:String, callback:haxe.io.Bytes->Void, errCallback:String->Void) {
var req = {
url: url,
callback: callback,
errCallback: errCallback,
cancelled: false,
fulfilled: false,
post: true,
postData: postData
};
#if sys
requests.add(req);
return req;
#else
return js.Browser.window.setTimeout(() -> {
js.Browser.window.fetch(url,
{
method: "POST",
headers: {
"User-Agent": js.Browser.window.navigator.userAgent,
"Content-Type": "application/json",
},
body: postData
}).then(r -> r.arrayBuffer().then(b -> callback(haxe.io.Bytes.ofData(b))), e -> errCallback(e.toString()));
}, 75);
#end
}
public static function loop() {
#if sys
var resp = responses.pop(false);
if (resp != null) {
resp();
}
#end
}
#if sys
public static function cancel(req:HttpRequest) {
cancellationMutex.acquire();
req.cancelled = true;
cancellationMutex.release();
}
#else
public static function cancel(req:Int) {
js.Browser.window.clearTimeout(req);
}
#end
}

View file

@ -1,5 +1,6 @@
package src;
import h3d.prim.Instanced;
import h3d.shader.pbr.PropsValues;
import shaders.Billboard;
import shaders.DtsTexture;
@ -12,16 +13,25 @@ import h3d.scene.Object;
import h3d.scene.Mesh;
import h3d.scene.MeshBatch;
typedef MeshBatchInfo = {
@:publicFields
class MeshBatchInfo {
var instances:Array<MeshInstance>;
var meshbatch:MeshBatch;
var ?transparencymeshbatch:MeshBatch;
var transparencymeshbatch:MeshBatch;
var mesh:Mesh;
public function new() {}
}
typedef MeshInstance = {
@:publicFields
class MeshInstance {
var emptyObj:Object;
var gameObject:GameObject;
public function new(eo, go) {
this.emptyObj = eo;
this.gameObject = go;
}
}
class InstanceManager {
@ -37,8 +47,21 @@ class InstanceManager {
public function update(dt:Float) {
for (meshes in objects) {
for (minfo in meshes) {
var visibleinstances = [];
// Culling
if (minfo.meshbatch != null || minfo.transparencymeshbatch != null) {
for (inst in minfo.instances) {
var objBounds = @:privateAccess cast(minfo.meshbatch.primitive, Instanced).baseBounds.clone();
objBounds.transform(inst.emptyObj.getAbsPos());
if (scene.camera.frustum.hasBounds(objBounds)) {
visibleinstances.push(inst);
}
}
}
// Emit non culled primitives
if (minfo.meshbatch != null) {
var opaqueinstances = minfo.instances.filter(x -> x.gameObject.currentOpacity == 1);
var opaqueinstances = visibleinstances.filter(x -> x.gameObject.currentOpacity == 1);
minfo.meshbatch.begin(opaqueinstances.length);
for (instance in opaqueinstances) { // Draw the opaque shit first
var dtsShader = minfo.meshbatch.material.mainPass.getShader(DtsTexture);
@ -46,6 +69,7 @@ class InstanceManager {
dtsShader.currentOpacity = instance.gameObject.currentOpacity;
}
var transform = instance.emptyObj.getAbsPos();
// minfo.meshbatch.shadersChanged = true;
minfo.meshbatch.material.mainPass.setPassName(minfo.mesh.material.mainPass.name);
minfo.meshbatch.material.mainPass.enableLights = minfo.mesh.material.mainPass.enableLights;
minfo.meshbatch.setTransform(transform);
@ -53,7 +77,7 @@ class InstanceManager {
}
}
if (minfo.transparencymeshbatch != null) {
var transparentinstances = minfo.instances.filter(x -> x.gameObject.currentOpacity != 1);
var transparentinstances = visibleinstances.filter(x -> x.gameObject.currentOpacity != 1 && x.gameObject.currentOpacity != 0); // Filter out all zero opacity things too
minfo.transparencymeshbatch.begin(transparentinstances.length);
for (instance in transparentinstances) { // Non opaque shit
var dtsShader = minfo.transparencymeshbatch.material.mainPass.getShader(DtsTexture);
@ -63,7 +87,7 @@ class InstanceManager {
minfo.transparencymeshbatch.material.blendMode = Alpha;
// minfo.transparencymeshbatch.material.color.a = instance.gameObject.currentOpacity;
// minfo.transparencymeshbatch.material.mainPass.setPassName(minfo.mesh.material.mainPass.name);
minfo.transparencymeshbatch.shadersChanged = true;
// minfo.transparencymeshbatch.shadersChanged = true;
minfo.transparencymeshbatch.material.mainPass.enableLights = minfo.mesh.material.mainPass.enableLights;
// minfo.transparencymeshbatch.material.mainPass.depthWrite = false;
// if (dtsShader != null) {
@ -93,7 +117,7 @@ class InstanceManager {
var objs = getAllChildren(object);
var minfos = objects[objectMap.get(object.identifier)]; // objects.get(object.identifier);
for (i in 0...objs.length) {
minfos[i].instances.push({emptyObj: objs[i], gameObject: object});
minfos[i].instances.push(new MeshInstance(objs[i], object));
}
} else {
// First time appending the thing so bruh
@ -102,18 +126,19 @@ class InstanceManager {
var minfos = [];
for (obj in objs) {
var isMesh = obj is Mesh;
var minfo:MeshBatchInfo = {
instances: [{emptyObj: obj, gameObject: object}],
meshbatch: isMesh ? new MeshBatch(cast(cast(obj, Mesh).primitive), cast(cast(obj, Mesh)).material.clone(), scene) : null,
mesh: isMesh ? cast obj : null
}
var minfo:MeshBatchInfo = new MeshBatchInfo();
minfo.instances = [new MeshInstance(obj, object)];
minfo.meshbatch = isMesh ? new MeshBatch(cast(cast(obj, Mesh).primitive), cast(cast(obj, Mesh)).material.clone(), scene) : null;
minfo.mesh = isMesh ? cast obj : null;
if (isMesh) {
var mat = cast(obj, Mesh).material;
var dtsshader = mat.mainPass.getShader(DtsTexture);
if (dtsshader != null) {
minfo.meshbatch.material.mainPass.removeShader(minfo.meshbatch.material.textureShader);
minfo.meshbatch.material.mainPass.addShader(dtsshader);
// minfo.meshbatch.material.mainPass.culling = mat.mainPass.culling;
minfo.meshbatch.material.mainPass.culling = mat.mainPass.culling;
minfo.meshbatch.material.mainPass.depthWrite = mat.mainPass.depthWrite;
}
minfo.transparencymeshbatch = new MeshBatch(cast(cast(obj, Mesh).primitive), cast(cast(obj, Mesh)).material.clone(), scene);
minfo.transparencymeshbatch.material.mainPass.removeShader(minfo.meshbatch.material.textureShader);

View file

@ -1,5 +1,6 @@
package;
import src.Http;
import hxd.Key;
import src.Util;
import src.ResourceLoader;
@ -17,6 +18,8 @@ import hxd.res.DefaultFont;
import h2d.Text;
import h3d.Vector;
import src.ProfilerUI;
import src.Gamepad;
import src.Http;
class Main extends hxd.App {
var marbleGame:MarbleGame;
@ -57,7 +60,9 @@ class Main extends hxd.App {
#end
ResourceLoader.init(s2d, () -> {
Http.init();
Settings.init();
Gamepad.init();
AudioManager.init();
AudioManager.playShell();
marbleGame = new MarbleGame(s2d, s3d);

File diff suppressed because it is too large Load diff

View file

@ -16,6 +16,9 @@ import src.JSPlatform;
import gui.Canvas;
import src.Util;
import src.ProfilerUI;
import src.Gamepad;
import src.Analytics;
import src.Settings;
@:publicFields
class MarbleGame {
@ -77,6 +80,7 @@ class MarbleGame {
case x: x;
};
@:privateAccess Key.keyPressed[buttonCode] = Key.getFrame();
@:privateAccess Window.getInstance().onMouseDown(e);
});
pointercontainer.addEventListener('mouseup', (e:js.html.MouseEvent) -> {
var buttonCode = switch (e.button) {
@ -85,6 +89,7 @@ class MarbleGame {
case x: x;
};
@:privateAccess Key.keyPressed[buttonCode] = -Key.getFrame();
@:privateAccess Window.getInstance().onMouseUp(e);
});
canvas.addEventListener('mousedown', (e:js.html.MouseEvent) -> {
var buttonCode = switch (e.button) {
@ -102,13 +107,18 @@ class MarbleGame {
};
@:privateAccess Key.keyPressed[buttonCode] = -Key.getFrame();
});
pointercontainer.addEventListener('keypress', (e:js.html.KeyboardEvent) -> {
@:privateAccess Window.getInstance().onKeyPress(e);
});
pointercontainer.addEventListener('keydown', (e:js.html.KeyboardEvent) -> {
var buttonCode = (e.keyCode);
@:privateAccess Key.keyPressed[buttonCode] = Key.getFrame();
@:privateAccess Window.getInstance().onKeyDown(e);
});
pointercontainer.addEventListener('keyup', (e:js.html.KeyboardEvent) -> {
var buttonCode = (e.keyCode);
@:privateAccess Key.keyPressed[buttonCode] = -Key.getFrame();
@:privateAccess Window.getInstance().onKeyUp(e);
});
js.Browser.window.addEventListener('keydown', (e:js.html.KeyboardEvent) -> {
var buttonCode = (e.keyCode);
@ -147,6 +157,9 @@ class MarbleGame {
Window.getInstance().removeEventTarget(@:privateAccess Key.onEvent);
#end
Analytics.trackSingle("game-start");
Analytics.trackPlatformInfo();
}
public function update(dt:Float) {
@ -161,17 +174,11 @@ class MarbleGame {
if (!paused) {
world.update(dt);
}
if (Key.isPressed(Key.ESCAPE) && world.finishTime == null && world._ready) {
#if hl
if (((Key.isPressed(Key.ESCAPE) #if js && paused #end) || Gamepad.isPressed(["start"]))
&& world.finishTime == null
&& world._ready) {
paused = !paused;
handlePauseGame();
#end
#if js
if (paused) {
paused = false;
}
handlePauseGame();
#end
}
}
if (canvas != null) {
@ -192,10 +199,12 @@ class MarbleGame {
}, (sender) -> {
canvas.popDialog(exitGameDlg);
paused = !paused;
world.setCursorLock(true);
var w = getWorld();
w.setCursorLock(true);
}, (sender) -> {
canvas.popDialog(exitGameDlg);
world.restart();
var w = getWorld();
w.restart();
// world.setCursorLock(true);
paused = !paused;
});
@ -209,8 +218,15 @@ class MarbleGame {
}
}
public function getWorld() {
// So that we don't actually store this somewhere in any closure stack
return world;
}
public function quitMission() {
world.setCursorLock(false);
Analytics.trackLevelQuit(world.mission.title, world.mission.path, Std.int(world.timeState.timeSinceLoad * 1000),
Settings.optionsSettings.rewindEnabled);
paused = false;
var pmg = new PlayMissionGui();
PlayMissionGui.currentSelectionStatic = world.mission.index;
@ -224,6 +240,10 @@ class MarbleGame {
public function playMission(mission:Mission) {
canvas.clearContent();
if (world != null) {
world.dispose();
}
Analytics.trackLevelPlay(mission.title, mission.path);
world = new MarbleWorld(scene, scene2d, mission, toRecord);
toRecord = false;
world.init();
@ -231,6 +251,10 @@ class MarbleGame {
public function watchMissionReplay(mission:Mission, replay:Replay) {
canvas.clearContent();
if (world != null) {
world.dispose();
}
Analytics.trackSingle("replay-watch");
world = new MarbleWorld(scene, scene2d, mission);
world.replay = replay;
world.isWatching = true;

View file

@ -1,5 +1,8 @@
package src;
import rewind.RewindManager;
import shapes.PushButton;
import collision.Collision;
import src.Replay;
import hxd.impl.Air3File.FileSeek;
import gui.Canvas;
@ -74,6 +77,9 @@ import src.Marble;
import src.Resource;
import src.ProfilerUI;
import src.ResourceLoaderWorker;
import src.Gamepad;
import src.ResourceLoader;
import src.Analytics;
class MarbleWorld extends Scheduler {
public var collisionWorld:CollisionWorld;
@ -99,6 +105,7 @@ class MarbleWorld extends Scheduler {
var endPadElement:MissionElementStaticShape;
var endPad:EndPad;
var skyElement:MissionElementSky;
public var scene:Scene;
public var scene2d:h2d.Scene;
@ -131,8 +138,13 @@ class MarbleWorld extends Scheduler {
// Replay
public var replay:Replay;
public var isWatching:Bool = false;
public var wasRecording:Bool = false;
public var isRecording:Bool = false;
// Rewind
public var rewindManager:RewindManager;
public var rewinding:Bool = false;
// Loading
var resourceLoadFuncs:Array<(() -> Void)->Void> = [];
@ -147,6 +159,9 @@ class MarbleWorld extends Scheduler {
var textureResources:Array<Resource<h3d.mat.Texture>> = [];
var soundResources:Array<Resource<Sound>> = [];
var oobSchedule:Float;
var oobSchedule2:Float;
var lock:Bool = false;
public function new(scene:Scene, scene2d:h2d.Scene, mission:Mission, record:Bool = false) {
@ -154,7 +169,8 @@ class MarbleWorld extends Scheduler {
this.scene2d = scene2d;
this.mission = mission;
this.replay = new Replay(mission.path);
this.isRecording = record;
this.isRecording = this.wasRecording = record;
this.rewindManager = new RewindManager(this);
}
public function init() {
@ -172,7 +188,8 @@ class MarbleWorld extends Scheduler {
MissionElementType.Item,
MissionElementType.PathedInterior,
MissionElementType.StaticShape,
MissionElementType.TSStatic
MissionElementType.TSStatic,
MissionElementType.Sky
].contains(element._type)) {
// this.loadingState.total++;
@ -182,6 +199,10 @@ class MarbleWorld extends Scheduler {
if (so.datablock.toLowerCase() == 'endpad')
this.endPadElement = so;
}
if (element._type == Sky) {
this.skyElement = cast element;
}
} else if (element._type == MissionElementType.SimGroup) {
scanMission(cast element);
}
@ -200,6 +221,7 @@ class MarbleWorld extends Scheduler {
}
public function postInit() {
this.scene.addChild(this.sky);
this._ready = true;
this.playGui.init(this.scene2d);
var musicFileName = [
@ -271,11 +293,7 @@ class MarbleWorld extends Scheduler {
sky.dmlPath = "data/skies/sky_day.dml";
worker.addTask(fwd -> sky.init(cast this, fwd));
worker.addTask(fwd -> {
scene.addChild(sky);
return fwd();
});
worker.addTask(fwd -> sky.init(cast this, fwd, skyElement));
worker.run();
}
@ -300,7 +318,19 @@ class MarbleWorld extends Scheduler {
"sound/spawn.wav",
"sound/ready.wav",
"sound/set.wav",
"sound/go.wav"
"sound/go.wav",
"sound/missinggems.wav",
"shapes/images/glow_bounce.dts",
"shapes/images/glow_bounce.png",
"shapes/images/helicopter.dts",
"shapes/images/helicopter.jpg",
"shapes/pads/white.jpg", // These irk us a lot because ifl shit
"shapes/pads/red.jpg",
"shapes/pads/blue.jpg",
"shapes/pads/green.jpg",
"shapes/items/gem.dts", // Ew ew
"shapes/items/gemshine.png",
"shapes/balls/base.marble.png"
];
for (file in marblefiles) {
worker.loadFile(file);
@ -326,14 +356,14 @@ class MarbleWorld extends Scheduler {
this.replay.clear();
} else
this.replay.rewind();
this.rewindManager.clear();
this.timeState.currentAttemptTime = 0;
this.timeState.gameplayClock = 0;
this.bonusTime = 0;
this.outOfBounds = false;
this.outOfBoundsTime = null;
this.finishTime = null;
this.helpTextTimeState = Math.NEGATIVE_INFINITY;
this.alertTextTimeState = Math.NEGATIVE_INFINITY;
if (this.endPad != null)
this.endPad.inFinish = false;
if (this.totalGems > 0) {
@ -344,6 +374,7 @@ class MarbleWorld extends Scheduler {
// Record/Playback trapdoor and landmine states
var tidx = 0;
var lidx = 0;
var pidx = 0;
for (dtss in this.dtsObjects) {
if (dtss is Trapdoor) {
var trapdoor:Trapdoor = cast dtss;
@ -366,12 +397,23 @@ class MarbleWorld extends Scheduler {
}
lidx++;
}
if (dtss is PushButton) {
var pushbutton:PushButton = cast dtss;
if (!this.isWatching) {
this.replay.recordPushButtonState(pushbutton.lastContactTime - this.timeState.timeSinceLoad);
} else {
pushbutton.lastContactTime = this.replay.getPushButtonState(pidx) + this.timeState.timeSinceLoad;
}
pidx++;
}
}
var startquat = this.getStartPositionAndOrientation();
this.marble.setPosition(startquat.position.x, startquat.position.y, startquat.position.z + 3);
this.marble.collider.transform.setPosition(startquat.position);
var oldtransform = this.marble.collider.transform.clone();
oldtransform.setPosition(startquat.position);
this.marble.collider.setTransform(oldtransform);
this.marble.reset();
var euler = startquat.quat.toEuler();
@ -425,24 +467,27 @@ class MarbleWorld extends Scheduler {
}
public function updateGameState() {
if (this.timeState.currentAttemptTime < 0.5) {
if (this.outOfBounds)
return; // We will update state manually
if (this.timeState.currentAttemptTime < 0.5 && this.finishTime == null) {
this.playGui.setCenterText('none');
this.marble.mode = Start;
}
if ((this.timeState.currentAttemptTime >= 0.5) && (this.timeState.currentAttemptTime < 2)) {
if ((this.timeState.currentAttemptTime >= 0.5) && (this.timeState.currentAttemptTime < 2) && this.finishTime == null) {
this.playGui.setCenterText('ready');
this.marble.mode = Start;
}
if ((this.timeState.currentAttemptTime >= 2) && (this.timeState.currentAttemptTime < 3.5)) {
if ((this.timeState.currentAttemptTime >= 2) && (this.timeState.currentAttemptTime < 3.5) && this.finishTime == null) {
this.playGui.setCenterText('set');
this.marble.mode = Start;
}
if ((this.timeState.currentAttemptTime >= 3.5) && (this.timeState.currentAttemptTime < 5.5)) {
if ((this.timeState.currentAttemptTime >= 3.5) && (this.timeState.currentAttemptTime < 5.5) && this.finishTime == null) {
this.playGui.setCenterText('go');
this.marble.mode = Play;
}
if (this.timeState.currentAttemptTime >= 5.5) {
if (this.timeState.currentAttemptTime >= 5.5 && this.finishTime == null) {
this.playGui.setCenterText('none');
}
if (this.outOfBounds) {
this.playGui.setCenterText('outofbounds');
this.marble.mode = Play;
}
}
@ -542,10 +587,12 @@ class MarbleWorld extends Scheduler {
if (interiorScale.z == 0)
interiorScale.z = 0.0001;
var mat = new Matrix();
interiorRotation.toMatrix(mat);
mat.scale(interiorScale.x, interiorScale.y, interiorScale.z);
mat.setPosition(interiorPosition);
var mat = Matrix.S(interiorScale.x, interiorScale.y, interiorScale.z);
var tmp = new Matrix();
interiorRotation.toMatrix(tmp);
mat.multiply3x4(mat, tmp);
var tmat = Matrix.T(interiorPosition.x, interiorPosition.y, interiorPosition.z);
mat.multiply(mat, tmat);
interior.setTransform(mat);
onFinish();
@ -607,6 +654,8 @@ class MarbleWorld extends Scheduler {
shape = new Tornado();
else if (dataBlockLowerCase == "trapdoor")
shape = new Trapdoor();
else if (dataBlockLowerCase == "pushbutton")
shape = new PushButton();
else if (dataBlockLowerCase == "oilslick")
shape = new Oilslick();
else {
@ -629,9 +678,12 @@ class MarbleWorld extends Scheduler {
if (shapeScale.z == 0)
shapeScale.z = 0.0001;
var mat = shapeRotation.toMatrix();
mat.scale(shapeScale.x, shapeScale.y, shapeScale.z);
mat.setPosition(shapePosition);
var mat = Matrix.S(shapeScale.x, shapeScale.y, shapeScale.z);
var tmp = new Matrix();
shapeRotation.toMatrix(tmp);
mat.multiply3x4(mat, tmp);
var tmat = Matrix.T(shapePosition.x, shapePosition.y, shapePosition.z);
mat.multiply(mat, tmat);
this.addDtsObject(shape, () -> {
shape.setTransform(mat);
@ -685,6 +737,8 @@ class MarbleWorld extends Scheduler {
shape = new Tornado();
else if (dataBlockLowerCase == "trapdoor")
shape = new Trapdoor();
else if (dataBlockLowerCase == "pushbutton")
shape = new PushButton();
else if (dataBlockLowerCase == "oilslick")
shape = new Oilslick();
else {
@ -707,8 +761,10 @@ class MarbleWorld extends Scheduler {
if (shapeScale.z == 0)
shapeScale.z = 0.0001;
var mat = shapeRotation.toMatrix();
mat.scale(shapeScale.x, shapeScale.y, shapeScale.z);
var mat = Matrix.S(shapeScale.x, shapeScale.y, shapeScale.z);
var tmp = new Matrix();
shapeRotation.toMatrix(tmp);
mat.multiply3x4(mat, tmp);
mat.setPosition(shapePosition);
this.addDtsObject(shape, () -> {
@ -744,9 +800,18 @@ class MarbleWorld extends Scheduler {
if (index == -1)
return;
var dtsPath = 'data/' + shapeName.substring(index + 'data/'.length);
if (ResourceLoader.getProperFilepath(dtsPath) == "") {
onFinish();
return;
}
var tsShape = new DtsObject();
tsShape.useInstancing = true;
tsShape.dtsPath = shapeName.substring(index + 'data/'.length);
tsShape.dtsPath = dtsPath;
tsShape.identifier = shapeName + "tsStatic";
tsShape.isCollideable = true;
tsShape.showSequences = false;
var shapePosition = MisParser.parseVector3(element.position);
shapePosition.x = -shapePosition.x;
@ -763,14 +828,16 @@ class MarbleWorld extends Scheduler {
if (shapeScale.z == 0)
shapeScale.z = 0.0001;
var mat = shapeRotation.toMatrix();
mat.scale(shapeScale.x, shapeScale.y, shapeScale.z);
var mat = Matrix.S(shapeScale.x, shapeScale.y, shapeScale.z);
var tmp = new Matrix();
shapeRotation.toMatrix(tmp);
mat.multiply3x4(mat, tmp);
mat.setPosition(shapePosition);
this.addDtsObject(tsShape, () -> {
tsShape.setTransform(mat);
onFinish();
});
}, true);
}
public function addParticleEmitterNode(element:MissionElementParticleEmitterNode) {
@ -801,12 +868,14 @@ class MarbleWorld extends Scheduler {
});
}
public function addDtsObject(obj:DtsObject, onFinish:Void->Void) {
public function addDtsObject(obj:DtsObject, onFinish:Void->Void, isTsStatic:Bool = false) {
obj.idInLevel = this.dtsObjects.length; // Set the id of the thing
this.dtsObjects.push(obj);
if (obj is ForceObject) {
this.forceObjects.push(cast obj);
}
if (isTsStatic)
obj.useInstancing = false;
obj.init(cast this, () -> {
obj.update(this.timeState);
if (obj.useInstancing) {
@ -848,8 +917,29 @@ class MarbleWorld extends Scheduler {
if (!_ready) {
return;
}
var realDt = dt;
if ((Key.isDown(Settings.controlsSettings.rewind)
|| MarbleGame.instance.touchInput.rewindButton.pressed
|| Gamepad.isDown(Settings.gamepadSettings.rewind))
&& Settings.optionsSettings.rewindEnabled
&& !this.isWatching
&& this.finishTime == null) {
this.rewinding = true;
} else {
if (((Key.isReleased(Settings.controlsSettings.rewind) || Gamepad.isReleased(Settings.gamepadSettings.rewind))
|| !MarbleGame.instance.touchInput.rewindButton.pressed)
&& this.rewinding) {
if (this.isRecording) {
this.replay.spliceReplay(timeState.currentAttemptTime);
}
}
this.rewinding = false;
}
if (!this.isWatching) {
if (this.isRecording) {
if (this.isRecording && !this.rewinding) {
this.replay.startFrame();
}
} else {
@ -870,10 +960,22 @@ class MarbleWorld extends Scheduler {
}
}
if (this.rewinding && !this.isWatching) {
var rframe = rewindManager.getNextRewindFrame(timeState.currentAttemptTime - dt * rewindManager.timeScale);
if (rframe != null) {
var actualDt = timeState.currentAttemptTime - rframe.timeState.currentAttemptTime - dt * rewindManager.timeScale;
dt = actualDt;
rewindManager.applyFrame(rframe);
}
}
if (dt < 0)
return;
ProfilerUI.measure("updateTimer");
this.updateTimer(dt);
this.tickSchedule(timeState.currentAttemptTime);
this.updateGameState();
ProfilerUI.measure("updateDTS");
for (obj in dtsObjects) {
@ -883,32 +985,39 @@ class MarbleWorld extends Scheduler {
for (marble in marbles) {
marble.update(timeState, collisionWorld, this.pathedInteriors);
}
if (this.rewinding) {
// Update camera separately
marble.camera.update(timeState.currentAttemptTime, realDt);
}
ProfilerUI.measure("updateInstances");
this.instanceManager.update(dt);
ProfilerUI.measure("updateParticles");
this.particleManager.update(1000 * timeState.timeSinceLoad, dt);
if (this.rewinding) {
this.particleManager.update(1000 * timeState.timeSinceLoad, -realDt * rewindManager.timeScale);
} else
this.particleManager.update(1000 * timeState.timeSinceLoad, dt);
ProfilerUI.measure("updatePlayGui");
this.playGui.update(timeState);
ProfilerUI.measure("updateAudio");
AudioManager.update(this.scene);
if (!this.isWatching) {
if (this.isRecording) {
if (this.isRecording && !this.rewinding) {
this.replay.endFrame();
}
}
if (this.outOfBounds && this.finishTime == null && Key.isDown(Settings.controlsSettings.powerup)) {
if (!this.rewinding && Settings.optionsSettings.rewindEnabled)
this.rewindManager.recordFrame();
if (this.outOfBounds
&& this.finishTime == null
&& (Key.isDown(Settings.controlsSettings.powerup) || Gamepad.isDown(Settings.gamepadSettings.powerup))) {
this.clearSchedule();
this.restart();
return;
}
if (Key.isDown(Key.H)) {
this.isWatching = true;
this.restart();
}
this.updateTexts();
}
@ -941,7 +1050,7 @@ class MarbleWorld extends Scheduler {
});
#end
} else {
if (this._resourcesLoaded < _loadingLength)
if (this._resourcesLoaded < _loadingLength || lock)
return;
if (!_ready)
postInit();
@ -1001,15 +1110,15 @@ class MarbleWorld extends Scheduler {
function updateTexts() {
var helpTextTime = this.helpTextTimeState;
var alertTextTime = this.alertTextTimeState;
var helpTextCompletion = Math.pow(Util.clamp((this.timeState.currentAttemptTime - helpTextTime - 3), 0, 1), 2);
var alertTextCompletion = Math.pow(Util.clamp((this.timeState.currentAttemptTime - alertTextTime - 3), 0, 1), 2);
var helpTextCompletion = Math.pow(Util.clamp((this.timeState.timeSinceLoad - helpTextTime - 3), 0, 1), 2);
var alertTextCompletion = Math.pow(Util.clamp((this.timeState.timeSinceLoad - alertTextTime - 3), 0, 1), 2);
this.playGui.setHelpTextOpacity(1 - helpTextCompletion);
this.playGui.setAlertTextOpacity(1 - alertTextCompletion);
}
public function displayAlert(text:String) {
this.playGui.setAlertText(text);
this.alertTextTimeState = this.timeState.currentAttemptTime;
this.alertTextTimeState = this.timeState.timeSinceLoad;
}
public function displayHelp(text:String) {
@ -1053,7 +1162,7 @@ class MarbleWorld extends Scheduler {
pos = text.indexOf("<func:", start);
}
this.playGui.setHelpText(text);
this.helpTextTimeState = this.timeState.currentAttemptTime;
this.helpTextTimeState = this.timeState.timeSinceLoad;
}
public function pickUpGem(gem:Gem) {
@ -1090,52 +1199,42 @@ class MarbleWorld extends Scheduler {
this.playGui.formatGemCounter(this.gemCount, this.totalGems);
}
public function callCollisionHandlers(marble:Marble, timeState:TimeState) {
var gjkSphere = new collision.gjk.Sphere();
gjkSphere.position = marble.getAbsPos().getPosition();
gjkSphere.radius = marble._radius;
public function callCollisionHandlers(marble:Marble, timeState:TimeState, start:Vector, end:Vector) {
var expansion = marble._radius + 0.2;
var minP = new Vector(Math.min(start.x, end.x) - expansion, Math.min(start.y, end.y) - expansion, Math.min(start.z, end.z) - expansion);
var maxP = new Vector(Math.max(start.x, end.x) + expansion, Math.max(start.y, end.y) + expansion, Math.max(start.z, end.z) + expansion);
var box = Bounds.fromPoints(minP.toPoint(), maxP.toPoint());
// var marbleHitbox = new Bounds();
// marbleHitbox.addSpherePos(0, 0, 0, marble._radius);
// marbleHitbox.transform(startQuat.toMatrix());
// marbleHitbox.transform(endQuat.toMatrix());
// marbleHitbox.offset(end.x, end.y, end.z);
var spherebounds = new Bounds();
spherebounds.addSpherePos(gjkSphere.position.x, gjkSphere.position.y, gjkSphere.position.z, gjkSphere.radius);
// spherebounds.addSpherePos(gjkCapsule.p2.x, gjkCapsule.p2.y, gjkCapsule.p2.z, gjkCapsule.radius);
// var contacts = this.collisionWorld.radiusSearch(marble.getAbsPos().getPosition(), marble._radius);
var contacts = marble.contactEntities;
var newImmunity = [];
var calledShapes = [];
var contacts = this.collisionWorld.boundingSearch(box);
// var contacts = marble.contactEntities;
var inside = [];
var contactsphere = new SphereCollisionEntity(marble);
contactsphere.velocity = new Vector();
for (contact in contacts) {
if (contact.go != marble) {
if (contact.go is DtsObject) {
var shape:DtsObject = cast contact.go;
var contacttest = shape.colliders.filter(x -> x != null).map(x -> x.sphereIntersection(contactsphere, timeState));
var contactlist:Array<collision.CollisionInfo> = [];
for (l in contacttest) {
contactlist = contactlist.concat(l);
if (contact.boundingBox.collide(box)) {
shape.onMarbleInside(timeState);
if (!this.shapeOrTriggerInside.contains(contact.go)) {
this.shapeOrTriggerInside.push(contact.go);
shape.onMarbleEnter(timeState);
}
inside.push(contact.go);
}
if (!calledShapes.contains(shape) && !this.shapeImmunity.contains(shape) && contactlist.length != 0) {
calledShapes.push(shape);
newImmunity.push(shape);
shape.onMarbleContact(timeState);
}
shape.onMarbleInside(timeState);
if (!this.shapeOrTriggerInside.contains(contact.go)) {
this.shapeOrTriggerInside.push(contact.go);
shape.onMarbleEnter(timeState);
}
inside.push(contact.go);
}
if (contact.go is Trigger) {
var trigger:Trigger = cast contact.go;
var triggeraabb = trigger.collider.boundingBox;
if (triggeraabb.collide(spherebounds)) {
if (triggeraabb.collide(box)) {
trigger.onMarbleInside(timeState);
if (!this.shapeOrTriggerInside.contains(contact.go)) {
this.shapeOrTriggerInside.push(contact.go);
@ -1155,8 +1254,57 @@ class MarbleWorld extends Scheduler {
}
if (this.finishTime == null) {
if (spherebounds.collide(this.endPad.finishBounds)) {
if (collision.gjk.GJK.gjk(gjkSphere, this.endPad.finishCollider) != null) {
if (box.collide(this.endPad.finishBounds)) {
var padUp = this.endPad.getAbsPos().up();
padUp = padUp.multiply(10);
var checkBounds = box.clone();
checkBounds.zMin -= 10;
checkBounds.zMax += 10;
var checkBoundsCenter = checkBounds.getCenter();
var checkSphereRadius = checkBounds.getMax().sub(checkBoundsCenter).length();
var checkSphere = new Bounds();
checkSphere.addSpherePos(checkBoundsCenter.x, checkBoundsCenter.y, checkBoundsCenter.z, checkSphereRadius);
var endpadBB = this.collisionWorld.boundingSearch(checkSphere, false);
var found = false;
for (collider in endpadBB) {
if (collider.go == this.endPad) {
var chull = cast(collider, collision.CollisionHull);
var chullinvT = @:privateAccess chull.invTransform.clone();
chullinvT.transpose();
for (surface in chull.surfaces) {
var i = 0;
while (i < surface.indices.length) {
var surfaceN = surface.getNormal(surface.indices[i]).transformed3x3(chullinvT);
var v1 = surface.getPoint(surface.indices[i]).transformed(chull.transform);
var surfaceD = -surfaceN.dot(v1);
if (surfaceN.dot(padUp.multiply(-10)) < 0) {
var dist = surfaceN.dot(checkBoundsCenter.toVector()) + surfaceD;
if (dist >= 0 && dist < 5) {
var intersectT = -(checkBoundsCenter.dot(surfaceN.toPoint()) + surfaceD) / (padUp.dot(surfaceN));
var intersectP = checkBoundsCenter.add(padUp.multiply(intersectT).toPoint()).toVector();
if (Collision.PointInTriangle(intersectP, v1, surface.getPoint(surface.indices[i + 1]).transformed(chull.transform),
surface.getPoint(surface.indices[i + 2]).transformed(chull.transform))) {
found = true;
break;
}
}
}
i += 3;
}
if (found) {
break;
}
}
if (found) {
break;
}
}
}
if (found) {
if (!endPad.inFinish) {
touchFinish();
endPad.inFinish = true;
@ -1165,9 +1313,11 @@ class MarbleWorld extends Scheduler {
if (endPad.inFinish)
endPad.inFinish = false;
}
} else {
if (endPad.inFinish)
endPad.inFinish = false;
}
}
this.shapeImmunity = newImmunity;
}
function touchFinish() {
@ -1186,20 +1336,28 @@ class MarbleWorld extends Scheduler {
this.finishYaw = this.marble.camera.CameraYaw;
this.finishPitch = this.marble.camera.CameraPitch;
displayAlert("Congratulations! You've finished!");
this.schedule(this.timeState.currentAttemptTime + 2, () -> cast showFinishScreen());
Analytics.trackLevelScore(mission.title, mission.path, Std.int(finishTime.gameplayClock * 1000), Settings.optionsSettings.rewindEnabled);
if (!this.isWatching)
this.schedule(this.timeState.currentAttemptTime + 2, () -> cast showFinishScreen());
// Stop the ongoing sounds
if (timeTravelSound != null) {
timeTravelSound.stop();
timeTravelSound = null;
}
}
}
function showFinishScreen() {
if (this.isWatching)
return 0;
var egg:EndGameGui = null;
#if js
var pointercontainer = js.Browser.document.querySelector("#pointercontainer");
pointercontainer.hidden = false;
#end
if (this.isRecording) {
this.schedule(this.timeState.currentAttemptTime + 3, () -> {
this.isRecording = false; // Stop recording here
this.saveReplay();
}
}, "stopRecordingTimeout");
if (Util.isTouchDevice()) {
MarbleGame.instance.touchInput.setControlsEnabled(false);
}
@ -1207,6 +1365,13 @@ class MarbleWorld extends Scheduler {
if (Util.isTouchDevice()) {
MarbleGame.instance.touchInput.hideControls(@:privateAccess this.playGui.playGuiCtrl);
}
if (this.isRecording) {
this.isRecording = false; // Stop recording here if we haven't already
this.clearScheduleId("stopRecordingTimeout");
}
if (this.wasRecording) {
this.saveReplay();
}
this.dispose();
var pmg = new PlayMissionGui();
PlayMissionGui.currentSelectionStatic = mission.index + 1;
@ -1216,7 +1381,13 @@ class MarbleWorld extends Scheduler {
#end
}, (sender) -> {
MarbleGame.canvas.popDialog(egg);
this.setCursorLock(true);
if (this.isRecording) {
this.clearScheduleId("stopRecordingTimeout");
}
if (this.wasRecording) {
this.saveReplay();
this.isRecording = true;
}
this.restart();
#if js
pointercontainer.hidden = true;
@ -1313,7 +1484,14 @@ class MarbleWorld extends Scheduler {
playGui.setCenterText('outofbounds');
AudioManager.playSound(ResourceLoader.getResource('data/sound/whoosh.wav', ResourceLoader.getAudio, this.soundResources));
// if (this.replay.mode != = 'playback')
this.schedule(this.timeState.currentAttemptTime + 2, () -> this.restart());
this.oobSchedule = this.schedule(this.timeState.currentAttemptTime + 2, () -> {
playGui.setCenterText('none');
return null;
});
this.oobSchedule2 = this.schedule(this.timeState.currentAttemptTime + 2.5, () -> {
this.restart();
return null;
});
}
public function setCursorLock(enabled:Bool) {
@ -1329,6 +1507,7 @@ class MarbleWorld extends Scheduler {
public function saveReplay() {
var replayBytes = this.replay.write();
var defaultFilename = '${this.mission.title} ${this.finishTime == null ? "Unfinished Run" : Std.string(this.finishTime.gameplayClock)}.mbr';
#if hl
hxd.File.saveAs(replayBytes, {
title: 'Save Replay',
@ -1338,7 +1517,7 @@ class MarbleWorld extends Scheduler {
extensions: ["mbr"]
}
],
defaultPath: '${this.mission.title}${this.timeState.gameplayClock}.mbr'
defaultPath: defaultFilename
});
#end
#if js
@ -1346,7 +1525,7 @@ class MarbleWorld extends Scheduler {
type: 'application/octet-stream'
});
var url = js.html.URL.createObjectURL(blob);
var fname = '${this.mission.title}${this.timeState.gameplayClock}.mbr';
var fname = defaultFilename;
var element = js.Browser.document.createElement('a');
element.setAttribute('href', url);
element.setAttribute('download', fname);
@ -1368,18 +1547,23 @@ class MarbleWorld extends Scheduler {
for (interior in this.interiors) {
interior.dispose();
}
interiors = null;
for (pathedInteriors in this.pathedInteriors) {
pathedInteriors.dispose();
}
pathedInteriors = null;
for (marble in this.marbles) {
marble.dispose();
}
marbles = null;
for (dtsObject in this.dtsObjects) {
dtsObject.dispose();
}
dtsObjects = null;
for (trigger in this.triggers) {
trigger.dispose();
}
triggers = null;
for (soundResource in this.soundResources) {
soundResource.release();
}
@ -1388,6 +1572,14 @@ class MarbleWorld extends Scheduler {
}
sky.dispose();
sky = null;
instanceManager = null;
collisionWorld.dispose();
collisionWorld = null;
particleManager = null;
shapeOrTriggerInside = null;
shapeImmunity = null;
marble = null;
this._disposed = true;
AudioManager.stopAllSounds();

View file

@ -11,6 +11,7 @@ import mis.MissionElement.MissionElementSimGroup;
import src.ResourceLoader;
import hxd.res.Image;
import src.Resource;
import src.Util;
class Mission {
public var root:MissionElementSimGroup;
@ -36,7 +37,10 @@ class Mission {
public function new() {}
public function load() {
var misParser = new MisParser(ResourceLoader.fileSystem.get(this.path).getText());
var entry = ResourceLoader.fileSystem.get(this.path);
var misText = Util.toASCII(entry.getBytes());
var misParser = new MisParser(misText);
var contents = misParser.parse();
root = contents.root;
}
@ -62,7 +66,7 @@ class Mission {
if (missionInfo.goldtime != null) {
mission.goldTime = MisParser.parseNumber(missionInfo.goldtime) / 1000;
}
mission.type = missionInfo.type.toLowerCase();
mission.type = missionInfo.type != null ? missionInfo.type.toLowerCase() : "custom";
mission.missionInfo = missionInfo;
return mission;
}
@ -71,18 +75,26 @@ class Mission {
if (!this.isClaMission) {
var basename = haxe.io.Path.withoutExtension(this.path);
if (ResourceLoader.fileSystem.exists(basename + ".png")) {
#if (!android)
imgFileEntry = ResourceLoader.fileSystem.get(basename + ".png");
imgFileEntry.load(() -> {
#end
var ret = ResourceLoader.getResource(basename + ".png", ResourceLoader.getImage, this.imageResources).toTile();
onLoaded(ret);
#if (!android)
});
#end
}
if (ResourceLoader.fileSystem.exists(basename + ".jpg")) {
#if (!android)
imgFileEntry = ResourceLoader.fileSystem.get(basename + ".jpg");
imgFileEntry.load(() -> {
#end
var ret = ResourceLoader.getResource(basename + ".jpg", ResourceLoader.getImage, this.imageResources).toTile();
onLoaded(ret);
#if (!android)
});
#end
}
var img = new BitmapData(1, 1);
img.setPixel(0, 0, 0);
@ -94,7 +106,36 @@ class Mission {
}
}
public function getPreviewImageSync() {
if (!this.isClaMission) {
var basename = haxe.io.Path.withoutExtension(this.path);
if (ResourceLoader.fileSystem.exists(basename + ".png")) {
var ret = ResourceLoader.getResource(basename + ".png", ResourceLoader.getImage, this.imageResources).toTile();
return ret;
}
if (ResourceLoader.fileSystem.exists(basename + ".jpg")) {
var ret = ResourceLoader.getResource(basename + ".jpg", ResourceLoader.getImage, this.imageResources).toTile();
return ret;
}
var img = new BitmapData(1, 1);
img.setPixel(0, 0, 0);
return Tile.fromBitmap(img);
} else {
var img = new BitmapData(1, 1);
img.setPixel(0, 0, 0);
return Tile.fromBitmap(img);
}
}
public function getDifPath(rawElementPath:String) {
if (StringTools.contains(rawElementPath, "$usermods")) {
rawElementPath = rawElementPath.split("@").slice(1).map(x -> {
var a = StringTools.trim(x);
a = Util.unescape(a.substr(1, a.length - 2));
return a;
}).join('');
}
var fname = rawElementPath.substring(rawElementPath.lastIndexOf('/') + 1);
rawElementPath = rawElementPath.toLowerCase();
var path = StringTools.replace(rawElementPath.substring(rawElementPath.indexOf('data/')), "\"", "");
if (StringTools.contains(path, 'interiors_mbg/'))
@ -102,6 +143,8 @@ class Mission {
#if (js || android)
path = StringTools.replace(path, "data/", "");
#end
if (!StringTools.endsWith(path, ".dif"))
path += ".dif";
if (ResourceLoader.fileSystem.exists(path))
return path;
return "";

View file

@ -2,6 +2,7 @@ import haxe.Json;
import mis.MisParser;
import src.ResourceLoader;
import src.Mission;
import src.Util;
@:publicFields
class MissionList {
@ -32,12 +33,16 @@ class MissionList {
var difficultyMissions = [];
for (file in difficultyFiles) {
if (file.extension == "mis") {
var misParser = new MisParser(file.getText());
var misParser = new MisParser(Util.toASCII(file.getBytes()));
var mInfo = misParser.parseMissionInfo();
var mission = Mission.fromMissionInfo(file.path, mInfo);
missions.set(file.path, mission);
difficultyMissions.push(mission);
}
if (file.isDirectory) {
var retdir = parseDifficulty(difficulty + "/" + file.name);
difficultyMissions = difficultyMissions.concat(retdir);
}
}
difficultyMissions.sort((a, b) -> Std.parseInt(a.missionInfo.level) - Std.parseInt(b.missionInfo.level));
return difficultyMissions;

View file

@ -1,5 +1,8 @@
package src;
import shaders.DtsTexture;
import h3d.parts.Particles;
import h3d.Matrix;
import src.TimeState;
import h3d.prim.UV;
import h3d.parts.Data.BlendMode;
@ -17,6 +20,7 @@ import h3d.mat.Material;
import h3d.Vector;
import h3d.scene.MeshBatch;
import h3d.scene.Mesh;
import src.ResourceLoader;
@:publicFields
class ParticleData {
@ -28,6 +32,8 @@ class ParticleData {
@:publicFields
class Particle {
public var part:h3d.parts.Particle;
var data:ParticleData;
var manager:ParticleManager;
var o:ParticleOptions;
@ -53,6 +59,8 @@ class Particle {
this.lifeTime = this.o.lifetime + this.o.lifetimeVariance * (Math.random() * 2 - 1);
this.initialSpin = Util.lerp(this.o.spinRandomMin, this.o.spinRandomMax, Math.random());
this.part = new h3d.parts.Particle();
}
public function update(time:Float, dt:Float) {
@ -67,13 +75,13 @@ class Particle {
var elapsed = time - this.spawnTime;
var completion = Util.clamp(elapsed / this.lifeTime, 0, 1);
if (currentAge > this.lifeTime) // Again, rewind needs this
if (currentAge > this.lifeTime || currentAge < 0) // Again, rewind needs this
{
this.manager.removeParticle(this.data, this);
return;
}
if (completion == 1) {
if (completion == 1 || completion < 0) {
// The particle can die
this.manager.removeParticle(this.data, this);
return;
@ -134,6 +142,15 @@ class Particle {
// Adjust sizing
this.scale = Util.lerp(this.o.sizes[indexLow], this.o.sizes[indexHigh], t);
this.part.x = this.position.x;
this.part.y = this.position.y;
this.part.z = this.position.z;
this.part.r = this.color.r;
this.part.g = this.color.g;
this.part.b = this.color.b;
this.part.ratio = 1;
this.part.size = this.scale / 2;
}
}
@ -269,12 +286,15 @@ class ParticleEmitter {
}
class ParticleManager {
var particlebatches:Array<ParticleBatch> = [];
var particlebatchMap:Map<String, Int> = [];
// var particlebatches:Array<ParticleBatch> = [];
// var particlebatchMap:Map<String, Int> = [];
var level:MarbleWorld;
var scene:Scene;
var currentTime:Float;
var particleGroups:Map<String, Particles> = [];
var particles:Array<Particle> = [];
var emitters:Array<ParticleEmitter> = [];
public function new(level:MarbleWorld) {
@ -284,76 +304,36 @@ class ParticleManager {
public function update(currentTime:Float, dt:Float) {
this.currentTime = currentTime;
for (batch in particlebatches) {
for (instance in batch.instances)
instance.update(currentTime, dt);
for (particle in this.particles) {
particle.update(currentTime, dt);
}
this.tick(dt);
for (batch in particlebatches) {
batch.meshBatch.begin(batch.instances.length);
for (instance in batch.instances) {
if (instance.currentAge != 0) {
batch.meshBatch.setPosition(instance.position.x, instance.position.y, instance.position.z);
var particleShader = batch.meshBatch.material.mainPass.getShader(Billboard);
particleShader.scale = instance.scale;
particleShader.rotation = instance.rotation;
particleShader.color = instance.color;
batch.meshBatch.material.blendMode = instance.o.blending;
batch.meshBatch.material.mainPass.depthWrite = false;
// batch.meshBatch.material.mainPass.setPassName("overlay");
// batch.meshBatch.material.color.load(instance.color);
batch.meshBatch.shadersChanged = true;
batch.meshBatch.setScale(instance.scale);
batch.meshBatch.emitInstance();
}
}
}
}
public function addParticle(particleData:ParticleData, particle:Particle) {
if (particlebatchMap.exists(particleData.identifier)) {
particlebatches[particlebatchMap.get(particleData.identifier)].instances.push(particle);
if (particleGroups.exists(particleData.identifier)) {
particleGroups[particleData.identifier].add(particle.part);
} else {
var pts = [
new Point(-0.5, -0.5, 0),
new Point(-0.5, 0.5, 0),
new Point(0.5, -0.5, 0),
new Point(0.5, 0.5)
];
var prim = new Polygon(pts);
prim.idx = new IndexBuffer();
prim.idx.push(0);
prim.idx.push(1);
prim.idx.push(2);
prim.idx.push(1);
prim.idx.push(3);
prim.idx.push(2);
prim.uvs = [new UV(0, 0), new UV(0, 1), new UV(1, 0), new UV(1, 1)];
prim.addNormals();
var mat = Material.create(particleData.texture);
// matshader.texture = mat.texture;
mat.mainPass.enableLights = false;
// mat.mainPass.setPassName("overlay");
// mat.mainPass.addShader(new h3d.shader.pbr.PropsValues(1, 0, 0, 1));
mat.shadows = false;
mat.texture.wrap = Wrap.Repeat;
var billboardShader = new Billboard();
mat.mainPass.addShader(billboardShader);
var mb = new MeshBatch(prim, mat, this.scene);
var batch:ParticleBatch = {
instances: [particle],
meshBatch: mb
};
var curidx = particlebatches.length;
particlebatches.push(batch);
particlebatchMap.set(particleData.identifier, curidx);
var pGroup = new Particles(particle.data.texture, this.scene);
pGroup.hasColor = true;
pGroup.material.setDefaultProps("ui");
// var pdts = new DtsTexture(pGroup.material.texture);
// pdts.currentOpacity = 1;
pGroup.material.blendMode = particle.o.blending;
pGroup.material.mainPass.depthWrite = false;
// pGroup.material.mainPass.removeShader(pGroup.material.textureShader);
// pGroup.material.mainPass.addShader(pdts);
pGroup.add(particle.part);
particleGroups.set(particleData.identifier, pGroup);
}
this.particles.push(particle);
}
public function removeParticle(particleData:ParticleData, particle:Particle) {
if (particlebatchMap.exists(particleData.identifier)) {
particlebatches[particlebatchMap.get(particleData.identifier)].instances.remove(particle);
if (particleGroups.exists(particleData.identifier)) {
@:privateAccess particleGroups[particleData.identifier].kill(particle.part);
}
this.particles.remove(particle);
}
public function getTime() {
@ -377,9 +357,10 @@ class ParticleManager {
}
public function removeEverything() {
for (particle in this.particlebatches) {
particle.instances = [];
for (ident => particles in this.particleGroups) {
particles.remove();
}
this.particleGroups = [];
for (emitter in this.emitters)
this.removeEmitter(emitter);
}

View file

@ -24,9 +24,6 @@ import src.Resource;
typedef PIState = {
var currentTime:Float;
var targetTime:Float;
var changeTime:Float;
var prevPosition:Vector;
var currentPosition:Vector;
var velocity:Vector;
}
@ -42,21 +39,14 @@ class PathedInterior extends InteriorObject {
public var duration:Float;
public var currentTime:Float;
public var targetTime:Float;
public var changeTime:Float;
var basePosition:Vector;
var baseOrientation:Quat;
var baseScale:Vector;
public var prevPosition:Vector;
public var currentPosition:Vector;
public var velocity:Vector;
var stopped:Bool = false;
var stopTime:Float;
var previousState:PIState;
var soundChannel:Channel;
@ -105,7 +95,9 @@ class PathedInterior extends InteriorObject {
if (this.baseScale.z == 0)
this.baseScale.z = 0.0001;
this.setRotationQuat(this.baseOrientation);
this.setRotationQuat(this.baseOrientation.clone());
this.collider.setTransform(this.getTransform());
this.collider.fastTransform = true;
this.path = cast this.simGroup.elements.filter((element) -> element._type == MissionElementType.Path)[0];
@ -143,77 +135,63 @@ class PathedInterior extends InteriorObject {
onFinish();
}
public function update(timeState:TimeState) {
// this.previousState = {
// currentTime: currentTime,
// targetTime: targetTime,
// changeTime: changeTime,
// prevPosition: prevPosition,
// currentPosition: currentPosition,
// velocity: velocity
// };
public function computeNextPathStep(timeDelta:Float) {
stopped = false;
if (currentTime == targetTime) {
velocity.set(0, 0, 0);
} else {
var delta = 0.0;
if (targetTime < 0) {
if (targetTime == -1)
delta = timeDelta;
else if (targetTime == -2)
delta = -timeDelta;
currentTime += delta;
while (currentTime >= duration)
currentTime -= duration;
while (currentTime < 0)
currentTime += duration;
} else {
delta = targetTime - currentTime;
if (delta < -timeDelta)
delta = -timeDelta;
else if (delta > timeDelta)
delta = timeDelta;
currentTime += delta;
}
var thisTime = timeState.currentAttemptTime;
var curTform = this.getAbsPos();
var tForm = getTransformAtTime(currentTime);
if (stopped) {
thisTime = stopTime;
popTickState();
var displaceDelta = tForm.getPosition().sub(curTform.getPosition());
velocity.set(displaceDelta.x / timeDelta, displaceDelta.y / timeDelta, displaceDelta.z / timeDelta);
this.collider.velocity = velocity.clone();
}
var transform = this.getTransformAtTime(this.getInternalTime(thisTime));
var position = transform.getPosition();
this.prevPosition = this.currentPosition;
this.currentPosition = position;
if (!stopped) {
this.stopTime = timeState.currentAttemptTime;
pushTickState();
}
// if (!stopped)
// this.currentTime = timeState.currentAttemptTime;
velocity = position.sub(this.prevPosition).multiply(1 / timeState.dt);
this.updatePosition();
}
public function advance(timeDelta:Float) {
if (stopped)
return;
if (this.velocity.length() == 0)
return;
var newp = this.getAbsPos().getPosition().add(velocity.multiply(timeDelta));
this.setPosition(newp.x, newp.y, newp.z);
this.setTransform(this.getTransform());
if (this.soundChannel != null) {
var spat = this.soundChannel.getEffect(Spatialization);
spat.position = newp;
}
}
public function update(timeState:TimeState) {}
public function setStopped(stopped:Bool = true) {
// if (!this.stopped)
// this.stopTime = currentTime;
this.stopped = stopped;
}
public function recomputeVelocity(currentTime:Float, dt:Float) {
var thisTime = currentTime;
var transform = this.getTransformAtTime(this.getInternalTime(thisTime));
var position = transform.getPosition();
velocity = position.sub(this.currentPosition).multiply(1 / dt);
this.collider.velocity = velocity;
}
public function pushTickState() {
this.previousState = {
currentTime: currentTime,
targetTime: targetTime,
changeTime: changeTime,
prevPosition: prevPosition,
currentPosition: currentPosition,
velocity: velocity
};
}
public function popTickState() {
this.currentTime = this.previousState.currentTime;
this.targetTime = this.previousState.targetTime;
this.changeTime = this.previousState.changeTime;
this.prevPosition = this.previousState.prevPosition;
this.currentPosition = this.previousState.currentPosition;
this.velocity = this.previousState.velocity;
this.collider.velocity = this.velocity;
// this.updatePosition();
}
function computeDuration() {
var total = 0.0;
for (i in 0...(markerData.length - 1)) {
@ -224,34 +202,18 @@ class PathedInterior extends InteriorObject {
}
public function setTargetTime(now:TimeState, target:Float) {
var currentInternalTime = this.getInternalTime(now.currentAttemptTime);
this.currentTime = currentInternalTime; // Start where the interior currently is
this.targetTime = target;
this.changeTime = now.currentAttemptTime;
}
public function getInternalTime(externalTime:Float) {
if (this.targetTime < 0) {
var direction = (this.targetTime == -1) ? 1 : (this.targetTime == -2) ? -1 : 0;
return Util.adjustedMod(this.currentTime + (externalTime - this.changeTime) * direction, this.duration);
} else {
var dur = Math.abs(this.currentTime - this.targetTime);
var compvarion = Util.clamp(dur != 0 ? (externalTime - this.changeTime) / dur : 1, 0, 1);
return Util.clamp(Util.lerp(this.currentTime, this.targetTime, compvarion), 0, this.duration);
}
}
function updatePosition() {
var tform = this.collider.transform;
tform.setPosition(this.currentPosition);
this.setTransform(tform);
this.collider.setTransform(tform);
var newp = this.getAbsPos().getPosition();
this.setPosition(newp.x, newp.y, newp.z);
this.collider.setTransform(this.getTransform());
this.collider.velocity = this.velocity;
if (this.soundChannel != null) {
var spat = this.soundChannel.getEffect(Spatialization);
spat.position = this.currentPosition;
spat.position = newp;
}
}
@ -260,9 +222,10 @@ class PathedInterior extends InteriorObject {
var m2:PathedInteriorMarker = this.markerData[1];
if (m1 == null) {
// Incase there are no markers at all
var mat = new Matrix();
this.baseOrientation.toMatrix(mat);
mat.scale(this.baseScale.x, this.baseScale.y, this.baseScale.z);
var tmp = new Matrix();
var mat = Matrix.S(this.baseScale.x, this.baseScale.y, this.baseScale.z);
this.baseOrientation.toMatrix(tmp);
mat.multiply3x4(mat, tmp);
mat.setPosition(this.basePosition);
return mat;
}
@ -313,10 +276,10 @@ class PathedInterior extends InteriorObject {
position = position.sub(firstPosition);
position = position.add(basePosition); // Add the base position
var mat = new Matrix();
this.baseOrientation.toMatrix(mat);
mat.scale(this.baseScale.x, this.baseScale.y, this.baseScale.z);
var tmp = new Matrix();
var mat = Matrix.S(this.baseScale.x, this.baseScale.y, this.baseScale.z);
this.baseOrientation.toMatrix(tmp);
mat.multiply3x4(mat, tmp);
mat.setPosition(position);
return mat;
@ -325,7 +288,6 @@ class PathedInterior extends InteriorObject {
override function reset() {
this.currentTime = 0;
this.targetTime = 0;
this.changeTime = 0;
if (this.element.initialposition != "") {
this.currentTime = MisParser.parseNumber(this.element.initialposition) / 1000;
@ -340,14 +302,11 @@ class PathedInterior extends InteriorObject {
this.currentTime = this.duration;
}
this.stopTime = 0;
this.stopped = false;
// Reset the position
var transform = this.getTransformAtTime(this.getInternalTime(0));
var position = transform.getPosition();
this.prevPosition = position.clone();
this.currentPosition = position;
this.velocity = new Vector();
var initialTform = this.getTransformAtTime(this.currentTime);
this.setTransform(initialTform);
updatePosition();
}
}

View file

@ -147,6 +147,7 @@ class ReplayInitialState {
var trapdoorLastDirections:Array<Int> = [];
var trapdoorLastCompletions:Array<Float> = [];
var landMineDisappearTimes:Array<Float> = [];
var pushButtonContactTimes:Array<Float> = [];
public function new() {}
@ -165,6 +166,10 @@ class ReplayInitialState {
for (time in this.landMineDisappearTimes) {
bw.writeFloat(time);
}
bw.writeInt16(this.pushButtonContactTimes.length);
for (time in this.pushButtonContactTimes) {
bw.writeFloat(time);
}
}
public function read(br:BytesReader) {
@ -182,6 +187,10 @@ class ReplayInitialState {
for (i in 0...landMineCount) {
this.landMineDisappearTimes.push(br.readFloat());
}
var pushButtonCount = br.readInt16();
for (i in 0...pushButtonCount) {
this.pushButtonContactTimes.push(br.readFloat());
}
}
}
@ -197,7 +206,7 @@ class Replay {
var currentPlaybackFrameIdx:Int;
var currentPlaybackTime:Float;
var version:Int = 1;
var version:Int = 6;
public function new(mission:String) {
this.mission = mission;
@ -214,12 +223,16 @@ class Replay {
}
public function recordTimeState(time:Float, clockTime:Float, bonusTime:Float) {
if (currentRecordFrame == null)
return;
currentRecordFrame.time = time;
currentRecordFrame.clockTime = clockTime;
currentRecordFrame.bonusTime = bonusTime;
}
public function recordMarbleState(position:Vector, velocity:Vector, orientation:Quat, angularVelocity:Vector) {
if (currentRecordFrame == null)
return;
currentRecordFrame.marblePosition = position.clone();
currentRecordFrame.marbleVelocity = velocity.clone();
currentRecordFrame.marbleOrientation = orientation.clone();
@ -227,6 +240,8 @@ class Replay {
}
public function recordMarbleStateFlags(jumped:Bool, usedPowerup:Bool, instantTeleport:Bool) {
if (currentRecordFrame == null)
return;
if (jumped)
currentRecordFrame.marbleStateFlags.set(Jumped);
if (usedPowerup)
@ -236,11 +251,15 @@ class Replay {
}
public function recordMarbleInput(x:Float, y:Float) {
if (currentRecordFrame == null)
return;
currentRecordFrame.marbleX = x;
currentRecordFrame.marbleY = y;
}
public function recordCameraState(pitch:Float, yaw:Float) {
if (currentRecordFrame == null)
return;
currentRecordFrame.cameraPitch = pitch;
currentRecordFrame.cameraYaw = yaw;
}
@ -255,6 +274,10 @@ class Replay {
initialState.landMineDisappearTimes.push(disappearTime);
}
public function recordPushButtonState(lastContactTime:Float) {
initialState.pushButtonContactTimes.push(lastContactTime);
}
public function getTrapdoorState(idx:Int) {
return {
lastContactTime: initialState.trapdoorLastContactTimes[idx],
@ -267,6 +290,10 @@ class Replay {
return initialState.landMineDisappearTimes[idx];
}
public function getPushButtonState(idx:Int) {
return initialState.pushButtonContactTimes[idx];
}
public function clear() {
this.frames = [];
currentRecordFrame = null;
@ -303,6 +330,16 @@ class Replay {
this.currentPlaybackFrameIdx = 0;
}
public function spliceReplay(cutAfterTime:Float) {
if (this.frames.length > 0) {
var curframe = this.frames[this.frames.length - 1];
while (curframe.time > cutAfterTime && this.frames.length > 0) {
this.frames.pop();
curframe = this.frames[this.frames.length - 1];
}
}
}
public function write() {
var bw = new BytesWriter();

View file

@ -20,8 +20,12 @@ import src.ResourceLoaderWorker;
class ResourceLoader {
#if (hl && !android)
#if MACOS_BUNDLE
public static var fileSystem:FileSystem = new LocalFileSystem(Path.normalize(Path.join([Path.directory(Sys.programPath()), "..", "Resources"])), null);
#else
public static var fileSystem:FileSystem = new LocalFileSystem(".", null);
#end
#end
#if (js || android)
public static var fileSystem:FileSystem = null;
#end
@ -40,6 +44,9 @@ class ResourceLoader {
// static var threadPool:FixedThreadPool = new FixedThreadPool(4);
public static function init(scene2d:h2d.Scene, onLoadedFunc:Void->Void) {
#if hl
@:privateAccess @:privateAccess cast(fileSystem, LocalFileSystem).convert.tmpDir = "data/tmp/";
#end
hxd.res.Resource.LIVE_UPDATE = false; // Disable live update to save frames
@:privateAccess hxd.res.Image.ENABLE_AUTO_WATCH = false;
@:privateAccess hxd.res.Sound.ENABLE_AUTO_WATCH = false;
@ -53,6 +60,7 @@ class ResourceLoader {
fileSystem = mfileSystem;
onLoadedFunc();
}, scene2d);
#if js
loader = mloader;
fileSystem = mfileSystem;
var loadg = new h2d.Text(hxd.res.DefaultFont.get());
@ -94,7 +102,10 @@ class ResourceLoader {
fwd();
});
worker.run();
// preloader.start();
#end
#if android
preloader.start();
#end
#end
#if (hl && !android)
onLoadedFunc();
@ -204,7 +215,7 @@ class ResourceLoader {
}
public static function load(path:String) {
#if hl
#if (hl && !android)
if (!StringTools.startsWith(path, "data/"))
path = "data/" + path;
#end
@ -346,4 +357,21 @@ class ResourceLoader {
}
return names;
}
public static function getProperFilepath(rawElementPath:String) {
var fname = rawElementPath.substring(rawElementPath.lastIndexOf('/') + 1);
rawElementPath = rawElementPath.toLowerCase();
var path = StringTools.replace(rawElementPath.substring(rawElementPath.indexOf('data/')), "\"", "");
if (StringTools.contains(path, 'interiors_mbg/'))
path = StringTools.replace(path, 'interiors_mbg/', 'interiors/');
var dirpath = path.substring(0, path.lastIndexOf('/') + 1);
#if (js || android)
path = StringTools.replace(path, "data/", "");
#end
if (fileSystem.exists(path))
return path;
if (fileSystem.exists(dirpath + fname))
return dirpath + fname;
return "";
}
}

View file

@ -20,7 +20,11 @@ class ResourceLoaderWorker {
}
public function addTaskParallel(task:(() -> Void)->Void) {
#if (!android)
paralleltasks.push(task);
#else
tasks.push(task);
#end
}
public function run() {
@ -54,6 +58,10 @@ class ResourceLoaderWorker {
}
public function loadFile(path:String) {
#if (!android)
paralleltasks.push(fwd -> ResourceLoader.load(path).entry.load(fwd));
#else
tasks.push(fwd -> ResourceLoader.load(path).entry.load(fwd));
#end
}
}

View file

@ -10,6 +10,8 @@ import hxd.Window;
import haxe.DynamicAccess;
#if hl
import sys.io.File;
import sys.FileSystem;
import haxe.io.Path;
#end
import src.ResourceLoader;
import haxe.Json;
@ -30,7 +32,9 @@ typedef OptionsSettings = {
var musicVolume:Float;
var soundVolume:Float;
var vsync:Bool;
var fov:Int;
var fovX:Int;
var rewindEnabled:Bool;
var rewindTimescale:Float;
}
typedef ControlsSettings = {
@ -48,6 +52,7 @@ typedef ControlsSettings = {
var alwaysFreeLook:Bool;
var cameraSensitivity:Float;
var invertYAxis:Bool;
var rewind:Int;
}
typedef TouchSettings = {
@ -57,9 +62,25 @@ typedef TouchSettings = {
var jumpButtonSize:Float;
var powerupButtonPos:Array<Float>;
var powerupButtonSize:Float;
var rewindButtonPos:Array<Float>;
var rewindButtonSize:Float;
var buttonJoystickMultiplier:Float;
}
typedef GamepadSettings = {
var moveXAxis:String;
var moveYAxis:String;
var cameraXAxis:String;
var cameraYAxis:String;
var jump:Array<String>;
var powerup:Array<String>;
var cameraSensitivity:Float;
var invertXAxis:Bool;
var invertYAxis:Bool;
var axisDeadzone:Float;
var rewind:Array<String>;
}
class Settings {
public static var highScores:Map<String, Array<Score>> = [];
@ -72,7 +93,9 @@ class Settings {
shadows: false,
musicVolume: 1,
soundVolume: 0.7,
fov: 60,
fovX: 90,
rewindEnabled: false,
rewindTimescale: 1,
vsync: #if js true #end
#if hl
false
@ -93,7 +116,8 @@ class Settings {
freelook: Key.MOUSE_RIGHT,
alwaysFreeLook: true,
cameraSensitivity: 0.6,
invertYAxis: false
invertYAxis: false,
rewind: Key.R,
};
public static var touchSettings:TouchSettings = {
@ -103,8 +127,25 @@ class Settings {
jumpButtonSize: 60,
powerupButtonPos: [440, 180],
powerupButtonSize: 60,
rewindButtonPos: [380, 240],
rewindButtonSize: 60,
buttonJoystickMultiplier: 2.5
}
public static var gamepadSettings:GamepadSettings = {
moveXAxis: "analogX",
moveYAxis: "analogY",
cameraXAxis: "ranalogX",
cameraYAxis: "ranalogY",
jump: ["A", "LT"],
powerup: ["B", "RT"],
cameraSensitivity: 1.0,
invertXAxis: false,
invertYAxis: false,
axisDeadzone: 0.15,
rewind: ["Y"],
}
public static var progression = [24, 24, 52];
public static var highscoreName = "";
@ -114,6 +155,13 @@ class Settings {
public static var isTouch:Option<Bool> = Option.None;
#if hl
#if MACOS_BUNDLE
public static var settingsDir = Path.join([Sys.getEnv("HOME"), "Library", "Application Support", "MBHaxe-MBG"]);
#else
public static var settingsDir = ".";
#end
#end
public static function applySettings() {
#if hl
Window.getInstance().resize(optionsSettings.screenWidth, optionsSettings.screenHeight);
@ -149,6 +197,7 @@ class Settings {
options: optionsSettings,
controls: controlsSettings,
touch: touchSettings,
gamepad: gamepadSettings,
progression: progression,
highscoreName: highscoreName
};
@ -171,7 +220,10 @@ class Settings {
#end
var json = Json.stringify(outputData);
#if (hl && !android)
File.saveContent("settings.json", json);
if (!FileSystem.exists(settingsDir)) {
FileSystem.createDirectory(settingsDir);
}
File.saveContent(Path.join([settingsDir, "settings.json"]), json);
#end
#if js
var localStorage = js.Browser.getLocalStorage();
@ -184,7 +236,7 @@ class Settings {
public static function load() {
var settingsExists = false;
#if hl
settingsExists = ResourceLoader.fileSystem.exists("settings.json");
settingsExists = FileSystem.exists(Path.join([settingsDir, "settings.json"]));
#end
#if js
var localStorage = js.Browser.getLocalStorage();
@ -195,7 +247,7 @@ class Settings {
if (settingsExists) {
#if hl
var json = Json.parse(ResourceLoader.fileSystem.get("settings.json").getText());
var json = Json.parse(File.getContent(Path.join([settingsDir, "settings.json"])));
#end
#if js
var json = Json.parse(localStorage.getItem("MBHaxeSettings"));
@ -205,12 +257,40 @@ class Settings {
highScores.set(key, value);
}
optionsSettings = json.options;
if (optionsSettings.fov == 0 #if js || optionsSettings.fov == null #end)
optionsSettings.fov = 60;
if (optionsSettings.fovX == 0 #if js || optionsSettings.fovX == null #end)
optionsSettings.fovX = 90;
if (optionsSettings.rewindEnabled == false #if js || optionsSettings.rewindEnabled == null #end)
optionsSettings.rewindEnabled = false;
if (optionsSettings.rewindTimescale == 0 #if js || optionsSettings.rewindTimescale == null #end)
optionsSettings.rewindTimescale = 1;
controlsSettings = json.controls;
if (json.touch != null) {
touchSettings = json.touch;
}
if (controlsSettings.rewind == 0) {
controlsSettings.rewind = Key.R;
}
if (touchSettings.rewindButtonPos == null) {
touchSettings.rewindButtonPos = [380, 240];
touchSettings.rewindButtonSize = 60;
}
if (json.gamepad != null) {
gamepadSettings = json.gamepad;
}
if (gamepadSettings.rewind == null) {
gamepadSettings.rewind = ["Y"];
}
#if js
if (controlsSettings.rewind == null) {
controlsSettings.rewind = Key.R;
}
if (optionsSettings.rewindEnabled == null) {
optionsSettings.rewindEnabled = false;
}
if (optionsSettings.rewindTimescale == null) {
optionsSettings.rewindTimescale = 1;
}
#end
progression = json.progression;
highscoreName = json.highscoreName;
} else {
@ -226,6 +306,7 @@ class Settings {
#if hl
Window.getInstance().resize(optionsSettings.screenWidth, optionsSettings.screenHeight);
Window.getInstance().displayMode = optionsSettings.isFullScreen ? FullscreenResize : Windowed;
uiScale = 1 / Window.getInstance().windowToPixelRatio;
#end
#if js
Window.getInstance().propagateKeyEvents = true;
@ -233,7 +314,7 @@ class Settings {
// @:privateAccess Window.getInstance().window.center();
Window.getInstance().addResizeEvent(() -> {
var wnd = Window.getInstance();
var zoomRatio = 1.0;
var zoomRatio = Window.getInstance().windowToPixelRatio;
#if js
var zoomRatio = Util.isTouchDevice() ? js.Browser.window.screen.height * js.Browser.window.devicePixelRatio / 600 : js.Browser.window.devicePixelRatio; // 768 / js.Browser.window.innerHeight; // js.Browser.window.innerHeight * js.Browser.window.devicePixelRatio / 768;
Settings.zoomRatio = zoomRatio;
@ -243,8 +324,8 @@ class Settings {
Settings.zoomRatio = zoomRatio;
#end
#if hl
Settings.optionsSettings.screenWidth = cast wnd.width / zoomRatio;
Settings.optionsSettings.screenHeight = cast wnd.height / zoomRatio;
Settings.optionsSettings.screenWidth = cast wnd.width;
Settings.optionsSettings.screenHeight = cast wnd.height;
#end
#if js
Settings.optionsSettings.screenWidth = cast js.Browser.window.screen.width; // 1024; // cast(js.Browser.window.innerWidth / js.Browser.window.innerHeight) * 768; // cast js.Browser.window.innerWidth * js.Browser.window.devicePixelRatio * 0.5;
@ -257,6 +338,11 @@ class Settings {
MarbleGame.canvas.scene2d.scaleMode = Zoom(zoomRatio);
if (MarbleGame.instance.world != null) {
MarbleGame.instance.world.scene.camera.setFovX(Settings.optionsSettings.fovX,
Settings.optionsSettings.screenWidth / Settings.optionsSettings.screenHeight);
}
MarbleGame.canvas.render(MarbleGame.canvas.scene2d);
});
}

View file

@ -1,5 +1,7 @@
package src;
import mis.MisParser;
import mis.MissionElement.MissionElementSky;
import hxd.Pixels;
import shaders.Skybox;
import h3d.shader.pbr.PropsValues;
@ -20,14 +22,16 @@ import src.ResourceLoaderWorker;
class Sky extends Object {
public var dmlPath:String;
public var cubemap:Texture;
var imageResources:Array<Resource<Image>> = [];
public function new() {
super();
}
public function init(level:MarbleWorld, onFinish:Void->Void) {
createSkyboxCubeTextured(this.dmlPath, texture -> {
public function init(level:MarbleWorld, onFinish:Void->Void, element:MissionElementSky) {
createSkyboxCubeTextured(this.dmlPath, element, texture -> {
var sky = new h3d.prim.Sphere(1, 128, 128);
sky.addNormals();
sky.addUVs();
@ -49,8 +53,11 @@ class Sky extends Object {
// env.compute();
// var renderer = cast(level.scene.renderer, h3d.scene.pbr.Renderer);
var shad = new Skybox(texture);
skyMesh.material.mainPass.removeShader(skyMesh.material.textureShader);
skyMesh.material.mainPass.addShader(shad);
skyMesh.material.mainPass.depthWrite = false;
skyMesh.material.mainPass.depth(false, h3d.mat.Data.Compare.LessEqual);
cubemap = texture;
onFinish();
});
// skyMesh.material.shadows = false;
@ -62,7 +69,7 @@ class Sky extends Object {
}
}
function createSkyboxCubeTextured(dmlPath:String, onFinish:Texture->Void) {
function createSkyboxCubeTextured(dmlPath:String, element:MissionElementSky, onFinish:Texture->Void) {
#if (js || android)
dmlPath = StringTools.replace(dmlPath, "data/", "");
#end
@ -85,12 +92,26 @@ class Sky extends Object {
}
}
var fogColor = MisParser.parseVector4(element.fogcolor);
var skySolidColor = MisParser.parseVector4(element.skysolidcolor);
var skyColor = fogColor;
if (skySolidColor.x != 0.6 || skySolidColor.y != 0.6 || skySolidColor.z != 0.6)
skyColor = skySolidColor;
if (skyColor.x > 1)
skyColor.x = 1 - (skyColor.x - 1) % 256 / 256;
if (skyColor.y > 1)
skyColor.y = 1 - (skyColor.y - 1) % 256 / 256;
if (skyColor.z > 1)
skyColor.z = 1 - (skyColor.z - 1) % 256 / 256;
var noSkyTexture = element.useskytextures == "0";
var worker = new ResourceLoaderWorker(() -> {
for (i in 0...6) {
var line = StringTools.trim(lines[i]);
var filenames = ResourceLoader.getFullNamesOf(dmlDirectory + '/' + line);
if (filenames.length == 0) {
var pixels = Texture.fromColor(0).capturePixels(0, 0);
if (filenames.length == 0 || noSkyTexture) {
var pixels = Texture.fromColor(skyColor.toColor()).capturePixels(0, 0);
skyboxImages.push(pixels);
// var tex = new h3d.mat.Texture();
// skyboxImages.push(new BitmapData(128, 128));

View file

@ -1,5 +1,7 @@
package src;
import haxe.io.BytesBuffer;
import haxe.io.Bytes;
import h3d.Matrix;
import hxd.Key;
import h2d.Tile;
@ -9,6 +11,11 @@ import h3d.Vector;
import src.Settings;
class Util {
public static function mat3x3equal(a:Matrix, b:Matrix) {
return a._11 == b._11 && a._12 == b._12 && a._13 == b._13 && a._21 == b._21 && a._22 == b._22 && a._23 == b._23 && a._31 == b._31 && a._32 == b._32
&& a._33 == b._33;
}
public static function adjustedMod(a:Float, n:Float) {
var r1 = a % n;
var r2 = (r1 + n) % n;
@ -211,12 +218,12 @@ class Util {
}
/** Gets the index of a substring like String.prototype.indexOf, but only if that index lies outside of string literals. */
public static function indexOfIgnoreStringLiterals(str:String, searchString:String, position = 0, strLiteralToken = '"') {
public static function indexOfIgnoreStringLiterals(str:String, searchString:String, position = 0, strLiteralToken:Int = '"'.code) {
var inString = false;
for (i in position...str.length) {
var c = str.charAt(i);
var c = StringTools.fastCodeAt(str, i);
if (inString) {
if (c == strLiteralToken && str.charAt(i - 1) != '\\')
if (c == strLiteralToken && StringTools.fastCodeAt(str, i - 1) != '\\'.code)
inString = false;
continue;
}
@ -263,9 +270,9 @@ class Util {
public static function formatTime(time:Float) {
var et = time * 1000;
var thousandth = Math.floor(et % 10);
var hundredth = Math.floor((et % 1000) / 10);
var totalSeconds = Math.floor(et / 1000);
var thousandth = Std.int(et % 10);
var hundredth = Std.int((et % 1000) / 10);
var totalSeconds = Std.int(et / 1000);
var seconds = totalSeconds % 60;
var minutes = (totalSeconds - seconds) / 60;
@ -372,4 +379,27 @@ class Util {
return Settings.optionsSettings.isFullScreen;
#end
}
public static function toASCII(bytes:haxe.io.Bytes) {
var totBytes = new BytesBuffer();
for (i in 0...bytes.length) {
var utfbytes = Bytes.ofString(String.fromCharCode(bytes.get(i)));
totBytes.add(utfbytes);
}
return totBytes.getBytes().toString();
}
public static function getPlatform() {
#if js
return js.Browser.navigator.platform;
#end
#if hl
#if MACOS_BUNDLE
return "MacOS";
#else
return "Windows";
#end
#end
}
}

365
src/collision/BVHTree.hx Normal file
View file

@ -0,0 +1,365 @@
package collision;
import h3d.Vector;
import h3d.col.Bounds;
interface IBVHObject {
var boundingBox:Bounds;
function rayCast(rayOrigin:Vector, rayDirection:Vector):Array<octree.IOctreeObject.RayIntersectionData>;
}
@:publicFields
class BVHNode<T:IBVHObject> {
var id:Int;
var parent:BVHNode<T>;
var child1:BVHNode<T>;
var child2:BVHNode<T>;
var isLeaf:Bool;
var bounds:Bounds;
var object:T;
public function new() {}
}
class BVHTree<T:IBVHObject> {
var nodeId:Int = 0;
var root:BVHNode<T>;
public function new() {}
function update() {
var invalidNodes = [];
this.traverse(node -> {
if (node.isLeaf) {
var entity = node.object;
var tightAABB = entity.boundingBox;
if (node.bounds.containsBounds(tightAABB)) {
return;
}
invalidNodes.push(node);
}
});
for (node in invalidNodes) {
this.remove(node);
this.add(node.object);
}
}
public function add(entity:T) {
// Enlarged AABB
var aabb = entity.boundingBox;
var newNode = new BVHNode();
newNode.id = this.nodeId++;
newNode.bounds = aabb;
newNode.object = entity;
newNode.isLeaf = true;
if (this.root == null) {
this.root = newNode;
return newNode;
}
// Find the best sibling for the new leaf
var bestSibling = this.root;
var bestCostBox = this.root.bounds.clone();
bestCostBox.add(aabb);
var bestCost = bestCostBox.xSize * bestCostBox.ySize + bestCostBox.xSize * bestCostBox.zSize + bestCostBox.ySize * bestCostBox.zSize;
var q = [{p1: this.root, p2: 0.0}];
while (q.length != 0) {
var front = q.shift();
var current = front.p1;
var inheritedCost = front.p2;
var combined = current.bounds.clone();
combined.add(aabb);
var directCost = combined.xSize * combined.ySize + combined.xSize * combined.zSize + combined.ySize * combined.zSize;
var costForCurrent = directCost + inheritedCost;
if (costForCurrent < bestCost) {
bestCost = costForCurrent;
bestSibling = current;
}
inheritedCost += directCost
- (current.bounds.xSize * current.bounds.ySize + current.bounds.xSize * current.bounds.zSize + current.bounds.ySize * current.bounds.zSize);
var aabbCost = aabb.xSize * aabb.ySize + aabb.xSize * aabb.zSize + aabb.ySize * aabb.zSize;
var lowerBoundCost = aabbCost + inheritedCost;
if (lowerBoundCost < bestCost) {
if (!current.isLeaf) {
if (current.child1 != null)
q.push({p1: current.child1, p2: inheritedCost});
if (current.child2 != null)
q.push({p1: current.child2, p2: inheritedCost});
}
}
}
// Create a new parent
var oldParent = bestSibling.parent;
var newParent = new BVHNode();
newParent.id = this.nodeId++;
newParent.parent = oldParent;
newParent.bounds = bestSibling.bounds.clone();
newParent.bounds.add(aabb);
newParent.isLeaf = false;
if (oldParent != null) {
if (oldParent.child1 == bestSibling) {
oldParent.child1 = newParent;
} else {
oldParent.child2 = newParent;
}
newParent.child1 = bestSibling;
newParent.child2 = newNode;
bestSibling.parent = newParent;
newNode.parent = newParent;
} else {
newParent.child1 = bestSibling;
newParent.child2 = newNode;
bestSibling.parent = newParent;
newNode.parent = newParent;
this.root = newParent;
}
// Walk back up the tree refitting ancestors' AABB and applying rotations
var ancestor = newNode.parent;
while (ancestor != null) {
var child1 = ancestor.child1;
var child2 = ancestor.child2;
ancestor.bounds = new Bounds();
if (child1 != null)
ancestor.bounds.add(child1.bounds);
if (child2 != null)
ancestor.bounds.add(child2.bounds);
this.rotate(ancestor);
ancestor = ancestor.parent;
}
return newNode;
}
function reset() {
this.nodeId = 0;
this.root = null;
}
// BFS tree traversal
function traverse(callback:(node:BVHNode<T>) -> Void) {
var q = [this.root];
while (q.length != 0) {
var current = q.shift();
if (current == null) {
break;
}
callback(current);
if (!current.isLeaf) {
if (current.child1 != null)
q.push(current.child1);
if (current.child2 != null)
q.push(current.child2);
}
}
}
public function remove(node:BVHNode<T>) {
var parent = node.parent;
if (parent != null) {
var sibling = parent.child1 == node ? parent.child2 : parent.child1;
if (parent.parent != null) {
sibling.parent = parent.parent;
if (parent.parent.child1 == parent) {
parent.parent.child1 = sibling;
} else {
parent.parent.child2 = sibling;
}
} else {
this.root = sibling;
sibling.parent = null;
}
var ancestor = sibling.parent;
while (ancestor != null) {
var child1 = ancestor.child1;
var child2 = ancestor.child2;
ancestor.bounds = child1.bounds.clone();
ancestor.bounds.add(child2.bounds);
ancestor = ancestor.parent;
}
} else {
if (this.root == node) {
this.root = null;
}
}
}
function rotate(node:BVHNode<T>) {
if (node.parent == null) {
return;
}
var parent = node.parent;
var sibling = parent.child1 == node ? parent.child2 : parent.child1;
var costDiffs = [];
var nodeArea = node.bounds.xSize * node.bounds.ySize + node.bounds.zSize * node.bounds.ySize + node.bounds.xSize * node.bounds.zSize;
var ch1 = sibling.bounds.clone();
ch1.add(node.child1.bounds);
costDiffs.push(ch1.xSize * ch1.ySize + ch1.zSize * ch1.ySize + ch1.xSize * ch1.zSize - nodeArea);
var ch2 = sibling.bounds.clone();
ch2.add(node.child2.bounds);
costDiffs.push(ch2.xSize * ch2.ySize + ch2.zSize * ch2.ySize + ch2.xSize * ch2.zSize - nodeArea);
if (!sibling.isLeaf) {
var siblingArea = sibling.bounds.xSize * sibling.bounds.ySize + sibling.bounds.zSize * sibling.bounds.ySize
+ sibling.bounds.xSize * sibling.bounds.zSize;
if (sibling.child1 != null) {
var ch3 = node.bounds.clone();
ch3.add(sibling.child1.bounds);
costDiffs.push(ch3.xSize * ch3.ySize + ch3.zSize * ch3.ySize + ch3.xSize * ch3.zSize - siblingArea);
}
if (sibling.child2 != null) {
var ch4 = node.bounds.clone();
ch4.add(sibling.child2.bounds);
costDiffs.push(ch4.xSize * ch4.ySize + ch4.zSize * ch4.ySize + ch4.xSize * ch4.zSize - siblingArea);
}
}
var bestDiffIndex = 0;
for (i in 1...costDiffs.length) {
if (costDiffs[i] < costDiffs[bestDiffIndex]) {
bestDiffIndex = i;
}
}
if (costDiffs[bestDiffIndex] < 0.0) {
switch (bestDiffIndex) {
case 0:
if (parent.child1 == sibling) {
parent.child1 = node.child2;
} else {
parent.child2 = node.child2;
}
if (node.child2 != null) {
node.child2.parent = parent;
}
node.child2 = sibling;
sibling.parent = node;
node.bounds = sibling.bounds.clone();
if (node.child1 != null) {
node.bounds.add(node.child1.bounds);
}
case 1:
if (parent.child1 == sibling) {
parent.child1 = node.child1;
} else {
parent.child2 = node.child1;
}
if (node.child1 != null) {
node.child1.parent = parent;
}
node.child1 = sibling;
sibling.parent = node;
node.bounds = sibling.bounds.clone();
if (node.child2 != null) {
node.bounds.add(node.child2.bounds);
}
case 2:
if (parent.child1 == node) {
parent.child1 = sibling.child2;
} else {
parent.child2 = sibling.child2;
}
if (sibling.child2 != null) {
sibling.child2.parent = parent;
}
sibling.child2 = node;
node.parent = sibling;
sibling.bounds = node.bounds.clone();
if (sibling.child2 != null) {
sibling.bounds.add(sibling.child2.bounds);
}
case 3:
if (parent.child1 == node) {
parent.child1 = sibling.child1;
} else {
parent.child2 = sibling.child1;
}
if (sibling.child1 != null) {
sibling.child1.parent = parent;
}
sibling.child1 = node;
node.parent = sibling;
sibling.bounds = node.bounds.clone();
if (sibling.child1 != null) {
sibling.bounds.add(sibling.child1.bounds);
}
}
}
}
public function boundingSearch(searchbox:Bounds) {
var res = [];
if (this.root == null)
return res;
var q = [this.root];
while (q.length != 0) {
var current = q.shift();
if (current.bounds.containsBounds(searchbox) || current.bounds.collide(searchbox)) {
if (current.isLeaf) {
res.push(current.object);
} else {
if (current.child1 != null)
q.push(current.child1);
if (current.child2 != null)
q.push(current.child2);
}
}
}
return res;
}
public function rayCast(origin:Vector, direction:Vector) {
var res = [];
if (this.root == null)
return res;
var ray = h3d.col.Ray.fromValues(origin.x, origin.y, origin.z, direction.x, direction.y, direction.z);
var q = [this.root];
while (q.length != 0) {
var current = q.shift();
if (ray.collide(current.bounds)) {
if (current.isLeaf) {
res = res.concat(current.object.rayCast(origin, direction));
} else {
if (current.child1 != null)
q.push(current.child1);
if (current.child2 != null)
q.push(current.child2);
}
}
}
return res;
}
}

View file

@ -1,5 +1,7 @@
package collision;
import collision.BVHTree.IBVHObject;
import src.MarbleGame;
import src.TimeState;
import h3d.Matrix;
import src.GameObject;
@ -9,7 +11,7 @@ import h3d.Vector;
import h3d.col.Sphere;
import h3d.col.Bounds;
class BoxCollisionEntity extends CollisionEntity {
class BoxCollisionEntity extends CollisionEntity implements IBVHObject {
var bounds:Bounds;
public function new(bounds:Bounds, go:GameObject) {
@ -21,6 +23,24 @@ class BoxCollisionEntity extends CollisionEntity {
public override function generateBoundingBox() {
this.boundingBox = bounds.clone();
this.boundingBox.transform(this.transform);
// if (_dbgEntity == null) {
// _dbgEntity = cast this.boundingBox.makeDebugObj();
// _dbgEntity.getMaterials()[0].mainPass.wireframe = true;
// MarbleGame.instance.scene.addChild(_dbgEntity);
// } else {
// _dbgEntity = cast this.boundingBox.makeDebugObj();
// _dbgEntity.getMaterials()[0].mainPass.wireframe = true;
// MarbleGame.instance.scene.addChild(_dbgEntity);
// }
}
public override function setTransform(transform:Matrix) {
super.setTransform(transform);
// if (_dbgEntity != null) {
// _dbgEntity = cast this.boundingBox.makeDebugObj();
// _dbgEntity.getMaterials()[0].mainPass.wireframe = true;
// MarbleGame.instance.scene.addChild(_dbgEntity);
// }
}
public override function rayCast(rayOrigin:Vector, rayDirection:Vector) {

View file

@ -24,6 +24,7 @@ typedef ITSResult = {
var result:Bool;
var normal:Vector;
var point:Vector;
var resIdx:Int;
}
class Collision {
@ -61,13 +62,14 @@ class Collision {
// 010b: v1v2 is edge
// 100b: v0v2 is edge
public static function IntersectTriangleSphere(v0:Vector, v1:Vector, v2:Vector, normal:Vector, center:Vector, radius:Float, edgeData:Int,
edgeDots:Array<Float>) {
edgeConcavities:Array<Bool>) {
var radiusSq = radius * radius;
var res:ITSResult = {
result: false,
point: null,
normal: null
normal: null,
resIdx: 0
};
var pnorm = normal.clone();
@ -88,7 +90,7 @@ class Collision {
if (PointInTriangle(pt, v0, v1, v2)) {
res.result = true;
res.point = pt;
res.normal = center.sub(pt).normalized();
res.normal = pnorm;
return res;
}
// return res;
@ -120,75 +122,147 @@ class Collision {
if (res.point.distanceSq(center) <= radiusSq) {
res.result = true;
if (chosenEdge & edgeData > 0) {
res.normal = center.sub(res.point).normalized();
} else { // We hit an internal edge
chosenEdge -= 1;
if (chosenEdge > 2)
chosenEdge--;
// if (edgeNormals[chosenEdge].length() < 0.5) {
// res.normal = center.sub(res.point).normalized();
// } else
var edgeDotAng = Math.acos(edgeDots[chosenEdge]);
if (edgeDotAng < Math.PI / 12) {
if (edgeDotAng == 0) {
res.normal = center.sub(res.point).normalized();
} else {
res.normal = normal; // edgeNormals[chosenEdge];
res.normal = center.sub(res.point).normalized();
if (res.normal.dot(normal) > 0.8) {
// Internal edge
if (chosenEdge & edgeData > 0) {
chosenEdge -= 1;
if (chosenEdge > 2)
chosenEdge--;
// if (edgeNormals[chosenEdge].length() < 0.5) {
// res.normal = center.sub(res.point).normalized();
// } else
if (edgeConcavities[chosenEdge]) { // Our edge is concave
res.normal = pnorm;
}
} else {
res.result = false;
res.normal = center.sub(res.point).normalized();
}
// trace("Internal Edge Collision");
}
return res;
}
return res;
}
// var r1 = IntersectLineSphere(v0, v1, center, radius);
// if (r1 != null) {
// res.result = true;
// res.point = r1;
// res.normal = center.sub(r1).normalized();
// return res;
// }
// var r2 = IntersectLineSphere(v1, v2, center, radius);
// if (r2 != null) {
// res.result = true;
// res.point = r2;
// res.normal = center.sub(r2).normalized();
// return res;
// }
// var r3 = IntersectLineSphere(v2, v0, center, radius);
// if (r3 != null) {
// res.result = true;
// res.point = r3;
// res.normal = center.sub(r3).normalized();
// return res;
// }
// Check points
// if (center.sub(v0).lengthSq() < radiusSq) {
// res.result = true;
// res.point = v0;
// res.normal = center.sub(v0).normalized();
// // center.sub(v0).normalized();
// return res;
// }
// if (center.sub(v1).lengthSq() < radiusSq) {
// res.result = true;
// res.point = v1;
// res.normal = center.sub(v1).normalized();
// return res;
// }
// if (center.sub(v2).lengthSq() < radiusSq) {
// res.result = true;
// res.point = v2;
// res.normal = center.sub(v2).normalized();
// return res;
// }
// Check plane
// var p = PlaneF.ThreePoints(toDifPoint(v0), toDifPoint(v1), toDifPoint(v2));
public static function TriangleSphereIntersection(A:Vector, B:Vector, C:Vector, N:Vector, P:Vector, r:Float) {
var res:ITSResult = {
result: false,
point: null,
normal: null,
resIdx: -1
};
var v0 = A;
var v1 = B;
var v2 = C;
A = A.sub(P);
B = B.sub(P);
C = C.sub(P);
var ca = C.sub(A);
var ba = B.sub(A);
var radiusSq = r * r;
var cp = ba.cross(ca);
var aDotCp = A.dot(cp);
var cpLenSq = cp.lengthSq();
if (aDotCp * aDotCp > radiusSq * cpLenSq) {
return res;
}
var aSq = A.dot(A);
var aDotB = A.dot(B);
var aDotC = A.dot(C);
var bSq = B.dot(B);
var bDotC = B.dot(C);
var cSq = C.dot(C);
if (aSq > radiusSq && aDotB > aSq && aDotC > aSq) {
return res;
}
if (bSq > radiusSq && aDotB > bSq && bDotC > bSq) {
return res;
}
if (cSq > radiusSq && aDotC > cSq && bDotC > cSq) {
return res;
}
var cSubB = C.sub(B);
var aSubC = A.sub(C);
var baSq = ba.lengthSq();
var cSubBSq = cSubB.lengthSq();
var aSubCSq = aSubC.lengthSq();
var aTest = A.multiply(baSq).sub(ba.multiply(aDotB - aSq));
var bTest = B.multiply(cSubBSq).sub(cSubB.multiply(bDotC - bSq));
var cTest = C.multiply(aSubCSq).sub(aSubC.multiply(aDotC - cSq));
var rhs = C.multiply(baSq).sub(aTest);
var rhs2 = A.multiply(cSubBSq).sub(bTest);
var rhs3 = B.multiply(aSubCSq).sub(cTest);
if (aTest.dot(aTest) > radiusSq * baSq * baSq && aTest.dot(rhs) > 0) {
return res;
}
if (bTest.dot(bTest) > radiusSq * cSubBSq * cSubBSq && bTest.dot(rhs2) > 0) {
return res;
}
if (cTest.dot(cTest) > radiusSq * aSubCSq * aSubCSq && cTest.dot(rhs3) > 0) {
return res;
}
var lhs = P.sub(v0);
var baca = ba.dot(ca);
var caSq = ca.lengthSq();
var lhsBa = lhs.dot(ba);
var lhsCa = lhs.dot(ca);
var len = baSq * caSq - baca * baca;
var d1 = (caSq * lhsBa - baca * lhsCa) / len;
var d2 = (baSq * lhsCa - baca * lhsBa) / len;
if (1 - d1 - d2 >= 0 && d1 >= 0 && d2 >= 0) {
res.result = true;
res.normal = N.clone();
res.point = P.sub(N.multiply(P.sub(v0).dot(N)));
res.resIdx = 0;
} else {
var closestPt = P.sub(N.multiply(P.sub(v0).dot(N)));
var r1 = ClosestPointLine(v0, v1, closestPt);
var r2 = ClosestPointLine(v1, v2, closestPt);
var r3 = ClosestPointLine(v2, v0, closestPt);
var chosenEdge = 0; // Bitfield
var chosenPt:Vector;
if (r1.distanceSq(P) < r2.distanceSq(P)) {
chosenPt = r1;
chosenEdge = 1;
} else {
chosenPt = r2;
chosenEdge = 2;
}
if (chosenPt.distanceSq(P) < r3.distanceSq(P))
res.point = chosenPt;
else {
chosenEdge = 4;
res.point = r3;
}
res.normal = P.sub(res.point).normalized();
res.result = true;
res.resIdx = chosenEdge;
// if (res.normal.dot(N) > 0.8) {
// // Internal edge
// if (chosenEdge & edgeData > 0) {
// chosenEdge -= 1;
// if (chosenEdge > 2)
// chosenEdge--;
// // if (edgeNormals[chosenEdge].length() < 0.5) {
// // res.normal = center.sub(res.point).normalized();
// // } else
// if (edgeConcavities[chosenEdge]) { // Our edge is concave
// res.normal = N.clone();
// }
// }
// }
}
return res;
}
@ -282,7 +356,7 @@ class Collision {
return res;
}
public static function PointInTriangle(point:Vector, v0:Vector, v1:Vector, v2:Vector):Bool {
public static inline function PointInTriangle(point:Vector, v0:Vector, v1:Vector, v2:Vector):Bool {
var u = v1.sub(v0);
var v = v2.sub(v0);
var w = point.sub(v0);
@ -324,7 +398,7 @@ class Collision {
}
public static function IntersectTriangleCapsule(start:Vector, end:Vector, radius:Float, p1:Vector, p2:Vector, p3:Vector, normal:Vector, edgeData:Int,
edgeDots:Array<Float>) {
edgeConcavities:Array<Bool>) {
var dir = end.sub(start);
var d = -(p1.dot(normal));
var t = -(start.dot(normal) - d) / dir.dot(normal);
@ -333,7 +407,7 @@ class Collision {
if (t < 0)
t = 0;
var tracePoint = start.add(dir.multiply(t));
return IntersectTriangleSphere(p1, p2, p3, normal, tracePoint, radius, edgeData, edgeDots);
return IntersectTriangleSphere(p1, p2, p3, normal, tracePoint, radius, edgeData, edgeConcavities);
}
private static function GetLowestRoot(a:Float, b:Float, c:Float, max:Float):Null<Float> {

View file

@ -1,5 +1,6 @@
package collision;
import collision.BVHTree.IBVHObject;
import src.TimeState;
import src.GameObject;
import dif.math.Point3F;
@ -12,13 +13,15 @@ import octree.IOctreeObject;
import h3d.Matrix;
import h3d.col.Bounds;
import src.PathedInterior;
import src.Util;
import src.MarbleGame;
class CollisionEntity implements IOctreeObject {
class CollisionEntity implements IOctreeObject implements IBVHObject {
public var boundingBox:Bounds;
public var octree:Octree;
public var grid:Grid;
public var bvh:BVHTree<CollisionSurface>;
public var surfaces:Array<CollisionSurface>;
@ -33,8 +36,11 @@ class CollisionEntity implements IOctreeObject {
public var go:GameObject;
public var userData:Int;
public var fastTransform:Bool = false;
public var difEdgeMap:Map<Int, dif.Edge>;
var _transformKey:Int = 0;
var _dbgEntity:h3d.scene.Mesh;
public function new(go:GameObject) {
this.go = go;
@ -51,21 +57,50 @@ class CollisionEntity implements IOctreeObject {
}
}
// Generates the grid
// Generates the bvh
public function finalize() {
this.generateBoundingBox();
this.grid = new Grid(this.boundingBox);
this.bvh = new BVHTree();
for (surface in this.surfaces) {
this.grid.insert(surface);
this.bvh.add(surface);
}
// this.bvh.build();
}
public function dispose() {
for (s in this.surfaces)
s.dispose();
go = null;
surfaces = null;
bvh = null;
octree = null;
}
public function setTransform(transform:Matrix) {
if (this.transform == transform)
if (this.transform.equal(transform))
return;
this.transform = transform;
this.invTransform = transform.getInverse();
generateBoundingBox();
// Speedup
if (this.fastTransform && Util.mat3x3equal(this.transform, transform)) {
var oldPos = this.transform.getPosition();
var newPos = transform.getPosition();
this.transform.setPosition(newPos);
this.invTransform.setPosition(newPos.multiply(-1));
if (this.boundingBox == null)
generateBoundingBox();
else {
this.boundingBox.xMin += newPos.x - oldPos.x;
this.boundingBox.xMax += newPos.x - oldPos.x;
this.boundingBox.yMin += newPos.y - oldPos.y;
this.boundingBox.yMax += newPos.y - oldPos.y;
this.boundingBox.zMin += newPos.z - oldPos.z;
this.boundingBox.zMax += newPos.z - oldPos.z;
}
} else {
this.transform.load(transform);
this.invTransform = transform.getInverse();
generateBoundingBox();
}
_transformKey++;
}
public function generateBoundingBox() {
@ -76,28 +111,42 @@ class CollisionEntity implements IOctreeObject {
boundingBox.add(tform);
}
this.boundingBox = boundingBox;
// if (Debug.drawBounds) {
// if (_dbgEntity == null) {
// _dbgEntity = cast this.boundingBox.makeDebugObj();
// _dbgEntity.getMaterials()[0].mainPass.wireframe = true;
// MarbleGame.instance.scene.addChild(_dbgEntity);
// } else {
// _dbgEntity.remove();
// _dbgEntity = cast this.boundingBox.makeDebugObj();
// _dbgEntity.getMaterials()[0].mainPass.wireframe = true;
// MarbleGame.instance.scene.addChild(_dbgEntity);
// }
// }
}
public function rayCast(rayOrigin:Vector, rayDirection:Vector):Array<RayIntersectionData> {
var invMatrix = invTransform;
var invTPos = invMatrix.clone();
invTPos.transpose();
var rStart = rayOrigin.clone();
rStart.transform(invMatrix);
var rDir = rayDirection.transformed3x3(invMatrix);
if (grid == null) {
if (bvh == null) {
var intersections = octree.raycast(rStart, rDir);
var iData:Array<RayIntersectionData> = [];
for (i in intersections) {
i.point.transform(transform);
i.normal.transform3x3(transform);
i.normal.transform3x3(invTPos);
i.normal.normalize();
iData.push({point: i.point, normal: i.normal, object: i.object});
}
return iData;
} else {
var intersections = this.grid.rayCast(rStart, rDir);
var intersections = this.bvh.rayCast(rStart, rDir);
for (i in intersections) {
i.point.transform(transform);
i.normal.transform3x3(transform);
i.normal.transform3x3(invTPos);
i.normal.normalize();
}
@ -115,7 +164,6 @@ class CollisionEntity implements IOctreeObject {
public function sphereIntersection(collisionEntity:SphereCollisionEntity, timeState:TimeState) {
var position = collisionEntity.transform.getPosition();
var velocity = collisionEntity.velocity;
var radius = collisionEntity.radius;
var invMatrix = invTransform;
@ -124,10 +172,14 @@ class CollisionEntity implements IOctreeObject {
var sphereBounds = new Bounds();
var localPos = position.clone();
localPos.transform(invMatrix);
sphereBounds.addSpherePos(position.x, position.y, position.z, radius * 1.1);
sphereBounds.transform(invMatrix);
sphereBounds.addSpherePos(localPos.x, localPos.y, localPos.z, radius * 1.1);
var surfaces = grid == null ? octree.boundingSearch(sphereBounds).map(x -> cast x) : grid.boundingSearch(sphereBounds);
// sphereBounds.addSpherePos(position.x, position.y, position.z, radius * 1.1);
// sphereBounds.transform(invMatrix);
var invScale = invMatrix.getScale();
var sphereRadius = new Vector(radius * invScale.x, radius * invScale.y, radius * invScale.z);
sphereBounds.addSpherePos(localPos.x, localPos.y, localPos.z, Math.max(Math.max(sphereRadius.x, sphereRadius.y), sphereRadius.z) * 1.1);
var surfaces = bvh == null ? octree.boundingSearch(sphereBounds).map(x -> cast x) : bvh.boundingSearch(sphereBounds);
var invtform = invMatrix.clone();
invtform.transpose();
var tform = transform.clone();
// tform.setPosition(tform.getPosition().add(this.velocity.multiply(timeState.dt)));
@ -154,32 +206,17 @@ class CollisionEntity implements IOctreeObject {
var i = 0;
while (i < surface.indices.length) {
var v0 = surface.points[surface.indices[i]].transformed(tform);
var v = surface.points[surface.indices[i + 1]].transformed(tform);
var v2 = surface.points[surface.indices[i + 2]].transformed(tform);
var verts = surface.transformTriangle(i, tform, invtform, this._transformKey);
// var v0 = surface.points[surface.indices[i]].transformed(tform);
// var v = surface.points[surface.indices[i + 1]].transformed(tform);
// var v2 = surface.points[surface.indices[i + 2]].transformed(tform);
var v0 = verts.v1;
var v = verts.v2;
var v2 = verts.v3;
// var e1e2 = hashEdge(surface.originalIndices[i], surface.originalIndices[i + 1]);
// var e2e3 = hashEdge(surface.originalIndices[i + 1], surface.originalIndices[i + 2]);
// var e1e3 = hashEdge(surface.originalIndices[i], surface.originalIndices[i + 3]);
var surfacenormal = verts.n; // surface.normals[surface.indices[i]].transformed3x3(transform).normalized();
// var edgeData = 0;
// if (this.difEdgeMap.exists(e1e2)) {
// edgeData |= 1;
// }
// if (this.difEdgeMap.exists(e2e3)) {
// edgeData |= 2;
// }
// if (this.difEdgeMap.exists(e1e3)) {
// edgeData |= 4;
// }
var edgeData = surface.edgeData[Math.floor(i / 3)];
var edgeDots = surface.edgeDots.slice(Math.floor(i / 3), Math.floor(i / 3) + 3);
var surfacenormal = surface.normals[surface.indices[i]].transformed3x3(transform).normalized();
var res = Collision.IntersectTriangleSphere(v0, v, v2, surfacenormal, position, radius, edgeData, edgeDots);
var res = Collision.TriangleSphereIntersection(v0, v, v2, surfacenormal, position, radius);
var closest = res.point;
// var closest = Collision.ClosestPtPointTriangle(position, radius, v0, v, v2, surfacenormal);
if (closest != null) {

View file

@ -38,7 +38,7 @@ class CollisionHull extends CollisionEntity {
newTform.setPosition(newpos);
hull.setTransform(newTform);
var pt = GJK.gjk(sph, this.hull);
var pt = GJK.gjk(sph, this.hull).epa;
if (pt != null) {
var cinfo = new CollisionInfo();
cinfo.normal = pt.normalized();
@ -60,7 +60,9 @@ class CollisionHull extends CollisionEntity {
super.addSurface(surface);
if (hull == null)
hull = new ConvexHull([]);
hull.vertices = hull.vertices.concat(surface.points);
for (i in 0...(Std.int(surface.points.length / 3))) {
hull.vertices.push(new Vector(surface.points[i * 3], surface.points[i * 3 + 1], surface.points[i * 3 + 2]));
}
if (surface.points.length != 0) {
this.force = surface.force;
this.friction = surface.friction;

View file

@ -4,29 +4,24 @@ import h3d.Matrix;
import h3d.col.Bounds;
import octree.IOctreeObject;
import h3d.Vector;
import collision.BVHTree.IBVHObject;
class CollisionSurface implements IOctreeObject {
class CollisionSurface implements IOctreeObject implements IBVHObject {
public var priority:Int;
public var position:Int;
public var boundingBox:Bounds;
public var points:Array<Vector>;
public var normals:Array<Vector>;
public var points:Array<Float>;
public var normals:Array<Float>;
public var indices:Array<Int>;
public var friction:Float = 1;
public var restitution:Float = 1;
public var force:Float = 0;
public var edgeData:Array<Int>;
public var edgeDots:Array<Float>;
public var originalIndices:Array<Int>;
public var originalSurfaceIndex:Int;
public var transformKeys:Array<Int>;
public var key:Bool = false;
var _transformedPoints:Array<Float>;
var _transformedNormals:Array<Float>;
public function new() {}
@ -36,15 +31,21 @@ class CollisionSurface implements IOctreeObject {
public function generateNormals() {
var i = 0;
normals = [for (n in points) null];
normals = [for (n in points) 0.0];
while (i < indices.length) {
var p1 = points[indices[i]].clone();
var p2 = points[indices[i + 1]].clone();
var p3 = points[indices[i + 2]].clone();
var p1 = getPoint(indices[i]);
var p2 = getPoint(indices[i + 1]);
var p3 = getPoint(indices[i + 2]);
var n = p2.sub(p1).cross(p3.sub(p1)).normalized().multiply(-1);
normals[indices[i]] = n;
normals[indices[i + 1]] = n;
normals[indices[i + 2]] = n;
normals[indices[i] * 3] = n.x;
normals[indices[i] * 3 + 1] = n.y;
normals[indices[i] * 3 + 2] = n.z;
normals[indices[i + 1] * 3] = n.x;
normals[indices[i + 1] * 3 + 1] = n.y;
normals[indices[i + 1] * 3 + 2] = n.z;
normals[indices[i + 2] * 3] = n.x;
normals[indices[i + 2] * 3 + 1] = n.y;
normals[indices[i + 2] * 3 + 2] = n.z;
i += 3;
}
}
@ -58,7 +59,8 @@ class CollisionSurface implements IOctreeObject {
boundingBox.yMax = -10e8;
boundingBox.zMax = -10e8;
for (point in points) {
for (i in 0...Std.int(points.length / 3)) {
var point = getPoint(i);
if (point.x > boundingBox.xMax) {
boundingBox.xMax = point.x;
}
@ -85,14 +87,34 @@ class CollisionSurface implements IOctreeObject {
this.priority = priority;
}
inline public function getPoint(idx:Int) {
return new Vector(points[idx * 3], points[idx * 3 + 1], points[idx * 3 + 2]);
}
inline public function getNormal(idx:Int) {
return new Vector(normals[idx * 3], normals[idx * 3 + 1], normals[idx * 3 + 2]);
}
inline public function addPoint(x:Float, y:Float, z:Float) {
points.push(x);
points.push(y);
points.push(z);
}
inline public function addNormal(x:Float, y:Float, z:Float) {
normals.push(x);
normals.push(y);
normals.push(z);
}
public function rayCast(rayOrigin:Vector, rayDirection:Vector):Array<RayIntersectionData> {
var intersections = [];
var i = 0;
while (i < indices.length) {
var p1 = points[indices[i]].clone();
var p2 = points[indices[i + 1]].clone();
var p3 = points[indices[i + 2]].clone();
var n = normals[indices[i]].clone();
var p1 = getPoint(indices[i]);
var p2 = getPoint(indices[i + 1]);
var p3 = getPoint(indices[i + 2]);
var n = getNormal(indices[i]);
var d = -p1.dot(n);
var t = -(rayOrigin.dot(n) + d) / (rayDirection.dot(n));
@ -110,7 +132,8 @@ class CollisionSurface implements IOctreeObject {
var furthestDistance:Float = Math.NEGATIVE_INFINITY;
var furthestVertex:Vector = new Vector();
for (v in points) {
for (i in 0...Std.int(points.length / 3)) {
var v = getPoint(i);
var v2 = v.transformed(transform);
var distance:Float = v2.dot(direction);
if (distance > furthestDistance) {
@ -123,4 +146,56 @@ class CollisionSurface implements IOctreeObject {
return furthestVertex;
}
public function transformTriangle(idx:Int, tform:Matrix, invtform:Matrix, key:Int) {
if (_transformedPoints == null) {
_transformedPoints = points.copy();
}
if (_transformedNormals == null) {
_transformedNormals = normals.copy();
}
var p1 = indices[idx];
var p2 = indices[idx + 1];
var p3 = indices[idx + 2];
if (transformKeys[p1] != key) {
var pt = getPoint(p1).transformed(tform);
_transformedPoints[p1 * 3] = pt.x;
_transformedPoints[p1 * 3 + 1] = pt.y;
_transformedPoints[p1 * 3 + 2] = pt.z;
var pn = getNormal(p1).transformed3x3(invtform).normalized();
_transformedNormals[p1 * 3] = pn.x;
_transformedNormals[p1 * 3 + 1] = pn.y;
_transformedNormals[p1 * 3 + 2] = pn.z;
transformKeys[p1] = key;
}
if (transformKeys[p2] != key) {
var pt = getPoint(p2).transformed(tform);
_transformedPoints[p2 * 3] = pt.x;
_transformedPoints[p2 * 3 + 1] = pt.y;
_transformedPoints[p2 * 3 + 2] = pt.z;
transformKeys[p2] = key;
}
if (transformKeys[p3] != key) {
var pt = getPoint(p3).transformed(tform);
_transformedPoints[p3 * 3] = pt.x;
_transformedPoints[p3 * 3 + 1] = pt.y;
_transformedPoints[p3 * 3 + 2] = pt.z;
transformKeys[p3] = key;
}
return {
v1: new Vector(_transformedPoints[p1 * 3], _transformedPoints[p1 * 3 + 1], _transformedPoints[p1 * 3 + 2]),
v2: new Vector(_transformedPoints[p2 * 3], _transformedPoints[p2 * 3 + 1], _transformedPoints[p2 * 3 + 2]),
v3: new Vector(_transformedPoints[p3 * 3], _transformedPoints[p3 * 3 + 1], _transformedPoints[p3 * 3 + 2]),
n: new Vector(_transformedNormals[p1 * 3], _transformedNormals[p1 * 3 + 1], _transformedNormals[p1 * 3 + 2])
};
}
public function dispose() {
points = null;
normals = null;
indices = null;
_transformedPoints = null;
_transformedNormals = null;
originalIndices = null;
}
}

View file

@ -1,5 +1,6 @@
package collision;
import src.MarbleGame;
import src.TimeState;
import h3d.col.Bounds;
import h3d.col.Sphere;
@ -10,15 +11,19 @@ class CollisionWorld {
public var octree:Octree;
public var entities:Array<CollisionEntity> = [];
public var dynamicEntities:Array<CollisionEntity> = [];
public var dynamicOctree:Octree;
var dynamicEntitySet:Map<CollisionEntity, Bool> = [];
public function new() {
this.octree = new Octree();
this.dynamicOctree = new Octree();
}
public function sphereIntersection(spherecollision:SphereCollisionEntity, timeState:TimeState) {
var position = spherecollision.transform.getPosition();
var radius = spherecollision.radius;
var velocity = spherecollision.velocity;
// var velocity = spherecollision.velocity;
// var intersections = this.octree.radiusSearch(position, searchdist);
var box = new Bounds();
@ -26,7 +31,7 @@ class CollisionWorld {
var rotQuat = spherecollision.marble.getRotationQuat();
box.transform(rotQuat.toMatrix());
box.offset(position.x, position.y, position.z);
box.addSpherePos(position.x + velocity.x * timeState.dt, position.y + velocity.y * timeState.dt, position.z + velocity.z * timeState.dt, radius);
// box.addSpherePos(position.x + velocity.x * timeState.dt, position.y + velocity.y * timeState.dt, position.z + velocity.z * timeState.dt, radius);
var intersections = this.octree.boundingSearch(box);
// var intersections = this.rtree.search([box.xMin, box.yMax, box.zMin], [box.xSize, box.ySize, box.zSize]);
@ -43,10 +48,11 @@ class CollisionWorld {
}
}
for (obj in dynamicEntities) {
var dynSearch = dynamicOctree.boundingSearch(box).map(x -> cast(x, CollisionEntity));
for (obj in dynSearch) {
if (obj != spherecollision) {
// if (obj.boundingBox.collide(box) && obj.go.isCollideable)
contacts = contacts.concat(obj.sphereIntersection(spherecollision, timeState));
if (obj.boundingBox.collide(box) && obj.go.isCollideable)
contacts = contacts.concat(obj.sphereIntersection(spherecollision, timeState));
}
}
return {foundEntities: foundEntities, contacts: contacts};
@ -71,20 +77,14 @@ class CollisionWorld {
contacts.push(entity);
}
for (obj in dynamicEntities) {
if (obj.boundingBox.collide(box))
contacts.push(obj);
}
contacts = contacts.concat(dynamicOctree.boundingSearch(box, false).map(x -> cast(x, CollisionEntity)));
return contacts;
}
public function boundingSearch(bounds:Bounds) {
var contacts = this.octree.boundingSearch(bounds).map(x -> cast(x, CollisionEntity));
for (obj in dynamicEntities) {
// if (obj.boundingBox.collide(bounds))
contacts.push(obj);
}
public function boundingSearch(bounds:Bounds, useCache:Bool = true) {
var contacts = this.octree.boundingSearch(bounds, useCache).map(x -> cast(x, CollisionEntity));
contacts = contacts.concat(dynamicOctree.boundingSearch(bounds, useCache).map(x -> cast(x, CollisionEntity)));
return contacts;
}
@ -98,7 +98,7 @@ class CollisionWorld {
+ rayDirection.x * rayLength, rayStart.y
+ rayDirection.y * rayLength, rayStart.z
+ rayDirection.z * rayLength);
var objs = this.octree.boundingSearch(bounds).map(x -> cast(x, CollisionEntity));
var objs = this.octree.boundingSearch(bounds).concat(dynamicOctree.boundingSearch(bounds)).map(x -> cast(x, CollisionEntity));
var results = [];
for (obj in objs) {
results = results.concat(obj.rayCast(rayStart, rayDirection));
@ -116,10 +116,29 @@ class CollisionWorld {
public function addMovingEntity(entity:CollisionEntity) {
this.dynamicEntities.push(entity);
this.dynamicOctree.insert(entity);
this.dynamicEntitySet.set(entity, true);
}
public function updateTransform(entity:CollisionEntity) {
this.octree.remove(entity);
this.octree.insert(entity);
if (!dynamicEntitySet.exists(entity)) {
this.octree.update(entity);
} else {
this.dynamicOctree.update(entity);
}
}
public function dispose() {
for (e in entities) {
e.dispose();
}
for (e in dynamicEntities) {
e.dispose();
}
octree = null;
entities = null;
dynamicEntities = null;
dynamicOctree = null;
dynamicEntitySet = null;
}
}

View file

@ -16,7 +16,7 @@ class Grid {
var surfaces:Array<CollisionSurface> = [];
public function new(bounds:Bounds) {
this.bounds = bounds;
this.bounds = bounds.clone();
this.cellSize = new Vector(bounds.xSize / CELL_DIV.x, bounds.ySize / CELL_DIV.y, bounds.zSize / CELL_DIV.z);
}
@ -73,13 +73,12 @@ class Grid {
var hash = hashVector(i, j, k);
if (this.map.exists(hash)) {
var surfs = this.map.get(hash);
var actualsurfs = surfs.map(x -> this.surfaces[x]);
for (surf in actualsurfs) {
if (surf.key)
for (surf in surfs) {
if (surfaces[surf].key)
continue;
if (searchbox.containsBounds(surf.boundingBox) || searchbox.collide(surf.boundingBox)) {
foundSurfaces.push(surf);
surf.key = true;
if (searchbox.containsBounds(surfaces[surf].boundingBox) || searchbox.collide(surfaces[surf].boundingBox)) {
foundSurfaces.push(surfaces[surf]);
surfaces[surf].key = true;
}
}
}

View file

@ -1,16 +1,20 @@
package collision;
import h3d.Matrix;
import src.TimeState;
import src.Marble;
import h3d.col.Ray;
import h3d.Vector;
import h3d.col.Sphere;
import h3d.col.Bounds;
import src.MarbleGame;
class SphereCollisionEntity extends CollisionEntity {
public var radius:Float;
public var marble:Marble;
var _dbgEntity2:h3d.scene.Mesh;
public function new(marble:Marble) {
super(cast marble);
this.marble = marble;
@ -23,7 +27,40 @@ class SphereCollisionEntity extends CollisionEntity {
var boundingBox = new Bounds();
var pos = transform.getPosition();
boundingBox.addSpherePos(pos.x, pos.y, pos.z, radius);
boundingBox.transform3x3(transform);
this.boundingBox = boundingBox;
// if (_dbgEntity == null) {
// var cube = new h3d.prim.Cube(this.boundingBox.xSize, this.boundingBox.ySize, this.boundingBox.zSize, true);
// cube.addNormals();
// cube.addUVs();
// _dbgEntity = new h3d.scene.Mesh(cube);
// _dbgEntity.material.mainPass.wireframe = true;
// _dbgEntity.setTransform(transform);
// MarbleGame.instance.scene.addChild(_dbgEntity);
// var cube2 = new h3d.prim.Cube(this.boundingBox.xSize, this.boundingBox.ySize, this.boundingBox.zSize, true);
// cube2.addNormals();
// cube2.addUVs();
// _dbgEntity2 = new h3d.scene.Mesh(cube2);
// _dbgEntity2.material.mainPass.wireframe = true;
// _dbgEntity2.setTransform(transform);
// MarbleGame.instance.scene.addChild(_dbgEntity2);
// } else {
// _dbgEntity.setTransform(transform);
// var cube2 = new h3d.prim.Cube(this.boundingBox.xSize, this.boundingBox.ySize, this.boundingBox.zSize, true);
// cube2.addNormals();
// cube2.addUVs();
// _dbgEntity2.primitive = cube2;
// _dbgEntity2.setPosition(pos.x, pos.y, pos.z);
// }
}
public override function setTransform(transform:Matrix) {
super.setTransform(transform);
// if (_dbgEntity != null) {
// _dbgEntity.setTransform(transform);
// }
}
public override function rayCast(rayOrigin:Vector, rayDirection:Vector) {

View file

@ -31,7 +31,7 @@ class ConvexHull implements GJKShape {
public function setTransform(matrix:Matrix):Void {
if (this.transform != matrix) {
this.transform = matrix;
this.transform.load(matrix);
this._centercache = null;
}
}

View file

@ -0,0 +1,23 @@
package collision.gjk;
import h3d.Vector;
@:publicFields
class Cylinder implements GJKShape {
var p1:Vector;
var p2:Vector;
var radius:Float;
public function new() {}
public function getCenter():Vector {
return p1.add(p2).multiply(0.5);
}
public function support(dir:Vector) {
var axis = p2.sub(p1);
var v = axis.dot(dir) > 0 ? p2 : p1;
var rejection = dir.sub(axis.multiply(dir.dot(axis) / (axis.dot(axis)))).normalized().multiply(radius);
return v.add(rejection);
}
}

View file

@ -10,7 +10,10 @@ class GJK {
public static var maxEpaLooseEdges = 64;
public static var maxEpaIterations = 64;
public static function gjk(s1:GJKShape, s2:GJKShape) {
static var epaFaces:Array<Array<Vector>>;
static var loose_edges:Array<Array<Vector>>;
public static function gjk(s1:GJKShape, s2:GJKShape, doEpa:Bool = true) {
var searchDir = s1.getCenter().sub(s2.getCenter());
var a = new Vector();
var b = new Vector();
@ -21,7 +24,10 @@ class GJK {
searchDir = c.multiply(-1);
b = s2.support(searchDir).sub(s1.support(searchDir.multiply(-1)));
if (b.dot(searchDir) < 0)
return null;
return {
result: false,
epa: null
};
searchDir = c.sub(b).cross(b.multiply(-1)).cross(c.sub(b));
if (searchDir.length() == 0) {
@ -35,7 +41,10 @@ class GJK {
for (i in 0...maxIterations) {
a = s2.support(searchDir).sub(s1.support(searchDir.multiply(-1)));
if (a.dot(searchDir) < 0) {
return null;
return {
result: false,
epa: null
};
}
simpDim++;
@ -83,44 +92,57 @@ class GJK {
b = a;
searchDir = adb;
} else {
return epa(a, b, c, d, s1, s2);
if (doEpa)
return {
result: true,
epa: epa(a, b, c, d, s1, s2)
};
return {
result: true,
epa: null
};
}
}
}
return null;
return {
result: false,
epa: null
};
}
public static function epa(a:Vector, b:Vector, c:Vector, d:Vector, s1:GJKShape, s2:GJKShape) {
var faces = [];
for (i in 0...maxEpaFaces)
faces.push([new Vector(), new Vector(), new Vector(), new Vector()]);
if (epaFaces == null) {
epaFaces = [];
for (i in 0...maxEpaFaces)
epaFaces.push([new Vector(), new Vector(), new Vector(), new Vector()]);
}
faces[0][0] = a;
faces[0][1] = b;
faces[0][2] = c;
faces[0][3] = b.sub(a).cross(c.sub(a)).normalized(); // ABC
faces[1][0] = a;
faces[1][1] = c;
faces[1][2] = d;
faces[1][3] = c.sub(a).cross(d.sub(a)).normalized();
faces[2][0] = a;
faces[2][1] = d;
faces[2][2] = b;
faces[2][3] = d.sub(a).cross(b.sub(a)).normalized();
faces[3][0] = b;
faces[3][1] = d;
faces[3][2] = c;
faces[3][3] = d.sub(b).cross(c.sub(b)).normalized();
epaFaces[0][0] = a;
epaFaces[0][1] = b;
epaFaces[0][2] = c;
epaFaces[0][3] = b.sub(a).cross(c.sub(a)).normalized(); // ABC
epaFaces[1][0] = a;
epaFaces[1][1] = c;
epaFaces[1][2] = d;
epaFaces[1][3] = c.sub(a).cross(d.sub(a)).normalized();
epaFaces[2][0] = a;
epaFaces[2][1] = d;
epaFaces[2][2] = b;
epaFaces[2][3] = d.sub(a).cross(b.sub(a)).normalized();
epaFaces[3][0] = b;
epaFaces[3][1] = d;
epaFaces[3][2] = c;
epaFaces[3][3] = d.sub(b).cross(c.sub(b)).normalized();
var numFaces = 4;
var closestFace = 0;
for (iteration in 0...maxEpaIterations) {
// Find face that's closest to origin
var min_dist = faces[0][0].dot(faces[0][3]);
var min_dist = epaFaces[0][0].dot(epaFaces[0][3]);
closestFace = 0;
for (i in 1...numFaces) {
var dist = faces[i][0].dot(faces[i][3]);
var dist = epaFaces[i][0].dot(epaFaces[i][3]);
if (dist < min_dist) {
min_dist = dist;
closestFace = i;
@ -128,28 +150,30 @@ class GJK {
}
// search normal to face that's closest to origin
var search_dir = faces[closestFace][3];
var search_dir = epaFaces[closestFace][3];
var p = s2.support(search_dir).sub(s1.support(search_dir.multiply(-1)));
if (p.dot(search_dir) - min_dist < epaTolerance) {
// Convergence (new point is not significantly further from origin)
return faces[closestFace][3].multiply(p.dot(search_dir)); // dot vertex with normal to resolve collision along normal!
return epaFaces[closestFace][3].multiply(p.dot(search_dir)); // dot vertex with normal to resolve collision along normal!
}
if (loose_edges == null) {
loose_edges = [];
for (i in 0...maxEpaLooseEdges)
loose_edges.push([new Vector(), new Vector()]);
}
var loose_edges = [];
for (i in 0...maxEpaLooseEdges)
loose_edges.push([new Vector(), new Vector()]);
var num_loose_edges = 0;
// Find all triangles that are facing p
var i = 0;
while (i < numFaces) {
if (faces[i][3].dot(p.sub(faces[i][0])) > 0) // triangle i faces p, remove it
if (epaFaces[i][3].dot(p.sub(epaFaces[i][0])) > 0) // triangle i faces p, remove it
{
// Add removed triangle's edges to loose edge list.
// If it's already there, remove it (both triangles it belonged to are gone)
for (j in 0...3) // Three edges per face
{
var current_edge = [faces[i][j], faces[i][(j + 1) % 3]];
var current_edge = [epaFaces[i][j], epaFaces[i][(j + 1) % 3]];
var found_edge = false;
for (k in 0...num_loose_edges) // Check if current edge is already in list
{
@ -178,10 +202,10 @@ class GJK {
}
// Remove triangle i from list
faces[i][0] = faces[numFaces - 1][0];
faces[i][1] = faces[numFaces - 1][1];
faces[i][2] = faces[numFaces - 1][2];
faces[i][3] = faces[numFaces - 1][3];
epaFaces[i][0] = epaFaces[numFaces - 1][0];
epaFaces[i][1] = epaFaces[numFaces - 1][1];
epaFaces[i][2] = epaFaces[numFaces - 1][2];
epaFaces[i][3] = epaFaces[numFaces - 1][3];
numFaces--;
i--;
} // endif p can see triangle i
@ -194,22 +218,22 @@ class GJK {
// assert(num_faces<EPA_MAX_NUM_FACES);
if (numFaces >= maxEpaFaces)
break;
faces[numFaces][0] = loose_edges[i][0];
faces[numFaces][1] = loose_edges[i][1];
faces[numFaces][2] = p;
faces[numFaces][3] = loose_edges[i][0].sub(loose_edges[i][1]).cross(loose_edges[i][0].sub(p)).normalized();
epaFaces[numFaces][0] = loose_edges[i][0];
epaFaces[numFaces][1] = loose_edges[i][1];
epaFaces[numFaces][2] = p;
epaFaces[numFaces][3] = loose_edges[i][0].sub(loose_edges[i][1]).cross(loose_edges[i][0].sub(p)).normalized();
// Check for wrong normal to maintain CCW winding
var bias = 0.000001; // in case dot result is only slightly < 0 (because origin is on face)
if (faces[numFaces][0].dot(faces[numFaces][3]) + bias < 0) {
var temp = faces[numFaces][0];
faces[numFaces][0] = faces[numFaces][1];
faces[numFaces][1] = temp;
faces[numFaces][3] = faces[numFaces][3].multiply(-1);
if (epaFaces[numFaces][0].dot(epaFaces[numFaces][3]) + bias < 0) {
var temp = epaFaces[numFaces][0];
epaFaces[numFaces][0] = epaFaces[numFaces][1];
epaFaces[numFaces][1] = temp;
epaFaces[numFaces][3] = epaFaces[numFaces][3].multiply(-1);
}
numFaces++;
}
}
return faces[closestFace][3].multiply(faces[closestFace][0].dot(faces[closestFace][3]));
return epaFaces[closestFace][3].multiply(epaFaces[closestFace][0].dot(epaFaces[closestFace][3]));
}
}

View file

@ -10,6 +10,8 @@ class Edge {
public var pointIndex1:Int32;
public var surfaceIndex0:Int32;
public var surfaceIndex1:Int32;
public var farPoint0:Int32;
public var farPoint1:Int32;
public function new(pointIndex0, pointIndex1, surfaceIndex0, surfaceIndex1) {
this.pointIndex0 = pointIndex0;

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