├── .gitignore ├── CHANGELOG.md ├── CONTRIBUTORS ├── LICENSE ├── README.md ├── STANDARDS.md ├── package-lock.json ├── package.json ├── scripts ├── extract-scripts.js └── generate-docs.js ├── src-legacy ├── gdash.yyp ├── objects │ ├── obj_example_object │ │ └── obj_example_object.yy │ ├── obj_gdash_test_1 │ │ ├── Create_0.gml │ │ ├── Other_10.gml │ │ ├── Other_11.gml │ │ ├── Other_12.gml │ │ ├── Other_13.gml │ │ ├── Other_14.gml │ │ ├── Other_15.gml │ │ ├── Other_16.gml │ │ ├── Other_17.gml │ │ ├── Other_18.gml │ │ ├── Other_19.gml │ │ ├── Other_20.gml │ │ ├── Other_21.gml │ │ ├── Other_22.gml │ │ ├── Other_23.gml │ │ ├── Other_24.gml │ │ ├── Other_25.gml │ │ └── obj_gdash_test_1.yy │ ├── obj_gdash_test_2 │ │ ├── Create_0.gml │ │ ├── Other_10.gml │ │ ├── Other_11.gml │ │ ├── Other_12.gml │ │ ├── Other_13.gml │ │ ├── Other_14.gml │ │ ├── Other_15.gml │ │ ├── Other_16.gml │ │ ├── Other_17.gml │ │ ├── Other_18.gml │ │ ├── Other_19.gml │ │ ├── Other_20.gml │ │ ├── Other_21.gml │ │ ├── Other_22.gml │ │ ├── Other_23.gml │ │ ├── Other_24.gml │ │ ├── Other_25.gml │ │ └── obj_gdash_test_2.yy │ ├── obj_gdash_test_3 │ │ ├── Create_0.gml │ │ ├── Other_10.gml │ │ ├── Other_11.gml │ │ ├── Other_12.gml │ │ ├── Other_13.gml │ │ └── obj_gdash_test_3.yy │ ├── obj_gdash_test_4 │ │ ├── Create_0.gml │ │ ├── Other_10.gml │ │ ├── Other_11.gml │ │ ├── Other_12.gml │ │ ├── Other_13.gml │ │ ├── Other_14.gml │ │ ├── Other_15.gml │ │ ├── Other_16.gml │ │ ├── Other_17.gml │ │ ├── Other_18.gml │ │ ├── Other_19.gml │ │ ├── Other_20.gml │ │ ├── Other_21.gml │ │ ├── Other_22.gml │ │ ├── Other_23.gml │ │ ├── Other_24.gml │ │ └── obj_gdash_test_4.yy │ └── obj_performance_test │ │ ├── Alarm_0.gml │ │ ├── Create_0.gml │ │ └── obj_performance_test.yy ├── options │ ├── linux │ │ └── options_linux.yy │ ├── mac │ │ ├── icon512.png │ │ ├── icons │ │ │ └── icon512.png │ │ ├── options_mac.yy │ │ ├── splash.png │ │ └── splash │ │ │ └── splash.png │ ├── main │ │ └── inherited │ │ │ └── options_main.inherited.yy │ └── windows │ │ ├── License.txt │ │ ├── RunnerInstaller.nsi │ │ ├── Runner_Icon_256.ico │ │ ├── Runner_finish.bmp │ │ ├── Runner_header.bmp │ │ ├── installer │ │ ├── license.txt │ │ └── runnerinstaller.nsi │ │ ├── options_windows.yy │ │ ├── runner_icon.ico │ │ └── splash.png ├── rooms │ ├── rm_perf_test │ │ └── rm_perf_test.yy │ ├── rm_test_1 │ │ └── rm_test_1.yy │ ├── rm_test_2 │ │ └── rm_test_2.yy │ ├── rm_test_3 │ │ └── rm_test_3.yy │ └── rm_test_4 │ │ └── rm_test_4.yy ├── scripts │ ├── _and │ │ ├── _and.gml │ │ └── _and.yy │ ├── _array_of │ │ ├── _array_of.gml │ │ └── _array_of.yy │ ├── _backward │ │ ├── _backward.gml │ │ └── _backward.yy │ ├── _chunk │ │ ├── _chunk.gml │ │ └── _chunk.yy │ ├── _clone_array │ │ ├── _clone_array.gml │ │ └── _clone_array.yy │ ├── _collect │ │ ├── _collect.gml │ │ └── _collect.yy │ ├── _concat │ │ ├── _concat.gml │ │ └── _concat.yy │ ├── _contains │ │ ├── _contains.gml │ │ └── _contains.yy │ ├── _destroy │ │ ├── _destroy.gml │ │ └── _destroy.yy │ ├── _difference │ │ ├── _difference.gml │ │ └── _difference.yy │ ├── _difference_by │ │ ├── _difference_by.gml │ │ └── _difference_by.yy │ ├── _drop │ │ ├── _drop.gml │ │ └── _drop.yy │ ├── _drop_right │ │ ├── _drop_right.gml │ │ └── _drop_right.yy │ ├── _error │ │ ├── _error.gml │ │ └── _error.yy │ ├── _fill │ │ ├── _fill.gml │ │ └── _fill.yy │ ├── _filter │ │ ├── _filter.gml │ │ └── _filter.yy │ ├── _find │ │ ├── _find.gml │ │ └── _find.yy │ ├── _free │ │ ├── _free.gml │ │ └── _free.yy │ ├── _get │ │ ├── _get.gml │ │ └── _get.yy │ ├── _index_of │ │ ├── _index_of.gml │ │ └── _index_of.yy │ ├── _intersection │ │ ├── _intersection.gml │ │ └── _intersection.yy │ ├── _intersection_by │ │ ├── _intersection_by.gml │ │ └── _intersection_by.yy │ ├── _is_equal │ │ ├── _is_equal.gml │ │ └── _is_equal.yy │ ├── _join │ │ ├── _join.gml │ │ └── _join.yy │ ├── _keys │ │ ├── _keys.gml │ │ └── _keys.yy │ ├── _length │ │ ├── _length.gml │ │ └── _length.yy │ ├── _list_of │ │ ├── _list_of.gml │ │ └── _list_of.yy │ ├── _log │ │ ├── _log.gml │ │ └── _log.yy │ ├── _map │ │ ├── _map.gml │ │ └── _map.yy │ ├── _map_of │ │ ├── _map_of.gml │ │ └── _map_of.yy │ ├── _nth │ │ ├── _nth.gml │ │ └── _nth.yy │ ├── _or │ │ ├── _or.gml │ │ └── _or.yy │ ├── _partial │ │ ├── _partial.gml │ │ └── _partial.yy │ ├── _push │ │ ├── _push.gml │ │ └── _push.yy │ ├── _reduce │ │ ├── _reduce.gml │ │ └── _reduce.yy │ ├── _reverse │ │ ├── _reverse.gml │ │ └── _reverse.yy │ ├── _run │ │ ├── _run.gml │ │ └── _run.yy │ ├── _set │ │ ├── _set.gml │ │ └── _set.yy │ ├── _slice │ │ ├── _slice.gml │ │ └── _slice.yy │ ├── _split │ │ ├── _split.gml │ │ └── _split.yy │ ├── _spread │ │ ├── _spread.gml │ │ └── _spread.yy │ ├── _times │ │ ├── _times.gml │ │ └── _times.yy │ ├── _to_array │ │ ├── _to_array.gml │ │ └── _to_array.yy │ ├── _to_list │ │ ├── _to_list.gml │ │ └── _to_list.yy │ ├── _type_of │ │ ├── _type_of.gml │ │ └── _type_of.yy │ ├── _union │ │ ├── _union.gml │ │ └── _union.yy │ ├── _union_by │ │ ├── _union_by.gml │ │ └── _union_by.yy │ ├── _uniq │ │ ├── _uniq.gml │ │ └── _uniq.yy │ ├── _unzip │ │ ├── _unzip.gml │ │ └── _unzip.yy │ ├── _without │ │ ├── _without.gml │ │ └── _without.yy │ ├── _zip │ │ ├── _zip.gml │ │ └── _zip.yy │ ├── add │ │ ├── add.gml │ │ └── add.yy │ ├── assert │ │ ├── assert.gml │ │ └── assert.yy │ ├── assert_does_not_exist │ │ ├── assert_does_not_exist.gml │ │ └── assert_does_not_exist.yy │ ├── assert_equal │ │ ├── assert_equal.gml │ │ └── assert_equal.yy │ ├── assert_exists │ │ ├── assert_exists.gml │ │ └── assert_exists.yy │ ├── assert_is_false │ │ ├── assert_is_false.gml │ │ └── assert_is_false.yy │ ├── assert_is_true │ │ ├── assert_is_true.gml │ │ └── assert_is_true.yy │ ├── assert_is_undefined │ │ ├── assert_is_undefined.gml │ │ └── assert_is_undefined.yy │ ├── assert_not_equal │ │ ├── assert_not_equal.gml │ │ └── assert_not_equal.yy │ ├── double │ │ ├── double.gml │ │ └── double.yy │ ├── gamatas_create_assert_error │ │ ├── gamatas_create_assert_error.gml │ │ └── gamatas_create_assert_error.yy │ ├── gamatas_info │ │ ├── gamatas_info.gml │ │ └── gamatas_info.yy │ ├── greaterThanThree │ │ ├── greaterThanThree.gml │ │ └── greaterThanThree.yy │ ├── isEven │ │ ├── isEven.gml │ │ └── isEven.yy │ ├── native_floor │ │ ├── native_floor.gml │ │ └── native_floor.yy │ ├── returnFour │ │ ├── returnFour.gml │ │ └── returnFour.yy │ ├── sum │ │ ├── sum.gml │ │ └── sum.yy │ ├── test_end │ │ ├── test_end.gml │ │ └── test_end.yy │ ├── test_fail │ │ ├── test_fail.gml │ │ └── test_fail.yy │ ├── test_next │ │ ├── test_next.gml │ │ └── test_next.yy │ ├── test_start │ │ ├── test_start.gml │ │ └── test_start.yy │ ├── test_suite_init │ │ ├── test_suite_init.gml │ │ └── test_suite_init.yy │ └── test_suite_pass │ │ ├── test_suite_pass.gml │ │ └── test_suite_pass.yy └── views │ ├── 03e6bf78-c9fc-4f10-9549-7dc253ca0bfc.yy │ ├── 06188c03-8a58-4be1-b30b-7286b73779ee.yy │ ├── 2481bf08-af5f-487f-8ba3-de56222d643f.yy │ ├── 28492427-9ce2-484c-87ab-39ecd3479df0.yy │ ├── 2c55db64-9b48-4e9d-946e-d61128133698.yy │ ├── 3d4c1a45-cb51-440d-93f7-4508fb15da2d.yy │ ├── 3df7296c-6ac7-4b71-8f67-7202521cb283.yy │ ├── 411563b4-d20f-4313-8e25-baafa8501c71.yy │ ├── 47c9dcf3-db98-49b6-b391-9e8d4ad93ccb.yy │ ├── 487f543a-4cda-49b2-8606-d69071691939.yy │ ├── 4b2720a1-e8f2-435e-b526-fecdfa79b961.yy │ ├── 5f7a0fdf-5764-4afb-8e56-a4e70ee39bd9.yy │ ├── 8ebd4763-7203-42aa-9554-cc55d03a802b.yy │ ├── 94736fe3-0d88-4094-9ad3-af09d1fd4782.yy │ ├── a4eea40d-a933-497b-b91f-7e386fa9a986.yy │ ├── aaa232fc-30a0-4c62-950f-a776d3fef239.yy │ ├── c180f1aa-9fbf-4693-a798-00a3c87790d1.yy │ ├── cfd80378-4324-4b7a-9b8d-fd071e4b1e80.yy │ ├── dc6060fd-690b-4fe2-8ac8-c86faf2e04c0.yy │ ├── e03eb5fc-f39c-4961-9abd-4347303a7909.yy │ ├── ecfa581b-ebf3-43f2-b17d-cd091ea11541.yy │ └── ef1f07da-8677-4904-9251-8af85ce5ae10.yy └── src └── gdash ├── gdash.yyp ├── objects ├── obj_example_object │ └── obj_example_object.yy ├── obj_gdash_test_1 │ ├── Create_0.gml │ ├── Other_10.gml │ ├── Other_11.gml │ ├── Other_12.gml │ ├── Other_13.gml │ ├── Other_14.gml │ ├── Other_15.gml │ ├── Other_16.gml │ ├── Other_17.gml │ ├── Other_18.gml │ ├── Other_19.gml │ ├── Other_20.gml │ ├── Other_21.gml │ ├── Other_22.gml │ ├── Other_23.gml │ ├── Other_24.gml │ ├── Other_25.gml │ └── obj_gdash_test_1.yy ├── obj_gdash_test_2 │ ├── Create_0.gml │ ├── Other_10.gml │ ├── Other_11.gml │ ├── Other_12.gml │ ├── Other_13.gml │ ├── Other_14.gml │ ├── Other_15.gml │ ├── Other_16.gml │ ├── Other_17.gml │ ├── Other_18.gml │ ├── Other_19.gml │ ├── Other_20.gml │ ├── Other_21.gml │ ├── Other_22.gml │ ├── Other_23.gml │ ├── Other_24.gml │ ├── Other_25.gml │ └── obj_gdash_test_2.yy ├── obj_gdash_test_3 │ ├── Create_0.gml │ ├── Other_10.gml │ ├── Other_11.gml │ ├── Other_12.gml │ ├── Other_13.gml │ └── obj_gdash_test_3.yy ├── obj_gdash_test_4 │ ├── Create_0.gml │ ├── Other_10.gml │ ├── Other_11.gml │ ├── Other_12.gml │ ├── Other_13.gml │ ├── Other_14.gml │ ├── Other_15.gml │ ├── Other_16.gml │ ├── Other_17.gml │ ├── Other_18.gml │ ├── Other_19.gml │ ├── Other_20.gml │ ├── Other_21.gml │ ├── Other_22.gml │ ├── Other_23.gml │ ├── Other_24.gml │ └── obj_gdash_test_4.yy └── obj_performance_test │ ├── Alarm_0.gml │ ├── Create_0.gml │ └── obj_performance_test.yy ├── options ├── linux │ └── options_linux.yy ├── mac │ ├── icon512.png │ ├── icons │ │ └── icon512.png │ ├── options_mac.yy │ ├── splash.png │ └── splash │ │ └── splash.png ├── main │ ├── inherited │ │ └── options_main.inherited.yy │ └── options_main.yy └── windows │ ├── License.txt │ ├── RunnerInstaller.nsi │ ├── Runner_Icon_256.ico │ ├── Runner_finish.bmp │ ├── Runner_header.bmp │ ├── installer │ ├── license.txt │ └── runnerinstaller.nsi │ ├── options_windows.yy │ ├── runner_icon.ico │ └── splash.png ├── rooms ├── rm_perf_test │ └── rm_perf_test.yy ├── rm_test_1 │ └── rm_test_1.yy ├── rm_test_2 │ └── rm_test_2.yy ├── rm_test_3 │ └── rm_test_3.yy └── rm_test_4 │ └── rm_test_4.yy └── scripts ├── _and ├── _and.gml └── _and.yy ├── _array_of ├── _array_of.gml └── _array_of.yy ├── _backward ├── _backward.gml └── _backward.yy ├── _chunk ├── _chunk.gml └── _chunk.yy ├── _clone_array ├── _clone_array.gml └── _clone_array.yy ├── _collect ├── _collect.gml └── _collect.yy ├── _concat ├── _concat.gml └── _concat.yy ├── _contains ├── _contains.gml └── _contains.yy ├── _destroy ├── _destroy.gml └── _destroy.yy ├── _difference ├── _difference.gml └── _difference.yy ├── _difference_by ├── _difference_by.gml └── _difference_by.yy ├── _drop ├── _drop.gml └── _drop.yy ├── _drop_right ├── _drop_right.gml └── _drop_right.yy ├── _error ├── _error.gml └── _error.yy ├── _fill ├── _fill.gml └── _fill.yy ├── _filter ├── _filter.gml └── _filter.yy ├── _find ├── _find.gml └── _find.yy ├── _free ├── _free.gml └── _free.yy ├── _get ├── _get.gml └── _get.yy ├── _index_of ├── _index_of.gml └── _index_of.yy ├── _intersection ├── _intersection.gml └── _intersection.yy ├── _intersection_by ├── _intersection_by.gml └── _intersection_by.yy ├── _is_equal ├── _is_equal.gml └── _is_equal.yy ├── _join ├── _join.gml └── _join.yy ├── _keys ├── _keys.gml └── _keys.yy ├── _length ├── _length.gml └── _length.yy ├── _list_of ├── _list_of.gml └── _list_of.yy ├── _log ├── _log.gml └── _log.yy ├── _map ├── _map.gml └── _map.yy ├── _map_of ├── _map_of.gml └── _map_of.yy ├── _nth ├── _nth.gml └── _nth.yy ├── _or ├── _or.gml └── _or.yy ├── _partial ├── _partial.gml └── _partial.yy ├── _push ├── _push.gml └── _push.yy ├── _reduce ├── _reduce.gml └── _reduce.yy ├── _reverse ├── _reverse.gml └── _reverse.yy ├── _run ├── _run.gml └── _run.yy ├── _set ├── _set.gml └── _set.yy ├── _slice ├── _slice.gml └── _slice.yy ├── _split ├── _split.gml └── _split.yy ├── _spread ├── _spread.gml └── _spread.yy ├── _times ├── _times.gml └── _times.yy ├── _to_array ├── _to_array.gml └── _to_array.yy ├── _to_list ├── _to_list.gml └── _to_list.yy ├── _type_of ├── _type_of.gml └── _type_of.yy ├── _union ├── _union.gml └── _union.yy ├── _union_by ├── _union_by.gml └── _union_by.yy ├── _uniq ├── _uniq.gml └── _uniq.yy ├── _unzip ├── _unzip.gml └── _unzip.yy ├── _without ├── _without.gml └── _without.yy ├── _zip ├── _zip.gml └── _zip.yy ├── add ├── add.gml └── add.yy ├── assert ├── assert.gml └── assert.yy ├── assert_does_not_exist ├── assert_does_not_exist.gml └── assert_does_not_exist.yy ├── assert_equal ├── assert_equal.gml └── assert_equal.yy ├── assert_exists ├── assert_exists.gml └── assert_exists.yy ├── assert_is_false ├── assert_is_false.gml └── assert_is_false.yy ├── assert_is_true ├── assert_is_true.gml └── assert_is_true.yy ├── assert_is_undefined ├── assert_is_undefined.gml └── assert_is_undefined.yy ├── assert_not_equal ├── assert_not_equal.gml └── assert_not_equal.yy ├── gamatas_create_assert_error ├── gamatas_create_assert_error.gml └── gamatas_create_assert_error.yy ├── gamatas_info ├── gamatas_info.gml └── gamatas_info.yy ├── native_floor ├── native_floor.gml └── native_floor.yy ├── returnFour ├── returnFour.gml └── returnFour.yy ├── sum ├── sum.gml └── sum.yy ├── test_end ├── test_end.gml └── test_end.yy ├── test_fail ├── test_fail.gml └── test_fail.yy ├── test_next ├── test_next.gml └── test_next.yy ├── test_start ├── test_start.gml └── test_start.yy ├── test_suite_init ├── test_suite_init.gml └── test_suite_init.yy └── test_suite_pass ├── test_suite_pass.gml └── test_suite_pass.yy /.gitignore: -------------------------------------------------------------------------------- 1 | *.zip 2 | node_modules 3 | *.log 4 | build 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## v4.0.0 4 | 5 | * **Dropped support for GameMaker: Studio v1** 6 | * **All scripts changed to be `_snake_case` instead of `_camelCase`** 7 | * Minor performance tuning in most scripts 8 | * Significant performance updates to: 9 | * `_uniq` 10 | * `_contains` 11 | * Bug fixes and behavior alignment for `_contains` 12 | * `_keys` now returns an empty array for empty maps 13 | * New scripts: 14 | * `_to_list(array)` 15 | * `_list_of(values...)` 16 | * `_map_of(values...)` 17 | * `_error(message [, fatal])` 18 | * Documentation is now generated directly from code comments in the source 19 | -------------------------------------------------------------------------------- /CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | * Michael Barrett (https://github.com/twisterghost) 2 | * Thijs Miedema (https://github.com/thijsmie) 3 | * Zack Strickland (https://github.com/trouvant) 4 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gdash", 3 | "version": "6.0.0", 4 | "description": "This package.json is to install development utilities for gdash. You can ignore this if you are using gdash in your game.", 5 | "scripts": { 6 | "readme-toc": "markdown-toc -i README.md", 7 | "generate-docs": "node scripts/generate-docs.js && npm run readme-toc", 8 | "build": "npm run clean && node scripts/extract-scripts.js", 9 | "clean": "rimraf build" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/gm-core/gdash.git" 14 | }, 15 | "author": "", 16 | "license": "MIT", 17 | "bugs": { 18 | "url": "https://github.com/gm-core/gdash/issues" 19 | }, 20 | "homepage": "https://github.com/gm-core/gdash#readme", 21 | "devDependencies": { 22 | "glob": "^7.1.2", 23 | "markdown-toc": "^1.2.0", 24 | "mkdirp": "^0.5.1", 25 | "rimraf": "^2.6.2" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /scripts/extract-scripts.js: -------------------------------------------------------------------------------- 1 | const {promisify} = require('util'); 2 | const path = require('path'); 3 | const copyFile = promisify(require('fs').copyFile); 4 | const glob = promisify(require('glob')); 5 | const mkdirp = promisify(require('mkdirp')); 6 | 7 | const sourceDir = path.join(__dirname, '../src/scripts'); 8 | const scriptGlob = path.join(sourceDir, '**/_*.gml'); 9 | const targetDir = path.join(__dirname, '../build'); 10 | 11 | async function main() { 12 | await mkdirp(targetDir); 13 | const scriptFiles = await glob(scriptGlob); 14 | const copyAll = scriptFiles.map(file => { 15 | const outFile = path.join(targetDir, path.basename(file)); 16 | return copyFile(file, outFile); 17 | }); 18 | 19 | await Promise.all(copyAll); 20 | } 21 | 22 | main(); 23 | -------------------------------------------------------------------------------- /src-legacy/objects/obj_example_object/obj_example_object.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "62905c30-d5ac-491b-9710-8429298e5440", 3 | "modelName": "GMObject", 4 | "mvc": "1.0", 5 | "name": "obj_example_object", 6 | "eventList": [ 7 | 8 | ], 9 | "maskSpriteId": "00000000-0000-0000-0000-000000000000", 10 | "parentObjectId": "00000000-0000-0000-0000-000000000000", 11 | "persistent": false, 12 | "physicsAngularDamping": 0.1, 13 | "physicsDensity": 0.5, 14 | "physicsFriction": 0.2, 15 | "physicsGroup": 0, 16 | "physicsKinematic": false, 17 | "physicsLinearDamping": 0.1, 18 | "physicsObject": false, 19 | "physicsRestitution": 0.1, 20 | "physicsSensor": false, 21 | "physicsShape": 1, 22 | "physicsShapePoints": null, 23 | "physicsStartAwake": true, 24 | "solid": false, 25 | "spriteId": "00000000-0000-0000-0000-000000000000", 26 | "visible": true 27 | } -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_1/Create_0.gml: -------------------------------------------------------------------------------- 1 | test_suite_init("gdash suite 1"); 2 | test_next(); 3 | -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_1/Other_10.gml: -------------------------------------------------------------------------------- 1 | /// @desc _type_of 2 | test_start("_type_of", "Should return the type of any known data type"); 3 | 4 | assert_equal(_type_of(100), "real"); 5 | assert_equal(_type_of("hello"), "string"); 6 | assert_equal(_type_of(undefined), "undefined"); 7 | 8 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_1/Other_12.gml: -------------------------------------------------------------------------------- 1 | /// @desc _keys 2 | test_start("_keys", "Returns an array of all keys in a map"); 3 | 4 | var map = ds_map_create(); 5 | ds_map_add(map, "one", "hello"); 6 | ds_map_add(map, "two", "hello"); 7 | ds_map_add(map, "three", "hello"); 8 | ds_map_add(map, "four", "hello"); 9 | ds_map_add(map, "five", "hello"); 10 | 11 | var keys = _keys(map); 12 | 13 | assert_equal(_length(keys), 5); 14 | assert_is_true(_contains(keys, "one")); 15 | assert_is_true(_contains(keys, "two")); 16 | assert_is_true(_contains(keys, "three")); 17 | assert_is_true(_contains(keys, "four")); 18 | assert_is_true(_contains(keys, "five")); 19 | assert_is_false(_contains(keys, "rando")); 20 | 21 | ds_map_destroy(map); 22 | test_end(); 23 | 24 | -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_1/Other_14.gml: -------------------------------------------------------------------------------- 1 | /// @desc _reduce 2 | test_start("_reduce", "Iterates over an array, calling a function, returning the overall result"); 3 | 4 | var arr = [1, 2, 3, 4, 5]; 5 | 6 | assert_equal(_reduce(arr, sum), 15); 7 | 8 | var list = ds_list_create(); 9 | list[| 0] = 1; 10 | list[| 1] = 2; 11 | list[| 2] = 3; 12 | list[| 3] = 4; 13 | list[| 4] = 5; 14 | 15 | assert_equal(_reduce(list, sum), 15); 16 | 17 | assert_equal(_reduce(arr, sum, 10), 25); 18 | 19 | test_end(); 20 | 21 | -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_1/Other_16.gml: -------------------------------------------------------------------------------- 1 | /// @desc _uniq 2 | test_start("_uniq", "Removes duplicate values from an array"); 3 | 4 | var duped = [1, 1, 2, 2, "hello", "hello", 3]; 5 | var unique = [1, 2, "hello", 3]; 6 | 7 | assert_is_true(_is_equal(_uniq(duped), unique)); 8 | 9 | duped = [1, 2, 3, 4, 1, 2, 100, 200, 300, 400, 300, "hello", "world", "hello"]; 10 | unique = [1, 2, 3, 4, 100, 200, 300, 400, "hello", "world"]; 11 | 12 | assert_is_true(_is_equal(_uniq(duped), unique)); 13 | 14 | test_end(); 15 | 16 | -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_1/Other_17.gml: -------------------------------------------------------------------------------- 1 | /// @desc _push 2 | test_start("_push", "Adds an element to an array"); 3 | 4 | var arr = [0, 1, 2]; 5 | assert_equal(_length(arr), 3); 6 | 7 | arr = _push(arr, 3); 8 | assert_equal(_length(arr), 4); 9 | assert_equal(arr[3], 3); 10 | 11 | test_end(); 12 | 13 | -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_1/Other_18.gml: -------------------------------------------------------------------------------- 1 | /// @desc _find 2 | test_start("_find", "returns the first element in an array that is truthy in the function"); 3 | 4 | var arr = [0, 1, 2, 3, 40, 5]; 5 | var res = _find(arr, greaterThanThree); 6 | 7 | assert_equal(res, 40); 8 | 9 | test_end(); 10 | 11 | -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_1/Other_20.gml: -------------------------------------------------------------------------------- 1 | /// @desc _concat 2 | test_start("_concat", "Appends one array to another"); 3 | 4 | var arr1 = [0, 1, 2]; 5 | var arr2 = [30, 40, 50]; 6 | 7 | var res = _concat(arr1, arr2); 8 | 9 | assert_equal(_length(res), 6); 10 | 11 | assert_equal(res[0], 0); 12 | assert_equal(res[1], 1); 13 | assert_equal(res[2], 2); 14 | assert_equal(res[3], 30); 15 | assert_equal(res[4], 40); 16 | assert_equal(res[5], 50); 17 | test_end(); 18 | 19 | -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_1/Other_21.gml: -------------------------------------------------------------------------------- 1 | /// @desc _index_of 2 | test_start("_index_of", "Returns the index of a value in a collection"); 3 | 4 | var arr = [1, 2, 3, 4]; 5 | var list = ds_list_create(); 6 | list[| 0] = 1; 7 | list[| 1] = 2; 8 | list[| 2] = 3; 9 | list[| 3] = 4; 10 | 11 | assert_equal(_index_of(arr, 2), 1); 12 | assert_equal(_index_of(arr, 3), 2); 13 | assert_equal(_index_of(arr, 6), -1); 14 | assert_equal(_index_of(list, 2), 1); 15 | assert_equal(_index_of(list, 100), -1); 16 | 17 | test_end(); 18 | 19 | -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_1/Other_22.gml: -------------------------------------------------------------------------------- 1 | /// @desc _set 2 | test_start("_set", "Sets a value safely in a deeply nested map"); 3 | 4 | var map = ds_map_create(); 5 | _set(map, "hello.world", 2); 6 | 7 | var hello = map[? "hello"]; 8 | assert_equal(hello[? "world"], 2); 9 | 10 | _set(map, "setMap", ds_map_create(), ds_type_map); 11 | _set(map, "setList", ds_list_create(), ds_type_list); 12 | 13 | assert(ds_exists(map[? "setMap"], ds_type_map)); 14 | assert(ds_exists(map[? "setList"], ds_type_list)); 15 | 16 | test_end(); 17 | 18 | -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_1/Other_23.gml: -------------------------------------------------------------------------------- 1 | /// @desc _get 2 | test_start("_get", "Retrieves a deeply nested map value"); 3 | 4 | var map = ds_map_create(); 5 | map[? "hello"] = ds_map_create(); 6 | var hello = map[? "hello"]; 7 | hello[? "world"] = 2; 8 | 9 | assert_equal(_get(map, "hello.world"), 2); 10 | 11 | test_end(); 12 | 13 | -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_1/Other_24.gml: -------------------------------------------------------------------------------- 1 | /// @desc _clone_array 2 | test_start("_clone_array", "Returns a clone of the given array"); 3 | 4 | var arr = [2, 1, 5, 4, 6]; 5 | var cloned = _clone_array(arr); 6 | 7 | for (var i = 0; i < array_length_1d(arr); i++) { 8 | assert_equal(cloned[i], arr[i]); 9 | } 10 | 11 | test_end(); 12 | 13 | 14 | -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_1/Other_25.gml: -------------------------------------------------------------------------------- 1 | test_suite_pass(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_2/Create_0.gml: -------------------------------------------------------------------------------- 1 | test_suite_init("gdash suite 2"); 2 | test_next(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_2/Other_10.gml: -------------------------------------------------------------------------------- 1 | /// @desc _times 2 | test_start("_times", "returns an array of script results over a number of times"); 3 | 4 | var arr = _times(3, returnFour); 5 | 6 | assert_equal(_length(arr), 3); 7 | assert_equal(arr[0], 4); 8 | assert_equal(arr[1], 4); 9 | assert_equal(arr[2], 4); 10 | 11 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_2/Other_11.gml: -------------------------------------------------------------------------------- 1 | /// @desc _collect 2 | test_start("_collect", "returns an array of instances of the given type"); 3 | 4 | var firstObj = instance_create_depth(0, 0, 0, obj_example_object); 5 | var secondObj = instance_create_depth(0, 0, 0, obj_example_object); 6 | 7 | var objects = _collect(obj_example_object); 8 | 9 | assert_is_true(_contains(objects, firstObj)); 10 | assert_is_true(_contains(objects, secondObj)); 11 | 12 | with (obj_example_object) { 13 | instance_destroy(); 14 | } 15 | 16 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_2/Other_12.gml: -------------------------------------------------------------------------------- 1 | /// @desc _destroy 2 | test_start("_destroy", "destroys the given object") 3 | 4 | instance_create_depth(0, 0, 0, obj_example_object); 5 | 6 | _destroy(obj_example_object); 7 | 8 | assert_does_not_exist(obj_example_object); 9 | 10 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_2/Other_13.gml: -------------------------------------------------------------------------------- 1 | /// @desc _array_of 2 | test_start("_array_of", "returns an array of the arguments"); 3 | 4 | var arr = _array_of(2, 4, 6, 1, 2, 3); 5 | 6 | assert_equal(_type_of(arr), "array"); 7 | 8 | assert_equal(arr[0], 2); 9 | assert_equal(arr[1], 4); 10 | assert_equal(arr[2], 6); 11 | assert_equal(arr[3], 1); 12 | assert_equal(arr[4], 2); 13 | assert_equal(arr[5], 3); 14 | 15 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_2/Other_14.gml: -------------------------------------------------------------------------------- 1 | /// @desc _and 2 | test_start("_and", "returns the result of a logical 'and' of the params"); 3 | 4 | assert_is_true(_and(true, true)); 5 | assert_is_false(_and(false, true)); 6 | assert_is_false(_and(true, false)); 7 | assert_is_false(_and(false, false)); 8 | 9 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_2/Other_15.gml: -------------------------------------------------------------------------------- 1 | /// @desc _free 2 | test_start("_free", "frees a ds_map or ds_list or partial from memory"); 3 | 4 | var map = ds_map_create(); 5 | var list = ds_list_create(); 6 | var partial = _partial(add, 1); 7 | 8 | _free(map, ds_type_map); 9 | _free(list, ds_type_list); 10 | _free(partial); 11 | 12 | assert_is_false(ds_exists(map, ds_type_map)); 13 | assert_is_false(ds_exists(list, ds_type_list)); 14 | assert_is_false(ds_exists(partial, ds_type_map)); 15 | 16 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_2/Other_16.gml: -------------------------------------------------------------------------------- 1 | /// @desc _partial and _run 2 | test_start("_partial and _run", "returns a partial which can be executed with _run"); 3 | 4 | var add_one = _partial(add, 1); 5 | 6 | var two = _run(add_one, 1); 7 | var three = _run(add_one, 2); 8 | 9 | assert_equal(two, 2); 10 | assert_equal(three, 3); 11 | 12 | _free(add_one); 13 | 14 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_2/Other_17.gml: -------------------------------------------------------------------------------- 1 | /// @desc _spread 2 | test_start("_spread", "turns an array into script arguments") 3 | 4 | var args = [2, 5]; 5 | var args2 = [10, 20]; 6 | 7 | assert_equal(_spread(add, args), 7); 8 | assert_equal(_spread(add, args2), 30); 9 | 10 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_2/Other_18.gml: -------------------------------------------------------------------------------- 1 | /// @desc _length 2 | test_start("_length", "returns the length of an array, list, or string, or 0 for undefined"); 3 | 4 | var array = [1, 2, 3]; 5 | 6 | var list = ds_list_create(); 7 | ds_list_add(list, 1, 2, 3, 4); 8 | 9 | var str = "hello"; 10 | 11 | assert_equal(_length(array), 3); 12 | assert_equal(_length(list), 4); 13 | assert_equal(_length(str), 5); 14 | assert_equal(_length(undefined), 0); 15 | 16 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_2/Other_19.gml: -------------------------------------------------------------------------------- 1 | /// @desc _split 2 | test_start("_split", "returns an array of a string split up by a substring"); 3 | 4 | var str = "hello,world,foo,bar"; 5 | var splitStr = _split(str, ","); 6 | assert_equal(_length(splitStr), 4); 7 | 8 | assert_equal(splitStr[0], "hello"); 9 | assert_equal(splitStr[1], "world"); 10 | assert_equal(splitStr[2], "foo"); 11 | assert_equal(splitStr[3], "bar"); 12 | 13 | var str2 = "hello, world, foo"; 14 | var splitStr2 = _split(str2, ", "); 15 | 16 | assert_equal(_length(splitStr2), 3); 17 | assert_equal(splitStr2[0], "hello"); 18 | assert_equal(splitStr2[1], "world"); 19 | assert_equal(splitStr2[2], "foo"); 20 | 21 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_2/Other_20.gml: -------------------------------------------------------------------------------- 1 | /// @desc _join 2 | test_start("_join", "turns an array into a string"); 3 | 4 | var array = ["hello", "world", "!"]; 5 | var str = _join(array, " "); 6 | assert_equal(str, "hello world !"); 7 | 8 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_2/Other_21.gml: -------------------------------------------------------------------------------- 1 | /// @desc _or 2 | test_start("_or", "returns the result of an OR of two values"); 3 | 4 | assert_is_true(_or(true, true)); 5 | assert_is_true(_or(true, false)); 6 | assert_is_true(_or(false, true)); 7 | assert_is_false(_or(false, false)); 8 | 9 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_2/Other_22.gml: -------------------------------------------------------------------------------- 1 | /// @desc _nth 2 | test_start("_nth", "Returns the nth element of the collection"); 3 | 4 | var list = ds_list_create(); 5 | list[| 0] = "first"; 6 | list[| 1] = "second"; 7 | list[| 2] = "third"; 8 | 9 | var array; 10 | array[0] = "first"; 11 | array[1] = "second"; 12 | array[2] = "third"; 13 | 14 | assert_equal(_nth(list, 0), list[| 0]); 15 | assert_equal(_nth(list, 1), list[| 1]); 16 | assert_equal(_nth(list, 2), list[| 2]); 17 | 18 | assert_equal(_nth(list, -1), list[| 2]); 19 | assert_equal(_nth(list, -2), list[| 1]); 20 | assert_equal(_nth(list, -3), list[| 0]); 21 | 22 | assert_equal(_nth(array, 0), array[0]); 23 | assert_equal(_nth(array, 1), array[1]); 24 | assert_equal(_nth(array, 2), array[2]); 25 | 26 | assert_equal(_nth(array, -1), array[2]); 27 | assert_equal(_nth(array, -2), array[1]); 28 | assert_equal(_nth(array, -3), array[0]); 29 | 30 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_2/Other_23.gml: -------------------------------------------------------------------------------- 1 | /// @desc _to_array 2 | test_start("_to_array", "Converts a list to an array"); 3 | 4 | var list = ds_list_create(); 5 | ds_list_add(1, 2, 3, 4, 5); 6 | 7 | var arr = _to_array(list); 8 | 9 | for (var i = 0; i < _length(arr); i++) { 10 | assert_equal(list[| i], arr[i]); 11 | } 12 | 13 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_2/Other_24.gml: -------------------------------------------------------------------------------- 1 | /// @description _backward 2 | test_start("_backward", "Reverses an array"); 3 | 4 | var arr1 = [1]; 5 | var arr2 = [1, 2, 3]; 6 | 7 | var test1 = _backward(arr1); 8 | var test2 = _backward(arr2); 9 | var test3 = _backward(test2); 10 | 11 | assert_equal(test1[0], arr1[0]); 12 | assert_equal(test2[0], 3); 13 | assert_equal(test2[1], 2); 14 | assert_equal(test2[2], 1); 15 | assert_equal(test3[0], 1); 16 | assert_equal(test3[1], 2); 17 | assert_equal(test3[2], 3); 18 | 19 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_2/Other_25.gml: -------------------------------------------------------------------------------- 1 | test_suite_pass() -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_3/Create_0.gml: -------------------------------------------------------------------------------- 1 | test_suite_init("gdash suite 3"); 2 | test_next(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_3/Other_10.gml: -------------------------------------------------------------------------------- 1 | /// @description _slice 2 | 3 | test_start("_slice", "Slices an array"); 4 | 5 | var arr = [1, 2, 3]; 6 | 7 | var test1 = _slice(arr, 0); 8 | var test2 = _slice(arr, 1, 2); 9 | var test3 = _slice(arr, 1, 3); 10 | 11 | 12 | assert_equal(_length(test1), 3); 13 | assert_equal(_length(test2), 1); 14 | assert_equal(_length(test3), 2); 15 | 16 | assert_equal(test1[0], 1); 17 | assert_equal(test1[1], 2); 18 | assert_equal(test1[2], 3); 19 | 20 | assert_equal(test2[0], 2); 21 | 22 | assert_equal(test3[0], 2); 23 | assert_equal(test3[1], 3); 24 | 25 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_3/Other_11.gml: -------------------------------------------------------------------------------- 1 | /// @description _list_of 2 | test_start("_list_of", "returns a list of the given parameters"); 3 | var res = _list_of(1, 2, 3, 4); 4 | 5 | assert_is_true(ds_exists(res, ds_type_list)); 6 | assert_equal(res[| 0], 1); 7 | assert_equal(res[| 1], 2); 8 | assert_equal(res[| 2], 3); 9 | assert_equal(res[| 3], 4); 10 | 11 | ds_list_destroy(res); 12 | 13 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_3/Other_12.gml: -------------------------------------------------------------------------------- 1 | /// @description _map_of 2 | test_start("_map_of", "returns a map of the given parameters, paired as key/value"); 3 | var res = _map_of( 4 | "hello", 1, 5 | "world", 2, 6 | "test", 3 7 | ); 8 | 9 | assert_is_true(ds_exists(res, ds_type_map)); 10 | assert_equal(res[? "hello"], 1); 11 | assert_equal(res[? "world"], 2); 12 | assert_equal(res[? "test"], 3); 13 | 14 | ds_map_destroy(res); 15 | 16 | // Odd argument count - fails with empty map 17 | res = _map_of(1); 18 | assert_is_true(ds_exists(res, ds_type_map)); 19 | assert_equal(_length(_keys(res)), 0); 20 | ds_map_destroy(res); 21 | 22 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_3/Other_13.gml: -------------------------------------------------------------------------------- 1 | test_suite_pass(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_4/Create_0.gml: -------------------------------------------------------------------------------- 1 | test_suite_init("gdash suite 4"); 2 | test_next(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_4/Other_11.gml: -------------------------------------------------------------------------------- 1 | /// @description _difference 2 | 3 | test_start("_difference", "Finds the difference between arrays"); 4 | 5 | var arr1 = [1, 2, 3, 4]; 6 | var arr2 = [0, 2]; 7 | var arr3 = [3, 4]; 8 | 9 | var test1 = _difference(arr1, arr2); 10 | var test2 = _difference(arr1, arr3); 11 | var test3 = _difference(arr1, arr2, arr3); 12 | var test4 = _difference(arr3, arr1); 13 | 14 | assert_equal(_length(test1), 3); 15 | assert_equal(_length(test2), 2); 16 | assert_equal(_length(test3), 1); 17 | assert_equal(_length(test4), 0); 18 | 19 | assert_equal(test1[0], 1); 20 | assert_equal(test1[1], 3); 21 | assert_equal(test1[2], 4); 22 | 23 | assert_equal(test2[0], 1); 24 | assert_equal(test2[1], 2); 25 | 26 | assert_equal(test3[0], 1); 27 | 28 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_4/Other_12.gml: -------------------------------------------------------------------------------- 1 | /// @description _difference_by 2 | 3 | test_start("_difference_by", "Finds the difference between arrays using an iteratee"); 4 | 5 | var arr1 = [1, 2.5, 3, 4.5]; 6 | var arr2 = [0.9, 2]; 7 | var arr3 = [3.9, 4.25]; 8 | 9 | var test1 = _difference_by(arr1, arr2, native_floor); 10 | var test2 = _difference_by(arr1, arr3, native_floor); 11 | var test3 = _difference_by(arr1, arr2, arr3, native_floor); 12 | var test4 = _difference_by(arr3, arr1, native_floor); 13 | 14 | assert_equal(_length(test1), 3); 15 | assert_equal(_length(test2), 2); 16 | assert_equal(_length(test3), 1); 17 | assert_equal(_length(test4), 0); 18 | 19 | assert_equal(test1[0], 1); 20 | assert_equal(test1[1], 3); 21 | assert_equal(test1[2], 4.5); 22 | 23 | assert_equal(test2[0], 1); 24 | assert_equal(test2[1], 2.5); 25 | 26 | assert_equal(test3[0], 1); 27 | 28 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_4/Other_13.gml: -------------------------------------------------------------------------------- 1 | /// @description _drop 2 | 3 | test_start("_drop", "Drops elements from the beginning of an array"); 4 | 5 | var arr = [1, 2, 3]; 6 | 7 | var test1 = _drop(arr, 1); 8 | var test2 = _drop(arr, 2); 9 | var test3 = _drop(arr, 3); 10 | 11 | assert_equal(_length(test1), 2); 12 | assert_equal(_length(test2), 1); 13 | assert_equal(_length(test3), 0); 14 | 15 | assert_equal(test1[0], 2); 16 | assert_equal(test1[1], 3); 17 | 18 | assert_equal(test2[0], 3); 19 | 20 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_4/Other_14.gml: -------------------------------------------------------------------------------- 1 | /// @description _drop_right 2 | 3 | test_start("_drop_right", "Drops elements from the end of an array"); 4 | 5 | var arr = [1, 2, 3]; 6 | 7 | var test1 = _drop_right(arr, 1); 8 | var test2 = _drop_right(arr, 2); 9 | var test3 = _drop_right(arr, 3); 10 | 11 | assert_equal(_length(test1), 2); 12 | assert_equal(_length(test2), 1); 13 | assert_equal(_length(test3), 0); 14 | 15 | assert_equal(test1[0], 1); 16 | assert_equal(test1[1], 2); 17 | 18 | assert_equal(test2[0], 1); 19 | 20 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_4/Other_15.gml: -------------------------------------------------------------------------------- 1 | /// @description _fill 2 | 3 | test_start("_fill", "Fills elements of an array with a given value"); 4 | 5 | var arr = [1, 2, 3]; 6 | 7 | _fill(arr, 0); 8 | 9 | assert_equal(arr[0], 0); 10 | assert_equal(arr[1], 0); 11 | assert_equal(arr[2], 0); 12 | 13 | _fill(arr, 1, 1, 3); 14 | 15 | assert_equal(arr[0], 0); 16 | assert_equal(arr[1], 1); 17 | assert_equal(arr[2], 1); 18 | 19 | _fill(arr, 2, 0, 1); 20 | 21 | assert_equal(arr[0], 2); 22 | assert_equal(arr[1], 1); 23 | assert_equal(arr[2], 1); 24 | 25 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_4/Other_16.gml: -------------------------------------------------------------------------------- 1 | /// @description _intersection 2 | 3 | test_start("_intersection", "Finds the intersection of arrays"); 4 | 5 | var arr1 = [1, 2, 3, 4]; 6 | var arr2 = [1, 4, 3]; 7 | var arr3 = [0, 2]; 8 | 9 | var test1 = _intersection(arr1, arr2); 10 | var test2 = _intersection(arr1, arr3); 11 | var test3 = _intersection(arr2, arr1); 12 | var test4 = _intersection(arr1, arr2, arr3); 13 | 14 | assert_equal(_length(test1), 3); 15 | assert_equal(_length(test2), 1); 16 | assert_equal(_length(test3), 3); 17 | assert_equal(_length(test4), 0); 18 | 19 | assert_equal(test1[0], 1); 20 | assert_equal(test1[1], 3); 21 | assert_equal(test1[2], 4); 22 | 23 | assert_equal(test2[0], 2); 24 | 25 | assert_equal(test3[0], 1); 26 | assert_equal(test3[1], 4); 27 | assert_equal(test3[2], 3); 28 | 29 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_4/Other_17.gml: -------------------------------------------------------------------------------- 1 | /// @description _intersection_by 2 | 3 | test_start("_intersection_by", "Finds the intersection of arrays using an iteratee"); 4 | 5 | var arr1 = [1.4, 2, 3.5, 4]; 6 | var arr2 = [1, 4.9, 3]; 7 | var arr3 = [0.75, 2.1]; 8 | 9 | var test1 = _intersection_by(arr1, arr2, native_floor); 10 | var test2 = _intersection_by(arr1, arr3, native_floor); 11 | var test3 = _intersection_by(arr2, arr1, native_floor); 12 | var test4 = _intersection_by(arr1, arr2, arr3, native_floor); 13 | 14 | assert_equal(_length(test1), 3); 15 | assert_equal(_length(test2), 1); 16 | assert_equal(_length(test3), 3); 17 | assert_equal(_length(test4), 0); 18 | 19 | assert_equal(test1[0], 1.4); 20 | assert_equal(test1[1], 3.5); 21 | assert_equal(test1[2], 4); 22 | 23 | assert_equal(test2[0], 2); 24 | 25 | assert_equal(test3[0], 1); 26 | assert_equal(test3[1], 4.9); 27 | assert_equal(test3[2], 3); 28 | 29 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_4/Other_18.gml: -------------------------------------------------------------------------------- 1 | /// @description _reverse 2 | test_start("_reverse", "Reverses an array"); 3 | 4 | var arr1 = [1]; 5 | var arr2 = [1, 2, 3]; 6 | 7 | _reverse(arr1); 8 | _reverse(arr2); 9 | 10 | assert_equal(arr1[0], 1); 11 | assert_equal(arr2[0], 3); 12 | assert_equal(arr2[1], 2); 13 | assert_equal(arr2[2], 1); 14 | 15 | var test = _reverse(arr2); 16 | 17 | assert_equal(test[0], 1); 18 | assert_equal(test[1], 2); 19 | assert_equal(test[2], 3); 20 | 21 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_4/Other_19.gml: -------------------------------------------------------------------------------- 1 | /// @description _union 2 | 3 | test_start("_union", "Finds the union of arrays"); 4 | 5 | var arr1 = [1, 2, 3]; 6 | var arr2 = [3, 1, 1]; 7 | var arr3 = [0, 2]; 8 | 9 | var test1 = _union(arr1, arr2); 10 | var test2 = _union(arr1, arr3); 11 | var test3 = _union(arr2, arr1); 12 | 13 | assert_equal(_length(test1), 3); 14 | assert_equal(_length(test2), 4); 15 | assert_equal(_length(test3), 3); 16 | 17 | assert_equal(test1[0], 1); 18 | assert_equal(test1[1], 2); 19 | assert_equal(test1[2], 3); 20 | 21 | assert_equal(test2[0], 1); 22 | assert_equal(test2[1], 2); 23 | assert_equal(test2[2], 3); 24 | assert_equal(test2[3], 0); 25 | 26 | assert_equal(test3[0], 3); 27 | assert_equal(test3[1], 1); 28 | assert_equal(test3[2], 2); 29 | 30 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_4/Other_20.gml: -------------------------------------------------------------------------------- 1 | /// @description _union_by 2 | 3 | test_start("_union_by", "Finds the union of arrays using an iteratee"); 4 | 5 | var arr1 = [1, 2, 3.3]; 6 | var arr2 = [3, 1.2, 1.9]; 7 | var arr3 = [0, 2.6]; 8 | 9 | var test1 = _union_by(arr1, arr2, native_floor); 10 | var test2 = _union_by(arr1, arr3, native_floor); 11 | var test3 = _union_by(arr2, arr1, native_floor); 12 | 13 | assert_equal(_length(test1), 3); 14 | assert_equal(_length(test2), 4); 15 | assert_equal(_length(test3), 3); 16 | 17 | assert_equal(test1[0], 1); 18 | assert_equal(test1[1], 2); 19 | assert_equal(test1[2], 3.3); 20 | 21 | assert_equal(test2[0], 1); 22 | assert_equal(test2[1], 2); 23 | assert_equal(test2[2], 3.3); 24 | assert_equal(test2[3], 0); 25 | 26 | assert_equal(test3[0], 3); 27 | assert_equal(test3[1], 1.2); 28 | assert_equal(test3[2], 2); 29 | 30 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_4/Other_21.gml: -------------------------------------------------------------------------------- 1 | /// @description _without 2 | 3 | test_start("_without", "Creates an array from a given array excluding certain values"); 4 | 5 | var arr = [1, 2, 3]; 6 | 7 | var test1 = _without(arr, 0); 8 | var test2 = _without(arr, 2); 9 | var test3 = _without(arr, 1, 3, 5); 10 | var test4 = _without(test3, 2); 11 | 12 | assert_equal(_length(test1), 3); 13 | assert_equal(_length(test2), 2); 14 | assert_equal(_length(test3), 1); 15 | assert_equal(_length(test4), 0); 16 | 17 | assert_equal(test1[0], 1); 18 | assert_equal(test1[1], 2); 19 | assert_equal(test1[2], 3); 20 | 21 | assert_equal(test2[0], 1); 22 | assert_equal(test2[1], 3); 23 | 24 | assert_equal(test3[0], 2); 25 | 26 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_4/Other_22.gml: -------------------------------------------------------------------------------- 1 | /// @description _zip 2 | 3 | test_start("_zip", "Groups elements of an array"); 4 | 5 | var arr1 = [1, 2, 3]; 6 | var arr2 = [true, false, true]; 7 | var arr3 = [2, 4]; 8 | 9 | var test = _zip(arr1, arr2, arr3); 10 | 11 | assert_equal(array_height_2d(test), 3); 12 | 13 | assert_equal(test[0, 0], 1); 14 | assert_equal(test[0, 1], true); 15 | assert_equal(test[0, 2], 2); 16 | 17 | assert_equal(test[1, 0], 2); 18 | assert_equal(test[1, 1], false); 19 | assert_equal(test[1, 2], 4); 20 | 21 | assert_equal(test[2, 0], 3); 22 | assert_equal(test[2, 1], true); 23 | 24 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_4/Other_23.gml: -------------------------------------------------------------------------------- 1 | /// @description _unzip 2 | 3 | test_start("_unzip", "Ungroups a zipped array"); 4 | 5 | var arr1 = [1, 2, 3]; 6 | var arr2 = [true, false]; 7 | var arr3 = _zip(arr1, arr2); 8 | 9 | var test = _unzip(arr3); 10 | 11 | assert_equal(array_height_2d(test), 2); 12 | 13 | assert_equal(test[0, 0], 1); 14 | assert_equal(test[0, 1], 2); 15 | assert_equal(test[0, 2], 3); 16 | 17 | assert_equal(test[1, 0], true); 18 | assert_equal(test[1, 1], false); 19 | assert_equal(test[1, 2], 0); 20 | 21 | test_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_gdash_test_4/Other_24.gml: -------------------------------------------------------------------------------- 1 | test_suite_pass(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_performance_test/Alarm_0.gml: -------------------------------------------------------------------------------- 1 | game_end(); -------------------------------------------------------------------------------- /src-legacy/objects/obj_performance_test/Create_0.gml: -------------------------------------------------------------------------------- 1 | var count = 1000000; 2 | var testName = "Performance test"; 3 | 4 | #region setup 5 | 6 | var arr = [1, 2, 3, 4, 5]; 7 | 8 | #endregion 9 | 10 | var startTime = get_timer(); 11 | for (var i = 0; i < count; i++) { 12 | 13 | #region test 14 | 15 | //_uniq(arr); 16 | 17 | #endregion 18 | 19 | } 20 | 21 | var endTime = get_timer(); 22 | _log(">>> " + testName + " completed in " + string((endTime - startTime) * 0.000001) + " seconds"); 23 | alarm[0] = 1; -------------------------------------------------------------------------------- /src-legacy/options/mac/icon512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gm-core/gdash/9b1e34fbb4406df1e9f5330e803d3a9d11be2e3e/src-legacy/options/mac/icon512.png -------------------------------------------------------------------------------- /src-legacy/options/mac/icons/icon512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gm-core/gdash/9b1e34fbb4406df1e9f5330e803d3a9d11be2e3e/src-legacy/options/mac/icons/icon512.png -------------------------------------------------------------------------------- /src-legacy/options/mac/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gm-core/gdash/9b1e34fbb4406df1e9f5330e803d3a9d11be2e3e/src-legacy/options/mac/splash.png -------------------------------------------------------------------------------- /src-legacy/options/mac/splash/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gm-core/gdash/9b1e34fbb4406df1e9f5330e803d3a9d11be2e3e/src-legacy/options/mac/splash/splash.png -------------------------------------------------------------------------------- /src-legacy/options/main/inherited/options_main.inherited.yy: -------------------------------------------------------------------------------- 1 | 1.0.0←ed6a955d-5826-4f98-a450-10b414266c27←ed6a955d-5826-4f98-a450-10b414266c27|{ 2 | "option_gameguid": "{3EF251CB-D808-4812-825B-C05EBDC6FE1B}", 3 | "option_steam_app_id": "0", 4 | "option_lastchanged": "02/04/2017 13:21:40", 5 | "option_sci_usesci": false, 6 | "option_game_speed": 30 7 | }←1225f6b0-ac20-43bd-a82e-be73fa0b6f4f|{ 8 | "autocrop": false, 9 | "scaled": false, 10 | "targets": 461609314234257646 11 | }←7b2c4976-1e09-44e5-8256-c527145e03bb|{ 12 | "targets": 461609314234257646 13 | } -------------------------------------------------------------------------------- /src-legacy/options/windows/License.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gm-core/gdash/9b1e34fbb4406df1e9f5330e803d3a9d11be2e3e/src-legacy/options/windows/License.txt -------------------------------------------------------------------------------- /src-legacy/options/windows/Runner_Icon_256.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gm-core/gdash/9b1e34fbb4406df1e9f5330e803d3a9d11be2e3e/src-legacy/options/windows/Runner_Icon_256.ico -------------------------------------------------------------------------------- /src-legacy/options/windows/Runner_finish.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gm-core/gdash/9b1e34fbb4406df1e9f5330e803d3a9d11be2e3e/src-legacy/options/windows/Runner_finish.bmp -------------------------------------------------------------------------------- /src-legacy/options/windows/Runner_header.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gm-core/gdash/9b1e34fbb4406df1e9f5330e803d3a9d11be2e3e/src-legacy/options/windows/Runner_header.bmp -------------------------------------------------------------------------------- /src-legacy/options/windows/installer/license.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gm-core/gdash/9b1e34fbb4406df1e9f5330e803d3a9d11be2e3e/src-legacy/options/windows/installer/license.txt -------------------------------------------------------------------------------- /src-legacy/options/windows/runner_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gm-core/gdash/9b1e34fbb4406df1e9f5330e803d3a9d11be2e3e/src-legacy/options/windows/runner_icon.ico -------------------------------------------------------------------------------- /src-legacy/options/windows/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gm-core/gdash/9b1e34fbb4406df1e9f5330e803d3a9d11be2e3e/src-legacy/options/windows/splash.png -------------------------------------------------------------------------------- /src-legacy/scripts/_and/_and.gml: -------------------------------------------------------------------------------- 1 | /// @func _and(valueA, valueB) 2 | /// @desc Returns the value of the provided arguments after a boolean and 3 | /// @param {*} valueA Some first input 4 | /// @param {*} valueB A value to && the first input with 5 | /// @returns {Boolean} The value of the provided arguments after an && 6 | /* 7 | @example 8 | _and(true, true); 9 | // => true 10 | 11 | _and(false, true); 12 | // => false 13 | 14 | */ 15 | gml_pragma("forceinline"); 16 | return argument0 && argument1; 17 | 18 | -------------------------------------------------------------------------------- /src-legacy/scripts/_and/_and.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "b37db980-06b5-44b7-b0b6-1dca01f04279", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_and", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_array_of/_array_of.gml: -------------------------------------------------------------------------------- 1 | /// @func _array_of(values...) 2 | /// @desc Returns an array of the given arguments. 3 | /// @param {*) values... Values to put into an array 4 | /// @returns {Array} An array of the given parameters 5 | /* 6 | @example 7 | _arrayOf(1, 2, 3); 8 | // => [1, 2, 3]; 9 | 10 | _arrayOf('hello', 'world', 'i', 'am', 'an', 'array'); 11 | // => ['hello', 'world', 'i', 'am', 'an', 'array']; 12 | */ 13 | 14 | var result; 15 | 16 | for (i = argument_count-1; i >= 0; i--) { 17 | result[i] = argument[i]; 18 | } 19 | 20 | return result; 21 | -------------------------------------------------------------------------------- /src-legacy/scripts/_array_of/_array_of.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "a6902058-42c5-4eb6-8658-c430cfa31c1a", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_array_of", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_backward/_backward.gml: -------------------------------------------------------------------------------- 1 | /// @func _backward(array) 2 | /// @desc Creates a new array containing the elements of array in reverse order. 3 | /// @param {Array} array The array to reverse 4 | /// @returns {Array} The reversed array 5 | /// @note To modify an array in-place, use `_reverse` 6 | /* 7 | @example 8 | var myArray = [1, 2, 3]; 9 | var reverseArray = _backward(myArray); 10 | // => [3, 2, 1] 11 | */ 12 | 13 | var arr; 14 | var len; 15 | var result; 16 | 17 | arr = argument0; 18 | len = array_length_1d(arr); 19 | 20 | for (var i = len - 1; i >= 0; i--) { 21 | result[i] = arr[@ len - 1 - i]; 22 | } 23 | 24 | return result; 25 | -------------------------------------------------------------------------------- /src-legacy/scripts/_backward/_backward.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "a099a4f0-a29c-4209-ba86-dd62ac3ff07c", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_backward", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_chunk/_chunk.gml: -------------------------------------------------------------------------------- 1 | /// @func _chunk(array, size) 2 | /// @desc Creates a two-dimensional array of elements split into groups of given length. 3 | /// @param {Array} array The array to split 4 | /// @param {Integer} size The size of each chunk 5 | /// @returns {Array} The two-dimensional array of chunks 6 | /* 7 | @example 8 | var arr = [0, 1, 2, 3]; 9 | _chunk(arr, 2); 10 | // => [[0, 1], [2, 3]]; 11 | 12 | var arr = [0, 1, 2, 3]; 13 | _chunk(arr, 3); 14 | // => [[0, 1, 2], [3]]; 15 | */ 16 | 17 | if (argument_count != 2) return false; 18 | 19 | var i; 20 | var arr; 21 | var len; 22 | var size; 23 | var result; 24 | 25 | size = argument1; 26 | if (size == 0) return array_create(0); 27 | 28 | arr = argument0; 29 | len = array_length_1d(arr); 30 | 31 | for (i = len - 1; i >= 0; i--) { 32 | result[i / size, i % size] = arr[i]; 33 | } 34 | 35 | return result; 36 | -------------------------------------------------------------------------------- /src-legacy/scripts/_chunk/_chunk.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "30814abc-08cb-429f-91b8-352de81acdc3", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_chunk", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_clone_array/_clone_array.gml: -------------------------------------------------------------------------------- 1 | /// @func _clone_array(array) 2 | /// @desc Clones a given input array, returning a deep copy. 3 | /// @param {Array} array The array to clone 4 | /// @returns {Array} A copy of the input array 5 | /* 6 | @example 7 | var myArray = [1, 2, 3]; 8 | var copyArray = _clone_array(myArray); 9 | _is_equal(myArray, copyArray) 10 | // => true 11 | */ 12 | 13 | // Abuse GML array copy into script mechanics. 14 | /// Note, maybe switch to GMS2 new method: array_copy? 15 | 16 | var result = argument0; 17 | 18 | result[0] = result[0]; // this forces a copy 19 | return result; 20 | -------------------------------------------------------------------------------- /src-legacy/scripts/_clone_array/_clone_array.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "024cd91c-bb54-4636-a223-6ba0a8f98e80", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_clone_array", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_collect/_collect.gml: -------------------------------------------------------------------------------- 1 | /// @func _collect(object) 2 | /// @desc Returns an array of all objects of the provided type 3 | /// @param {ObjectType} objectType The object type to collect 4 | /// @returns {Array} An array of all object IDs of the provided type in the room 5 | /* 6 | @example 7 | 8 | _collect(obj_character); 9 | // => [10001, 10002, 10005] 10 | */ 11 | 12 | var result; 13 | 14 | for (var i = instance_number(argument0); i >= 0; i--) { 15 | result[i] = instance_find(argument0, i); 16 | } 17 | 18 | return result; 19 | 20 | -------------------------------------------------------------------------------- /src-legacy/scripts/_collect/_collect.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "94e9b58c-1b5c-4e05-8348-05e1155444a6", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_collect", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_concat/_concat.gml: -------------------------------------------------------------------------------- 1 | /// @func _concat(arrayA, arrayB) 2 | /// @desc Appends the values of one array to another. 3 | /// @param {Array} baseArray The array to append to 4 | /// @param {Array} arrayToAppend The array to append 5 | /// @returns {Array} The concatenated array 6 | /* 7 | @example 8 | _concat([0, 1, 2], [3, 4, 5]); 9 | // => [0, 1, 2, 3, 4, 5] 10 | 11 | */ 12 | 13 | var n = array_length_1d(argument0); 14 | var arr = _clone_array(argument0); 15 | 16 | for (var i = array_length_1d(argument1) - 1; i >= 0; i--) { 17 | arr[@ n+i] = argument1[@ i]; 18 | } 19 | 20 | return arr; -------------------------------------------------------------------------------- /src-legacy/scripts/_concat/_concat.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "a4a5b8b5-6a80-4608-8d72-d363ee719bcd", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_concat", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_contains/_contains.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "cf6d1c85-7152-4e6c-9814-5b6fd0a19260", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_contains", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_destroy/_destroy.gml: -------------------------------------------------------------------------------- 1 | /// @func _destroy(object) 2 | /// @desc Destroys the passed in instance 3 | /// @param {Instance} instance The instance to destroy 4 | /* 5 | @example 6 | _destroy(obj_enemy); 7 | 8 | // Destroy all obj_enemy with no health (hasNoHealth is a script) 9 | _map(_filter(_collect(obj_enemy)), hasNoHealth), _destroy); 10 | */ 11 | 12 | with (argument0) { 13 | instance_destroy(); 14 | } 15 | 16 | -------------------------------------------------------------------------------- /src-legacy/scripts/_destroy/_destroy.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "695b8b1b-7f66-473f-aeb5-5d9f1431c1a5", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_destroy", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_difference/_difference.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "cabfe734-b23d-4024-9089-eece7d748037", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_difference", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_difference_by/_difference_by.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "5c31d4b3-4c1b-4687-982e-40832d3e8148", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_difference_by", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_drop/_drop.gml: -------------------------------------------------------------------------------- 1 | /// @func _drop(array, n) 2 | /// @desc Creates a slice of array with n elements dropped from the beginning. 3 | /// @param {Array} array The array to inspect 4 | /// @param {Integer} n The number of elements to drop 5 | /// @returns {Array} The slice of array 6 | /* 7 | @example 8 | var arr = [0, 1, 2, 3]; 9 | _drop(arr, 2); 10 | // => [2, 3]; 11 | */ 12 | 13 | var i; 14 | var n; 15 | var arr; 16 | var len; 17 | var num; 18 | var result; 19 | 20 | arr = argument0; 21 | num = argument1; 22 | 23 | if (num == 0) return arr; 24 | 25 | n = 0; 26 | len = array_length_1d(arr); 27 | result = array_create(clamp(len - num, 0, len)); 28 | 29 | for (i = num; i < len; i++) { 30 | result[n++] = arr[i]; 31 | } 32 | 33 | return result; 34 | -------------------------------------------------------------------------------- /src-legacy/scripts/_drop/_drop.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "ad183422-6cc2-41f7-b74f-76e5e32b1fe7", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_drop", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_drop_right/_drop_right.gml: -------------------------------------------------------------------------------- 1 | /// @func _drop_right(array, n) 2 | /// @desc Creates a slice of array with n elements dropped from the end. 3 | /// @param {Array} array The array to inspect 4 | /// @param {Integer} n The number of elements to drop 5 | /// @returns {Array} The slice of array 6 | /* 7 | @example 8 | var arr = [0, 1, 2, 3]; 9 | _drop_right(arr, 2); 10 | // => [0, 1]; 11 | */ 12 | 13 | var i; 14 | var n; 15 | var arr; 16 | var len; 17 | var num; 18 | var result; 19 | 20 | arr = argument0; 21 | num = argument1; 22 | 23 | if (num == 0) return arr; 24 | 25 | n = 0; 26 | len = array_length_1d(arr) - num; 27 | result = array_create(max(len, 0)); 28 | 29 | for (i = 0; i < len; i++) { 30 | result[n++] = arr[i]; 31 | } 32 | 33 | return result; 34 | -------------------------------------------------------------------------------- /src-legacy/scripts/_drop_right/_drop_right.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "a2848a7b-0ac5-43b6-9310-fa3bdae189ee", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_drop_right", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_error/_error.gml: -------------------------------------------------------------------------------- 1 | /// @func _error(message [, fatal]) 2 | /// @desc When running with the debugger, displays an error window. Otherwise, logs an error using `_log`. 3 | /// @param {String} message The message to error with 4 | /// @param {Boolean} fatal [Optional] If true, will force a show_error() call with `abort` set to true 5 | /// @note Only mark an error as `fatal` if you are okay with it ending your game 6 | /* 7 | @example 8 | _error("This is an error that will let the game continue"); 9 | _error("This is an error that will let the game continue", false); 10 | _error("This is an error that will kill the game", true); 11 | */ 12 | 13 | var message = argument[0]; 14 | var fatal = argument_count > 1 ? argument[1] : false; 15 | 16 | if (fatal || debug_mode) { 17 | show_error(message, fatal); 18 | } else { 19 | _log("ERROR: " + message); 20 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_error/_error.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "8a354fed-f770-4663-b039-2052e1e08f70", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_error", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_fill/_fill.gml: -------------------------------------------------------------------------------- 1 | /// @func _fill(array, value [, start, end]) 2 | /// @desc Fills elements of array with value from start up to, but not including, end. 3 | /// @param {Array} array The array to fill 4 | /// @param {*} value The value with which to fill elements of array 5 | /// @param {Integer} optionalStart The start index 6 | /// @param {Integer} optionalEnd The end index 7 | /// @returns {Array} The filled array 8 | /// @note This method mutates array. 9 | /* 10 | @example 11 | var arr = [0, 1, 2, 3]; 12 | _fill(arr, 4, 1, 3); 13 | // => [0, 4, 4, 3]; 14 | 15 | var arr = [0, 1, 2, 3]; 16 | _fill(arr, 0); 17 | // => [0, 0, 0, 0]; 18 | */ 19 | 20 | var i; 21 | var arr; 22 | var last; 23 | 24 | if (argument_count == 2) { 25 | i = 0; 26 | last = array_length_1d(argument[0]); 27 | } else if (argument_count == 4) { 28 | i = argument[2]; 29 | last = argument[3]; 30 | } else return false; 31 | 32 | arr = argument[0]; 33 | 34 | for (; i < last; i++) { 35 | arr[@ i] = argument[1]; 36 | } 37 | 38 | return arr; 39 | -------------------------------------------------------------------------------- /src-legacy/scripts/_fill/_fill.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "6d89431c-c6b2-444d-92a6-709d7a0e21f8", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_fill", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_filter/_filter.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "10eda2f5-f03f-4f57-83ee-c65c10d22dce", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_filter", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_find/_find.gml: -------------------------------------------------------------------------------- 1 | /// @func _find(array, findScript) 2 | /// @desc Iterates over an array, returning the first element that the given script returns true for. 3 | /// @param {Array} array The array to iterate over 4 | /// @param {Script} findScript The script to run on the given element 5 | /// @returns {*} The first element that returns truthy from the script 6 | /* 7 | @example 8 | _find([0, 1, 2, 3], __equalsThree); 9 | // => 3 10 | */ 11 | 12 | 13 | var n = array_length_1d(argument0); 14 | 15 | for (var i = 0; i < n; i++) { 16 | if (_run(argument1, argument0[@ i])) { 17 | return argument0[@ i]; 18 | } 19 | } 20 | 21 | // Catch empty result 22 | return undefined; 23 | -------------------------------------------------------------------------------- /src-legacy/scripts/_find/_find.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "b340ab46-5d6e-4797-8b0c-07b65051d71d", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_find", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_free/_free.gml: -------------------------------------------------------------------------------- 1 | /// @func _free(id [, ds_type]) 2 | /// @desc Frees a partial function from memory 3 | /// @param {Real} resource The partial ID to free 4 | /// @param {DS_TYPE} optionalType The type of resource to free 5 | /* 6 | @example 7 | var __something = _partial(someScript, 1); 8 | __something(2); 9 | _free(__something); 10 | 11 | */ 12 | 13 | var dsId = argument[0]; 14 | var type; 15 | 16 | if (argument_count == 1) { 17 | type = ds_type_map; 18 | } else { 19 | type = argument[1]; 20 | } 21 | 22 | if (_is_equal(type, "partial")) { 23 | type = ds_type_map; 24 | } 25 | 26 | switch (type) { 27 | case ds_type_map: 28 | ds_map_destroy(dsId); 29 | break; 30 | case ds_type_list: 31 | ds_list_destroy(dsId); 32 | break; 33 | } 34 | 35 | 36 | -------------------------------------------------------------------------------- /src-legacy/scripts/_free/_free.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "19877baf-f9bd-4216-b356-45c2b3bf122e", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_free", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_get/_get.gml: -------------------------------------------------------------------------------- 1 | /// @func _get(map, locationString) 2 | /// @desc Gets a nested value following a dot notation 3 | /// @param {DS_Map} map The map to get data from 4 | /// @param {String} locationString The location of the data to get 5 | /// @returns {Mixed} The data found at the given location 6 | /* 7 | @example 8 | // someMap looks like: 9 | // { nested: {three: {deep: 1}}} 10 | _.get(someMap, 'nested.three.deep'); 11 | // => 1 12 | 13 | */ 14 | 15 | var location = argument1; 16 | var locationArray = _split(location, "."); 17 | var map = argument0; 18 | var n = array_length_1d(locationArray); 19 | var thisLoc; 20 | 21 | for (var i = 0; i < n; i++) { 22 | thisLoc = locationArray[i]; 23 | if (ds_map_exists(map, thisLoc)) { 24 | map = map[? thisLoc]; 25 | } else { 26 | return undefined; 27 | } 28 | } 29 | 30 | return map; 31 | 32 | -------------------------------------------------------------------------------- /src-legacy/scripts/_get/_get.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "acbe9db1-5a5b-4ce1-944c-58cf842a7935", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_get", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_index_of/_index_of.gml: -------------------------------------------------------------------------------- 1 | /// @func _index_of(collection, value) 2 | /// @desc Returns the index of the given item in the given array, or -1 3 | /// @param {Array|DS_List} collection The collection to search 4 | /// @param {*} value The value to look for 5 | /// @returns {Real} The index of the value, or -1 6 | 7 | var collection = argument0; 8 | var search = argument1; 9 | 10 | // Search lists 11 | if (is_real(collection)) { 12 | return ds_list_find_index(collection, search); 13 | } 14 | 15 | // Search arrays 16 | var n = array_length_1d(collection); 17 | 18 | for (var i = 0; i < n; i++) { 19 | if (_is_equal(collection[@ i], search)) { 20 | return i; 21 | } 22 | } 23 | 24 | return -1; 25 | 26 | -------------------------------------------------------------------------------- /src-legacy/scripts/_index_of/_index_of.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "cfac0abc-4609-4eae-a2d7-af54980b51fd", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_index_of", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_intersection/_intersection.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "81c329de-8b88-4780-91cf-0bd3ee674f78", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_intersection", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_intersection_by/_intersection_by.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "29c5c198-489e-44d7-8492-800559d1e396", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_intersection_by", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_is_equal/_is_equal.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "78a96032-6d47-40a1-94e8-dcb78178a134", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_is_equal", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_join/_join.gml: -------------------------------------------------------------------------------- 1 | /// @func _join(array, joinChar) 2 | /// @desc Returns a string of the given array combined with the given joiner 3 | /// @param {Array} array The array to join 4 | /// @param {String} joinChar The character to join by 5 | /// @returns {String} The joined array 6 | /* 7 | @example 8 | var arr = ['hello', 'world']; 9 | _join(arr, ' '); 10 | // => 'hello world' 11 | 12 | var arr = ['Peter', 'Paul', 'Mary']; 13 | _join(arr, ', '); 14 | // => 'Peter, Paul, Mary'; 15 | */ 16 | 17 | var outString = ""; 18 | var inArray = argument0; 19 | var joiner = argument1; 20 | 21 | var arrLength = array_length_1d(inArray); 22 | var maxIndex = arrLength - 1; 23 | var stringJoiner = string(joiner); 24 | 25 | for (var i = 0; i < arrLength; i++) { 26 | outString += string(inArray[@ i]); 27 | 28 | if (i != maxIndex) { 29 | outString += stringJoiner; 30 | } 31 | } 32 | 33 | return outString; 34 | 35 | 36 | -------------------------------------------------------------------------------- /src-legacy/scripts/_join/_join.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "69828e54-01dd-4a2a-b789-7e999d214dca", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_join", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_keys/_keys.gml: -------------------------------------------------------------------------------- 1 | /// @func _keys(map) 2 | /// @desc Returns an array contains all keys in a ds_map. Order is not guaranteed due to how ds_maps are stored. 3 | /// @param {DS_Map} map The map to get the keys from 4 | /// @returns {Array} An array of all keys in the map 5 | /* 6 | @example 7 | var map = ds_map_create(); 8 | ds_map_add(map, 'hello', 'world'); 9 | ds_map_add(map, 'health', 100); 10 | 11 | _keys(map); 12 | // => ['hello', 'health'] 13 | 14 | */ 15 | 16 | var map = argument0; 17 | var nextKey = ds_map_find_first(map); 18 | var nextInd = 0; 19 | var keys = []; 20 | 21 | while (!is_undefined(nextKey)) { 22 | keys[nextInd++] = nextKey; 23 | nextKey = ds_map_find_next(map, nextKey); 24 | } 25 | 26 | return keys; 27 | 28 | -------------------------------------------------------------------------------- /src-legacy/scripts/_keys/_keys.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "f008e78e-dd51-41d2-bb3d-95199a8e7c3c", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_keys", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_length/_length.gml: -------------------------------------------------------------------------------- 1 | /// @func _length(collectionOrString) 2 | /// @desc Returns the length of the given array or ds_list 3 | /// @param {Array|DS_List} collection The collection to determine the length of 4 | /// @returns {Real} The length of the collection 5 | /* 6 | @example 7 | _length([1, 2, 3, 4]); 8 | // => 4 9 | 10 | _length(some_list_id_of_size_5); 11 | // => 5 12 | */ 13 | 14 | if (is_undefined(argument0)) { 15 | return 0; 16 | } 17 | 18 | if (_type_of(argument0) == "array") { 19 | return array_length_1d(argument0); 20 | } else if (_type_of(argument0) == "real" && ds_exists(argument0, ds_type_list)) { 21 | return ds_list_size(argument0); 22 | } else if (_type_of(argument0) == "string") { 23 | return string_length(argument0); 24 | } 25 | 26 | return 0; 27 | 28 | -------------------------------------------------------------------------------- /src-legacy/scripts/_length/_length.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "dbd1ee41-adb8-45ec-b8bd-1098a1541bc0", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_length", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_list_of/_list_of.gml: -------------------------------------------------------------------------------- 1 | /// @func _list_of(values...) 2 | /// @desc Returns a DS_List containing the provided values. This DS_List should be destroyed as you would any other DS. 3 | /// @param {*} values... As many starting values for the list as desired 4 | /// @returns {DS_List} A new DS_List containing the provided values 5 | /* 6 | @example 7 | 8 | var list = _list_of(1, 2, 3, 4); 9 | _log(list[| 2]) // logs 3 10 | */ 11 | 12 | var list = ds_list_create(); 13 | 14 | for (var i = 0; i < argument_count; i++) { 15 | ds_list_add(list, argument[i]); 16 | } 17 | 18 | return list; -------------------------------------------------------------------------------- /src-legacy/scripts/_list_of/_list_of.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "3ed75ec2-5722-4eb3-926c-d94b33649e3f", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_list_of", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_log/_log.gml: -------------------------------------------------------------------------------- 1 | /// @func _log(values...) 2 | /// @desc Convenience method for show_debug_message(). Automatically convetrs arguments to strings. 3 | /// @param {Mixed} Messages... The message or value to log 4 | 5 | var toshow = ""; 6 | for (var i = 0; i < argument_count; i++) { 7 | 8 | if (i != 0) { 9 | toshow += ", "; 10 | } 11 | 12 | if (is_array(argument[i])) { 13 | toshow += "[" + _join(argument[i],", ") + "]"; 14 | } else { 15 | toshow += string(argument[i]); 16 | } 17 | } 18 | 19 | show_debug_message(toshow); -------------------------------------------------------------------------------- /src-legacy/scripts/_log/_log.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "40753ca5-3efd-4c93-b4b8-ee4bd601c676", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_log", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_map/_map.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "e873aad6-9ebf-4686-823d-72033eff542a", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_map", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_map_of/_map_of.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "06a27fe3-58c5-4c6a-8990-5cf80eda9fdf", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_map_of", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_nth/_nth.gml: -------------------------------------------------------------------------------- 1 | /// @func _nth(collection, index) 2 | /// @desc Returns the nth index of the given array or ds_list. If n is negative, the nth element from the end is returned. 3 | /// @param collection 4 | /// @param n 5 | 6 | var collection = argument0; 7 | var n = argument1; 8 | var type = _type_of(collection); 9 | 10 | 11 | if (type == "real") { 12 | if (n >= 0) { 13 | return collection[| n]; 14 | } else { 15 | return collection[| ds_list_size(collection) + n]; 16 | } 17 | } else if (type == "array") { 18 | if (n >= 0) { 19 | return collection[@ n]; 20 | } else { 21 | return collection[@ array_length_1d(collection) + n]; 22 | } 23 | } else { 24 | show_error("Trying to return nth element of an incorrect type: " + type + "\nCollection must be a ds_list or array.", false); 25 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_nth/_nth.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "e8b3e4ac-cefc-43b3-85d8-b8668d14ef8f", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_nth", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_or/_or.gml: -------------------------------------------------------------------------------- 1 | /// @func _or(valueA, valueB) 2 | /// @desc Returns the value of the provided arguments after a boolean OR 3 | /// @param {*} valueA Some first input 4 | /// @param {*} valueB A value to || the first input with 5 | /// @returns {Boolean} The value of the provided arguments after an || 6 | /* 7 | @example 8 | _or(true, true); 9 | // => true 10 | 11 | _or(false, true); 12 | // => true 13 | 14 | _or(false, false); 15 | // => false 16 | 17 | */ 18 | gml_pragma("forceinline"); 19 | return argument0 || argument1; 20 | 21 | -------------------------------------------------------------------------------- /src-legacy/scripts/_or/_or.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "57f78abd-c504-4760-9308-eae1d4712394", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_or", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_partial/_partial.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "b5cea827-b3fd-48e4-9686-ccb08fd5d898", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_partial", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_push/_push.gml: -------------------------------------------------------------------------------- 1 | /// @func _push(array, value) 2 | /// @desc Adds a value to the end of an array 3 | /// @param {Array} array The array to add the value to 4 | /// @param {*} value The value to add 5 | /// @returns {Array} The array with the value added 6 | /* 7 | @example 8 | _push([1, 2], 3); 9 | // => [1, 2, 3] 10 | */ 11 | 12 | gml_pragma("forceinline"); 13 | argument0[@ array_length_1d(argument0)] = argument1; 14 | return argument0; 15 | 16 | -------------------------------------------------------------------------------- /src-legacy/scripts/_push/_push.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "bd7bc958-28aa-43a9-8251-81041ca0b631", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_push", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_reduce/_reduce.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "477b2a17-84c8-4ddc-ba07-345ab325cd4f", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_reduce", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_reverse/_reverse.gml: -------------------------------------------------------------------------------- 1 | /// @func _reverse(array) 2 | /// @desc Reverses the order of elements in array. 3 | /// @param {Array} array The array to modify 4 | /// @returns {Array} The reversed array 5 | /// @note This method mutates the input array. To create a new array instead, use `_backward` 6 | /* 7 | @example 8 | var arr = [0, 1, 2]; 9 | _reverse(arr); 10 | // => [2, 1, 0]; 11 | */ 12 | 13 | var i; 14 | var arr; 15 | var half; 16 | var len; 17 | var tmp; 18 | 19 | arr = argument0; 20 | len = array_length_1d(arr); 21 | half = len div 2; 22 | 23 | for (i = 0; i < half; i++) { 24 | tmp = arr[@ i]; 25 | arr[@ i] = arr[@ len - 1 - i]; 26 | arr[@ len - 1 - i] = tmp; 27 | } 28 | 29 | return arr; 30 | -------------------------------------------------------------------------------- /src-legacy/scripts/_reverse/_reverse.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "a6b523a8-9863-4b43-b7d2-d0490d07f636", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_reverse", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_run/_run.gml: -------------------------------------------------------------------------------- 1 | /// @func _run(scriptOrPartial, arguments...) 2 | /// @desc Executes a script or partial with the provided arguments 3 | /// @param {Script|Real} scriptOrPartial The script to run or the ID of the partial to run 4 | /// @param {*} arguments... Arguments to pass the script 5 | /// @returns {*} The return value of the script 6 | /* 7 | @example 8 | _run(_add, 1, 2); 9 | // => 3 10 | 11 | var addTwo = _partial(_add, 2); 12 | _run(addTwo, 1); 13 | // => 3 14 | */ 15 | 16 | var func = argument[0]; 17 | var args = undefined; 18 | 19 | for (var i = argument_count-1; i >= 1; i--) { 20 | args[i - 1] = argument[i]; 21 | } 22 | 23 | // Check if func is a partial (map with 'partial' set to 'partial'); 24 | if (ds_exists(func, ds_type_map) && _is_equal(ds_map_find_value(func, "partial"), "partial")) { 25 | var partialId = func; 26 | func = ds_map_find_value(partialId, "function"); 27 | args = _concat(ds_map_find_value(partialId, "args"), args); 28 | } 29 | 30 | return _spread(func, args); 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src-legacy/scripts/_run/_run.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "13bccc1f-b0d5-4ec9-aed0-4ec8f6d5078e", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_run", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_set/_set.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "46c29120-6d6b-44ea-86b8-afacfb700cae", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_set", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_slice/_slice.gml: -------------------------------------------------------------------------------- 1 | /// @func _slice(array, start [, end]) 2 | /// @desc Creates a slice of array from start up to, but not including, end. 3 | /// @param {Array} array The array to slice 4 | /// @param {Integer} start Index to start the slice 5 | /// @param {Integer} end(optional) Index up to which to make the slice, defaults to end of array. 6 | /// @returns {Array} The sliced array 7 | /* 8 | @example 9 | var myArray = [1, 2, 3, 4]; 10 | var slicedArray = _slice(myArray, 1, 3); 11 | _is_equal([2, 3], slicedArray) 12 | // => true 13 | */ 14 | 15 | var result; 16 | var array = argument[0]; 17 | var starti = argument[1]; 18 | var endi = 0; 19 | 20 | if (argument_count == 3) { 21 | endi = argument[2]; 22 | } else { 23 | endi = array_length_1d(array); 24 | } 25 | 26 | for (var i = endi - 1; i >= starti; i--) { 27 | result[i-starti] = array[@ i]; 28 | } 29 | 30 | return result; 31 | -------------------------------------------------------------------------------- /src-legacy/scripts/_slice/_slice.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "afacb44e-b26f-4211-bd5f-175ffd3f6677", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_slice", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_split/_split.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "a1387e7d-9ef7-458e-8194-e706a534715b", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_split", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_spread/_spread.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "8d7b1a7b-dadd-486c-9b21-deffc695e159", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_spread", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_times/_times.gml: -------------------------------------------------------------------------------- 1 | /// @func _times(script) 2 | /// @desc Returns an array of the result of a function run the given number of times 3 | /// @param {Real} executeCount The number of times to execute the function 4 | /// @param {Script} script The script to execute 5 | /// @returns {Array} An array of the script results 6 | /* 7 | @example 8 | _times(3, returnTheValue5); 9 | // => [5, 5, 5]; 10 | 11 | */ 12 | 13 | var count = argument0; 14 | var func = argument1; 15 | var arr; 16 | 17 | arr[count-1] = 0; 18 | 19 | for (var i = 0; i < count; i++) { 20 | arr[i] = _run(func, i); 21 | } 22 | 23 | return arr; 24 | 25 | -------------------------------------------------------------------------------- /src-legacy/scripts/_times/_times.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "eeb441d7-af5e-4ceb-a389-32557c90856f", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_times", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_to_array/_to_array.gml: -------------------------------------------------------------------------------- 1 | /// @func _to_array(list) 2 | /// @desc Converts the given ds_list to an array 3 | /// @param list 4 | /// @note If the given list is of size 0, this will return undefined. 5 | 6 | var list = argument0; 7 | var listSize = ds_list_size(list); 8 | var array; 9 | array[0] = undefined; 10 | 11 | for (var i = listSize - 1; i >= 0; i--) { 12 | array[i] = list[| i]; 13 | } 14 | 15 | if (is_undefined(array[0])) { 16 | return undefined; 17 | } 18 | 19 | return array; -------------------------------------------------------------------------------- /src-legacy/scripts/_to_array/_to_array.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "da7da0f1-1a2d-47c9-955b-587d639ca46a", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_to_array", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_to_list/_to_list.gml: -------------------------------------------------------------------------------- 1 | /// @func _to_list(array) 2 | /// @desc Converts the given array to a new ds_list 3 | /// @param array 4 | /// Note: This creates a ds_list resource which should be destroyed with ds_list_destroy when it is no longer needed. 5 | /* 6 | @example 7 | var input = ["hello", "world", 10]; 8 | var list = _to_list(input); 9 | list[| 0]; // "hello" 10 | list[| 1]; // "world" 11 | list[| 2]; // 10 12 | */ 13 | 14 | var arr = argument0; 15 | var arrSize = array_length_1d(arr); 16 | var list = ds_list_create(); 17 | 18 | for (var i = 0; i < arrSize; i++) { 19 | ds_list_add(list, arr[@ i]); 20 | } 21 | 22 | return list; -------------------------------------------------------------------------------- /src-legacy/scripts/_to_list/_to_list.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "35e69a0a-ad8c-4689-b731-ed623b41cf4f", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_to_list", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_type_of/_type_of.gml: -------------------------------------------------------------------------------- 1 | /// @func _type_of(value) 2 | /// @desc Returns the variable type of the given argument as a string. 3 | /// @note Works exactly as the native typeof(), though refers to `number` as `real` to be more consistent with GM:S terminology 4 | /// @param {*} value A variable to check the type of 5 | /// @returns {String} The type of the variable as a human readable string 6 | /* 7 | @example 8 | 9 | _type_of(1); 10 | // => "real" 11 | 12 | _type_of("hello"); 13 | // => "string" 14 | 15 | var arr; 16 | arr[0] = 1; arr[1] = 2; 17 | _type_of(arr); 18 | // => "array" 19 | 20 | _type_of(undefined); 21 | // => "undefined"; 22 | 23 | _type_of(sprite_get_texture(spr_player, 1)); 24 | // => "ptr"; 25 | */ 26 | 27 | var type = typeof(argument0) 28 | return type == "number" ? "real" : type; -------------------------------------------------------------------------------- /src-legacy/scripts/_type_of/_type_of.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "1ba92935-c21d-4159-91a1-0a778afcbcf6", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_type_of", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_union/_union.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "120574fd-7f32-42b6-a7bd-bd1d337eda3a", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_union", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_union_by/_union_by.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "aaddf501-f581-440e-a652-6eb79cb6b4ec", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_union_by", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_uniq/_uniq.gml: -------------------------------------------------------------------------------- 1 | /// @func _uniq(array) 2 | /// @desc Returns an array with all duplicate values removed 3 | /// @param {Array} array An array with duplicate values 4 | /// @returns {Array} An array with the duplicate values removed 5 | /* 6 | @example 7 | _uniq([1, 1, 2, 3]); 8 | // => [1, 2, 3] 9 | */ 10 | 11 | var arr = argument0; 12 | var n = array_length_1d(arr); 13 | var j = 0; 14 | var result = undefined; 15 | var seenMap = ds_map_create(); 16 | 17 | if (array_length_1d(arr) <= 1) { 18 | return arr; 19 | } 20 | 21 | for (var i = 0; i < n; i++) { 22 | var val = arr[@ i]; 23 | if (is_undefined(seenMap[? val])) { 24 | seenMap[? val] = true; 25 | result[j++] = val; 26 | } 27 | } 28 | 29 | ds_map_destroy(seenMap); 30 | 31 | return result; 32 | 33 | 34 | -------------------------------------------------------------------------------- /src-legacy/scripts/_uniq/_uniq.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "ec3ab82c-0beb-45ba-97e5-236df32ca017", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_uniq", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_unzip/_unzip.gml: -------------------------------------------------------------------------------- 1 | /// @func _unzip(array) 2 | /// @desc From a zipped two-dimensional array, creates a collection of grouped elements by regrouping the elements to their pre-zipped configuration 3 | /// @param {Array} array The zipped two-dimensional array 4 | /// @returns {Array} The two-dimensional array of regrouped elements 5 | /* 6 | @example 7 | var arr0 = [0, 1, 2]; 8 | var arr1 = [3, 4, 5]; 9 | var arr2 =_zip(arr0, arr1); 10 | _unzip(arr2); 11 | // => [[0, 1, 2], [3, 4, 5]]; 12 | 13 | */ 14 | 15 | if (argument_count != 1) return array_create(0); 16 | 17 | var i; 18 | var j; 19 | var arr; 20 | var len; 21 | var num; 22 | var result; 23 | 24 | arr = argument0; 25 | len = array_height_2d(arr); 26 | num = array_length_2d(arr, 0); 27 | result = array_create(len); 28 | 29 | for (i = num - 1; i >= 0; i--) { 30 | for (j = len - 1; j >= 0; j--) { 31 | result[i, j] = arr[j, i]; 32 | } 33 | } 34 | 35 | return result; 36 | -------------------------------------------------------------------------------- /src-legacy/scripts/_unzip/_unzip.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "e2bca758-18d1-400f-8fe0-7a3d77d83655", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_unzip", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_without/_without.gml: -------------------------------------------------------------------------------- 1 | /// @func _without(array, values...) 2 | /// @desc Creates an array excluding all given values from amongst the elements of the given array 3 | /// @param {Array} array The array to inspect 4 | /// @param {*} values... The values to exclude 5 | /// @returns {Array} The array of filtered elements 6 | /* 7 | @example 8 | var arr = [0, 1, 0, 2]; 9 | _without(arr, 0, 1); 10 | // => [2]; 11 | */ 12 | 13 | if (argument_count == 0) return array_create(0); 14 | if (argument_count == 1) return argument[0]; 15 | 16 | var i; 17 | var j; 18 | var n; 19 | var arr; 20 | var match; 21 | var len; 22 | var result; 23 | 24 | n = 0; 25 | arr = argument[0]; 26 | len = array_length_1d(arr); 27 | result = array_create(0); 28 | 29 | for (i = 0; i < len; i++) { 30 | match = false; 31 | for (j = 1; j < argument_count; j++) { 32 | if (arr[i] == argument[j]) { 33 | match = true; 34 | } 35 | } 36 | if (!match) { 37 | result[n++] = arr[i]; 38 | } 39 | } 40 | 41 | return result; 42 | -------------------------------------------------------------------------------- /src-legacy/scripts/_without/_without.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "8d8a9d6e-af78-4037-9e5b-a78bdc24dcac", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_without", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/_zip/_zip.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "0ed1f92e-cf2d-4dda-9ea7-6b290b55eaf0", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "_zip", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/add/add.gml: -------------------------------------------------------------------------------- 1 | return argument0 + argument1; 2 | -------------------------------------------------------------------------------- /src-legacy/scripts/add/add.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "71fc0e7e-ac29-4c46-920e-a07621c9158d", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "add", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/assert/assert.gml: -------------------------------------------------------------------------------- 1 | /// @desc Convenience method for assert_is_true 2 | /// @param Value 3 | /// @param OptionalMessage 4 | if (argument_count > 1) { 5 | assert_is_true(argument[0], argument[1]); 6 | } else { 7 | assert_is_true(argument[0]); 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/assert/assert.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "e92bff8e-c7f9-4b62-99dd-7c2c8e34a8c5", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "assert", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/assert_does_not_exist/assert_does_not_exist.gml: -------------------------------------------------------------------------------- 1 | /// @desc Ensures the passed in object/instance does not exist in this room 2 | /// @param Object 3 | 4 | global.gamatas_testAssertNumber++; 5 | if (instance_exists(argument0)) { 6 | 7 | if (argument_count > 1) { 8 | msg = argument[1]; 9 | } else { 10 | msg = gamatas_create_assert_error(string(argument[0]) + " should not exist"); 11 | } 12 | test_fail(msg); 13 | } 14 | -------------------------------------------------------------------------------- /src-legacy/scripts/assert_does_not_exist/assert_does_not_exist.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "b32257d4-ac63-4961-93cd-d23f41da4deb", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "assert_does_not_exist", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/assert_equal/assert_equal.gml: -------------------------------------------------------------------------------- 1 | /// @desc Ensures the passed values are equal 2 | /// @param TestValue 3 | /// @param ExpectedValue 4 | /// @param OptionalMessage 5 | 6 | global.gamatas_testAssertNumber++; 7 | if (argument[0] != argument[1]) { 8 | 9 | var msg; 10 | if (argument_count > 2) { 11 | msg = argument[2]; 12 | } else { 13 | msg = gamatas_create_assert_error(string(argument[0]) + " is not " + string(argument[1])); 14 | } 15 | test_fail(msg); 16 | } 17 | -------------------------------------------------------------------------------- /src-legacy/scripts/assert_equal/assert_equal.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "c62a30c7-6d70-4a19-840a-e14fc2b00f30", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "assert_equal", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/assert_exists/assert_exists.gml: -------------------------------------------------------------------------------- 1 | /// @desc Ensures the passed in object/instance exists 2 | /// @param Object 3 | global.gamatas_testAssertNumber++; 4 | if (!instance_exists(argument0)) { 5 | var msg; 6 | 7 | if (argument_count > 1) { 8 | msg = argument[1]; 9 | } else { 10 | msg = gamatas_create_assert_error(string(argument[0]) + " has no instances"); 11 | } 12 | test_fail(msg); 13 | } 14 | -------------------------------------------------------------------------------- /src-legacy/scripts/assert_exists/assert_exists.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "b5ad72d1-0993-40f4-9fee-e88d67c9f7c7", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "assert_exists", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/assert_is_false/assert_is_false.gml: -------------------------------------------------------------------------------- 1 | /// @desc Asserts that the passed in argument is false 2 | /// @param Value 3 | /// @param OptionalMessage 4 | 5 | if (argument_count > 1) { 6 | assert_equal(argument[0], false, argument[1]); 7 | } else { 8 | assert_equal(argument[0], false); 9 | } -------------------------------------------------------------------------------- /src-legacy/scripts/assert_is_false/assert_is_false.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "eb59c611-ad90-4091-9ff8-890fa38a3b2c", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "assert_is_false", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/assert_is_true/assert_is_true.gml: -------------------------------------------------------------------------------- 1 | /// @desc Asserts that the passed in argument is true 2 | /// @param Value 3 | /// @param OptionalMessage 4 | 5 | if (argument_count > 1) { 6 | assert_equal(argument[0], true, argument[1]); 7 | } else { 8 | assert_equal(argument[0], true); 9 | } -------------------------------------------------------------------------------- /src-legacy/scripts/assert_is_true/assert_is_true.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "3b7a5125-87e3-472c-bcea-6eb7ac80de75", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "assert_is_true", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/assert_is_undefined/assert_is_undefined.gml: -------------------------------------------------------------------------------- 1 | /// @desc Ensures the passed in argument is undefined 2 | /// @param TestValue 3 | /// @param OptionalMessage 4 | 5 | global.gamatas_testAssertNumber++; 6 | if (!is_undefined(argument[0])) { 7 | 8 | var msg; 9 | if (argument_count > 1) { 10 | msg = argument[1]; 11 | } else { 12 | msg = gamatas_create_assert_error(string(argument[0]) + " is not undefined."); 13 | } 14 | test_fail(msg); 15 | } 16 | -------------------------------------------------------------------------------- /src-legacy/scripts/assert_is_undefined/assert_is_undefined.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "0867ed85-c521-436c-b709-460351015c08", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "assert_is_undefined", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/assert_not_equal/assert_not_equal.gml: -------------------------------------------------------------------------------- 1 | /// @desc Ensures the passed in values are not equal 2 | /// @param TestValue 3 | /// @param UnexpectedValue 4 | /// @param OptionalMessage 5 | 6 | global.gamatas_testAssertNumber++; 7 | if (argument[0] == argument[1]) { 8 | var msg = ""; 9 | 10 | if (argument_count > 2) { 11 | msg = argument[2]; 12 | } else { 13 | msg = gamatas_create_assert_error(string(argument[0]) + " shouldn\'t be " + string(argument[1])); 14 | } 15 | test_fail(msg); 16 | } 17 | -------------------------------------------------------------------------------- /src-legacy/scripts/assert_not_equal/assert_not_equal.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "66f29b20-fcc2-4666-a728-ab9cc5f5754e", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "assert_not_equal", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/double/double.gml: -------------------------------------------------------------------------------- 1 | return argument0 * 2; 2 | -------------------------------------------------------------------------------- /src-legacy/scripts/double/double.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "a44c3458-a344-402c-8fd1-6eff64583bc8", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "double", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/gamatas_create_assert_error/gamatas_create_assert_error.gml: -------------------------------------------------------------------------------- 1 | /* 2 | * Helper method for asserts to create standardized error 3 | * messages. Not meant for external use. 4 | */ 5 | return "ASSERT ERROR - " + string(argument0) + " - ASSERT #" + string(global.gamatas_testAssertNumber); 6 | -------------------------------------------------------------------------------- /src-legacy/scripts/gamatas_create_assert_error/gamatas_create_assert_error.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "9f9cb746-17e1-42a8-9b2b-b82d330890a3", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "gamatas_create_assert_error", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/gamatas_info/gamatas_info.gml: -------------------------------------------------------------------------------- 1 | /* 2 | * Simplified logging. Prints all arguments to the output console. 3 | * If you are not using a version of GameMaker with an output console, you 4 | * may want to edit this script to output to a file or something else. 5 | */ 6 | var output = string(argument[0]); 7 | for (var i = 1; i < argument_count; i++) { 8 | output += " " + string(argument[i]) 9 | } 10 | show_debug_message(output); 11 | -------------------------------------------------------------------------------- /src-legacy/scripts/gamatas_info/gamatas_info.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "b7a6c2ff-4962-4c6a-a173-b1d9a4b4db17", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "gamatas_info", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/greaterThanThree/greaterThanThree.gml: -------------------------------------------------------------------------------- 1 | return argument0 > 3; 2 | -------------------------------------------------------------------------------- /src-legacy/scripts/greaterThanThree/greaterThanThree.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "73ab2ea6-b1dd-40ce-9fb0-1356bcff5f3e", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "greaterThanThree", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/isEven/isEven.gml: -------------------------------------------------------------------------------- 1 | return (argument0 % 2) == 0; 2 | -------------------------------------------------------------------------------- /src-legacy/scripts/isEven/isEven.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "6674cf91-7ea3-4e59-9ebf-1f0caf512692", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "isEven", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/native_floor/native_floor.gml: -------------------------------------------------------------------------------- 1 | return floor(argument0); -------------------------------------------------------------------------------- /src-legacy/scripts/native_floor/native_floor.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "3c3a3065-afd7-43ae-a56c-3737e596aaec", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "native_floor", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/returnFour/returnFour.gml: -------------------------------------------------------------------------------- 1 | return 4; -------------------------------------------------------------------------------- /src-legacy/scripts/returnFour/returnFour.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "b4af5c47-5e7e-4154-b1bd-ccf86a7504ae", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "returnFour", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/sum/sum.gml: -------------------------------------------------------------------------------- 1 | var total = argument[0]; 2 | var addMe = argument[1]; 3 | 4 | if (_type_of(total) == "undefined") { 5 | return addMe; 6 | } else { 7 | return total + addMe; 8 | } 9 | -------------------------------------------------------------------------------- /src-legacy/scripts/sum/sum.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "2e2daba8-4764-4076-8526-b2528785accc", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "sum", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/test_end/test_end.gml: -------------------------------------------------------------------------------- 1 | /* 2 | * Concludes an individual test in a test suite. 3 | * If the test passed, prints a success message and moves on 4 | * to the next test, otherwise, fails the test and exits. 5 | */ 6 | if (global.gamatas_testPassed) { 7 | gamatas_info("TEST PASSED: " + global.gamatas_testName); 8 | test_next(); 9 | } else { 10 | gamatas_info("TEST FAILED: " + global.gamatas_testName); 11 | gamatas_info("TEST SUITE FAILED: " + global.gamatas_testSuiteName); 12 | game_end(); 13 | } 14 | -------------------------------------------------------------------------------- /src-legacy/scripts/test_end/test_end.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "4661396e-c309-4810-a304-19ae7e55020d", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "test_end", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/test_fail/test_fail.gml: -------------------------------------------------------------------------------- 1 | /// @param Message 2 | /* 3 | * Fails a test, printing the message and test info. This is used 4 | * internally by asserts, but can also be used to manually fail 5 | * tests if need be. 6 | */ 7 | var msg = argument0; 8 | gamatas_info(msg); 9 | gamatas_info("In suite " + global.gamatas_testSuiteName); 10 | gamatas_info("In test " + global.gamatas_testName + ": " + global.gamatas_testDescription); 11 | global.gamatas_testPassed = false; 12 | -------------------------------------------------------------------------------- /src-legacy/scripts/test_fail/test_fail.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "aa10c8c9-61fd-4c64-8f0c-020a594c89ae", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "test_fail", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/test_next/test_next.gml: -------------------------------------------------------------------------------- 1 | /* 2 | * Kicks off the next test in a suite (the next user defined 3 | * action). Used internally in end_test(). Use directly with 4 | * caution, as this is not supported for direct developer use 5 | * within the test automation suite. 6 | */ 7 | event_user(global.gamatas_testNumber++); 8 | -------------------------------------------------------------------------------- /src-legacy/scripts/test_next/test_next.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "996403d5-3dc3-4db4-b513-6322da671b2c", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "test_next", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/test_start/test_start.gml: -------------------------------------------------------------------------------- 1 | /// @param Name 2 | /// @param Description 3 | /* 4 | * Sets the description of the currently running test or exits 5 | * if the previous test fails. Use this to define specific tests 6 | * within a given test suite. 7 | * Example: 8 | * describe("Player Death", "The player should die at 0 health"); 9 | */ 10 | if (global.gamatas_testPassed) { 11 | global.gamatas_testName = argument0; 12 | global.gamatas_testDescription = argument1; 13 | global.gamatas_testCount++; 14 | } else { 15 | game_end(); 16 | } 17 | -------------------------------------------------------------------------------- /src-legacy/scripts/test_start/test_start.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "203fea1b-cc99-4761-80c1-c5638ed06219", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "test_start", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/test_suite_init/test_suite_init.gml: -------------------------------------------------------------------------------- 1 | /// @param TestSuiteName 2 | /* 3 | * Initializes a test in an empty room 4 | */ 5 | global.gamatas_testPassed = true; 6 | global.gamatas_testCount = 0; 7 | global.gamatas_testSuiteName = argument0; 8 | global.gamatas_testNumber = 0; 9 | global.gamatas_testAssertNumber = 0; 10 | gamatas_info("TESTING SUITE: " + argument0); 11 | test_next(); 12 | -------------------------------------------------------------------------------- /src-legacy/scripts/test_suite_init/test_suite_init.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "a0f14370-d8cd-40df-8d1e-c4e5bda1652c", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "test_suite_init", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/scripts/test_suite_pass/test_suite_pass.gml: -------------------------------------------------------------------------------- 1 | /* 2 | * Finishes the test suite and moves on if there are more tests/rooms, 3 | * otherwise, quits. This should be called by itself in the last user 4 | * defined action on your test controller object. 5 | */ 6 | gamatas_info("TEST SUITE PASSED: " + global.gamatas_testSuiteName); 7 | if (room != room_last) { 8 | room_goto_next(); 9 | } else { 10 | gamatas_info("ALL TESTS PASSING"); 11 | game_end(); 12 | } 13 | -------------------------------------------------------------------------------- /src-legacy/scripts/test_suite_pass/test_suite_pass.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "a2a1d716-72c2-48f6-a6d7-233361694051", 3 | "modelName": "GMScript", 4 | "mvc": "1.0", 5 | "name": "test_suite_pass", 6 | "IsCompatibility": false, 7 | "IsDnD": false 8 | } -------------------------------------------------------------------------------- /src-legacy/views/03e6bf78-c9fc-4f10-9549-7dc253ca0bfc.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "03e6bf78-c9fc-4f10-9549-7dc253ca0bfc", 3 | "modelName": "GMFolder", 4 | "mvc": "1.1", 5 | "name": "03e6bf78-c9fc-4f10-9549-7dc253ca0bfc", 6 | "children": [ 7 | "a44c3458-a344-402c-8fd1-6eff64583bc8", 8 | "71fc0e7e-ac29-4c46-920e-a07621c9158d", 9 | "2e2daba8-4764-4076-8526-b2528785accc", 10 | "73ab2ea6-b1dd-40ce-9fb0-1356bcff5f3e", 11 | "6674cf91-7ea3-4e59-9ebf-1f0caf512692", 12 | "b4af5c47-5e7e-4154-b1bd-ccf86a7504ae", 13 | "3c3a3065-afd7-43ae-a56c-3737e596aaec" 14 | ], 15 | "filterType": "GMScript", 16 | "folderName": "unit test", 17 | "isDefaultView": false, 18 | "localisedFolderName": "" 19 | } -------------------------------------------------------------------------------- /src-legacy/views/06188c03-8a58-4be1-b30b-7286b73779ee.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "06188c03-8a58-4be1-b30b-7286b73779ee", 3 | "modelName": "GMFolder", 4 | "mvc": "1.1", 5 | "name": "06188c03-8a58-4be1-b30b-7286b73779ee", 6 | "children": [ 7 | 8 | ], 9 | "filterType": "GMTileSet", 10 | "folderName": "tilesets", 11 | "isDefaultView": false, 12 | "localisedFolderName": "ResourceTree_Tilesets" 13 | } -------------------------------------------------------------------------------- /src-legacy/views/28492427-9ce2-484c-87ab-39ecd3479df0.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "28492427-9ce2-484c-87ab-39ecd3479df0", 3 | "modelName": "GMFolder", 4 | "mvc": "1.1", 5 | "name": "28492427-9ce2-484c-87ab-39ecd3479df0", 6 | "children": [ 7 | "4b2720a1-e8f2-435e-b526-fecdfa79b961" 8 | ], 9 | "filterType": "GMScript", 10 | "folderName": "lib", 11 | "isDefaultView": false, 12 | "localisedFolderName": "" 13 | } -------------------------------------------------------------------------------- /src-legacy/views/2c55db64-9b48-4e9d-946e-d61128133698.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "2c55db64-9b48-4e9d-946e-d61128133698", 3 | "modelName": "GMFolder", 4 | "mvc": "1.1", 5 | "name": "2c55db64-9b48-4e9d-946e-d61128133698", 6 | "children": [ 7 | "ed6a955d-5826-4f98-a450-10b414266c27", 8 | "a9188620-a624-4a5a-83ae-a1b53faf038b", 9 | "cc98d028-7bdd-4680-85f3-c87a7baa481e", 10 | "f418569b-3bdd-4706-a0e4-364317f54032" 11 | ], 12 | "filterType": "GMOptions", 13 | "folderName": "options", 14 | "isDefaultView": false, 15 | "localisedFolderName": "ResourceTree_Options" 16 | } -------------------------------------------------------------------------------- /src-legacy/views/3d4c1a45-cb51-440d-93f7-4508fb15da2d.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "3d4c1a45-cb51-440d-93f7-4508fb15da2d", 3 | "modelName": "GMFolder", 4 | "mvc": "1.1", 5 | "name": "3d4c1a45-cb51-440d-93f7-4508fb15da2d", 6 | "children": [ 7 | 8 | ], 9 | "filterType": "GMSprite", 10 | "folderName": "sprites", 11 | "isDefaultView": false, 12 | "localisedFolderName": "ResourceTree_Sprites" 13 | } -------------------------------------------------------------------------------- /src-legacy/views/3df7296c-6ac7-4b71-8f67-7202521cb283.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "3df7296c-6ac7-4b71-8f67-7202521cb283", 3 | "modelName": "GMFolder", 4 | "mvc": "1.1", 5 | "name": "3df7296c-6ac7-4b71-8f67-7202521cb283", 6 | "children": [ 7 | "e80bc793-727b-4912-80cd-2a9381ae60e5", 8 | "0c09150c-1f43-47b1-b6ca-1bb744358609", 9 | "ffc8f9ff-847a-4442-8dca-835f728e67dc", 10 | "a8d78ff5-6a68-4b17-beec-18da9ec528d7", 11 | "b6c6bba7-1e78-4b34-a956-95ae24232057" 12 | ], 13 | "filterType": "GMRoom", 14 | "folderName": "rooms", 15 | "isDefaultView": false, 16 | "localisedFolderName": "ResourceTree_Rooms" 17 | } -------------------------------------------------------------------------------- /src-legacy/views/411563b4-d20f-4313-8e25-baafa8501c71.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "411563b4-d20f-4313-8e25-baafa8501c71", 3 | "modelName": "GMFolder", 4 | "mvc": "1.1", 5 | "name": "411563b4-d20f-4313-8e25-baafa8501c71", 6 | "children": [ 7 | 8 | ], 9 | "filterType": "GMConfig", 10 | "folderName": "configs", 11 | "isDefaultView": false, 12 | "localisedFolderName": "ResourceTree_Configs" 13 | } -------------------------------------------------------------------------------- /src-legacy/views/47c9dcf3-db98-49b6-b391-9e8d4ad93ccb.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "47c9dcf3-db98-49b6-b391-9e8d4ad93ccb", 3 | "modelName": "GMFolder", 4 | "mvc": "1.1", 5 | "name": "47c9dcf3-db98-49b6-b391-9e8d4ad93ccb", 6 | "children": [ 7 | 8 | ], 9 | "filterType": "GMIncludedFile", 10 | "folderName": "datafiles", 11 | "isDefaultView": false, 12 | "localisedFolderName": "ResourceTree_IncludedFiles" 13 | } -------------------------------------------------------------------------------- /src-legacy/views/487f543a-4cda-49b2-8606-d69071691939.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "487f543a-4cda-49b2-8606-d69071691939", 3 | "modelName": "GMFolder", 4 | "mvc": "1.1", 5 | "name": "487f543a-4cda-49b2-8606-d69071691939", 6 | "children": [ 7 | "03e6bf78-c9fc-4f10-9549-7dc253ca0bfc" 8 | ], 9 | "filterType": "GMScript", 10 | "folderName": "util", 11 | "isDefaultView": false, 12 | "localisedFolderName": "" 13 | } -------------------------------------------------------------------------------- /src-legacy/views/5f7a0fdf-5764-4afb-8e56-a4e70ee39bd9.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "5f7a0fdf-5764-4afb-8e56-a4e70ee39bd9", 3 | "modelName": "GMFolder", 4 | "mvc": "1.1", 5 | "name": "5f7a0fdf-5764-4afb-8e56-a4e70ee39bd9", 6 | "children": [ 7 | 8 | ], 9 | "filterType": "GMTimeline", 10 | "folderName": "timelines", 11 | "isDefaultView": false, 12 | "localisedFolderName": "ResourceTree_Timelines" 13 | } -------------------------------------------------------------------------------- /src-legacy/views/94736fe3-0d88-4094-9ad3-af09d1fd4782.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "94736fe3-0d88-4094-9ad3-af09d1fd4782", 3 | "modelName": "GMFolder", 4 | "mvc": "1.1", 5 | "name": "94736fe3-0d88-4094-9ad3-af09d1fd4782", 6 | "children": [ 7 | "e03eb5fc-f39c-4961-9abd-4347303a7909", 8 | "62905c30-d5ac-491b-9710-8429298e5440", 9 | "6fa04631-f8b2-4a2d-a503-192018527068" 10 | ], 11 | "filterType": "GMObject", 12 | "folderName": "objects", 13 | "isDefaultView": false, 14 | "localisedFolderName": "ResourceTree_Objects" 15 | } -------------------------------------------------------------------------------- /src-legacy/views/a4eea40d-a933-497b-b91f-7e386fa9a986.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "a4eea40d-a933-497b-b91f-7e386fa9a986", 3 | "modelName": "GMFolder", 4 | "mvc": "1.1", 5 | "name": "a4eea40d-a933-497b-b91f-7e386fa9a986", 6 | "children": [ 7 | 8 | ], 9 | "filterType": "GMFont", 10 | "folderName": "fonts", 11 | "isDefaultView": false, 12 | "localisedFolderName": "ResourceTree_Fonts" 13 | } -------------------------------------------------------------------------------- /src-legacy/views/aaa232fc-30a0-4c62-950f-a776d3fef239.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "aaa232fc-30a0-4c62-950f-a776d3fef239", 3 | "modelName": "GMFolder", 4 | "mvc": "1.1", 5 | "name": "aaa232fc-30a0-4c62-950f-a776d3fef239", 6 | "children": [ 7 | 8 | ], 9 | "filterType": "GMSound", 10 | "folderName": "sounds", 11 | "isDefaultView": false, 12 | "localisedFolderName": "ResourceTree_Sounds" 13 | } -------------------------------------------------------------------------------- /src-legacy/views/c180f1aa-9fbf-4693-a798-00a3c87790d1.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "c180f1aa-9fbf-4693-a798-00a3c87790d1", 3 | "modelName": "GMFolder", 4 | "mvc": "1.1", 5 | "name": "c180f1aa-9fbf-4693-a798-00a3c87790d1", 6 | "children": [ 7 | "8ebd4763-7203-42aa-9554-cc55d03a802b", 8 | "28492427-9ce2-484c-87ab-39ecd3479df0", 9 | "487f543a-4cda-49b2-8606-d69071691939" 10 | ], 11 | "filterType": "GMScript", 12 | "folderName": "scripts", 13 | "isDefaultView": false, 14 | "localisedFolderName": "ResourceTree_Scripts" 15 | } -------------------------------------------------------------------------------- /src-legacy/views/cfd80378-4324-4b7a-9b8d-fd071e4b1e80.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "cfd80378-4324-4b7a-9b8d-fd071e4b1e80", 3 | "modelName": "GMFolder", 4 | "mvc": "1.1", 5 | "name": "cfd80378-4324-4b7a-9b8d-fd071e4b1e80", 6 | "children": [ 7 | 8 | ], 9 | "filterType": "GMNotes", 10 | "folderName": "notes", 11 | "isDefaultView": false, 12 | "localisedFolderName": "ResourceTree_Notes" 13 | } -------------------------------------------------------------------------------- /src-legacy/views/dc6060fd-690b-4fe2-8ac8-c86faf2e04c0.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "dc6060fd-690b-4fe2-8ac8-c86faf2e04c0", 3 | "modelName": "GMFolder", 4 | "mvc": "1.1", 5 | "name": "dc6060fd-690b-4fe2-8ac8-c86faf2e04c0", 6 | "children": [ 7 | 8 | ], 9 | "filterType": "GMExtension", 10 | "folderName": "extensions", 11 | "isDefaultView": false, 12 | "localisedFolderName": "ResourceTree_Extensions" 13 | } -------------------------------------------------------------------------------- /src-legacy/views/e03eb5fc-f39c-4961-9abd-4347303a7909.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "e03eb5fc-f39c-4961-9abd-4347303a7909", 3 | "modelName": "GMFolder", 4 | "mvc": "1.1", 5 | "name": "e03eb5fc-f39c-4961-9abd-4347303a7909", 6 | "children": [ 7 | "75161d65-d380-49da-b5bd-8506f3d3c411", 8 | "7893bfef-671e-4406-83f9-e70a21e68cea", 9 | "306bd252-5957-48f2-b8af-8353d163a88d", 10 | "a34d8e76-f284-4808-bb25-3d09a5586449" 11 | ], 12 | "filterType": "GMObject", 13 | "folderName": "test_automation", 14 | "isDefaultView": false, 15 | "localisedFolderName": "" 16 | } -------------------------------------------------------------------------------- /src-legacy/views/ecfa581b-ebf3-43f2-b17d-cd091ea11541.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "ecfa581b-ebf3-43f2-b17d-cd091ea11541", 3 | "modelName": "GMFolder", 4 | "mvc": "1.1", 5 | "name": "ecfa581b-ebf3-43f2-b17d-cd091ea11541", 6 | "children": [ 7 | 8 | ], 9 | "filterType": "GMShader", 10 | "folderName": "shaders", 11 | "isDefaultView": false, 12 | "localisedFolderName": "ResourceTree_Shaders" 13 | } -------------------------------------------------------------------------------- /src-legacy/views/ef1f07da-8677-4904-9251-8af85ce5ae10.yy: -------------------------------------------------------------------------------- 1 | { 2 | "id": "ef1f07da-8677-4904-9251-8af85ce5ae10", 3 | "modelName": "GMFolder", 4 | "mvc": "1.1", 5 | "name": "ef1f07da-8677-4904-9251-8af85ce5ae10", 6 | "children": [ 7 | 8 | ], 9 | "filterType": "GMPath", 10 | "folderName": "paths", 11 | "isDefaultView": false, 12 | "localisedFolderName": "ResourceTree_Paths" 13 | } -------------------------------------------------------------------------------- /src/gdash/objects/obj_example_object/obj_example_object.yy: -------------------------------------------------------------------------------- 1 | { 2 | "spriteId": null, 3 | "solid": false, 4 | "visible": true, 5 | "spriteMaskId": null, 6 | "persistent": false, 7 | "parentObjectId": null, 8 | "physicsObject": false, 9 | "physicsSensor": false, 10 | "physicsShape": 1, 11 | "physicsGroup": 0, 12 | "physicsDensity": 0.5, 13 | "physicsRestitution": 0.1, 14 | "physicsLinearDamping": 0.1, 15 | "physicsAngularDamping": 0.1, 16 | "physicsFriction": 0.2, 17 | "physicsStartAwake": true, 18 | "physicsKinematic": false, 19 | "physicsShapePoints": [], 20 | "eventList": [], 21 | "properties": [], 22 | "overriddenProperties": [], 23 | "parent": { 24 | "name": "Objects", 25 | "path": "folders/Objects.yy", 26 | }, 27 | "resourceVersion": "1.0", 28 | "name": "obj_example_object", 29 | "tags": [], 30 | "resourceType": "GMObject", 31 | } -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_1/Create_0.gml: -------------------------------------------------------------------------------- 1 | test_suite_init("gdash suite 1"); 2 | test_next(); 3 | -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_1/Other_10.gml: -------------------------------------------------------------------------------- 1 | /// @desc _type_of 2 | test_start("_type_of", "Should return the type of any known data type"); 3 | 4 | 5 | 6 | assert_equal(_type_of(100), "real"); 7 | assert_equal(_type_of("hello"), "string"); 8 | assert_equal(_type_of(undefined), "undefined"); 9 | assert_equal(_type_of(function() {}), "method"); 10 | 11 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_1/Other_12.gml: -------------------------------------------------------------------------------- 1 | /// @desc _keys 2 | test_start("_keys", "Returns an array of all keys in a map"); 3 | 4 | var map = ds_map_create(); 5 | ds_map_add(map, "one", "hello"); 6 | ds_map_add(map, "two", "hello"); 7 | ds_map_add(map, "three", "hello"); 8 | ds_map_add(map, "four", "hello"); 9 | ds_map_add(map, "five", "hello"); 10 | 11 | var keys = _keys(map); 12 | 13 | assert_equal(_length(keys), 5); 14 | assert_is_true(_contains(keys, "one")); 15 | assert_is_true(_contains(keys, "two")); 16 | assert_is_true(_contains(keys, "three")); 17 | assert_is_true(_contains(keys, "four")); 18 | assert_is_true(_contains(keys, "five")); 19 | assert_is_false(_contains(keys, "rando")); 20 | 21 | ds_map_destroy(map); 22 | test_end(); 23 | 24 | -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_1/Other_14.gml: -------------------------------------------------------------------------------- 1 | /// @desc _reduce 2 | test_start("_reduce", "Iterates over an array, calling a function, returning the overall result"); 3 | 4 | var arr = [1, 2, 3, 4, 5]; 5 | 6 | assert_equal(_reduce(arr, sum), 15); 7 | 8 | var list = ds_list_create(); 9 | list[| 0] = 1; 10 | list[| 1] = 2; 11 | list[| 2] = 3; 12 | list[| 3] = 4; 13 | list[| 4] = 5; 14 | 15 | assert_equal(_reduce(list, sum), 15); 16 | 17 | assert_equal(_reduce(arr, sum, 10), 25); 18 | 19 | test_end(); 20 | 21 | -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_1/Other_16.gml: -------------------------------------------------------------------------------- 1 | /// @desc _uniq 2 | test_start("_uniq", "Removes duplicate values from an array"); 3 | 4 | var duped = [1, 1, 2, 2, "hello", "hello", 3]; 5 | var unique = [1, 2, "hello", 3]; 6 | 7 | assert_is_true(_is_equal(_uniq(duped), unique)); 8 | 9 | duped = [1, 2, 3, 4, 1, 2, 100, 200, 300, 400, 300, "hello", "world", "hello"]; 10 | unique = [1, 2, 3, 4, 100, 200, 300, 400, "hello", "world"]; 11 | 12 | assert_is_true(_is_equal(_uniq(duped), unique)); 13 | 14 | test_end(); 15 | 16 | -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_1/Other_17.gml: -------------------------------------------------------------------------------- 1 | /// @desc _push 2 | test_start("_push", "Adds an element to an array"); 3 | 4 | var arr = [0, 1, 2]; 5 | assert_equal(_length(arr), 3); 6 | 7 | arr = _push(arr, 3); 8 | assert_equal(_length(arr), 4); 9 | assert_equal(arr[3], 3); 10 | 11 | test_end(); 12 | 13 | -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_1/Other_18.gml: -------------------------------------------------------------------------------- 1 | /// @desc _find 2 | test_start("_find", "returns the first element in an array that is truthy in the function"); 3 | 4 | var arr = [0, 1, 2, 3, 40, 5]; 5 | var res = _find(arr, function(n) { return n > 3 }); 6 | 7 | assert_equal(res, 40); 8 | 9 | test_end(); 10 | 11 | -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_1/Other_20.gml: -------------------------------------------------------------------------------- 1 | /// @desc _concat 2 | test_start("_concat", "Appends one array to another"); 3 | 4 | var arr1 = [0, 1, 2]; 5 | var arr2 = [30, 40, 50]; 6 | 7 | var res = _concat(arr1, arr2); 8 | 9 | assert_equal(_length(res), 6); 10 | 11 | assert_equal(res[0], 0); 12 | assert_equal(res[1], 1); 13 | assert_equal(res[2], 2); 14 | assert_equal(res[3], 30); 15 | assert_equal(res[4], 40); 16 | assert_equal(res[5], 50); 17 | test_end(); 18 | 19 | -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_1/Other_21.gml: -------------------------------------------------------------------------------- 1 | /// @desc _index_of 2 | test_start("_index_of", "Returns the index of a value in a collection"); 3 | 4 | var arr = [1, 2, 3, 4]; 5 | var list = ds_list_create(); 6 | list[| 0] = 1; 7 | list[| 1] = 2; 8 | list[| 2] = 3; 9 | list[| 3] = 4; 10 | 11 | assert_equal(_index_of(arr, 2), 1); 12 | assert_equal(_index_of(arr, 3), 2); 13 | assert_equal(_index_of(arr, 6), -1); 14 | assert_equal(_index_of(list, 2), 1); 15 | assert_equal(_index_of(list, 100), -1); 16 | 17 | test_end(); 18 | 19 | -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_1/Other_22.gml: -------------------------------------------------------------------------------- 1 | /// @desc _set 2 | test_start("_set", "Sets a value safely in a deeply nested map"); 3 | 4 | var map = ds_map_create(); 5 | _set(map, "hello.world", 2); 6 | 7 | var hello = map[? "hello"]; 8 | assert_equal(hello[? "world"], 2); 9 | 10 | _set(map, "setMap", ds_map_create(), ds_type_map); 11 | _set(map, "setList", ds_list_create(), ds_type_list); 12 | 13 | assert(ds_exists(map[? "setMap"], ds_type_map)); 14 | assert(ds_exists(map[? "setList"], ds_type_list)); 15 | 16 | test_end(); 17 | 18 | -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_1/Other_23.gml: -------------------------------------------------------------------------------- 1 | /// @desc _get 2 | test_start("_get", "Retrieves a deeply nested map value"); 3 | 4 | var map = ds_map_create(); 5 | map[? "hello"] = ds_map_create(); 6 | var hello = map[? "hello"]; 7 | hello[? "world"] = 2; 8 | 9 | assert_equal(_get(map, "hello.world"), 2); 10 | 11 | test_end(); 12 | 13 | -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_1/Other_24.gml: -------------------------------------------------------------------------------- 1 | /// @desc _clone_array 2 | test_start("_clone_array", "Returns a clone of the given array"); 3 | 4 | var arr = [2, 1, 5, 4, 6]; 5 | var cloned = _clone_array(arr); 6 | 7 | for (var i = 0; i < array_length(arr); i++) { 8 | assert_equal(cloned[i], arr[i]); 9 | } 10 | 11 | // Test that it is a clone and not a reference 12 | var originalPositionZero = arr[0]; 13 | arr[0] = 10; 14 | 15 | assert_equal(cloned[0], originalPositionZero); 16 | 17 | // Test that it works with an array of size zero 18 | var smolArr = []; 19 | var smolCloned = _clone_array(smolArr); 20 | 21 | assert_equal(array_length(smolCloned), 0); 22 | 23 | test_end(); 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_1/Other_25.gml: -------------------------------------------------------------------------------- 1 | test_suite_pass(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_2/Create_0.gml: -------------------------------------------------------------------------------- 1 | test_suite_init("gdash suite 2"); 2 | test_next(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_2/Other_10.gml: -------------------------------------------------------------------------------- 1 | /// @desc _times 2 | test_start("_times", "returns an array of script results over a number of times"); 3 | 4 | var arr = _times(3, returnFour); 5 | 6 | assert_equal(_length(arr), 3); 7 | assert_equal(arr[0], 4); 8 | assert_equal(arr[1], 4); 9 | assert_equal(arr[2], 4); 10 | 11 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_2/Other_11.gml: -------------------------------------------------------------------------------- 1 | /// @desc _collect 2 | test_start("_collect", "returns an array of instances of the given type"); 3 | 4 | var firstObj = instance_create_depth(0, 0, 0, obj_example_object); 5 | var secondObj = instance_create_depth(0, 0, 0, obj_example_object); 6 | 7 | var objects = _collect(obj_example_object); 8 | 9 | assert_is_true(_contains(objects, firstObj)); 10 | assert_is_true(_contains(objects, secondObj)); 11 | 12 | with (obj_example_object) { 13 | instance_destroy(); 14 | } 15 | 16 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_2/Other_12.gml: -------------------------------------------------------------------------------- 1 | /// @desc _destroy 2 | test_start("_destroy", "destroys the given object") 3 | 4 | instance_create_depth(0, 0, 0, obj_example_object); 5 | 6 | _destroy(obj_example_object); 7 | 8 | assert_does_not_exist(obj_example_object); 9 | 10 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_2/Other_13.gml: -------------------------------------------------------------------------------- 1 | /// @desc _array_of 2 | test_start("_array_of", "returns an array of the arguments"); 3 | 4 | var arr = _array_of(2, 4, 6, 1, 2, 3); 5 | 6 | assert_equal(_type_of(arr), "array"); 7 | 8 | assert_equal(arr[0], 2); 9 | assert_equal(arr[1], 4); 10 | assert_equal(arr[2], 6); 11 | assert_equal(arr[3], 1); 12 | assert_equal(arr[4], 2); 13 | assert_equal(arr[5], 3); 14 | 15 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_2/Other_14.gml: -------------------------------------------------------------------------------- 1 | /// @desc _and 2 | test_start("_and", "returns the result of a logical 'and' of the params"); 3 | 4 | assert_is_true(_and(true, true)); 5 | assert_is_false(_and(false, true)); 6 | assert_is_false(_and(true, false)); 7 | assert_is_false(_and(false, false)); 8 | 9 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_2/Other_15.gml: -------------------------------------------------------------------------------- 1 | /// @desc _free 2 | test_start("_free", "frees a ds_map or ds_list or partial from memory"); 3 | 4 | var map = ds_map_create(); 5 | var list = ds_list_create(); 6 | var partial = _partial(add, 1); 7 | 8 | _free(map, ds_type_map); 9 | _free(list, ds_type_list); 10 | _free(partial); 11 | 12 | assert_is_false(ds_exists(map, ds_type_map)); 13 | assert_is_false(ds_exists(list, ds_type_list)); 14 | assert_is_false(ds_exists(partial, ds_type_map)); 15 | 16 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_2/Other_16.gml: -------------------------------------------------------------------------------- 1 | /// @desc _partial and _run 2 | test_start("_partial and _run", "returns a partial which can be executed with _run"); 3 | 4 | var add_one = _partial(add, 1); 5 | 6 | var two = _run(add_one, 1); 7 | var three = _run(add_one, 2); 8 | 9 | assert_equal(two, 2); 10 | assert_equal(three, 3); 11 | 12 | _free(add_one); 13 | 14 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_2/Other_17.gml: -------------------------------------------------------------------------------- 1 | /// @desc _spread 2 | test_start("_spread", "turns an array into script arguments") 3 | 4 | var args = [2, 5]; 5 | var args2 = [10, 20]; 6 | 7 | assert_equal(_spread(add, args), 7); 8 | assert_equal(_spread(add, args2), 30); 9 | 10 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_2/Other_18.gml: -------------------------------------------------------------------------------- 1 | /// @desc _length 2 | test_start("_length", "returns the length of an array, list, or string, or 0 for undefined"); 3 | 4 | var array = [1, 2, 3]; 5 | 6 | var list = ds_list_create(); 7 | ds_list_add(list, 1, 2, 3, 4); 8 | 9 | var str = "hello"; 10 | 11 | assert_equal(_length(array), 3); 12 | assert_equal(_length(list), 4); 13 | assert_equal(_length(str), 5); 14 | assert_equal(_length(undefined), 0); 15 | 16 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_2/Other_19.gml: -------------------------------------------------------------------------------- 1 | /// @desc _split 2 | test_start("_split", "returns an array of a string split up by a substring"); 3 | 4 | var str = "hello,world,foo,bar"; 5 | var splitStr = _split(str, ","); 6 | assert_equal(_length(splitStr), 4); 7 | 8 | assert_equal(splitStr[0], "hello"); 9 | assert_equal(splitStr[1], "world"); 10 | assert_equal(splitStr[2], "foo"); 11 | assert_equal(splitStr[3], "bar"); 12 | 13 | var str2 = "hello, world, foo"; 14 | var splitStr2 = _split(str2, ", "); 15 | 16 | assert_equal(_length(splitStr2), 3); 17 | assert_equal(splitStr2[0], "hello"); 18 | assert_equal(splitStr2[1], "world"); 19 | assert_equal(splitStr2[2], "foo"); 20 | 21 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_2/Other_20.gml: -------------------------------------------------------------------------------- 1 | /// @desc _join 2 | test_start("_join", "turns an array into a string"); 3 | 4 | var array = ["hello", "world", "!"]; 5 | var str = _join(array, " "); 6 | assert_equal(str, "hello world !"); 7 | 8 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_2/Other_21.gml: -------------------------------------------------------------------------------- 1 | /// @desc _or 2 | test_start("_or", "returns the result of an OR of two values"); 3 | 4 | assert_is_true(_or(true, true)); 5 | assert_is_true(_or(true, false)); 6 | assert_is_true(_or(false, true)); 7 | assert_is_false(_or(false, false)); 8 | 9 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_2/Other_22.gml: -------------------------------------------------------------------------------- 1 | /// @desc _nth 2 | test_start("_nth", "Returns the nth element of the collection"); 3 | 4 | var list = ds_list_create(); 5 | list[| 0] = "first"; 6 | list[| 1] = "second"; 7 | list[| 2] = "third"; 8 | 9 | var array; 10 | array[0] = "first"; 11 | array[1] = "second"; 12 | array[2] = "third"; 13 | 14 | assert_equal(_nth(list, 0), list[| 0]); 15 | assert_equal(_nth(list, 1), list[| 1]); 16 | assert_equal(_nth(list, 2), list[| 2]); 17 | 18 | assert_equal(_nth(list, -1), list[| 2]); 19 | assert_equal(_nth(list, -2), list[| 1]); 20 | assert_equal(_nth(list, -3), list[| 0]); 21 | 22 | assert_equal(_nth(array, 0), array[0]); 23 | assert_equal(_nth(array, 1), array[1]); 24 | assert_equal(_nth(array, 2), array[2]); 25 | 26 | assert_equal(_nth(array, -1), array[2]); 27 | assert_equal(_nth(array, -2), array[1]); 28 | assert_equal(_nth(array, -3), array[0]); 29 | 30 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_2/Other_23.gml: -------------------------------------------------------------------------------- 1 | /// @desc _to_array 2 | test_start("_to_array", "Converts a list to an array"); 3 | 4 | var list = ds_list_create(); 5 | ds_list_add(1, 2, 3, 4, 5); 6 | 7 | var arr = _to_array(list); 8 | 9 | for (var i = 0; i < _length(arr); i++) { 10 | assert_equal(list[| i], arr[i]); 11 | } 12 | 13 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_2/Other_24.gml: -------------------------------------------------------------------------------- 1 | /// @description _backward 2 | test_start("_backward", "Reverses an array"); 3 | 4 | var arr1 = [1]; 5 | var arr2 = [1, 2, 3]; 6 | 7 | var test1 = _backward(arr1); 8 | var test2 = _backward(arr2); 9 | var test3 = _backward(test2); 10 | 11 | assert_equal(test1[0], arr1[0]); 12 | assert_equal(test2[0], 3); 13 | assert_equal(test2[1], 2); 14 | assert_equal(test2[2], 1); 15 | assert_equal(test3[0], 1); 16 | assert_equal(test3[1], 2); 17 | assert_equal(test3[2], 3); 18 | 19 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_2/Other_25.gml: -------------------------------------------------------------------------------- 1 | test_suite_pass() -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_3/Create_0.gml: -------------------------------------------------------------------------------- 1 | test_suite_init("gdash suite 3"); 2 | test_next(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_3/Other_10.gml: -------------------------------------------------------------------------------- 1 | /// @description _slice 2 | 3 | test_start("_slice", "Slices an array"); 4 | 5 | var arr = [1, 2, 3]; 6 | 7 | var test1 = _slice(arr, 0); 8 | var test2 = _slice(arr, 1, 2); 9 | var test3 = _slice(arr, 1, 3); 10 | 11 | 12 | assert_equal(_length(test1), 3); 13 | assert_equal(_length(test2), 1); 14 | assert_equal(_length(test3), 2); 15 | 16 | assert_equal(test1[0], 1); 17 | assert_equal(test1[1], 2); 18 | assert_equal(test1[2], 3); 19 | 20 | assert_equal(test2[0], 2); 21 | 22 | assert_equal(test3[0], 2); 23 | assert_equal(test3[1], 3); 24 | 25 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_3/Other_11.gml: -------------------------------------------------------------------------------- 1 | /// @description _list_of 2 | test_start("_list_of", "returns a list of the given parameters"); 3 | var res = _list_of(1, 2, 3, 4); 4 | 5 | assert_is_true(ds_exists(res, ds_type_list)); 6 | assert_equal(res[| 0], 1); 7 | assert_equal(res[| 1], 2); 8 | assert_equal(res[| 2], 3); 9 | assert_equal(res[| 3], 4); 10 | 11 | ds_list_destroy(res); 12 | 13 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_3/Other_12.gml: -------------------------------------------------------------------------------- 1 | /// @description _map_of 2 | test_start("_map_of", "returns a map of the given parameters, paired as key/value"); 3 | var res = _map_of( 4 | "hello", 1, 5 | "world", 2, 6 | "test", 3 7 | ); 8 | 9 | assert_is_true(ds_exists(res, ds_type_map)); 10 | assert_equal(res[? "hello"], 1); 11 | assert_equal(res[? "world"], 2); 12 | assert_equal(res[? "test"], 3); 13 | 14 | ds_map_destroy(res); 15 | 16 | // Odd argument count - fails with empty map 17 | res = _map_of(1); 18 | assert_is_true(ds_exists(res, ds_type_map)); 19 | assert_equal(_length(_keys(res)), 0); 20 | ds_map_destroy(res); 21 | 22 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_3/Other_13.gml: -------------------------------------------------------------------------------- 1 | test_suite_pass(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_4/Create_0.gml: -------------------------------------------------------------------------------- 1 | test_suite_init("gdash suite 4"); 2 | test_next(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_4/Other_11.gml: -------------------------------------------------------------------------------- 1 | /// @description _difference 2 | 3 | test_start("_difference", "Finds the difference between arrays"); 4 | 5 | var arr1 = [1, 2, 3, 4]; 6 | var arr2 = [0, 2]; 7 | var arr3 = [3, 4]; 8 | 9 | var test1 = _difference(arr1, arr2); 10 | var test2 = _difference(arr1, arr3); 11 | var test3 = _difference(arr1, arr2, arr3); 12 | var test4 = _difference(arr3, arr1); 13 | 14 | assert_equal(_length(test1), 3); 15 | assert_equal(_length(test2), 2); 16 | assert_equal(_length(test3), 1); 17 | assert_equal(_length(test4), 0); 18 | 19 | assert_equal(test1[0], 1); 20 | assert_equal(test1[1], 3); 21 | assert_equal(test1[2], 4); 22 | 23 | assert_equal(test2[0], 1); 24 | assert_equal(test2[1], 2); 25 | 26 | assert_equal(test3[0], 1); 27 | 28 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_4/Other_12.gml: -------------------------------------------------------------------------------- 1 | /// @description _difference_by 2 | 3 | test_start("_difference_by", "Finds the difference between arrays using an iteratee"); 4 | 5 | var arr1 = [1, 2.5, 3, 4.5]; 6 | var arr2 = [0.9, 2]; 7 | var arr3 = [3.9, 4.25]; 8 | 9 | var test1 = _difference_by(arr1, arr2, native_floor); 10 | var test2 = _difference_by(arr1, arr3, native_floor); 11 | var test3 = _difference_by(arr1, arr2, arr3, native_floor); 12 | var test4 = _difference_by(arr3, arr1, native_floor); 13 | 14 | assert_equal(_length(test1), 3); 15 | assert_equal(_length(test2), 2); 16 | assert_equal(_length(test3), 1); 17 | assert_equal(_length(test4), 0); 18 | 19 | assert_equal(test1[0], 1); 20 | assert_equal(test1[1], 3); 21 | assert_equal(test1[2], 4.5); 22 | 23 | assert_equal(test2[0], 1); 24 | assert_equal(test2[1], 2.5); 25 | 26 | assert_equal(test3[0], 1); 27 | 28 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_4/Other_13.gml: -------------------------------------------------------------------------------- 1 | /// @description _drop 2 | 3 | test_start("_drop", "Drops elements from the beginning of an array"); 4 | 5 | var arr = [1, 2, 3]; 6 | 7 | var test1 = _drop(arr, 1); 8 | var test2 = _drop(arr, 2); 9 | var test3 = _drop(arr, 3); 10 | 11 | assert_equal(_length(test1), 2); 12 | assert_equal(_length(test2), 1); 13 | assert_equal(_length(test3), 0); 14 | 15 | assert_equal(test1[0], 2); 16 | assert_equal(test1[1], 3); 17 | 18 | assert_equal(test2[0], 3); 19 | 20 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_4/Other_14.gml: -------------------------------------------------------------------------------- 1 | /// @description _drop_right 2 | 3 | test_start("_drop_right", "Drops elements from the end of an array"); 4 | 5 | var arr = [1, 2, 3]; 6 | 7 | var test1 = _drop_right(arr, 1); 8 | var test2 = _drop_right(arr, 2); 9 | var test3 = _drop_right(arr, 3); 10 | 11 | assert_equal(_length(test1), 2); 12 | assert_equal(_length(test2), 1); 13 | assert_equal(_length(test3), 0); 14 | 15 | assert_equal(test1[0], 1); 16 | assert_equal(test1[1], 2); 17 | 18 | assert_equal(test2[0], 1); 19 | 20 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_4/Other_15.gml: -------------------------------------------------------------------------------- 1 | /// @description _fill 2 | 3 | test_start("_fill", "Fills elements of an array with a given value"); 4 | 5 | var arr = [1, 2, 3]; 6 | 7 | _fill(arr, 0); 8 | 9 | assert_equal(arr[0], 0); 10 | assert_equal(arr[1], 0); 11 | assert_equal(arr[2], 0); 12 | 13 | _fill(arr, 1, 1, 3); 14 | 15 | assert_equal(arr[0], 0); 16 | assert_equal(arr[1], 1); 17 | assert_equal(arr[2], 1); 18 | 19 | _fill(arr, 2, 0, 1); 20 | 21 | assert_equal(arr[0], 2); 22 | assert_equal(arr[1], 1); 23 | assert_equal(arr[2], 1); 24 | 25 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_4/Other_16.gml: -------------------------------------------------------------------------------- 1 | /// @description _intersection 2 | 3 | test_start("_intersection", "Finds the intersection of arrays"); 4 | 5 | var arr1 = [1, 2, 3, 4]; 6 | var arr2 = [1, 4, 3]; 7 | var arr3 = [0, 2]; 8 | 9 | var test1 = _intersection(arr1, arr2); 10 | var test2 = _intersection(arr1, arr3); 11 | var test3 = _intersection(arr2, arr1); 12 | var test4 = _intersection(arr1, arr2, arr3); 13 | 14 | assert_equal(_length(test1), 3); 15 | assert_equal(_length(test2), 1); 16 | assert_equal(_length(test3), 3); 17 | assert_equal(_length(test4), 0); 18 | 19 | assert_equal(test1[0], 1); 20 | assert_equal(test1[1], 3); 21 | assert_equal(test1[2], 4); 22 | 23 | assert_equal(test2[0], 2); 24 | 25 | assert_equal(test3[0], 1); 26 | assert_equal(test3[1], 4); 27 | assert_equal(test3[2], 3); 28 | 29 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_4/Other_17.gml: -------------------------------------------------------------------------------- 1 | /// @description _intersection_by 2 | 3 | test_start("_intersection_by", "Finds the intersection of arrays using an iteratee"); 4 | 5 | var arr1 = [1.4, 2, 3.5, 4]; 6 | var arr2 = [1, 4.9, 3]; 7 | var arr3 = [0.75, 2.1]; 8 | 9 | var test1 = _intersection_by(arr1, arr2, native_floor); 10 | var test2 = _intersection_by(arr1, arr3, native_floor); 11 | var test3 = _intersection_by(arr2, arr1, native_floor); 12 | var test4 = _intersection_by(arr1, arr2, arr3, native_floor); 13 | 14 | assert_equal(_length(test1), 3); 15 | assert_equal(_length(test2), 1); 16 | assert_equal(_length(test3), 3); 17 | assert_equal(_length(test4), 0); 18 | 19 | assert_equal(test1[0], 1.4); 20 | assert_equal(test1[1], 3.5); 21 | assert_equal(test1[2], 4); 22 | 23 | assert_equal(test2[0], 2); 24 | 25 | assert_equal(test3[0], 1); 26 | assert_equal(test3[1], 4.9); 27 | assert_equal(test3[2], 3); 28 | 29 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_4/Other_18.gml: -------------------------------------------------------------------------------- 1 | /// @description _reverse 2 | test_start("_reverse", "Reverses an array"); 3 | 4 | var arr1 = [1]; 5 | var arr2 = [1, 2, 3]; 6 | 7 | _reverse(arr1); 8 | _reverse(arr2); 9 | 10 | assert_equal(arr1[0], 1); 11 | assert_equal(arr2[0], 3); 12 | assert_equal(arr2[1], 2); 13 | assert_equal(arr2[2], 1); 14 | 15 | var test = _reverse(arr2); 16 | 17 | assert_equal(test[0], 1); 18 | assert_equal(test[1], 2); 19 | assert_equal(test[2], 3); 20 | 21 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_4/Other_19.gml: -------------------------------------------------------------------------------- 1 | /// @description _union 2 | 3 | test_start("_union", "Finds the union of arrays"); 4 | 5 | var arr1 = [1, 2, 3]; 6 | var arr2 = [3, 1, 1]; 7 | var arr3 = [0, 2]; 8 | 9 | var test1 = _union(arr1, arr2); 10 | var test2 = _union(arr1, arr3); 11 | var test3 = _union(arr2, arr1); 12 | 13 | assert_equal(_length(test1), 3); 14 | assert_equal(_length(test2), 4); 15 | assert_equal(_length(test3), 3); 16 | 17 | assert_equal(test1[0], 1); 18 | assert_equal(test1[1], 2); 19 | assert_equal(test1[2], 3); 20 | 21 | assert_equal(test2[0], 1); 22 | assert_equal(test2[1], 2); 23 | assert_equal(test2[2], 3); 24 | assert_equal(test2[3], 0); 25 | 26 | assert_equal(test3[0], 3); 27 | assert_equal(test3[1], 1); 28 | assert_equal(test3[2], 2); 29 | 30 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_4/Other_20.gml: -------------------------------------------------------------------------------- 1 | /// @description _union_by 2 | 3 | test_start("_union_by", "Finds the union of arrays using an iteratee"); 4 | 5 | var arr1 = [1, 2, 3.3]; 6 | var arr2 = [3, 1.2, 1.9]; 7 | var arr3 = [0, 2.6]; 8 | 9 | var test1 = _union_by(arr1, arr2, native_floor); 10 | var test2 = _union_by(arr1, arr3, native_floor); 11 | var test3 = _union_by(arr2, arr1, native_floor); 12 | 13 | assert_equal(_length(test1), 3); 14 | assert_equal(_length(test2), 4); 15 | assert_equal(_length(test3), 3); 16 | 17 | assert_equal(test1[0], 1); 18 | assert_equal(test1[1], 2); 19 | assert_equal(test1[2], 3.3); 20 | 21 | assert_equal(test2[0], 1); 22 | assert_equal(test2[1], 2); 23 | assert_equal(test2[2], 3.3); 24 | assert_equal(test2[3], 0); 25 | 26 | assert_equal(test3[0], 3); 27 | assert_equal(test3[1], 1.2); 28 | assert_equal(test3[2], 2); 29 | 30 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_4/Other_21.gml: -------------------------------------------------------------------------------- 1 | /// @description _without 2 | 3 | test_start("_without", "Creates an array from a given array excluding certain values"); 4 | 5 | var arr = [1, 2, 3]; 6 | 7 | var test1 = _without(arr, 0); 8 | var test2 = _without(arr, 2); 9 | var test3 = _without(arr, 1, 3, 5); 10 | var test4 = _without(test3, 2); 11 | 12 | assert_equal(_length(test1), 3); 13 | assert_equal(_length(test2), 2); 14 | assert_equal(_length(test3), 1); 15 | assert_equal(_length(test4), 0); 16 | 17 | assert_equal(test1[0], 1); 18 | assert_equal(test1[1], 2); 19 | assert_equal(test1[2], 3); 20 | 21 | assert_equal(test2[0], 1); 22 | assert_equal(test2[1], 3); 23 | 24 | assert_equal(test3[0], 2); 25 | 26 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_4/Other_22.gml: -------------------------------------------------------------------------------- 1 | /// @description _zip 2 | 3 | test_start("_zip", "Groups elements of an array"); 4 | 5 | var arr1 = [1, 2, 3]; 6 | var arr2 = [true, false, true]; 7 | var arr3 = [2, 4]; 8 | 9 | var test = _zip(arr1, arr2, arr3); 10 | 11 | assert_equal(array_length(test), 3); 12 | 13 | assert_equal(test[0, 0], 1); 14 | assert_equal(test[0, 1], true); 15 | assert_equal(test[0, 2], 2); 16 | 17 | assert_equal(test[1, 0], 2); 18 | assert_equal(test[1, 1], false); 19 | assert_equal(test[1, 2], 4); 20 | 21 | assert_equal(test[2, 0], 3); 22 | assert_equal(test[2, 1], true); 23 | 24 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_4/Other_23.gml: -------------------------------------------------------------------------------- 1 | /// @description _unzip 2 | 3 | test_start("_unzip", "Ungroups a zipped array"); 4 | 5 | var arr1 = [1, 2, 3]; 6 | var arr2 = [true, false]; 7 | var arr3 = _zip(arr1, arr2); 8 | 9 | var test = _unzip(arr3); 10 | 11 | assert_equal(array_length(test), 2); 12 | 13 | assert_equal(test[0][0], 1); 14 | assert_equal(test[0][1], 2); 15 | assert_equal(test[0][2], 3); 16 | 17 | assert_equal(test[1][0], true); 18 | assert_equal(test[1][1], false); 19 | assert_equal(test[1][2], 0); 20 | 21 | test_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_gdash_test_4/Other_24.gml: -------------------------------------------------------------------------------- 1 | test_suite_pass(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_performance_test/Alarm_0.gml: -------------------------------------------------------------------------------- 1 | game_end(); -------------------------------------------------------------------------------- /src/gdash/objects/obj_performance_test/Create_0.gml: -------------------------------------------------------------------------------- 1 | var count = 1000000; 2 | var testName = "Performance test"; 3 | 4 | #region setup 5 | 6 | var arr = [1, 2, 3, 4, 5]; 7 | 8 | #endregion 9 | 10 | var startTime = get_timer(); 11 | for (var i = 0; i < count; i++) { 12 | 13 | #region test 14 | 15 | //_uniq(arr); 16 | 17 | #endregion 18 | 19 | } 20 | 21 | var endTime = get_timer(); 22 | _log(">>> " + testName + " completed in " + string((endTime - startTime) * 0.000001) + " seconds"); 23 | alarm[0] = 1; -------------------------------------------------------------------------------- /src/gdash/options/linux/options_linux.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_linux_display_name": "gdash", 3 | "option_linux_version": "1.0.0.0", 4 | "option_linux_maintainer_email": "", 5 | "option_linux_homepage": "http://www.gdash.com", 6 | "option_linux_short_desc": "gdash", 7 | "option_linux_long_desc": "gdash", 8 | "option_linux_splash_screen": "${base_options_dir}\\linux\\splash\\splash.png", 9 | "option_linux_display_splash": false, 10 | "option_linux_icon": "${base_options_dir}\\linux\\icons\\64.png", 11 | "option_linux_start_fullscreen": false, 12 | "option_linux_allow_fullscreen": true, 13 | "option_linux_interpolate_pixels": false, 14 | "option_linux_display_cursor": false, 15 | "option_linux_sync": false, 16 | "option_linux_resize_window": false, 17 | "option_linux_scale": 0, 18 | "option_linux_texture_page": "2048x2048", 19 | "option_linux_enable_steam": false, 20 | "option_linux_disable_sandbox": false, 21 | "resourceVersion": "1.0", 22 | "name": "Linux", 23 | "tags": [], 24 | "resourceType": "GMLinuxOptions", 25 | } -------------------------------------------------------------------------------- /src/gdash/options/mac/icon512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gm-core/gdash/9b1e34fbb4406df1e9f5330e803d3a9d11be2e3e/src/gdash/options/mac/icon512.png -------------------------------------------------------------------------------- /src/gdash/options/mac/icons/icon512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gm-core/gdash/9b1e34fbb4406df1e9f5330e803d3a9d11be2e3e/src/gdash/options/mac/icons/icon512.png -------------------------------------------------------------------------------- /src/gdash/options/mac/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gm-core/gdash/9b1e34fbb4406df1e9f5330e803d3a9d11be2e3e/src/gdash/options/mac/splash.png -------------------------------------------------------------------------------- /src/gdash/options/mac/splash/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gm-core/gdash/9b1e34fbb4406df1e9f5330e803d3a9d11be2e3e/src/gdash/options/mac/splash/splash.png -------------------------------------------------------------------------------- /src/gdash/options/main/inherited/options_main.inherited.yy: -------------------------------------------------------------------------------- 1 | 1.0.0←ed6a955d-5826-4f98-a450-10b414266c27←ed6a955d-5826-4f98-a450-10b414266c27|{ 2 | "option_gameguid": "{3EF251CB-D808-4812-825B-C05EBDC6FE1B}", 3 | "option_steam_app_id": "0", 4 | "option_lastchanged": "02/04/2017 13:21:40", 5 | "option_sci_usesci": false, 6 | "option_game_speed": 30 7 | }←1225f6b0-ac20-43bd-a82e-be73fa0b6f4f|{ 8 | "autocrop": false, 9 | "scaled": false, 10 | "targets": 461609314234257646 11 | }←7b2c4976-1e09-44e5-8256-c527145e03bb|{ 12 | "targets": 461609314234257646 13 | } -------------------------------------------------------------------------------- /src/gdash/options/main/options_main.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_gameguid": "{3EF251CB-D808-4812-825B-C05EBDC6FE1B}", 3 | "option_game_speed": 30, 4 | "option_mips_for_3d_textures": false, 5 | "option_draw_colour": 4294967295, 6 | "option_window_colour": 255, 7 | "option_steam_app_id": "0", 8 | "option_sci_usesci": false, 9 | "option_author": "", 10 | "option_lastchanged": "02/04/2017 13:21:40", 11 | "option_spine_licence": false, 12 | "resourceVersion": "1.2", 13 | "name": "Main", 14 | "tags": [], 15 | "resourceType": "GMMainOptions", 16 | } -------------------------------------------------------------------------------- /src/gdash/options/windows/License.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gm-core/gdash/9b1e34fbb4406df1e9f5330e803d3a9d11be2e3e/src/gdash/options/windows/License.txt -------------------------------------------------------------------------------- /src/gdash/options/windows/Runner_Icon_256.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gm-core/gdash/9b1e34fbb4406df1e9f5330e803d3a9d11be2e3e/src/gdash/options/windows/Runner_Icon_256.ico -------------------------------------------------------------------------------- /src/gdash/options/windows/Runner_finish.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gm-core/gdash/9b1e34fbb4406df1e9f5330e803d3a9d11be2e3e/src/gdash/options/windows/Runner_finish.bmp -------------------------------------------------------------------------------- /src/gdash/options/windows/Runner_header.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gm-core/gdash/9b1e34fbb4406df1e9f5330e803d3a9d11be2e3e/src/gdash/options/windows/Runner_header.bmp -------------------------------------------------------------------------------- /src/gdash/options/windows/installer/license.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gm-core/gdash/9b1e34fbb4406df1e9f5330e803d3a9d11be2e3e/src/gdash/options/windows/installer/license.txt -------------------------------------------------------------------------------- /src/gdash/options/windows/runner_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gm-core/gdash/9b1e34fbb4406df1e9f5330e803d3a9d11be2e3e/src/gdash/options/windows/runner_icon.ico -------------------------------------------------------------------------------- /src/gdash/options/windows/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gm-core/gdash/9b1e34fbb4406df1e9f5330e803d3a9d11be2e3e/src/gdash/options/windows/splash.png -------------------------------------------------------------------------------- /src/gdash/scripts/_and/_and.gml: -------------------------------------------------------------------------------- 1 | /// @func _and(valueA, valueB) 2 | /// @desc Returns the value of the provided arguments after a boolean and 3 | /// @param {*} valueA Some first input 4 | /// @param {*} valueB A value to && the first input with 5 | /// @returns {Boolean} The value of the provided arguments after an && 6 | function _and(valueA, valueB) { 7 | /* 8 | @example 9 | _and(true, true); 10 | // => true 11 | 12 | _and(false, true); 13 | // => false 14 | 15 | */ 16 | gml_pragma("forceinline"); 17 | return valueA && valueB; 18 | } 19 | -------------------------------------------------------------------------------- /src/gdash/scripts/_and/_and.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_and", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_array_of/_array_of.gml: -------------------------------------------------------------------------------- 1 | /// @func _array_of(values...) 2 | /// @desc Returns an array of the given arguments. 3 | /// @param {*) values... Values to put into an array 4 | /// @returns {Array} An array of the given parameters 5 | function _array_of() { 6 | /* 7 | @example 8 | _arrayOf(1, 2, 3); 9 | // => [1, 2, 3]; 10 | 11 | _arrayOf('hello', 'world', 'i', 'am', 'an', 'array'); 12 | // => ['hello', 'world', 'i', 'am', 'an', 'array']; 13 | */ 14 | 15 | var result = array_create(argument_count-1, 0); 16 | 17 | for (i = argument_count-1; i >= 0; i--) { 18 | result[i] = argument[i]; 19 | } 20 | 21 | return result; 22 | } 23 | -------------------------------------------------------------------------------- /src/gdash/scripts/_array_of/_array_of.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_array_of", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_backward/_backward.gml: -------------------------------------------------------------------------------- 1 | /// @func _backward(array) 2 | /// @desc Creates a new array containing the elements of array in reverse order. 3 | /// @param {Array} array The array to reverse 4 | /// @returns {Array} The reversed array 5 | /// @note To modify an array in-place, use `_reverse` 6 | function _backward(arr) { 7 | /* 8 | @example 9 | var myArray = [1, 2, 3]; 10 | var reverseArray = _backward(myArray); 11 | // => [3, 2, 1] 12 | */ 13 | 14 | var len; 15 | var result = []; 16 | 17 | len = array_length(arr); 18 | 19 | for (var i = len - 1; i >= 0; i--) { 20 | result[i] = arr[@ len - 1 - i]; 21 | } 22 | 23 | return result; 24 | } 25 | -------------------------------------------------------------------------------- /src/gdash/scripts/_backward/_backward.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_backward", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_chunk/_chunk.gml: -------------------------------------------------------------------------------- 1 | /// @func _chunk(array, size) 2 | /// @desc Creates a two-dimensional array of elements split into groups of given length. 3 | /// @param {Array} array The array to split 4 | /// @param {Integer} size The size of each chunk 5 | /// @returns {Array} The two-dimensional array of chunks 6 | function _chunk(arr, size) { 7 | /* 8 | @example 9 | var arr = [0, 1, 2, 3]; 10 | _chunk(arr, 2); 11 | // => [[0, 1], [2, 3]]; 12 | 13 | var arr = [0, 1, 2, 3]; 14 | _chunk(arr, 3); 15 | // => [[0, 1, 2], [3]]; 16 | */ 17 | 18 | if (argument_count != 2) return false; 19 | 20 | var i; 21 | var len; 22 | var result = []; 23 | 24 | if (size == 0) return array_create(0); 25 | 26 | len = array_length(arr); 27 | 28 | for (i = len - 1; i >= 0; i--) { 29 | result[i / size, i % size] = arr[i]; 30 | } 31 | 32 | return result; 33 | } 34 | -------------------------------------------------------------------------------- /src/gdash/scripts/_chunk/_chunk.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_chunk", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_clone_array/_clone_array.gml: -------------------------------------------------------------------------------- 1 | /// @func _clone_array(array) 2 | /// @desc Clones a given input array, returning a deep copy. 3 | /// @param {Array} array The array to clone 4 | /// @returns {Array} A copy of the input array 5 | function _clone_array(arr) { 6 | /* 7 | @example 8 | var myArray = [1, 2, 3]; 9 | var copyArray = _clone_array(myArray); 10 | _is_equal(myArray, copyArray) 11 | // => true 12 | */ 13 | 14 | var result = []; 15 | array_copy(result, 0, arr, 0, array_length(arr)); 16 | return result; 17 | } 18 | -------------------------------------------------------------------------------- /src/gdash/scripts/_clone_array/_clone_array.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_clone_array", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_collect/_collect.gml: -------------------------------------------------------------------------------- 1 | /// @func _collect(object) 2 | /// @desc Returns an array of all objects of the provided type 3 | /// @param {ObjectType} objectType The object type to collect 4 | /// @returns {Array} An array of all object IDs of the provided type in the room 5 | function _collect(object) { 6 | /* 7 | @example 8 | 9 | _collect(obj_character); 10 | // => [10001, 10002, 10005] 11 | */ 12 | 13 | var result = []; 14 | 15 | for (var i = instance_number(object); i >= 0; i--) { 16 | result[i] = instance_find(object, i); 17 | } 18 | 19 | return result; 20 | } 21 | -------------------------------------------------------------------------------- /src/gdash/scripts/_collect/_collect.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_collect", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_concat/_concat.gml: -------------------------------------------------------------------------------- 1 | /// @func _concat(arrayA, arrayB) 2 | /// @desc Appends the values of one array to another. 3 | /// @param {Array} baseArray The array to append to 4 | /// @param {Array} arrayToAppend The array to append 5 | /// @returns {Array} The concatenated array 6 | function _concat(arrayA, arrayB) { 7 | /* 8 | @example 9 | _concat([0, 1, 2], [3, 4, 5]); 10 | // => [0, 1, 2, 3, 4, 5] 11 | 12 | */ 13 | 14 | var n = array_length(arrayA); 15 | var arr = _clone_array(arrayA); 16 | 17 | for (var i = array_length(arrayB) - 1; i >= 0; i--) { 18 | arr[@ n+i] = arrayB[@ i]; 19 | } 20 | 21 | return arr; 22 | } 23 | -------------------------------------------------------------------------------- /src/gdash/scripts/_concat/_concat.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_concat", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_contains/_contains.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_contains", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_destroy/_destroy.gml: -------------------------------------------------------------------------------- 1 | /// @func _destroy(object) 2 | /// @desc Destroys the passed in instance 3 | /// @param {Instance} instance The instance to destroy 4 | function _destroy(object) { 5 | /* 6 | @example 7 | _destroy(obj_enemy); 8 | 9 | // Destroy all obj_enemy with no health (hasNoHealth is a script) 10 | _map(_filter(_collect(obj_enemy)), hasNoHealth), _destroy); 11 | */ 12 | 13 | with (object) { 14 | instance_destroy(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/gdash/scripts/_destroy/_destroy.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_destroy", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_difference/_difference.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_difference", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_difference_by/_difference_by.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_difference_by", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_drop/_drop.gml: -------------------------------------------------------------------------------- 1 | /// @func _drop(array, n) 2 | /// @desc Creates a slice of array with n elements dropped from the beginning. 3 | /// @param {Array} array The array to inspect 4 | /// @param {Integer} n The number of elements to drop 5 | /// @returns {Array} The slice of array 6 | function _drop(arr, num) { 7 | /* 8 | @example 9 | var arr = [0, 1, 2, 3]; 10 | _drop(arr, 2); 11 | // => [2, 3]; 12 | */ 13 | 14 | var i; 15 | var n; 16 | var len; 17 | var result = []; 18 | 19 | if (num == 0) return arr; 20 | 21 | n = 0; 22 | len = array_length(arr); 23 | result = array_create(clamp(len - num, 0, len)); 24 | 25 | for (i = num; i < len; i++) { 26 | result[n++] = arr[i]; 27 | } 28 | 29 | return result; 30 | } 31 | -------------------------------------------------------------------------------- /src/gdash/scripts/_drop/_drop.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_drop", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_drop_right/_drop_right.gml: -------------------------------------------------------------------------------- 1 | /// @func _drop_right(array, n) 2 | /// @desc Creates a slice of array with n elements dropped from the end. 3 | /// @param {Array} array The array to inspect 4 | /// @param {Integer} n The number of elements to drop 5 | /// @returns {Array} The slice of array 6 | function _drop_right(arr, num) { 7 | /* 8 | @example 9 | var arr = [0, 1, 2, 3]; 10 | _drop_right(arr, 2); 11 | // => [0, 1]; 12 | */ 13 | 14 | var i; 15 | var n; 16 | var len; 17 | var result = []; 18 | 19 | if (num == 0) return arr; 20 | 21 | n = 0; 22 | len = array_length(arr) - num; 23 | result = array_create(max(len, 0)); 24 | 25 | for (i = 0; i < len; i++) { 26 | result[n++] = arr[i]; 27 | } 28 | 29 | return result; 30 | 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/gdash/scripts/_drop_right/_drop_right.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_drop_right", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_error/_error.gml: -------------------------------------------------------------------------------- 1 | /// @func _error(message [, fatal]) 2 | /// @desc When running with the debugger, displays an error window. Otherwise, logs an error using `_log`. 3 | /// @param {String} message The message to error with 4 | /// @param {Boolean} fatal [Optional] If true, will force a show_error() call with `abort` set to true 5 | /// @note Only mark an error as `fatal` if you are okay with it ending your game 6 | function _error() { 7 | /* 8 | @example 9 | _error("This is an error that will let the game continue"); 10 | _error("This is an error that will let the game continue", false); 11 | _error("This is an error that will kill the game", true); 12 | */ 13 | 14 | var message = argument[0]; 15 | var fatal = argument_count > 1 ? argument[1] : false; 16 | 17 | if (fatal || debug_mode) { 18 | show_error(message, fatal); 19 | } else { 20 | _log("ERROR: " + message); 21 | } 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/gdash/scripts/_error/_error.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_error", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_fill/_fill.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_fill", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_filter/_filter.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_filter", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_find/_find.gml: -------------------------------------------------------------------------------- 1 | /// @func _find(array, findMethod) 2 | /// @desc Iterates over an array, returning the first element that the given script returns true for. 3 | /// @param {Array} array The array to iterate over 4 | /// @param {Method} findMethod The method to run on the given element 5 | /// @returns {*} The first element that returns truthy from the script 6 | function _find(arr, findMethod) { 7 | /* 8 | @example 9 | _find([0, 1, 2, 3], function(n) {return n == 3}); 10 | // => 3 11 | */ 12 | 13 | 14 | var n = array_length(arr); 15 | 16 | for (var i = 0; i < n; i++) { 17 | if (findMethod(arr[@ i])) { 18 | return arr[@ i]; 19 | } 20 | } 21 | 22 | // Catch empty result 23 | return undefined; 24 | } 25 | -------------------------------------------------------------------------------- /src/gdash/scripts/_find/_find.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_find", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_free/_free.gml: -------------------------------------------------------------------------------- 1 | /// @func _free(id [, ds_type]) 2 | /// @desc Frees a partial function from memory 3 | /// @param {Real} resource The partial ID to free 4 | /// @param {DS_TYPE} optionalType The type of resource to free 5 | function _free() { 6 | /* 7 | @example 8 | var __something = _partial(someScript, 1); 9 | __something(2); 10 | _free(__something); 11 | 12 | */ 13 | 14 | var dsId = argument[0]; 15 | var type; 16 | 17 | if (argument_count == 1) { 18 | type = ds_type_map; 19 | } else { 20 | type = argument[1]; 21 | } 22 | 23 | if (_is_equal(type, "partial")) { 24 | type = ds_type_map; 25 | } 26 | 27 | switch (type) { 28 | case ds_type_map: 29 | ds_map_destroy(dsId); 30 | break; 31 | case ds_type_list: 32 | ds_list_destroy(dsId); 33 | break; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/gdash/scripts/_free/_free.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_free", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_get/_get.gml: -------------------------------------------------------------------------------- 1 | /// @func _get(map, locationString) 2 | /// @desc Gets a nested value following a dot notation 3 | /// @param {DS_Map} map The map to get data from 4 | /// @param {String} locationString The location of the data to get 5 | /// @returns {Mixed} The data found at the given location 6 | function _get(map, location) { 7 | /* 8 | @example 9 | // someMap looks like: 10 | // { nested: {three: {deep: 1}}} 11 | _.get(someMap, 'nested.three.deep'); 12 | // => 1 13 | 14 | */ 15 | 16 | var locationArray = _split(location, "."); 17 | var n = array_length(locationArray); 18 | var thisLoc; 19 | 20 | for (var i = 0; i < n; i++) { 21 | thisLoc = locationArray[i]; 22 | if (ds_map_exists(map, thisLoc)) { 23 | map = map[? thisLoc]; 24 | } else { 25 | return undefined; 26 | } 27 | } 28 | 29 | return map; 30 | } 31 | -------------------------------------------------------------------------------- /src/gdash/scripts/_get/_get.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_get", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_index_of/_index_of.gml: -------------------------------------------------------------------------------- 1 | /// @func _index_of(collection, value) 2 | /// @desc Returns the index of the given item in the given array, or -1 3 | /// @param {Array|DS_List} collection The collection to search 4 | /// @param {*} value The value to look for 5 | /// @returns {Real} The index of the value, or -1 6 | function _index_of(collection, value) { 7 | 8 | // Search lists 9 | if (is_real(collection)) { 10 | return ds_list_find_index(collection, value); 11 | } 12 | 13 | // Search arrays 14 | var n = array_length(collection); 15 | 16 | for (var i = 0; i < n; i++) { 17 | if (_is_equal(collection[@ i], value)) { 18 | return i; 19 | } 20 | } 21 | 22 | return -1; 23 | } 24 | -------------------------------------------------------------------------------- /src/gdash/scripts/_index_of/_index_of.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_index_of", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_intersection/_intersection.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_intersection", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_intersection_by/_intersection_by.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_intersection_by", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_is_equal/_is_equal.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_is_equal", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_join/_join.gml: -------------------------------------------------------------------------------- 1 | /// @func _join(array, joinChar) 2 | /// @desc Returns a string of the given array combined with the given joiner 3 | /// @param {Array} array The array to join 4 | /// @param {String} joinChar The character to join by 5 | /// @returns {String} The joined array 6 | function _join(arr, joinChar) { 7 | /* 8 | @example 9 | var arr = ['hello', 'world']; 10 | _join(arr, ' '); 11 | // => 'hello world' 12 | 13 | var arr = ['Peter', 'Paul', 'Mary']; 14 | _join(arr, ', '); 15 | // => 'Peter, Paul, Mary'; 16 | */ 17 | 18 | var outString = ""; 19 | var inArray = arr; 20 | var joiner = joinChar; 21 | 22 | var arrLength = array_length(inArray); 23 | var maxIndex = arrLength - 1; 24 | var stringJoiner = string(joiner); 25 | 26 | for (var i = 0; i < arrLength; i++) { 27 | outString += string(inArray[@ i]); 28 | 29 | if (i != maxIndex) { 30 | outString += stringJoiner; 31 | } 32 | } 33 | 34 | return outString; 35 | } 36 | -------------------------------------------------------------------------------- /src/gdash/scripts/_join/_join.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_join", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_keys/_keys.gml: -------------------------------------------------------------------------------- 1 | /// @func _keys(map) 2 | /// @desc Returns an array contains all keys in a ds_map. Order is not guaranteed due to how ds_maps are stored. 3 | /// @param {DS_Map} map The map to get the keys from 4 | /// @returns {Array} An array of all keys in the map 5 | function _keys(map) { 6 | /* 7 | @example 8 | var map = ds_map_create(); 9 | ds_map_add(map, 'hello', 'world'); 10 | ds_map_add(map, 'health', 100); 11 | 12 | _keys(map); 13 | // => ['hello', 'health'] 14 | 15 | */ 16 | 17 | var nextKey = ds_map_find_first(map); 18 | var nextInd = 0; 19 | var keys = []; 20 | 21 | while (!is_undefined(nextKey)) { 22 | keys[nextInd++] = nextKey; 23 | nextKey = ds_map_find_next(map, nextKey); 24 | } 25 | 26 | return keys; 27 | } 28 | -------------------------------------------------------------------------------- /src/gdash/scripts/_keys/_keys.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_keys", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_length/_length.gml: -------------------------------------------------------------------------------- 1 | /// @func _length(collectionOrString) 2 | /// @desc Returns the length of the given array or ds_list 3 | /// @param {Array|DS_List} collection The collection to determine the length of 4 | /// @returns {Real} The length of the collection 5 | function _length(collectionOrString) { 6 | /* 7 | @example 8 | _length([1, 2, 3, 4]); 9 | // => 4 10 | 11 | _length(some_list_id_of_size_5); 12 | // => 5 13 | */ 14 | 15 | if (is_undefined(collectionOrString)) { 16 | return 0; 17 | } 18 | 19 | if (_type_of(collectionOrString) == "array") { 20 | return array_length(collectionOrString); 21 | } else if (_type_of(collectionOrString) == "real" && ds_exists(collectionOrString, ds_type_list)) { 22 | return ds_list_size(collectionOrString); 23 | } else if (_type_of(collectionOrString) == "string") { 24 | return string_length(collectionOrString); 25 | } 26 | 27 | return 0; 28 | } 29 | -------------------------------------------------------------------------------- /src/gdash/scripts/_length/_length.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_length", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_list_of/_list_of.gml: -------------------------------------------------------------------------------- 1 | /// @func _list_of(values...) 2 | /// @desc Returns a DS_List containing the provided values. This DS_List should be destroyed as you would any other DS. 3 | /// @param {*} values... As many starting values for the list as desired 4 | /// @returns {DS_List} A new DS_List containing the provided values 5 | function _list_of() { 6 | /* 7 | @example 8 | 9 | var list = _list_of(1, 2, 3, 4); 10 | _log(list[| 2]) // logs 3 11 | */ 12 | 13 | var list = ds_list_create(); 14 | 15 | for (var i = 0; i < argument_count; i++) { 16 | ds_list_add(list, argument[i]); 17 | } 18 | 19 | return list; 20 | 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/gdash/scripts/_list_of/_list_of.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_list_of", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_log/_log.gml: -------------------------------------------------------------------------------- 1 | /// @func _log(values...) 2 | /// @desc Convenience method for show_debug_message(). Automatically convetrs arguments to strings. 3 | /// @param {Mixed} Messages... The message or value to log 4 | function _log() { 5 | 6 | var toshow = ""; 7 | for (var i = 0; i < argument_count; i++) { 8 | 9 | if (i != 0) { 10 | toshow += ", "; 11 | } 12 | 13 | if (is_array(argument[i])) { 14 | toshow += "[" + _join(argument[i],", ") + "]"; 15 | } else { 16 | toshow += string(argument[i]); 17 | } 18 | } 19 | 20 | show_debug_message(toshow); 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/gdash/scripts/_log/_log.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_log", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_map/_map.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_map", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_map_of/_map_of.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_map_of", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_nth/_nth.gml: -------------------------------------------------------------------------------- 1 | /// @func _nth(collection, index) 2 | /// @desc Returns the nth index of the given array or ds_list. If n is negative, the nth element from the end is returned. 3 | /// @param collection 4 | /// @param n 5 | function _nth(collection, index) { 6 | var n = index; 7 | var type = _type_of(collection); 8 | 9 | 10 | if (type == "real") { 11 | if (n >= 0) { 12 | return collection[| n]; 13 | } else { 14 | return collection[| ds_list_size(collection) + n]; 15 | } 16 | } else if (type == "array") { 17 | if (n >= 0) { 18 | return collection[@ n]; 19 | } else { 20 | return collection[@ array_length(collection) + n]; 21 | } 22 | } else { 23 | show_error("Trying to return nth element of an incorrect type: " + type + "\nCollection must be a ds_list or array.", false); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/gdash/scripts/_nth/_nth.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_nth", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_or/_or.gml: -------------------------------------------------------------------------------- 1 | /// @func _or(valueA, valueB) 2 | /// @desc Returns the value of the provided arguments after a boolean OR 3 | /// @param {*} valueA Some first input 4 | /// @param {*} valueB A value to || the first input with 5 | /// @returns {Boolean} The value of the provided arguments after an || 6 | function _or(valueA, valueB) { 7 | /* 8 | @example 9 | _or(true, true); 10 | // => true 11 | 12 | _or(false, true); 13 | // => true 14 | 15 | _or(false, false); 16 | // => false 17 | 18 | */ 19 | gml_pragma("forceinline"); 20 | return valueA || valueB; 21 | } 22 | -------------------------------------------------------------------------------- /src/gdash/scripts/_or/_or.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_or", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_partial/_partial.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_partial", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_push/_push.gml: -------------------------------------------------------------------------------- 1 | /// @func _push(array, value) 2 | /// @desc Adds a value to the end of an array 3 | /// @param {Array} array The array to add the value to 4 | /// @param {*} value The value to add 5 | /// @returns {Array} The array with the value added 6 | function _push(arr, value) { 7 | /* 8 | @example 9 | _push([1, 2], 3); 10 | // => [1, 2, 3] 11 | */ 12 | 13 | gml_pragma("forceinline"); 14 | arr[@ array_length(arr)] = value; 15 | return arr; 16 | } 17 | -------------------------------------------------------------------------------- /src/gdash/scripts/_push/_push.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_push", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_reduce/_reduce.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_reduce", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_reverse/_reverse.gml: -------------------------------------------------------------------------------- 1 | /// @func _reverse(array) 2 | /// @desc Reverses the order of elements in array. 3 | /// @param {Array} array The array to modify 4 | /// @returns {Array} The reversed array 5 | /// @note This method mutates the input array. To create a new array instead, use `_backward` 6 | function _reverse(arr) { 7 | /* 8 | @example 9 | var arr = [0, 1, 2]; 10 | _reverse(arr); 11 | // => [2, 1, 0]; 12 | */ 13 | 14 | var i; 15 | var half; 16 | var len; 17 | var tmp; 18 | 19 | len = array_length(arr); 20 | half = len div 2; 21 | 22 | for (i = 0; i < half; i++) { 23 | tmp = arr[@ i]; 24 | arr[@ i] = arr[@ len - 1 - i]; 25 | arr[@ len - 1 - i] = tmp; 26 | } 27 | 28 | return arr; 29 | } 30 | -------------------------------------------------------------------------------- /src/gdash/scripts/_reverse/_reverse.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_reverse", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_run/_run.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_run", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_set/_set.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_set", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_slice/_slice.gml: -------------------------------------------------------------------------------- 1 | /// @func _slice(array, start [, end]) 2 | /// @desc Creates a slice of array from start up to, but not including, end. 3 | /// @param {Array} array The array to slice 4 | /// @param {Integer} start Index to start the slice 5 | /// @param {Integer} end(optional) Index up to which to make the slice, defaults to end of array. 6 | /// @returns {Array} The sliced array 7 | function _slice() { 8 | /* 9 | @example 10 | var myArray = [1, 2, 3, 4]; 11 | var slicedArray = _slice(myArray, 1, 3); 12 | _is_equal([2, 3], slicedArray) 13 | // => true 14 | */ 15 | 16 | var result = []; 17 | var array = argument[0]; 18 | var starti = argument[1]; 19 | var endi = 0; 20 | 21 | if (argument_count == 3) { 22 | endi = argument[2]; 23 | } else { 24 | endi = array_length(array); 25 | } 26 | 27 | for (var i = endi - 1; i >= starti; i--) { 28 | result[i-starti] = array[@ i]; 29 | } 30 | 31 | return result; 32 | 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/gdash/scripts/_slice/_slice.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_slice", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_split/_split.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_split", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_spread/_spread.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_spread", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_times/_times.gml: -------------------------------------------------------------------------------- 1 | /// @func _times(executeCount, method) 2 | /// @desc Returns an array of the result of a function run the given number of times 3 | /// @param {Real} executeCount The number of times to execute the function 4 | /// @param {Method} method The method to execute 5 | /// @returns {Array} An array of the script results 6 | function _times(count, func) { 7 | /* 8 | @example 9 | _times(3, returnTheValue5); 10 | // => [5, 5, 5]; 11 | 12 | */ 13 | 14 | var arr; 15 | 16 | arr[count-1] = 0; 17 | 18 | for (var i = 0; i < count; i++) { 19 | arr[i] = _run(func, i); 20 | } 21 | 22 | return arr; 23 | } 24 | -------------------------------------------------------------------------------- /src/gdash/scripts/_times/_times.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_times", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_to_array/_to_array.gml: -------------------------------------------------------------------------------- 1 | /// @func _to_array(list) 2 | /// @desc Converts the given ds_list to an array 3 | /// @param list 4 | /// @note If the given list is of size 0, this will return undefined. 5 | function _to_array(list) { 6 | var listSize = ds_list_size(list); 7 | var array; 8 | array[0] = undefined; 9 | 10 | for (var i = listSize - 1; i >= 0; i--) { 11 | array[i] = list[| i]; 12 | } 13 | 14 | if (is_undefined(array[0])) { 15 | return undefined; 16 | } 17 | 18 | return array; 19 | } 20 | -------------------------------------------------------------------------------- /src/gdash/scripts/_to_array/_to_array.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_to_array", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_to_list/_to_list.gml: -------------------------------------------------------------------------------- 1 | /// @func _to_list(array) 2 | /// @desc Converts the given array to a new ds_list 3 | /// @param array 4 | /// Note: This creates a ds_list resource which should be destroyed with ds_list_destroy when it is no longer needed. 5 | function _to_list(arr) { 6 | /* 7 | @example 8 | var input = ["hello", "world", 10]; 9 | var list = _to_list(input); 10 | list[| 0]; // "hello" 11 | list[| 1]; // "world" 12 | list[| 2]; // 10 13 | */ 14 | 15 | var arrSize = array_length(arr); 16 | var list = ds_list_create(); 17 | 18 | for (var i = 0; i < arrSize; i++) { 19 | ds_list_add(list, arr[@ i]); 20 | } 21 | 22 | return list; 23 | } 24 | -------------------------------------------------------------------------------- /src/gdash/scripts/_to_list/_to_list.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_to_list", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_type_of/_type_of.gml: -------------------------------------------------------------------------------- 1 | /// @func _type_of(value) 2 | /// @desc Returns the variable type of the given argument as a string. 3 | /// @note Works exactly as the native typeof(), though refers to `number` as `real` to be more consistent with GM:S terminology 4 | /// @param {*} value A variable to check the type of 5 | /// @returns {String} The type of the variable as a human readable string 6 | function _type_of(value) { 7 | /* 8 | @example 9 | 10 | _type_of(1); 11 | // => "real" 12 | 13 | _type_of("hello"); 14 | // => "string" 15 | 16 | var arr; 17 | arr[0] = 1; arr[1] = 2; 18 | _type_of(arr); 19 | // => "array" 20 | 21 | _type_of(undefined); 22 | // => "undefined"; 23 | 24 | _type_of(sprite_get_texture(spr_player, 1)); 25 | // => "ptr"; 26 | */ 27 | 28 | var type = typeof(value) 29 | return type == "number" ? "real" : type; 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/gdash/scripts/_type_of/_type_of.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_type_of", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_union/_union.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_union", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_union_by/_union_by.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_union_by", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_uniq/_uniq.gml: -------------------------------------------------------------------------------- 1 | /// @func _uniq(array) 2 | /// @desc Returns an array with all duplicate values removed 3 | /// @param {Array} array An array with duplicate values 4 | /// @returns {Array} An array with the duplicate values removed 5 | function _uniq(arr) { 6 | /* 7 | @example 8 | _uniq([1, 1, 2, 3]); 9 | // => [1, 2, 3] 10 | */ 11 | 12 | var n = array_length(arr); 13 | var j = 0; 14 | var result = undefined; 15 | var seenMap = ds_map_create(); 16 | 17 | if (array_length(arr) <= 1) { 18 | return arr; 19 | } 20 | 21 | for (var i = 0; i < n; i++) { 22 | var val = arr[@ i]; 23 | if (is_undefined(seenMap[? val])) { 24 | seenMap[? val] = true; 25 | result[j++] = val; 26 | } 27 | } 28 | 29 | ds_map_destroy(seenMap); 30 | 31 | return result; 32 | 33 | 34 | 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/gdash/scripts/_uniq/_uniq.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_uniq", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_unzip/_unzip.gml: -------------------------------------------------------------------------------- 1 | /// @func _unzip(array) 2 | /// @desc From a zipped two-dimensional array, creates a collection of grouped elements by regrouping the elements to their pre-zipped configuration 3 | /// @param {Array} array The zipped two-dimensional array 4 | /// @returns {Array} The two-dimensional array of regrouped elements 5 | 6 | /* 7 | @example 8 | var arr0 = [0, 1, 2]; 9 | var arr1 = [3, 4, 5]; 10 | var arr2 =_zip(arr0, arr1); 11 | _unzip(arr2); 12 | // => [[0, 1, 2], [3, 4, 5]]; 13 | 14 | */ 15 | function _unzip(arr) { 16 | if (argument_count != 1) return array_create(0); 17 | 18 | var i; 19 | var j; 20 | var len; 21 | var num; 22 | var result = []; 23 | 24 | len = array_length(arr); 25 | num = array_length(arr[0]); 26 | result = array_create(num, 0); 27 | 28 | for (i = num - 1; i >= 0; i--) { 29 | result[i] = array_create(len, 0); 30 | for (j = len - 1; j >= 0; j--) { 31 | result[i][j] = arr[j][i]; 32 | } 33 | } 34 | 35 | return result; 36 | } 37 | -------------------------------------------------------------------------------- /src/gdash/scripts/_unzip/_unzip.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_unzip", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_without/_without.gml: -------------------------------------------------------------------------------- 1 | /// @func _without(array, values...) 2 | /// @desc Creates an array excluding all given values from amongst the elements of the given array 3 | /// @param {Array} array The array to inspect 4 | /// @param {*} values... The values to exclude 5 | /// @returns {Array} The array of filtered elements 6 | function _without() { 7 | /* 8 | @example 9 | var arr = [0, 1, 0, 2]; 10 | _without(arr, 0, 1); 11 | // => [2]; 12 | */ 13 | 14 | if (argument_count == 0) return array_create(0); 15 | if (argument_count == 1) return argument[0]; 16 | 17 | var i; 18 | var j; 19 | var n; 20 | var arr; 21 | var match; 22 | var len; 23 | var result = []; 24 | 25 | n = 0; 26 | arr = argument[0]; 27 | len = array_length(arr); 28 | result = array_create(0); 29 | 30 | for (i = 0; i < len; i++) { 31 | match = false; 32 | for (j = 1; j < argument_count; j++) { 33 | if (arr[i] == argument[j]) { 34 | match = true; 35 | } 36 | } 37 | if (!match) { 38 | result[n++] = arr[i]; 39 | } 40 | } 41 | 42 | return result; 43 | 44 | 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/gdash/scripts/_without/_without.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_without", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/_zip/_zip.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gdash", 6 | "path": "folders/Scripts/gdash.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "_zip", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/add/add.gml: -------------------------------------------------------------------------------- 1 | function add(argument0, argument1) { 2 | return argument0 + argument1; 3 | 4 | 5 | 6 | } 7 | -------------------------------------------------------------------------------- /src/gdash/scripts/add/add.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "unit test", 6 | "path": "folders/Scripts/util/unit test.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "add", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/assert/assert.gml: -------------------------------------------------------------------------------- 1 | /// @desc Convenience method for assert_is_true 2 | /// @param Value 3 | /// @param OptionalMessage 4 | function assert() { 5 | if (argument_count > 1) { 6 | assert_is_true(argument[0], argument[1]); 7 | } else { 8 | assert_is_true(argument[0]); 9 | } 10 | 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/gdash/scripts/assert/assert.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gamatas", 6 | "path": "folders/Scripts/lib/gamatas.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "assert", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/assert_does_not_exist/assert_does_not_exist.gml: -------------------------------------------------------------------------------- 1 | /// @desc Ensures the passed in object/instance does not exist in this room 2 | /// @param Object 3 | function assert_does_not_exist() { 4 | 5 | global.gamatas_testAssertNumber++; 6 | if (instance_exists(argument0)) { 7 | 8 | if (argument_count > 1) { 9 | msg = argument[1]; 10 | } else { 11 | msg = gamatas_create_assert_error(string(argument[0]) + " should not exist"); 12 | } 13 | test_fail(msg); 14 | } 15 | 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/gdash/scripts/assert_does_not_exist/assert_does_not_exist.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gamatas", 6 | "path": "folders/Scripts/lib/gamatas.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "assert_does_not_exist", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/assert_equal/assert_equal.gml: -------------------------------------------------------------------------------- 1 | /// @desc Ensures the passed values are equal 2 | /// @param TestValue 3 | /// @param ExpectedValue 4 | /// @param OptionalMessage 5 | function assert_equal() { 6 | 7 | global.gamatas_testAssertNumber++; 8 | if (argument[0] != argument[1]) { 9 | 10 | var msg; 11 | if (argument_count > 2) { 12 | msg = argument[2]; 13 | } else { 14 | msg = gamatas_create_assert_error(string(argument[0]) + " is not " + string(argument[1])); 15 | } 16 | test_fail(msg); 17 | } 18 | 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/gdash/scripts/assert_equal/assert_equal.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gamatas", 6 | "path": "folders/Scripts/lib/gamatas.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "assert_equal", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/assert_exists/assert_exists.gml: -------------------------------------------------------------------------------- 1 | /// @desc Ensures the passed in object/instance exists 2 | /// @param Object 3 | function assert_exists() { 4 | global.gamatas_testAssertNumber++; 5 | if (!instance_exists(argument0)) { 6 | var msg; 7 | 8 | if (argument_count > 1) { 9 | msg = argument[1]; 10 | } else { 11 | msg = gamatas_create_assert_error(string(argument[0]) + " has no instances"); 12 | } 13 | test_fail(msg); 14 | } 15 | 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/gdash/scripts/assert_exists/assert_exists.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gamatas", 6 | "path": "folders/Scripts/lib/gamatas.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "assert_exists", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/assert_is_false/assert_is_false.gml: -------------------------------------------------------------------------------- 1 | /// @desc Asserts that the passed in argument is false 2 | /// @param Value 3 | /// @param OptionalMessage 4 | function assert_is_false() { 5 | 6 | if (argument_count > 1) { 7 | assert_equal(argument[0], false, argument[1]); 8 | } else { 9 | assert_equal(argument[0], false); 10 | } 11 | 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/gdash/scripts/assert_is_false/assert_is_false.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gamatas", 6 | "path": "folders/Scripts/lib/gamatas.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "assert_is_false", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/assert_is_true/assert_is_true.gml: -------------------------------------------------------------------------------- 1 | /// @desc Asserts that the passed in argument is true 2 | /// @param Value 3 | /// @param OptionalMessage 4 | function assert_is_true() { 5 | 6 | if (argument_count > 1) { 7 | assert_equal(argument[0], true, argument[1]); 8 | } else { 9 | assert_equal(argument[0], true); 10 | } 11 | 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/gdash/scripts/assert_is_true/assert_is_true.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gamatas", 6 | "path": "folders/Scripts/lib/gamatas.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "assert_is_true", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/assert_is_undefined/assert_is_undefined.gml: -------------------------------------------------------------------------------- 1 | /// @desc Ensures the passed in argument is undefined 2 | /// @param TestValue 3 | /// @param OptionalMessage 4 | function assert_is_undefined() { 5 | 6 | global.gamatas_testAssertNumber++; 7 | if (!is_undefined(argument[0])) { 8 | 9 | var msg; 10 | if (argument_count > 1) { 11 | msg = argument[1]; 12 | } else { 13 | msg = gamatas_create_assert_error(string(argument[0]) + " is not undefined."); 14 | } 15 | test_fail(msg); 16 | } 17 | 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/gdash/scripts/assert_is_undefined/assert_is_undefined.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gamatas", 6 | "path": "folders/Scripts/lib/gamatas.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "assert_is_undefined", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/assert_not_equal/assert_not_equal.gml: -------------------------------------------------------------------------------- 1 | /// @desc Ensures the passed in values are not equal 2 | /// @param TestValue 3 | /// @param UnexpectedValue 4 | /// @param OptionalMessage 5 | function assert_not_equal() { 6 | 7 | global.gamatas_testAssertNumber++; 8 | if (argument[0] == argument[1]) { 9 | var msg = ""; 10 | 11 | if (argument_count > 2) { 12 | msg = argument[2]; 13 | } else { 14 | msg = gamatas_create_assert_error(string(argument[0]) + " shouldn\'t be " + string(argument[1])); 15 | } 16 | test_fail(msg); 17 | } 18 | 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/gdash/scripts/assert_not_equal/assert_not_equal.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gamatas", 6 | "path": "folders/Scripts/lib/gamatas.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "assert_not_equal", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/gamatas_create_assert_error/gamatas_create_assert_error.gml: -------------------------------------------------------------------------------- 1 | function gamatas_create_assert_error(argument0) { 2 | /* 3 | * Helper method for asserts to create standardized error 4 | * messages. Not meant for external use. 5 | */ 6 | return "ASSERT ERROR - " + string(argument0) + " - ASSERT #" + string(global.gamatas_testAssertNumber); 7 | 8 | 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/gdash/scripts/gamatas_create_assert_error/gamatas_create_assert_error.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gamatas", 6 | "path": "folders/Scripts/lib/gamatas.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "gamatas_create_assert_error", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/gamatas_info/gamatas_info.gml: -------------------------------------------------------------------------------- 1 | function gamatas_info() { 2 | /* 3 | * Simplified logging. Prints all arguments to the output console. 4 | * If you are not using a version of GameMaker with an output console, you 5 | * may want to edit this script to output to a file or something else. 6 | */ 7 | var output = string(argument[0]); 8 | for (var i = 1; i < argument_count; i++) { 9 | output += " " + string(argument[i]) 10 | } 11 | show_debug_message(output); 12 | 13 | 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/gdash/scripts/gamatas_info/gamatas_info.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gamatas", 6 | "path": "folders/Scripts/lib/gamatas.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "gamatas_info", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/native_floor/native_floor.gml: -------------------------------------------------------------------------------- 1 | function native_floor(argument0) { 2 | return floor(argument0); 3 | 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/gdash/scripts/native_floor/native_floor.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "unit test", 6 | "path": "folders/Scripts/util/unit test.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "native_floor", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/returnFour/returnFour.gml: -------------------------------------------------------------------------------- 1 | function returnFour() { 2 | return 4; 3 | 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/gdash/scripts/returnFour/returnFour.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "unit test", 6 | "path": "folders/Scripts/util/unit test.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "returnFour", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/sum/sum.gml: -------------------------------------------------------------------------------- 1 | function sum() { 2 | var total = argument[0]; 3 | var addMe = argument[1]; 4 | 5 | if (_type_of(total) == "undefined") { 6 | return addMe; 7 | } else { 8 | return total + addMe; 9 | } 10 | 11 | 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/gdash/scripts/sum/sum.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "unit test", 6 | "path": "folders/Scripts/util/unit test.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "sum", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/test_end/test_end.gml: -------------------------------------------------------------------------------- 1 | function test_end() { 2 | /* 3 | * Concludes an individual test in a test suite. 4 | * If the test passed, prints a success message and moves on 5 | * to the next test, otherwise, fails the test and exits. 6 | */ 7 | if (global.gamatas_testPassed) { 8 | gamatas_info("TEST PASSED: " + global.gamatas_testName); 9 | test_next(); 10 | } else { 11 | gamatas_info("TEST FAILED: " + global.gamatas_testName); 12 | gamatas_info("TEST SUITE FAILED: " + global.gamatas_testSuiteName); 13 | game_end(); 14 | } 15 | 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/gdash/scripts/test_end/test_end.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gamatas", 6 | "path": "folders/Scripts/lib/gamatas.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "test_end", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/test_fail/test_fail.gml: -------------------------------------------------------------------------------- 1 | /// @param Message 2 | function test_fail(argument0) { 3 | /* 4 | * Fails a test, printing the message and test info. This is used 5 | * internally by asserts, but can also be used to manually fail 6 | * tests if need be. 7 | */ 8 | var msg = argument0; 9 | gamatas_info(msg); 10 | gamatas_info("In suite " + global.gamatas_testSuiteName); 11 | gamatas_info("In test " + global.gamatas_testName + ": " + global.gamatas_testDescription); 12 | global.gamatas_testPassed = false; 13 | 14 | 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/gdash/scripts/test_fail/test_fail.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gamatas", 6 | "path": "folders/Scripts/lib/gamatas.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "test_fail", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/test_next/test_next.gml: -------------------------------------------------------------------------------- 1 | function test_next() { 2 | /* 3 | * Kicks off the next test in a suite (the next user defined 4 | * action). Used internally in end_test(). Use directly with 5 | * caution, as this is not supported for direct developer use 6 | * within the test automation suite. 7 | */ 8 | event_user(global.gamatas_testNumber++); 9 | 10 | 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/gdash/scripts/test_next/test_next.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gamatas", 6 | "path": "folders/Scripts/lib/gamatas.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "test_next", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/test_start/test_start.gml: -------------------------------------------------------------------------------- 1 | /// @param Name 2 | /// @param Description 3 | function test_start(argument0, argument1) { 4 | /* 5 | * Sets the description of the currently running test or exits 6 | * if the previous test fails. Use this to define specific tests 7 | * within a given test suite. 8 | * Example: 9 | * describe("Player Death", "The player should die at 0 health"); 10 | */ 11 | if (global.gamatas_testPassed) { 12 | global.gamatas_testName = argument0; 13 | global.gamatas_testDescription = argument1; 14 | global.gamatas_testCount++; 15 | } else { 16 | game_end(); 17 | } 18 | 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/gdash/scripts/test_start/test_start.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gamatas", 6 | "path": "folders/Scripts/lib/gamatas.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "test_start", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/test_suite_init/test_suite_init.gml: -------------------------------------------------------------------------------- 1 | /// @param TestSuiteName 2 | function test_suite_init(argument0) { 3 | /* 4 | * Initializes a test in an empty room 5 | */ 6 | global.gamatas_testPassed = true; 7 | global.gamatas_testCount = 0; 8 | global.gamatas_testSuiteName = argument0; 9 | global.gamatas_testNumber = 0; 10 | global.gamatas_testAssertNumber = 0; 11 | gamatas_info("TESTING SUITE: " + argument0); 12 | test_next(); 13 | 14 | 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/gdash/scripts/test_suite_init/test_suite_init.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gamatas", 6 | "path": "folders/Scripts/lib/gamatas.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "test_suite_init", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /src/gdash/scripts/test_suite_pass/test_suite_pass.gml: -------------------------------------------------------------------------------- 1 | function test_suite_pass() { 2 | /* 3 | * Finishes the test suite and moves on if there are more tests/rooms, 4 | * otherwise, quits. This should be called by itself in the last user 5 | * defined action on your test controller object. 6 | */ 7 | gamatas_info("TEST SUITE PASSED: " + global.gamatas_testSuiteName); 8 | if (room != room_last) { 9 | room_goto_next(); 10 | } else { 11 | gamatas_info("ALL TESTS PASSING"); 12 | game_end(); 13 | } 14 | 15 | 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/gdash/scripts/test_suite_pass/test_suite_pass.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "gamatas", 6 | "path": "folders/Scripts/lib/gamatas.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "test_suite_pass", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } --------------------------------------------------------------------------------