diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..ea3caecb --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,200 @@ +# v0.4.0 - First (proper) beta release + +This changelog lists every change that has been added since the last update (including public changes). + +## Flags System + +- Added a brand new flags system, which allows you to modify the game constants using a simple `flags.ini` file ([f8d1cf0](https://github.com/CodenameCrew/CodenameEngine/commit/f8d1cf08ad9f6cdda4e971a3d8adff6fce5130d2)) +- Added the ability to change the way the mod songs/weeks are added to the menu ([cb1d6fc](https://github.com/CodenameCrew/CodenameEngine/commit/cb1d6fcacf4ad0e2888ed7e76d16a6f85c09b021)) +- Added the ability to disable editors, transtions and beta warning state ([90a8c27](https://github.com/CodenameCrew/CodenameEngine/commit/90a8c2711ce36c9eaf85e705d551d46876991aa9)) +- Added the ability to set the default Transition, Pause, Game Over scripts ([fd0c188](https://github.com/CodenameCrew/CodenameEngine/commit/fd0c188577cf58e34e8ed706e59903a989ee2d11)) +- Added the ability to set the default glsl version ([cbbb598](https://github.com/CodenameCrew/CodenameEngine/commit/cbbb598f52b3f7c0f156cf72cd03e165aa38a4f1)) +- Added the ability to set the urls that the engine uses for wiki, fallback, and itch.io ([cbbb598](https://github.com/CodenameCrew/CodenameEngine/commit/cbbb598f52b3f7c0f156cf72cd03e165aa38a4f1)) + +## Additions + +- Added a function ``WindowUtils.resetAffixes()`` to reset the prefix and suffix of the engine's window title, and fixed a typo ([1d94945](https://github.com/CodenameCrew/CodenameEngine/commit/1d94945faeea86af02bcaecd715f5bea22ef48fd)) +- Added a field `extra` to FunkinSprite, which can be used to store any extra data you want (e.g. sprite.extra.set("name", value)) ([fb48570](https://github.com/CodenameCrew/CodenameEngine/commit/fb485701b451d6a7a22a1e696bfc081699f1c6d2)) +- Added default icon colors to every base game character ([814bd71](https://github.com/CodenameCrew/CodenameEngine/commit/814bd712fe2ea2dd21116e9903d9c2babe5341b1)) +- Added more features to cne.bat/cne.sh: ([4ef43df](https://github.com/CodenameCrew/CodenameEngine/commit/4ef43dfbecc79283d038d939f94671966802039e), [0dc166c](https://github.com/CodenameCrew/CodenameEngine/commit/0dc166c601b25e3167a1d04542840265484576b4)) + - Setup + - `--reinstall` to reinstall all libraries + - `--no-vscheck` to skip the Visual Studio check + - `--silent` to not print the download progress + - project file has conditionals now + - `--lib=path.xml` to use a specific setup file +- Alphabet now allows multiple lines in the text ([d519db0](https://github.com/CodenameCrew/CodenameEngine/commit/d519db011a14aac0ddfc052089836c6b445f7f44)) +- Allow importing mod root level modules in hscript, instead of only source/ ([7e66ee8](https://github.com/CodenameCrew/CodenameEngine/commit/7e66ee81e24204cd152de20046fa1500bb9d204b)) +- Added a way to force animations in the `Play Animation` event ([d7b6fbe](https://github.com/CodenameCrew/CodenameEngine/commit/d7b6fbe510edeb832112ab5adc8ab19dfe97d77f)) +- Adde unused boyfriend animations ([be55696](https://github.com/CodenameCrew/CodenameEngine/commit/be55696bbefe537f06ad6550b039278ffcbcfb2f)) +- Made it display the keybind for the mod menu in main menu ([1ac2e7f](https://github.com/CodenameCrew/CodenameEngine/commit/1ac2e7f53390a9e92aa2a1fea94d147ed50d3694)) +- Made the FPS Counter move on all Tree Menus instead of only in options ([bf0a6a9](https://github.com/CodenameCrew/CodenameEngine/commit/bf0a6a9bbe48bc5eb6df56077b66ecac7cbbcedd)) +- Improved the accuracy of the mall stage ([1fffb48](https://github.com/CodenameCrew/CodenameEngine/commit/1fffb487197c619bb8bae08c736ce868b5eb4df8)) +- Made the xml order consistent ([2f917fd](https://github.com/CodenameCrew/CodenameEngine/commit/2f917fd7c00ba4f80d85d2908781b806c77d8ce9)) +- Fixed issues with flipping the character in the editor ([2f917fd](https://github.com/CodenameCrew/CodenameEngine/commit/2f917fd7c00ba4f80d85d2908781b806c77d8ce9)) +- Added a toggle to turn off icon bopping `doIconBop` ([7b5d975](https://github.com/CodenameCrew/CodenameEngine/commit/7b5d975072690071824d21034485bf47c4396e8c)) +- Allow changing the camera zoom lerp speed `camGameZoomLerp` and `camHUDZoomLerp` ([d79959d](https://github.com/CodenameCrew/CodenameEngine/commit/d79959d0504562b952d04d5e3898847fcf45f0a6)) +- Added a system to easily set file attributes + Crash fix ([8d0a384](https://github.com/CodenameCrew/CodenameEngine/commit/8d0a38419de5ac4cccb5f08c47ea0acc3c6ded85), [a6c5b4d](https://github.com/CodenameCrew/CodenameEngine/commit/a6c5b4d6e81d1c5d2012388e69a906b7287599b3), [6715e2b](https://github.com/CodenameCrew/CodenameEngine/commit/6715e2b1ccec52ef82be92362a90e18a1b2ad7da)) +- Made a build info print when building ([6075da5](https://github.com/CodenameCrew/CodenameEngine/commit/6075da522077adba28154aba50ba1e07911ebe4f)) +- Made action builds use tar.gz for mac and linux ([d4a7d7e](https://github.com/CodenameCrew/CodenameEngine/commit/d4a7d7eac4dec7361aa778d97b6a2771c7b92295)) +- Made building have a progress bar ([ad52d5a](https://github.com/CodenameCrew/CodenameEngine/commit/ad52d5ac00918fea416c2add1ccffad389e22e85)) +- Added `onSplashShown` event ([82d50e5](https://github.com/CodenameCrew/CodenameEngine/commit/82d50e50c8416e377abcd3d5276f2e69023e90f3)) +- Added `Character` and `Stage` event parameter types ([363f828](https://github.com/CodenameCrew/CodenameEngine/commit/363f82860d302032f39d6b352ce95937b86719ab)) +- Added `bg` and `versionText`, and `forceCenterX` fields in funkin.menus.MainMenuState ([a3d9ddb](https://github.com/CodenameCrew/CodenameEngine/commit/a3d9ddb74e3e3fd1819ab41511f41c651c493ec6)) +- [Hscript] Actually use classes in tankmenRun.hx ([15e8e46](https://github.com/CodenameCrew/CodenameEngine/commit/15e8e4696123429ac00df74f7afb7e38349c7fc0)) +- Pass `shaderEnabled` and `colorTransform` to FlxAnimate ([9245078](https://github.com/CodenameCrew/CodenameEngine/commit/92450785f5be601d6e2e13b95fd46e87a3c240a8)) +- Added color support for credits, plus store the credits in a variable ([abb8449](https://github.com/CodenameCrew/CodenameEngine/commit/abb8449ca2782e748ae2a5fb4cfc6a7e3aeb5457)) +- Added number ranges `1..3,5,7..9,8..5` => `[1,2,3,5,7,8,9,8,7,6,5]` for use in indices ([1b55bef](https://github.com/CodenameCrew/CodenameEngine/commit/1b55beffe906404d8cb39ad63f6fc6b446557e1c)) +- Added support for `-loop` suffix animations ([24a65a4](https://github.com/CodenameCrew/CodenameEngine/commit/24a65a4a8ad1c1fd1f6fd989f94c901b93a8b07b)) +- Credits Main Menu Button instead of Donate button ([166c5f4](https://github.com/CodenameCrew/CodenameEngine/commit/166c5f44110965216ec6c58c7bb531a9fe9db86f)) +- Added customizable sound trays ([49db1a0](https://github.com/CodenameCrew/CodenameEngine/commit/49db1a089a83cb3db05d430f97be4797f380ba8f)) +- Allow for week colors in the story menu + a lot more ([49db1a0](https://github.com/CodenameCrew/CodenameEngine/commit/49db1a089a83cb3db05d430f97be4797f380ba8f)) +- Added `funkin.vis` (custom fork) and `grig.audio` for audio visualization ([173c48c](https://github.com/CodenameCrew/CodenameEngine/commit/173c48c7b54b85ddc9a550e7767f22515a87279b)) +- Added passable data to ModStates and ModSubStates ([e749a0e](https://github.com/CodenameCrew/CodenameEngine/commit/e749a0e7e32c336b4e3b5f32a8a09be2cfb8693e)) +- Imports in shaders + scriptable shaders ([a6697a8](https://github.com/CodenameCrew/CodenameEngine/commit/a6697a837c88ed38f4675d6bd63114b20dd592dc)) +- FNF Modern Parser wip ([47e60b6](https://github.com/CodenameCrew/CodenameEngine/commit/47e60b66f5d2d94491cec8489655236d21619abb)) +- Allow using custom extensions in `Paths` ([4b783a9](https://github.com/CodenameCrew/CodenameEngine/commit/4b783a983e9717993c28a67bb00cad21ae2f45fa)) +- Made the dropdown event parameter allow nested arrays and arrays ([ec4515f](https://github.com/CodenameCrew/CodenameEngine/commit/ec4515f4e21ea356fd298033100107d69c684a81)) +- Optimized StringTools.trim() code ([e51439b](https://github.com/CodenameCrew/CodenameEngine/commit/e51439b53e808a92e06afabaa2d48433b31117dc)) +- Added Stage Script Extensions ([15a18bb](https://github.com/CodenameCrew/CodenameEngine/commit/15a18bb3daf21c920266afee968e55e0325458ab), [bb58e08](https://github.com/CodenameCrew/CodenameEngine/commit/bb58e08c29a30a93e858b1d6c6bdcd0183b8021f), [d6ebd27](https://github.com/CodenameCrew/CodenameEngine/commit/d6ebd27b43924aef4d1c7ca25d299ed51f07f112)) +- Added a way to open the wiki from the engine ([d5740b4](https://github.com/CodenameCrew/CodenameEngine/commit/d5740b4e243909d95f34d528cf277dd71bb4d2dc)) +- Made the selected mod show as green in the mods menu ([33a5009](https://github.com/CodenameCrew/CodenameEngine/commit/33a50092acfe4b12bd78bdde81766735291c6ef0)) +- Added `getAnim` and `isAnimAtEnd` to `FunkinSprite` ([2c52720](https://github.com/CodenameCrew/CodenameEngine/commit/2c52720244a6b30a166d601185bf589ad12a0a15)) +- Added `bf` shorthand for `boyfriend` in playstate ([2b81220](https://github.com/CodenameCrew/CodenameEngine/commit/2b81220c15ed77acecd17c09a975ed401677165f)) +- Added character script extensions ([682358c](https://github.com/CodenameCrew/CodenameEngine/commit/682358c93a0c17469d1a481de0523e4c4e19c6ec)) +- Folder support in the character editor selection ([68c2fea](https://github.com/CodenameCrew/CodenameEngine/commit/68c2feab373db69d4a00b6f274f98afb3d8e3803)) +- cne.bat/cne.sh setup --fast for quickly downloading git libraries ([21bba98](https://github.com/CodenameCrew/CodenameEngine/commit/21bba98923307fe75667e1395781d068a7ec47ad)) +- Allow hold notes to be force deleted ([25b5630](https://github.com/CodenameCrew/CodenameEngine/commit/25b563066fc53ac92ebe3064175c80b5f1ae64bc)) +- Allow tweening shaders and array values using FlxTween ([3de3c3f](https://github.com/CodenameCrew/CodenameEngine/commit/3de3c3f8286b2b07c9690334e2d85ce052a909c5)) +- Made the advanced info show `Mod State: {name}` instead of `State: funkin.backend.scripting.ModState` ([3de3c3f](https://github.com/CodenameCrew/CodenameEngine/commit/3de3c3f8286b2b07c9690334e2d85ce052a909c5)) +- Made it possible to individually hide the rating and combo ([5ea2f57](https://github.com/CodenameCrew/CodenameEngine/commit/5ea2f57e25f513a70ed7fa9c7ecc2cdeb7112665)) +- Made the combo text be hidden by default ([5ea2f57](https://github.com/CodenameCrew/CodenameEngine/commit/5ea2f57e25f513a70ed7fa9c7ecc2cdeb7112665)) +- More scritping for the dialogues ([b1b1663](https://github.com/CodenameCrew/CodenameEngine/commit/b1b1663f5c3f06c88bfd6ed4c455ff03cc192d39)) +- Parse the error log for shaders and display it in a readable way ([200d8e3](https://github.com/CodenameCrew/CodenameEngine/commit/200d8e39509c783d78bf6b90d301e09d0defbc79)) +- Added import redirects for hscript ([1713e87](https://github.com/CodenameCrew/CodenameEngine/commit/1713e8700dd7dd3c62c625de11c231957bc48886)) +- Allow scrolling in the pause, mod, story, mod, main menus ([f671055](https://github.com/CodenameCrew/CodenameEngine/commit/f6710550c8805f1a1c987723faa77b884243d002)) +- Allow setting the window border color and title color on windows ([454bb73](https://github.com/CodenameCrew/CodenameEngine/commit/454bb735719a13a444ad9cfafa20d25266e8f799)) +- Added keybinds for some charter buttons ([32a0eda](https://github.com/CodenameCrew/CodenameEngine/commit/32a0eda1b03eefeab62ccddb734282cbc747a394)) +- Added more info about the latest commit in GitCommitMacro ([96b9851](https://github.com/CodenameCrew/CodenameEngine/commit/96b98513b322003058dff06b6d23c11b92e02840)) +- Support Psych Chart v1.0 Format ([eada310](https://github.com/CodenameCrew/CodenameEngine/commit/eada3105a471034250aa4b385f3e49d8c801567d)) +- Added FunkinSprite.addAnim + consistent names for FunkinSprite ([f6deda2](https://github.com/CodenameCrew/CodenameEngine/commit/f6deda2c84984202effdfc5f6b577c2d956aa7b5)) +- Added flipX and flipY to xml sprites ([6e2877c](https://github.com/CodenameCrew/CodenameEngine/commit/6e2877c2a9dc2d6de1ef793d35b6746f766d86b5)) +- Custom Transitions using scripting ([e2a3951](https://github.com/CodenameCrew/CodenameEngine/commit/e2a39517025e38832d24ce999be872963a19d105)) +- Added documentation for a lot of classes ([a6c9975](https://github.com/CodenameCrew/CodenameEngine/commit/a6c99754fd1bfe56db61b82b9749f073a1a0a170), [aec73ab](https://github.com/CodenameCrew/CodenameEngine/commit/aec73ab2b65ab8b2bfc18a3bb1393623da497913)) +- Added `SortedArrayUtil.removeSorted` ([a6c9975](https://github.com/CodenameCrew/CodenameEngine/commit/a6c99754fd1bfe56db61b82b9749f073a1a0a170)) +- Added blend mode support for FlxAnimate ([17cc888](https://github.com/CodenameCrew/CodenameEngine/commit/17cc888e61cb6dc55de0b285f533002c1ac05f4a), [76c07ce](https://github.com/CodenameCrew/CodenameEngine/commit/76c07cef30bda2e3718f2220cd3931e3fdc7ca75)) +- Allow for BPM Changes with decimals ([2557fc4](https://github.com/CodenameCrew/CodenameEngine/commit/2557fc4fb373ec09eee9b19642fb36bee909c72d)) +- Added NoteSkin, Dialogue, Alphabet editor icons ([16672e9](https://github.com/CodenameCrew/CodenameEngine/commit/16672e9f597fd4e621d7ee2c000ba559d3837662)) +- Added verbose mode for the log that can be enabled using `--verbose` ([a061284](https://github.com/CodenameCrew/CodenameEngine/commit/a06128472c3f0315a91110dd9882bfce75ad8999)) +- The Memory Info now shows more types of memory on windows ([38f6e86](https://github.com/CodenameCrew/CodenameEngine/commit/38f6e8676c36130a1a071e90ee1888244f8a405c)) +- Async video loading, bugfixes, pausing cutscenes, some playstate events now also get called in characters ([8e81d17](https://github.com/CodenameCrew/CodenameEngine/commit/8e81d17fb0cc9c69bc117ebfa9b901ec44e5a985)) +- Improved readability of the events macro ([47cf72d](https://github.com/CodenameCrew/CodenameEngine/commit/47cf72d53b985bcc818286a90fdbbaa92f4a9396)) +- Changed how editor icons are stored ([16672e9](https://github.com/CodenameCrew/CodenameEngine/commit/16672e9f597fd4e621d7ee2c000ba559d3837662), [18ea916](https://github.com/CodenameCrew/CodenameEngine/commit/18ea916f1af4c03db765ba55841acc13d7108766)) +- Changed `WindowUtils.winTitle` to `WindowUtils.title` ([a6c9975](https://github.com/CodenameCrew/CodenameEngine/commit/a6c99754fd1bfe56db61b82b9749f073a1a0a170)) + +## Removals + +- Removed `isGF` ([2f917fd](https://github.com/CodenameCrew/CodenameEngine/commit/2f917fd7c00ba4f80d85d2908781b806c77d8ce9)) +- Removed the `TITLESCREEN_XML` define because it made the code a lot more complicated ([2f63f8a](https://github.com/CodenameCrew/CodenameEngine/commit/2f63f8ac41f22c3ae33ad22ea497cb392af92291)) +- Removed the default example files since they are now on the website ([aae4dee](https://github.com/CodenameCrew/CodenameEngine/commit/aae4dee6cb6aa04ddd72b663f89901253b5e4015)) +- Removed the Haxe 4.3.0 warning ([5a8af43](https://github.com/CodenameCrew/CodenameEngine/commit/5a8af4301737b90b28500cb0409d77e51ae1e592)) + +## Bugfixes + +- Fixed min and max on event params TFloat not being floats ([97a486f](https://github.com/CodenameCrew/CodenameEngine/commit/97a486f03e076a2f1a0cbfcfb1f86dac2375edb4)) +- Fixed issues related to paused cameras ([0c06bf7](https://github.com/CodenameCrew/CodenameEngine/commit/0c06bf73b3dda26586285689c09d7b9757eaee39), [c38039c](https://github.com/CodenameCrew/CodenameEngine/commit/c38039c085ace56ed3dde4378ccf0701e1508e1b)) +- Fixed FPS counter breaking when changing timescale. ([0a1517d](https://github.com/CodenameCrew/CodenameEngine/commit/0a1517df6bb5374ab64f1149df856ae8e4d797c7)) +- Fixed week highscores not being saved correctly ([6021bd3](https://github.com/CodenameCrew/CodenameEngine/commit/6021bd36dc9e00edb646089e5d1e26a20765fc1e)) +- Fixed CoolUtil.openURL not working on Linux ([16fa304](https://github.com/CodenameCrew/CodenameEngine/commit/16fa3046e2ad69164e7ee2c0ef0826884a54dbe2)) +- Fixed CoolUtil.openURL not working on NixOs ([796d585](https://github.com/CodenameCrew/CodenameEngine/commit/796d585f9c4aeab96490f2554dd3038fef464384)) +- Fixed loop animations not supporting flxanimate ([2f552ae](https://github.com/CodenameCrew/CodenameEngine/commit/2f552ae519fdc54c735332d51934b9e4fb4e5446)) +- Fixed casesensitive issues when using Zip mods ([ecae996](https://github.com/CodenameCrew/CodenameEngine/commit/ecae996cc2001c4cdf05da21afdbd4efa56b7774)) +- Fixed issues with alphabet sprite ([2d7a87f](https://github.com/CodenameCrew/CodenameEngine/commit/2d7a87f9dad540889eb29071122831bc3dad9a44)) +- Fixed FNF Legacy Parser not handling mustHitSection ([31f9dd1](https://github.com/CodenameCrew/CodenameEngine/commit/31f9dd1aa55f8245fd742fcdfa3dd7913a798ecf)) +- Made `Alt Anim Note` and `No Anim Note` work on misses too ([b682bcf](https://github.com/CodenameCrew/CodenameEngine/commit/b682bcfb0b610ead51dbfe8805080d6b7b4a4ebf)) +- Improved sing animation code to reduce the amount of errors ([f259d62](https://github.com/CodenameCrew/CodenameEngine/commit/f259d626cfec591ef04c00429b37df16fb7f9857)) +- Fixed some issues with the character editor related to offsets ([ce19a63](https://github.com/CodenameCrew/CodenameEngine/commit/ce19a63225df3eba0135959f14e83ec4731b602f)) +- Made character scripts be destroyed ([1e8149e](https://github.com/CodenameCrew/CodenameEngine/commit/1e8149e0944dcab31d6196ba47e681da4e69d52d)) +- Fixed bug with autoplay that happened due to threading ([6aaa9e1](https://github.com/CodenameCrew/CodenameEngine/commit/6aaa9e1421230ef10eced39890fce4720ce09eac)) +- Fixed bug with the death counter not incrementing ([3ee946f](https://github.com/CodenameCrew/CodenameEngine/commit/3ee946fe031f8986fde2d354b0fc48102d11d7de)) +- Fixed videos not showing up ([c294c70](https://github.com/CodenameCrew/CodenameEngine/commit/c294c708170f528985933965f3320521dcbf1c5e)) +- Prevent the framerate counters from being selectable except when in advanced ([d9968a8](https://github.com/CodenameCrew/CodenameEngine/commit/d9968a8a87bb23957bb3e963e6e3a53c1b55b0d9), [e2c79be](https://github.com/CodenameCrew/CodenameEngine/commit/e2c79bea7d2125e3ad26f671c500d245d3e77cd9)) +- Forced xml animation attribute now works correctly ([ae5fc55](https://github.com/CodenameCrew/CodenameEngine/commit/ae5fc555a815cf5c8d9081bc84c477e2e3a91195), [680cb97](https://github.com/CodenameCrew/CodenameEngine/commit/680cb973a1af367926a3562014970c5dd9331318), [809f1f2](https://github.com/CodenameCrew/CodenameEngine/commit/809f1f2840b085ad50b4ac89895607a7fcc16152), [dd4e896](https://github.com/CodenameCrew/CodenameEngine/commit/dd4e8962d85bc9c65923418b576d622bdaf01bbc)) +- Fixed some issues with the editor blur not working on GL ES ([dec2a12](https://github.com/CodenameCrew/CodenameEngine/commit/dec2a126390faa60f3b458bfdaff312eb9ea355b)) +- Fixed limbs not being able to be rotated in spritemap for flxanimate ([90c5802](https://github.com/CodenameCrew/CodenameEngine/commit/90c5802057cad59362f6e6a4254477bebf48b7af)) +- Fixed notes disappearing early when exiting songs ([d8005a3](https://github.com/CodenameCrew/CodenameEngine/commit/d8005a316648e0d219110c000cf1c124c0e0c786)) +- Made it easier to apply flixel effects in shaders ([53c7746](https://github.com/CodenameCrew/CodenameEngine/commit/53c77466f5a09ce89913f38aec1859bd44dfb10a)) +- Fixed the volume on CoolUtil.playMusic not being a float ([36bb272](https://github.com/CodenameCrew/CodenameEngine/commit/36bb272ab401b83724863c1779780fa44da5e6d2)) +- UI Debug State is hidden in release ([71160f1](https://github.com/CodenameCrew/CodenameEngine/commit/71160f188e0abab627308547ccbf75eecd24a2fd)) +- Fixed so fast cars in the limo stage now work, and optimized the limo stage ([0b22165](https://github.com/CodenameCrew/CodenameEngine/commit/0b22165408c0b831e6bdc8512182851583b1c94b)) +- Allowed using introLength = 0 in scripts ([620650b](https://github.com/CodenameCrew/CodenameEngine/commit/620650bb81d0e314228ff863cd0edd15af37efe1)) +- Fixed not being able to use custom fonts in dialogues ([a886060](https://github.com/CodenameCrew/CodenameEngine/commit/a8860604e8a6d14d2781dda94bf14387e18c58e7)) +- Window title is now reset when the mod is changed ([2be2c68](https://github.com/CodenameCrew/CodenameEngine/commit/2be2c68c9b9268df7c7f9dc0a445f8890ce98992)) +- Fix the options not returning to the playstate if playstate opened the settings ([722278f](https://github.com/CodenameCrew/CodenameEngine/commit/722278fdd2f7b4601d8aaaed988e4a44317304ff)) +- Fixed the health icon health state being broken ([08179b1](https://github.com/CodenameCrew/CodenameEngine/commit/08179b124dc1f09f21df3b827565cce4c9b56a77)) +- Fix dialogueLine next sound not getting from `assets/sounds` ([cb54e5e](https://github.com/CodenameCrew/CodenameEngine/commit/cb54e5e1c56fd5914d868f0059c60948e2bff48d)) +- Fixed not being able to modify the main menu choice using scripts ([2ee70ca](https://github.com/CodenameCrew/CodenameEngine/commit/2ee70caf22f54353fca62703a370493ffaf57c2b)) +- Fixed not being able to modift the week choice using scripts ([0261223](https://github.com/CodenameCrew/CodenameEngine/commit/02612239e814aa4821b807670e22fcbee4aa4ff9)) +- Fixed engine hanging on sudo password prompt ([da3fd5e](https://github.com/CodenameCrew/CodenameEngine/commit/da3fd5e0ddc729c3af413d305d139a23e08a6074)) +- Fixed the default difficulty not being set to the middle of the difficulty list ([04e1763](https://github.com/CodenameCrew/CodenameEngine/commit/04e1763d259ed11871ef445a7d7cd7ffa41818d3)) +- Fixed the alpha for the week sprites ([04e1763](https://github.com/CodenameCrew/CodenameEngine/commit/04e1763d259ed11871ef445a7d7cd7ffa41818d3)) +- Fixed the documentation for the trail cache ([2d9c771](https://github.com/CodenameCrew/CodenameEngine/commit/2d9c7716240099dc23d777c0e5418ccaff258f96)) +- If on source assets: Paths.getAssetsRoot() now returns the path to the source assets ([1aacf14](https://github.com/CodenameCrew/CodenameEngine/commit/1aacf14c6b3a6f5261f0b7ce2d1a6d6814f633d7)) +- Fixed character offsets to be more visually pleasing ([9d51b9d](https://github.com/CodenameCrew/CodenameEngine/commit/9d51b9db8fdd7f031d88e78d3621ebf52870a2a9)) +- Fix some issues with incorrect types ([17301f6](https://github.com/CodenameCrew/CodenameEngine/commit/17301f6951432357e08c201c37f270522c82d36e)) +- Fixed not being able to have cutscenes on a video thats longer than 25 days ([1713e87](https://github.com/CodenameCrew/CodenameEngine/commit/1713e8700dd7dd3c62c625de11c231957bc48886)) +- Fixed split vocals not pausing when pausing in editor ([4bf58ae](https://github.com/CodenameCrew/CodenameEngine/commit/4bf58aeda5b66a6b4a9a2cfa5f2e1536d8c95bad)) +- Fixed bug with coop opponent mode ([4295d42](https://github.com/CodenameCrew/CodenameEngine/commit/4295d424941537d5a36dad4f8ae3526910d1f25e)) +- Fixed the hscript errors having incorrect line numbers ([a2a12f1](https://github.com/CodenameCrew/CodenameEngine/commit/a2a12f121ec388703f003f53dd4be689402099cd)) +- Fixed reloading a uistate that has custom script name ([83cf69b](https://github.com/CodenameCrew/CodenameEngine/commit/83cf69b4777d581d816cc0d1f4cf3c8f22254ff2)) +- Fixed typos across the entire engine ([d6dc3ea](https://github.com/CodenameCrew/CodenameEngine/commit/d6dc3ea232369e2b7b3d59024655a4d15fd4b027)) +- Fixed negative sustain lengths breaking the chart editor ([0040d93](https://github.com/CodenameCrew/CodenameEngine/commit/0040d93950d89f20acc09ae43fb9c248d8028748)) +- Fixed pasting and added copying in `UITextBox` ([c4abac4](https://github.com/CodenameCrew/CodenameEngine/commit/c4abac4ba1ef0692325a736f1123a511965368a6)) +- Made the Freeplay Autoplay change the bpm ([f90782d](https://github.com/CodenameCrew/CodenameEngine/commit/f90782d7123970215324ace99c55584ad78ca028)) +- Prevent accidental mouse inputs when pressing on the unfocused window ([300f38d](https://github.com/CodenameCrew/CodenameEngine/commit/300f38d290bb8c31a5c1e67afdf981c644b27f8a)) +- Fix notes not being destroyed when the strumline is destroyed ([1f224be](https://github.com/CodenameCrew/CodenameEngine/commit/1f224bef228c496d789aeed1f44c6517668107a9)) +- Fixed the credits and options menu backgorunds not being animated if the background is animated ([1facc82](https://github.com/CodenameCrew/CodenameEngine/commit/1facc82073b9a06b861d1987a162f8aecbec46f1)) +- Fixed duplicated line messages in the log ([1aa1364](https://github.com/CodenameCrew/CodenameEngine/commit/1aa136469d1ecadb4e9c49c04d6d6287d4b39884)) +- Selection fixes in Editors ([0102cbb](https://github.com/CodenameCrew/CodenameEngine/commit/0102cbbdb6812f315697f6e389760ce948ff1993), [accc197](https://github.com/CodenameCrew/CodenameEngine/commit/accc197407c86a6fe9aaf1c557c93148674879ff)) + +## Crash fixes + +- Fixed missing null check in Paths.getFrames() ([ea52e25](https://github.com/CodenameCrew/CodenameEngine/commit/ea52e25251089eed0edc92ef237b93916919e73d)) +- Fixed crash in charter regarding Voices missing ([b2c4cc3](https://github.com/CodenameCrew/CodenameEngine/commit/b2c4cc3777e634e76c83f477661156fee464e690)) +- Fixed crash if custom camera wasnt set in pause menu ([b79dbe4](https://github.com/CodenameCrew/CodenameEngine/commit/b79dbe4a74516c2ba8e43dff6bd236d377fd25f5)) +- Fixed waveform crashes ([64923a3](https://github.com/CodenameCrew/CodenameEngine/commit/64923a3e07317fc36db9e539b546c72d64275653)) +- Fixed null reference in PlayState ([6c34dbf](https://github.com/CodenameCrew/CodenameEngine/commit/6c34dbf6207b9ef17f9d551b637f151aade4f4e3)) +- Fixed crash that happens when using a assets/ path in a event pack ([0afbbbf](https://github.com/CodenameCrew/CodenameEngine/commit/0afbbbf625b128496e973b4f7922a187339330ef)) +- Fixed crash when skipping a transition ([e2a3951](https://github.com/CodenameCrew/CodenameEngine/commit/e2a39517025e38832d24ce999be872963a19d105)) +- Fixed crash when there are no mods folder ([7488485](https://github.com/CodenameCrew/CodenameEngine/commit/74884854ea2caceeef17edbffcb07cd8898d466e)) + + +## Typo fixes + +- Fixed typos in funkin.game.StrumLine ([71b7daa](https://github.com/CodenameCrew/CodenameEngine/commit/71b7daabbfc742212f2b35d27b5655561504bf3a)) +- Fixed documentation typos ([165338f](https://github.com/CodenameCrew/CodenameEngine/commit/165338f36c1e394b377ed87c2df6306676cfb4c7)) + +## Optimizations + Cleanup + +- Various optimizations and cleanup ([7b279bf](https://github.com/CodenameCrew/CodenameEngine/commit/7b279bfed0dea7b9d49fa7272fbb16d7ecdd4349), [8174fef](https://github.com/CodenameCrew/CodenameEngine/commit/8174fef53db028e5808239f87566a84d6467d9fd)) +- Small ram improvements +- Asset optimizations ([3ce7561](https://github.com/CodenameCrew/CodenameEngine/commit/3ce7561f560757f627144041bfdd3cde701eb5c2)) +- Optimized internal shader code ([ddd4be8](https://github.com/CodenameCrew/CodenameEngine/commit/ddd4be87554463adcbcf8559f03eb3aa38b95d6c)) +- Optimize the angle code ([120127b](https://github.com/CodenameCrew/CodenameEngine/commit/120127b10c2f7138955df07412c3e114cb610b0e)) +- Optimize the entire engine by using rewriting the casts ([2bfc58c](https://github.com/CodenameCrew/CodenameEngine/commit/2bfc58ccb0851ca498173dc6b253073000895d73)) +- Optimize the startsWith and endsWith functions on C++ ([73e6832](https://github.com/CodenameCrew/CodenameEngine/commit/73e6832ad3d65b2983d5683d6283ee2bc0150737)) +- Ram optimizations ([85b50c7](https://github.com/CodenameCrew/CodenameEngine/commit/85b50c7ccee88000ada26ae73391ab8693c5d5de)) +- Optimized the fast editor blur shader ([99fb9b4](https://github.com/CodenameCrew/CodenameEngine/commit/99fb9b48e5e7e9a709ae6e9d812a413bc50ed05b)) +- Optimize senpai sprites ([9d51b9d](https://github.com/CodenameCrew/CodenameEngine/commit/9d51b9db8fdd7f031d88e78d3621ebf52870a2a9)) +- Added optimizations for the entire engine ([669645e](https://github.com/CodenameCrew/CodenameEngine/commit/669645ed47fa6f12ab3d507f0bd3acea24ab08f7)) +- Optimizations for the editors and PlayState notes ([f54c485](https://github.com/CodenameCrew/CodenameEngine/commit/f54c485d0c7cec1799a0a1a7921e2ff16ed35028)) +- Cleanup Save macro ([85b50c7](https://github.com/CodenameCrew/CodenameEngine/commit/85b50c7ccee88000ada26ae73391ab8693c5d5de)) +- Cleaned up the controls code ([c3580cf](https://github.com/CodenameCrew/CodenameEngine/commit/c3580cf1413f90386dd52763042e11b20d21ce2d), [c1123b9](https://github.com/CodenameCrew/CodenameEngine/commit/c1123b9e3c3c1887888744e0c62827231abc48be)) +- Cleaned up unused variables in TitleState ([2779ef3](https://github.com/CodenameCrew/CodenameEngine/commit/2779ef3314471558e371b3ec2f17f8d4df48943a)) +- Restructured the events folder ([77b7eeb](https://github.com/CodenameCrew/CodenameEngine/commit/77b7eebed1ea077516ff884902528c0ff3d01872)) +- Reduced the amount of data thats stored for the Github Contributors savefile ([2abc45a](https://github.com/CodenameCrew/CodenameEngine/commit/2abc45a9e416a1c5dd2bd0a5297c664e60c6f1d8)) + + +## Unsorted list + +- @NexIsDumb Please document this i still dont understand it ([d31454c](https://github.com/CodenameCrew/CodenameEngine/commit/d31454c7ddf4cbf6a681cc8b32cd3f9480f8eacd)) \ No newline at end of file diff --git a/TODO.md b/TODO.md index b3d2e4cf..080b537f 100644 --- a/TODO.md +++ b/TODO.md @@ -44,7 +44,7 @@ - [x] Dialogue - [ ] Finish Base Game port - [x] Add credits -- [ ] Verbose mode (`--verbose`) +- [x] Verbose mode (`--verbose`) - [ ] Tooltips - [ ] Fix bugs diff --git a/alsoft.txt b/alsoft.txt new file mode 100644 index 00000000..2f928c99 --- /dev/null +++ b/alsoft.txt @@ -0,0 +1,14 @@ +[general] +sample-type=float32 +stereo-mode=speakers +stereo-encoding=panpot +hrtf=false +cf_level=0 +resampler=fast_bsinc24 +front-stablizer=false +output-limiter=false +volume-adjust=0 +[decoder] +hq-mode=false +distance-comp=false +nfc=false \ No newline at end of file diff --git a/assets/songs/thorns/cutscene.hx b/assets/songs/thorns/cutscene.hx index 79a46451..73a1f08f 100644 --- a/assets/songs/thorns/cutscene.hx +++ b/assets/songs/thorns/cutscene.hx @@ -1,16 +1,20 @@ +// import flixel.addons.util.FlxSimplex; var self = this; __script__.setParent(PlayState.instance); var scream:FlxSound; +var red:FlxSprite; var senpaiEvil:FlxSprite; +var timers:Array = []; var dfx = 0; var dfy = 0; + function create() { camHUD.visible = false; - var red:FlxSprite = new FlxSprite().makeSolid(FlxG.width + 100, FlxG.height + 100, 0xFFff1b31); + red = new FlxSprite().makeSolid(FlxG.width + 100, FlxG.height + 100, 0xFFff1b31); red.screenCenter(); red.scrollFactor.set(); add(red); @@ -28,7 +32,7 @@ function create() { dfy = senpaiEvil.y; add(senpaiEvil); - new FlxTimer().start(3.2, function(deadTime:FlxTimer) + timers.push(new FlxTimer().start(3.2, function(deadTime:FlxTimer) { FlxG.camera.fade(FlxColor.WHITE, 1.6, false, function() { remove(senpaiEvil, true); @@ -38,18 +42,20 @@ function create() { FlxG.camera._fxFadeAlpha = 1; }); - }); + timers.remove(deadTime); + })); scream = FlxG.sound.play(Paths.sound('cutscenes/weeb/Senpai_Dies'), 1, false, null, true, function() { - new FlxTimer().start(0.4, function(swagTimer:FlxTimer) { + timers.push(new FlxTimer().start(0.4, function(swagTimer:FlxTimer) { FlxG.camera._fxFadeAlpha -= 0.15; - if(FlxG.camera._fxFadeAlpha > 0.3) swagTimer.reset(); + if (FlxG.camera._fxFadeAlpha > 0.3) swagTimer.reset(); else { + timers.remove(swagTimer); camHUD.visible = true; self.startDialogue("assets/songs/" + PlayState.instance.SONG.meta.name.toLowerCase() + "/creepyDialogue.xml", self.close); } - }); + })); }); } @@ -67,4 +73,13 @@ function update(elapsed:Float) { senpaiEvil.setPosition(dfx + vx, dfy + vy); } +} + +function destroy() { // Since you can skip the cutscene - Nex + for (timer in timers) timer.cancel(); + senpaiEvil?.destroy(); + red?.destroy(); + FlxG.camera.stopFade(); + scream?.destroy(); + camHUD.visible = true; } \ No newline at end of file diff --git a/libraries/macro-fixer/macros/HashLinkFixer.hx b/libraries/macro-fixer/macros/HashLinkFixer.hx index a6537d99..8b9ffd7c 100644 --- a/libraries/macro-fixer/macros/HashLinkFixer.hx +++ b/libraries/macro-fixer/macros/HashLinkFixer.hx @@ -152,7 +152,4 @@ class HashLinkFixer { return fields; } } -#else -class HashLinkFixer { -} #end \ No newline at end of file diff --git a/libs.xml b/libs.xml index 7c5ee48f..c7285668 100644 --- a/libs.xml +++ b/libs.xml @@ -24,6 +24,7 @@ + diff --git a/project.xml b/project.xml index b8c1eb6c..942779db 100644 --- a/project.xml +++ b/project.xml @@ -68,6 +68,12 @@ + +
+ + +
+ @@ -143,6 +149,9 @@ + + +
@@ -154,6 +163,9 @@ + + + @@ -183,6 +195,7 @@ + diff --git a/source/funkin/backend/assets/Paths.hx b/source/funkin/backend/assets/Paths.hx index 5988a7ba..a02465e2 100644 --- a/source/funkin/backend/assets/Paths.hx +++ b/source/funkin/backend/assets/Paths.hx @@ -198,13 +198,15 @@ class Paths * @param Unique Whenever the image should be unique in the cache * @param Key Key to the image in the cache * @param SkipAtlasCheck Whenever the atlas check should be skipped. + * @param SkipMultiCheck Whenever the multi spritesheet check should be skipped. + * @param Ext Extension of the image. * @return FlxFramesCollection Frames */ - static function loadFrames(path:String, Unique:Bool = false, Key:String = null, SkipAtlasCheck:Bool = false, ?Ext:String = null):FlxFramesCollection { + static function loadFrames(path:String, Unique:Bool = false, Key:String = null, SkipAtlasCheck:Bool = false, SkipMultiCheck:Bool = false, ?Ext:String = null):FlxFramesCollection { var noExt = Path.withoutExtension(path); var ext = Ext != null ? Ext : Flags.IMAGE_EXT; - if (Assets.exists('$noExt/1.${ext}')) { + if (!SkipMultiCheck && Assets.exists('$noExt/1.${ext}')) { // MULTIPLE SPRITESHEETS!! var graphic = FlxG.bitmap.add("flixel/images/logo/default.png", false, '$noExt/mult'); @@ -216,7 +218,7 @@ class Paths var cur = 1; var finalFrames = new MultiFramesCollection(graphic); while(Assets.exists('$noExt/$cur.${ext}')) { - var spr = loadFrames('$noExt/$cur.${ext}'); + var spr = loadFrames('$noExt/$cur.${ext}', false, null, false, true); finalFrames.addFrames(spr); cur++; } diff --git a/source/funkin/backend/scripting/GlobalScript.hx b/source/funkin/backend/scripting/GlobalScript.hx index ecd52be7..887aea76 100644 --- a/source/funkin/backend/scripting/GlobalScript.hx +++ b/source/funkin/backend/scripting/GlobalScript.hx @@ -79,7 +79,8 @@ class GlobalScript { call("update", [FlxG.elapsed]); }); - onModSwitch(#if MOD_SUPPORT ModsFolder.currentModFolder #else null #end); + // Commented this out, because it might be the cause why global runs twice - Neo + //onModSwitch(#if MOD_SUPPORT ModsFolder.currentModFolder #else null #end); } public static function event(name:String, event:T):T { diff --git a/source/funkin/backend/scripting/HScript.hx b/source/funkin/backend/scripting/HScript.hx index 8a5f36fd..a1fbac54 100644 --- a/source/funkin/backend/scripting/HScript.hx +++ b/source/funkin/backend/scripting/HScript.hx @@ -101,11 +101,15 @@ class HScript extends Script { private function _errorHandler(error:Error) { var fileName = error.origin; + var oldfn = '$fileName:${error.line}: '; if(remappedNames.exists(fileName)) fileName = remappedNames.get(fileName); var fn = '$fileName:${error.line}: '; var err = error.toString(); - if (err.startsWith(fn)) err = err.substr(fn.length); + while(err.startsWith(oldfn) || err.startsWith(fn)) { + if (err.startsWith(oldfn)) err = err.substr(oldfn.length); + if (err.startsWith(fn)) err = err.substr(fn.length); + } Logs.traceColored([ Logs.logText(fn, GREEN), diff --git a/source/funkin/backend/scripting/Script.hx b/source/funkin/backend/scripting/Script.hx index 8eeef6f7..5fe597b9 100644 --- a/source/funkin/backend/scripting/Script.hx +++ b/source/funkin/backend/scripting/Script.hx @@ -156,7 +156,7 @@ class Script extends FlxBasic implements IFlxDestroyable { public static function getDefaultPreprocessors():Map { var defines = funkin.backend.system.macros.DefinesMacro.defines; defines.set("CODENAME_ENGINE", true); - defines.set("CODENAME_VER", Application.current.meta.get('version')); + defines.set("CODENAME_VER", Flags.VERSION); defines.set("CODENAME_BUILD", 2675); // 2675 being the last build num before it was removed defines.set("CODENAME_COMMIT", Flags.COMMIT_NUMBER); return defines; diff --git a/source/funkin/backend/shaders/CustomShader.hx b/source/funkin/backend/shaders/CustomShader.hx index 67be4761..62308e69 100644 --- a/source/funkin/backend/shaders/CustomShader.hx +++ b/source/funkin/backend/shaders/CustomShader.hx @@ -19,7 +19,8 @@ class CustomShader extends FunkinShader { * @param name Name of the frag and vert files. * @param glslVersion GLSL version to use. Defaults to `120`. */ - public function new(name:String, glslVersion:String = "120") { + public function new(name:String, glslVersion:String = null) { + if (glslVersion == null) glslVersion = Flags.DEFAULT_GLSL_VERSION; var fragShaderPath = Paths.fragShader(name); var vertShaderPath = Paths.vertShader(name); var fragCode = Assets.exists(fragShaderPath) ? Assets.getText(fragShaderPath) : null; diff --git a/source/funkin/backend/shaders/FunkinShader.hx b/source/funkin/backend/shaders/FunkinShader.hx index d3af27b5..fb3f9201 100644 --- a/source/funkin/backend/shaders/FunkinShader.hx +++ b/source/funkin/backend/shaders/FunkinShader.hx @@ -26,7 +26,7 @@ class FunkinShader extends FlxShader implements IHScriptCustomBehaviour { public var onGLUpdate:FlxTypedSignalVoid> = new FlxTypedSignalVoid>(); public var onProcessGLData:FlxTypedSignal<(String, String)->Void> = new FlxTypedSignal<(String, String)->Void>(); - public var glslVer:String = "120"; + public var glslVer:String = Flags.DEFAULT_GLSL_VERSION; public var fileName:String = "FunkinShader"; public var fragFileName:String = "FunkinShader"; public var vertFileName:String = "FunkinShader"; @@ -42,7 +42,8 @@ class FunkinShader extends FlxShader implements IHScriptCustomBehaviour { * @param vert Vertex source (pass `null` to use default) * @param glslVer Version of GLSL to use (defaults to 120) */ - public override function new(frag:String, vert:String, glslVer:String = "120") { + public override function new(frag:String, vert:String, glslVer:String = null) { + if (glslVer == null) glslVer = Flags.DEFAULT_GLSL_VERSION; if (frag == null) frag = ShaderTemplates.defaultFragmentSource; if (vert == null) vert = ShaderTemplates.defaultVertexSource; this.glFragmentSource = frag; diff --git a/source/funkin/backend/system/CommandLineHandler.hx b/source/funkin/backend/system/CommandLineHandler.hx index 3690b6a2..1545108f 100644 --- a/source/funkin/backend/system/CommandLineHandler.hx +++ b/source/funkin/backend/system/CommandLineHandler.hx @@ -64,6 +64,8 @@ class CommandLineHandler { Main.noCwdFix = true; case "-livereload": // do nothing + case "-v" | "-verbose" | "--verbose": + Main.verbose = true; default: Sys.println("Unknown command"); } diff --git a/source/funkin/backend/system/Flags.hx b/source/funkin/backend/system/Flags.hx index 3c096f5b..28c82b59 100644 --- a/source/funkin/backend/system/Flags.hx +++ b/source/funkin/backend/system/Flags.hx @@ -1,6 +1,6 @@ package funkin.backend.system; -import lime.utils.AssetLibrary; +import lime.utils.AssetLibrary as LimeAssetLibrary; import lime.utils.AssetType; import flixel.util.FlxColor; @@ -18,7 +18,11 @@ class Flags { public static var COMMIT_NUMBER:Int = GitCommitMacro.commitNumber; public static var COMMIT_HASH:String = GitCommitMacro.commitHash; public static var COMMIT_MESSAGE:String = 'Commit $COMMIT_NUMBER ($COMMIT_HASH)'; - @:lazy public static var VERSION_MESSAGE:String = 'Codename Engine v${Application.current.meta.get('version')}'; + + @:lazy public static var TITLE:String = Application.current.meta.get('name'); + @:lazy public static var VERSION:String = Application.current.meta.get('version'); + + @:lazy public static var VERSION_MESSAGE:String = 'Codename Engine v$VERSION'; public static var REPO_NAME:String = "CodenameEngine"; public static var REPO_OWNER:String = "CodenameCrew"; @@ -110,6 +114,16 @@ class Flags { public static var DEFAULT_HUD_ZOOM:Float = 1.0; public static var MAX_CAMERA_ZOOM:Float = 1.35; + // to translate these you need to convert them into ids + // Resume -> pause.resume + // Restart Song -> pause.restart + // Change Controls -> pause.changeControls + // Change Options -> pause.changeOptions + // Exit to menu -> pause.exitToMenu + // Exit to charter -> pause.exitToCharter + // Resume Cutscene -> pause.resumeCutscene + // Skip Cutscene -> pause.skipCutscene + // Restart Cutscene -> pause.restartCutscene public static var DEFAULT_PAUSE_ITEMS:Array = ['Resume', 'Restart Song', 'Change Controls', 'Change Options', 'Exit to menu', "Exit to charter"]; public static var DEFAULT_CUTSCENE_PAUSE_ITEMS:Array = ['Resume Cutscene', 'Skip Cutscene', 'Restart Cutscene', 'Exit to menu']; public static var DEFAULT_GITAROO:Bool = true; @@ -157,6 +171,14 @@ class Flags { public static var DEFAULT_PAUSE_SCRIPT:String = ""; @:also(funkin.game.GameOverSubstate.script) public static var DEFAULT_GAMEOVER_SCRIPT:String = ""; + + public static var URL_WIKI:String = "https://codename-engine.com/"; + public static var URL_EDITOR_FALLBACK:String = "https://www.youtube.com/watch?v=9Youam7GYdQ"; + public static var URL_FNF_ITCH:String = "https://ninja-muffin24.itch.io/funkin"; + + public static var DEFAULT_GLSL_VERSION:String = "120"; + @:also(funkin.backend.utils.HttpUtil.userAgent) + public static var USER_AGENT:String = 'request'; // -- End of Codename's Default Flags -- /** @@ -164,50 +186,68 @@ class Flags { */ @:bypass public static var customFlags:Map = []; - public static function load() { - var flags:Map = []; + public static function loadFromData(flags:Map, data:String) { + var trimmed:String; + var splitContent = [for(e in data.split("\n")) if ((trimmed = e.trim()) != "") trimmed]; - final flagsPath = Paths.getPath("flags.ini"); + for(line in splitContent) { + if(line.startsWith(";")) continue; + if(line.startsWith("#")) continue; + if(line.startsWith("//")) continue; + if(line.length == 0) continue; + if(line.charAt(0) == "[" && line.charAt(line.length-1) == "]") continue; - for(lib in Paths.assetsTree.libraries) { - #if TRANSLATIONS_SUPPORT - // skip translations since it would be useless, if you wanna modify it set the flags inside of global.hx - if(lib is funkin.backend.assets.TranslatedAssetLibrary) continue; - #end + var index = line.indexOf("="); + if(index == -1) continue; + var name = line.substr(0, index).trim(); + var value = line.substr(index+1).trim(); - if(lib.exists(flagsPath, AssetType.TEXT)) { - var data:String = lib.getAsset(flagsPath, AssetType.TEXT); - var trimmed:String; - var splitContent = [for(e in data.split("\n")) if ((trimmed = e.trim()) != "") trimmed]; + var wasQuoted = value.length > 1 && value.charCodeAt(0) == '"'.code && value.charCodeAt(value.length-1) == '"'.code; + if(wasQuoted) value = value.substr(1, value.length - 2); + if((!wasQuoted && value.length == 0) || name.length == 0) + continue; - for(line in splitContent) { - if(line.startsWith(";")) continue; - if(line.startsWith("#")) continue; - if(line.startsWith("//")) continue; - if(line.length == 0) continue; - if(line.charAt(0) == "[" && line.charAt(line.length-1) == "]") continue; - - var index = line.indexOf("="); - if(index == -1) continue; - var name = line.substr(0, index).trim(); - var value = line.substr(index+1).trim(); - - var wasQuoted = value.length > 1 && value.charCodeAt(0) == '"'.code && value.charCodeAt(value.length-1) == '"'.code; - if(wasQuoted) value = value.substr(1, value.length - 2); - if((!wasQuoted && value.length == 0) || name.length == 0) - continue; - - if(!flags.exists(name)) - flags[name] = value; - } - } + if(!flags.exists(name)) + flags[name] = value; } + } + public static function loadFromDatas(files:Array) { + var flags:Map = []; + for(file in files) { + var data:String = Assets.getText(file); + if(data != null) + loadFromData(flags, data); + } + return flags; + } + + public static function parseFlags(flags:Map) { customFlags = []; reset(); for(name=>value in flags) - if(!parse(name, value)) { + if(!parse(name, value)) customFlags.set(name, value); - } + } + + /** + * Loads the flags from the assets. + **/ + public static function load(?libs:Array = null) { + if (libs == null) + libs = Paths.assetsTree.libraries; + final flagsPath = Paths.getPath("flags.ini"); + var datas:Array = [ + for(lib in libs) + #if TRANSLATIONS_SUPPORT + // skip translations since it would be useless, if you wanna modify it set the flags inside of global.hx + if(!(lib is funkin.backend.assets.TranslatedAssetLibrary)) + #end + if(lib.exists(flagsPath, AssetType.TEXT)) + lib.getAsset(flagsPath, AssetType.TEXT) + ]; + + var flags:Map = loadFromDatas(datas); + parseFlags(flags); } } \ No newline at end of file diff --git a/source/funkin/backend/system/Logs.hx b/source/funkin/backend/system/Logs.hx index 36192db6..07759a60 100644 --- a/source/funkin/backend/system/Logs.hx +++ b/source/funkin/backend/system/Logs.hx @@ -24,7 +24,7 @@ class Logs { ); } } - __showInConsole(prepareColoredTrace(data, TRACE)); + traceColored(data, TRACE); }; LogFrontEnd.onLogs = function(data, style, fireOnce) { @@ -131,7 +131,7 @@ class Logs { #end } - public static function traceColored(text:Array, level:Level = INFO) + public inline static function traceColored(text:Array, level:Level = INFO) __showInConsole(prepareColoredTrace(text, level)); public static function trace(text:String, level:Level = INFO, color:ConsoleColor = LIGHTGRAY, ?prefix:String) { @@ -140,33 +140,20 @@ class Logs { traceColored(text, level); } - public inline static function getPrefix(prefix:String) { + public inline static function getPrefix(prefix:String) return logText('[${prefix}] ', BLUE); - } - public inline static function infos(text:String, color:ConsoleColor = LIGHTGRAY, ?prefix:String) { + public inline static function infos(text:String, color:ConsoleColor = LIGHTGRAY, ?prefix:String) Logs.trace(text, INFO, color, prefix); - } - public inline static function verbose(text:String, color:ConsoleColor = LIGHTGRAY, ?prefix:String) { - Logs.trace(text, VERBOSE, color, prefix); - } + public inline static function verbose(text:String, color:ConsoleColor = LIGHTGRAY, ?prefix:String) + if (Main.verbose) Logs.trace(text, VERBOSE, color, prefix); - public inline static function warn(text:String, color:ConsoleColor = YELLOW, ?prefix:String) { + public inline static function warn(text:String, color:ConsoleColor = YELLOW, ?prefix:String) Logs.trace(text, WARNING, color, prefix); - } - public inline static function error(text:String, color:ConsoleColor = RED, ?prefix:String) { + public inline static function error(text:String, color:ConsoleColor = RED, ?prefix:String) Logs.trace(text, ERROR, color, prefix); - } - - public inline static function success(text:String, color:ConsoleColor = GREEN, ?prefix:String) { - Logs.trace(text, SUCCESS, color, prefix); - } - - public inline static function failure(text:String, color:ConsoleColor = RED, ?prefix:String) { - Logs.trace(text, FAILURE, color, prefix); - } } enum abstract Level(Int) { diff --git a/source/funkin/backend/system/Main.hx b/source/funkin/backend/system/Main.hx index 8ebeb665..fc5fccdb 100644 --- a/source/funkin/backend/system/Main.hx +++ b/source/funkin/backend/system/Main.hx @@ -34,6 +34,7 @@ class Main extends Sprite public static var modToLoad:String = null; public static var forceGPUOnlyBitmapsOff:Bool = #if windows false #else true #end; public static var noTerminalColor:Bool = false; + public static var verbose:Bool = false; public static var scaleMode:FunkinRatioScaleMode; #if !mobile @@ -180,8 +181,6 @@ class Main extends Sprite } public static function refreshAssets() @:privateAccess { - WindowUtils.resetTitle(); - var game = FlxG.game; var daSndTray = Type.createInstance(game._customSoundTray = funkin.menus.ui.FunkinSoundTray, []); var index:Int = game.numChildren - 1; diff --git a/source/funkin/backend/system/MainState.hx b/source/funkin/backend/system/MainState.hx index 4398fc38..f3334147 100644 --- a/source/funkin/backend/system/MainState.hx +++ b/source/funkin/backend/system/MainState.hx @@ -61,6 +61,7 @@ class MainState extends FlxState { TranslationUtil.setLanguage(); ModsFolder.onModSwitch.dispatch(ModsFolder.currentModFolder); // Loads global.hx MusicBeatTransition.script = Flags.DEFAULT_TRANSITION_SCRIPT; + WindowUtils.resetTitle(); Main.refreshAssets(); DiscordUtil.init(); EventsData.reloadEvents(); diff --git a/source/funkin/backend/system/framerate/FramerateCounter.hx b/source/funkin/backend/system/framerate/FramerateCounter.hx index d6ff4b67..6543138c 100644 --- a/source/funkin/backend/system/framerate/FramerateCounter.hx +++ b/source/funkin/backend/system/framerate/FramerateCounter.hx @@ -33,7 +33,7 @@ class FramerateCounter extends Sprite { if (alpha <= 0.05) return; super.__enterFrame(t); - lastFPS = CoolUtil.fpsLerp(lastFPS, FlxG.elapsed == 0 ? 0 : (1 / FlxG.elapsed), 0.25); + lastFPS = CoolUtil.fpsLerp(lastFPS, FlxG.rawElapsed == 0 ? 0 : (1 / FlxG.rawElapsed), 0.25); fpsNum.text = Std.string(Math.floor(lastFPS)); fpsLabel.x = fpsNum.x + fpsNum.width; fpsLabel.y = (fpsNum.y + fpsNum.height) - fpsLabel.height; diff --git a/source/funkin/backend/system/framerate/MemoryCounter.hx b/source/funkin/backend/system/framerate/MemoryCounter.hx index 1c26a27d..a3bb39c8 100644 --- a/source/funkin/backend/system/framerate/MemoryCounter.hx +++ b/source/funkin/backend/system/framerate/MemoryCounter.hx @@ -21,7 +21,7 @@ class MemoryCounter extends Sprite { label.autoSize = LEFT; label.x = 0; label.y = 0; - label.text = "FPS"; + label.text = "MEM"; label.multiline = label.wordWrap = false; label.defaultTextFormat = new TextFormat(Framerate.fontName, 12, -1); label.selectable = false; diff --git a/source/funkin/backend/system/macros/FlagMacro.macro.hx b/source/funkin/backend/system/macros/FlagMacro.macro.hx index b1e6b68d..622bada9 100644 --- a/source/funkin/backend/system/macros/FlagMacro.macro.hx +++ b/source/funkin/backend/system/macros/FlagMacro.macro.hx @@ -92,10 +92,7 @@ class FlagMacro { case macro: Array: parser = macro value.split(",").map((e) -> Std.parseFloat(e)); case macro: Array: - parser = macro value.split(",").map((e) -> { - e = e.trim(); - e == "true" || e == "t" || e == "1"; - }); + parser = macro value.split(",").map(parseBool); case macro: TrimmedString: field.kind = FVar(macro: String, expr); parser = macro value.trim(); @@ -106,7 +103,7 @@ class FlagMacro { case macro: Float: parser = macro Std.parseFloat(value); case macro: Bool: - parser = macro value == "true" || value == "t" || value == "1"; + parser = macro parseBool(value); case TPath({name: "Allow", pack: [], params: params}): final NONE = 0; final STRING = 1; @@ -276,6 +273,22 @@ class FlagMacro { meta: [] }); + fields.push({ + name: "parseBool", + access: [APrivate, AStatic], + kind: FFun({ + args: [{name: "e", type: macro: String}], + expr: macro { + e = e.trim(); + return e == "true" || e == "t" || e == "1"; + }, + ret: macro: Bool + }), + pos: Context.currentPos(), + doc: null, + meta: [] + }); + //var printer = new haxe.macro.Printer(); //for(field in fields) { // trace(printer.printField(field)); diff --git a/source/funkin/backend/system/macros/GitCommitMacro.hx b/source/funkin/backend/system/macros/GitCommitMacro.hx index 11f32152..8b275499 100644 --- a/source/funkin/backend/system/macros/GitCommitMacro.hx +++ b/source/funkin/backend/system/macros/GitCommitMacro.hx @@ -29,6 +29,14 @@ class GitCommitMacro { * Returns the current commit date + time **/ public static var commitDate(get, never):Date; + /** + * Returns the current branch name + **/ + public static var currentBranch(get, never):String; + /** + * Returns if there are uncommitted changes + **/ + public static var hasUncommittedChanges(get, never):Bool; // GETTERS #if REGION @@ -46,6 +54,11 @@ class GitCommitMacro { return __getCommitAuthor(); private static inline function get_commitDate() return __getCommitDate(); + + private static inline function get_currentBranch() + return __getCurrentBranch(); + private static inline function get_hasUncommittedChanges() + return __getHasUncommittedChanges(); #end // INTERNAL MACROS @@ -149,5 +162,35 @@ class GitCommitMacro { return macro Date.fromString("1970-01-01T00:00:00"); // failed to parse date #end } + + private static macro function __getCurrentBranch() { + #if display + return macro $v{"-"}; + #else + try { + var process = new Process("git", ["rev-parse", "--abbrev-ref", "HEAD"], false); + if (process.exitCode() != 0) + throw 'Could not fetch current branch'; + + return macro $v{process.stdout.readLine().toString()}; + } catch(e) {} + return macro $v{"-"} + #end + } + + private static macro function __getHasUncommittedChanges() { + #if display + return macro $v{false}; + #else + try { + var process = new Process("git", ["status", "--porcelain"], false); + if (process.exitCode() != 0) + throw 'Could not fetch current branch'; + + return macro $v{process.stdout.readLine().toString() != ""}; + } catch(e) {} + return macro $v{false} + #end + } #end } \ No newline at end of file diff --git a/source/funkin/backend/system/macros/Macros.hx b/source/funkin/backend/system/macros/Macros.hx index 61e05546..86eaa3f7 100644 --- a/source/funkin/backend/system/macros/Macros.hx +++ b/source/funkin/backend/system/macros/Macros.hx @@ -21,6 +21,7 @@ class Macros { // OTHER LIBRARIES & STUFF #if THREE_D_SUPPORT "away3d", "flx3d", #end #if VIDEO_CUTSCENES "hxvlc.flixel", "hxvlc.openfl", #end + #if NAPE_ENABLED "nape", "flixel.addons.nape", #end // BASE HAXE "DateTools", "EReg", "Lambda", "StringBuf", "haxe.crypto", "haxe.display", "haxe.exceptions", "haxe.extern", "scripting" ]) diff --git a/source/funkin/backend/system/modules/ALSoftConfig.hx b/source/funkin/backend/system/modules/ALSoftConfig.hx new file mode 100644 index 00000000..0b1b57a0 --- /dev/null +++ b/source/funkin/backend/system/modules/ALSoftConfig.hx @@ -0,0 +1,31 @@ +package funkin.backend.system.modules; + +import haxe.io.Path; + +/* + * A class that simply points OpenALSoft to a custom configuration file when + * the game starts up. + * + * The config overrides a few global OpenALSoft settings with the aim of + * improving audio quality on desktop targets. + */ +@:keepInit class ALSoftConfig +{ + #if desktop + static function __init__():Void + { + var origin:String = #if hl Sys.getCwd() #else Sys.programPath() #end; + + var configPath:String = Path.directory(Path.withoutExtension(origin)); + #if windows + configPath += "/plugins/alsoft.ini"; + #elseif mac + configPath = Path.directory(configPath) + "/Resources/plugins/alsoft.conf"; + #else + configPath += "/plugins/alsoft.conf"; + #end + + Sys.putEnv("ALSOFT_CONF", configPath); + } + #end +} \ No newline at end of file diff --git a/source/funkin/backend/system/updating/UpdateUtil.hx b/source/funkin/backend/system/updating/UpdateUtil.hx index 9515b990..8118ae8e 100644 --- a/source/funkin/backend/system/updating/UpdateUtil.hx +++ b/source/funkin/backend/system/updating/UpdateUtil.hx @@ -9,9 +9,6 @@ import sys.FileSystem; using funkin.backend.system.github.GitHub; class UpdateUtil { - public static final repoOwner:String = "YoshiCrafter29"; - public static final repoName:String = "CodenameTestRepo"; - public static function init() { // deletes old bak file if it exists #if sys @@ -22,12 +19,12 @@ class UpdateUtil { } public static function checkForUpdates():UpdateCheckCallback { - var curTag = 'v${Application.current.meta.get('version')}'; + var curTag = 'v${Flags.VERSION}'; trace(curTag); var error = false; - var newUpdates = __doReleaseFiltering(GitHub.getReleases(repoOwner, repoName, function(e) { + var newUpdates = __doReleaseFiltering(GitHub.getReleases(Flags.REPO_NAME, Flags.REPO_OWNER, function(e) { error = true; }), curTag); diff --git a/source/funkin/backend/utils/HttpUtil.hx b/source/funkin/backend/utils/HttpUtil.hx index 640179a8..2daa96e2 100644 --- a/source/funkin/backend/utils/HttpUtil.hx +++ b/source/funkin/backend/utils/HttpUtil.hx @@ -4,7 +4,7 @@ import haxe.Http; class HttpUtil { - public static var userAgent:String = "request"; + public static var userAgent:String = Flags.USER_AGENT; public static function requestText(url:String) { var r = null; diff --git a/source/funkin/backend/utils/WindowUtils.hx b/source/funkin/backend/utils/WindowUtils.hx index 43cd5f8d..3a9f39ce 100644 --- a/source/funkin/backend/utils/WindowUtils.hx +++ b/source/funkin/backend/utils/WindowUtils.hx @@ -45,7 +45,7 @@ class WindowUtils { * Resets the window title to the application name and resets the prefix and suffix. **/ public static inline function resetTitle() { - title = Lib.application.meta["name"]; + title = Flags.TITLE == null ? Lib.application.meta.get('name') : Flags.TITLE; resetAffixes(); } @@ -65,18 +65,18 @@ class WindowUtils { // backwards compat @:noCompletion public static var endfix(get, set):String; - @:noCompletion private static function set_endfix(value:String):String { + @:noCompletion private inline static function set_endfix(value:String):String { return suffix = value; } - @:noCompletion private static function get_endfix():String { + @:noCompletion private inline static function get_endfix():String { return suffix; } @:noCompletion public static var winTitle(get, set):String; - @:noCompletion private static function get_winTitle():String { + @:noCompletion private inline static function get_winTitle():String { return title; } - @:noCompletion private static function set_winTitle(value:String):String { + @:noCompletion private inline static function set_winTitle(value:String):String { return title = value; } } \ No newline at end of file diff --git a/source/funkin/editors/EditorPicker.hx b/source/funkin/editors/EditorPicker.hx index 2c4c6b09..2b4f8d1a 100644 --- a/source/funkin/editors/EditorPicker.hx +++ b/source/funkin/editors/EditorPicker.hx @@ -40,7 +40,7 @@ class EditorPicker extends MusicBeatSubstate { id: "wiki", state: null, onClick: function() { - CoolUtil.openURL("https://codename-engine.com/"); + CoolUtil.openURL(Flags.URL_WIKI); } }, { @@ -131,7 +131,7 @@ class EditorPicker extends MusicBeatSubstate { }); }); } else { - CoolUtil.openURL("https://www.youtube.com/watch?v=9Youam7GYdQ"); + CoolUtil.openURL(Flags.URL_EDITOR_FALLBACK); } } diff --git a/source/funkin/editors/character/CharacterInfoScreen.hx b/source/funkin/editors/character/CharacterInfoScreen.hx index f993d210..3fd31268 100644 --- a/source/funkin/editors/character/CharacterInfoScreen.hx +++ b/source/funkin/editors/character/CharacterInfoScreen.hx @@ -79,6 +79,9 @@ class CharacterInfoScreen extends UISubstateWindow { add(iconColorWheel); addLabelOn(iconColorWheel, translate("iconColor")); + if (character.iconColor != null) + iconColorWheel.colorChanged = true; + add(title = new UIText(spriteTextBox.x, spriteTextBox.y + 10 + 46 + 84, 0, translate("characterData"), 28)); positionXStepper = new UINumericStepper(title.x, title.y + title.height + 36, character.globalOffset.x, 0.001, 2, null, null, 84); diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index b9734e39..0a41745a 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -690,6 +690,7 @@ class Charter extends UIState { public var dragStartPos:FlxPoint = new FlxPoint(); public var mousePos:FlxPoint = new FlxPoint(); public var selectionDragging:Bool = false; + public var isSelecting:Bool = false; public function updateSelectionLogic() { function select(s:ICharterSelectable) { @@ -757,11 +758,12 @@ class Charter extends UIState { case BOX_SELECTION: if (gridBackdropDummy.hoveredByChild) { selectionBox.visible = true; - if (FlxG.mouse.pressed) { + if (isSelecting) { selectionBox.x = Math.min(mousePos.x, dragStartPos.x); selectionBox.y = Math.min(mousePos.y, dragStartPos.y); selectionBox.bWidth = Std.int(Math.abs(mousePos.x - dragStartPos.x)); selectionBox.bHeight = Std.int(Math.abs(mousePos.y - dragStartPos.y)); + if (FlxG.mouse.justReleased) isSelecting = false; } else { if (FlxG.keys.pressed.SHIFT) { for (group in [notesGroup, eventsGroup]) { @@ -858,7 +860,7 @@ class Charter extends UIState { currentCursor = ARROW; } case NONE: - if (FlxG.mouse.justPressed) + if (FlxG.mouse.justPressed) FlxG.mouse.getWorldPosition(charterCamera, dragStartPos); else if (FlxG.mouse.justPressedRight) { closeCurrentContextMenu(); @@ -867,26 +869,29 @@ class Charter extends UIState { if (gridBackdropDummy.hovered) { // AUTO DETECT - if (FlxG.mouse.pressed && (Math.abs(mousePos.x - dragStartPos.x) > 20 || Math.abs(mousePos.y - dragStartPos.y) > 20)) + if (FlxG.mouse.justPressed) isSelecting = true; + if (isSelecting && (Math.abs(mousePos.x - dragStartPos.x) > 20 || Math.abs(mousePos.y - dragStartPos.y) > 20)) { gridActionType = BOX_SELECTION; + } var id = Math.floor(mousePos.x / 40); var mouseOnGrid = id >= 0 && id < 4 * gridBackdrops.strumlinesAmount && mousePos.y >= 0; if (FlxG.mouse.justReleased) { - for (n in selection) n.selected = false; - selection = []; + for (n in selection) n.selected = false; + selection = []; - if (mouseOnGrid && mousePos.y > 0 && mousePos.y < (__endStep)*40) { - var note = new CharterNote(); - note.updatePos( - FlxMath.bound(FlxG.keys.pressed.SHIFT ? ((mousePos.y-20) / 40) : quantStep(mousePos.y/40), 0, __endStep-1), - id % 4, 0, noteType, strumLines.members[Std.int(id/4)] - ); - notesGroup.add(note); - selection = [note]; - undos.addToUndo(CCreateSelection([note])); - } + if (mouseOnGrid && mousePos.y > 0 && mousePos.y < (__endStep)*40) { + var note = new CharterNote(); + note.updatePos( + FlxMath.bound(FlxG.keys.pressed.SHIFT ? ((mousePos.y-20) / 40) : quantStep(mousePos.y/40), 0, __endStep-1), + id % 4, 0, noteType, strumLines.members[Std.int(id/4)] + ); + notesGroup.add(note); + selection = [note]; + undos.addToUndo(CCreateSelection([note])); + } + isSelecting = false; } } else if (gridBackdropDummy.hoveredByChild) { if (FlxG.mouse.pressed) { @@ -1167,7 +1172,7 @@ class Charter extends UIState { if (note.strumLineID == strumLineID) selection.remove(note); else i++; - } + } else i++; } } #end @@ -1241,7 +1246,7 @@ class Charter extends UIState { __camZoom = Math.pow(2, zoom); } } else { - if (!FlxG.sound.music.playing) { + if (!FlxG.sound.music.playing && FlxG.mouse.wheel != 0) { Conductor.songPosition -= (__crochet * FlxG.mouse.wheel) - Conductor.songOffset; } } diff --git a/source/funkin/editors/ui/UIScrollBar.hx b/source/funkin/editors/ui/UIScrollBar.hx index c6ef73d2..55514e09 100644 --- a/source/funkin/editors/ui/UIScrollBar.hx +++ b/source/funkin/editors/ui/UIScrollBar.hx @@ -31,6 +31,7 @@ class UIScrollBar extends UISprite { members.push(thumbIcon); } + public var isScrolling:Bool = false; public override function update(elapsed:Float) { var lastHovered = hovered; @@ -42,7 +43,9 @@ class UIScrollBar extends UISprite { thumbIcon.follow(thumb, 0, Std.int((thumb.bHeight - thumbIcon.height) / 2)); thumbIcon.alpha = thumb.bHeight > 30 ? 1 : 0; - if ((lastHovered || lastHoveredThumb) && FlxG.mouse.pressed) { + if ((lastHovered || lastHoveredThumb) && FlxG.mouse.justPressed) isScrolling = true; + + if (isScrolling) { thumb.framesOffset = 18; var mousePos = FlxG.mouse.getScreenPosition(__lastDrawCameras[0], FlxPoint.get()); var yPos = FlxMath.bound(FlxMath.remapToRange(mousePos.y, y, y+height, -(size/2), length + size), 0, length); @@ -52,7 +55,10 @@ class UIScrollBar extends UISprite { onChange(value); } mousePos.put(); - } else + } + if (FlxG.mouse.justReleased && isScrolling) { + isScrolling = false; thumb.framesOffset = lastHoveredThumb ? 9 : 0; + } } } \ No newline at end of file diff --git a/source/funkin/editors/ui/UISlider.hx b/source/funkin/editors/ui/UISlider.hx index 0a6a853d..20fc219f 100644 --- a/source/funkin/editors/ui/UISlider.hx +++ b/source/funkin/editors/ui/UISlider.hx @@ -94,6 +94,8 @@ class UISlider extends UISprite { var __stepperWidth = 25; + public var isSliding:Bool = false; + public override function update(elapsed:Float) { selectableHitbox.follow(this, 0, (height-selectableHitbox.height)/2); @@ -103,10 +105,12 @@ class UISlider extends UISprite { var lastBarProgress:Float = __barProgress; - if (selectableHitbox.hovered && FlxG.mouse.pressed) { + if (selectableHitbox.hovered && FlxG.mouse.justPressed) isSliding = true; + if (isSliding) { var mousePos = FlxG.mouse.getScreenPosition(__lastDrawCameras[0], FlxPoint.get()); __barProgress = FlxMath.bound(mousePos.x-x, 0, barWidth)/barWidth; mousePos.put(); + if (FlxG.mouse.justReleased) isSliding = false; } if (__barProgress != lastBarProgress) { diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 2d949713..e84034f0 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -859,8 +859,9 @@ class PlayState extends MusicBeatState * @param cutsceneScriptPath Optional: Custom script path. * @param callback Callback called after the cutscene ended. If equals to `null`, `startCountdown` will be called. * @param checkSeen Bool that by default is false, if true and `seenCutscene` is also true, it won't play the cutscene but directly call `callback` (PS: `seenCutscene` becomes true if the cutscene gets played and `checkSeen` was true) + * @param canSkipTransIn Bool that by default is true makes the in transition skip on certain types of cutscenes like dialogues. */ - public function startCutscene(prefix:String = "", ?cutsceneScriptPath:String, ?callback:Void->Void, checkSeen:Bool = false) { + public function startCutscene(prefix:String = "", ?cutsceneScriptPath:String, ?callback:Void->Void, checkSeen:Bool = false, canSkipTransIn:Bool = true) { if (callback == null) callback = startCountdown; if ((checkSeen && seenCutscene) || !playCutscenes) { callback(); @@ -885,15 +886,15 @@ class PlayState extends MusicBeatState if (cutsceneScriptPath != null && Assets.exists(cutsceneScriptPath)) { openSubState(new ScriptedCutscene(cutsceneScriptPath, toCall)); } else if (Assets.exists(dialogue)) { - MusicBeatState.skipTransIn = true; + if (canSkipTransIn) MusicBeatState.skipTransIn = true; openSubState(new DialogueCutscene(dialogue, toCall)); } else if (Assets.exists(videoCutsceneAlt)) { - MusicBeatState.skipTransIn = true; + if (canSkipTransIn) MusicBeatState.skipTransIn = true; persistentUpdate = false; openSubState(new VideoCutscene(videoCutsceneAlt, toCall)); persistentDraw = false; } else if (Assets.exists(videoCutscene)) { - MusicBeatState.skipTransIn = true; + if (canSkipTransIn) MusicBeatState.skipTransIn = true; persistentUpdate = false; openSubState(new VideoCutscene(videoCutscene, toCall)); persistentDraw = false; @@ -943,7 +944,7 @@ class PlayState extends MusicBeatState var spr = event.spritePath; if (!Assets.exists(spr)) spr = Paths.image('$spr'); - sprite = new FlxSprite().loadAnimatedGraphic(spr); + sprite = new FunkinSprite().loadAnimatedGraphic(spr); sprite.scrollFactor.set(); sprite.scale.set(event.scale, event.scale); sprite.updateHitbox(); @@ -1281,8 +1282,11 @@ class PlayState extends MusicBeatState accFormat.format.color = curRating.color; accuracyTxt.text = TEXT_GAME_ACCURACY.format([accuracy < 0 ? "-%" : '${CoolUtil.quantize(accuracy * 100, 100)}%', curRating.rating]); - accuracyTxt._formatRanges[0].range.start = accuracyTxt.text.length - curRating.rating.length; - accuracyTxt._formatRanges[0].range.end = accuracyTxt.text.length; + for (i => frmtRange in accuracyTxt._formatRanges) if (frmtRange.format == accFormat) { + accuracyTxt._formatRanges[i].range.start = accuracyTxt.text.length - curRating.rating.length; + accuracyTxt._formatRanges[i].range.end = accuracyTxt.text.length; + break; + } } } @@ -1307,7 +1311,7 @@ class PlayState extends MusicBeatState FlxG.switchState(new funkin.editors.charter.Charter(SONG.meta.name, difficulty, false)); } /*if (FlxG.keys.justPressed.F5) { - Logs.warn('Reloading scripts...', YELLOW, "PlayState"); + Logs.warn('Reloading scripts...', "PlayState"); scripts.reload(); Logs.warn('Song scripts successfully reloaded.', GREEN, "PlayState"); }*/ @@ -1531,8 +1535,7 @@ class PlayState extends MusicBeatState #end } - startCutscene("end-", endCutscene, nextSong); - resetSongInfos(); + startCutscene("end-", endCutscene, nextSong, false, false); } private static inline function getSongChanges():Array { @@ -1548,6 +1551,8 @@ class PlayState extends MusicBeatState * Immediately switches to the next song, or goes back to the Story/Freeplay menu. */ public function nextSong() { + resetSongInfos(); + if (isStoryMode) { campaignScore += songScore; @@ -1575,8 +1580,7 @@ class PlayState extends MusicBeatState } else { - // TODO: make this colored - Logs.verbose('Loading next song (${storyPlaylist[0].toLowerCase()}/$difficulty)', "PlayState"); + Logs.infos('Loading next song (${storyPlaylist[0].toLowerCase()}/$difficulty)', "PlayState"); registerSmoothTransition(); diff --git a/source/funkin/game/cutscenes/Cutscene.hx b/source/funkin/game/cutscenes/Cutscene.hx index 41f7e233..9845e916 100644 --- a/source/funkin/game/cutscenes/Cutscene.hx +++ b/source/funkin/game/cutscenes/Cutscene.hx @@ -16,8 +16,8 @@ class Cutscene extends MusicBeatSubstate { public var skippable(default, set):Bool; public function set_skippable(val:Bool):Bool { - if(!val) pauseItems.remove('Skip Cutscene'); - else if(!pauseItems.contains('Skip Cutscene')) pauseItems.insert(1, 'Skip Cutscene'); + if (!val) pauseItems.remove('Skip Cutscene'); + else if (!pauseItems.contains('Skip Cutscene')) pauseItems.insert(1, 'Skip Cutscene'); return skippable = val; } @@ -75,6 +75,7 @@ class Cutscene extends MusicBeatSubstate { } public override function close() { + canOpenCustomTransition = false; __callback(); super.close(); } diff --git a/source/funkin/game/cutscenes/DialogueCutscene.hx b/source/funkin/game/cutscenes/DialogueCutscene.hx index f44c3855..61d8ddff 100644 --- a/source/funkin/game/cutscenes/DialogueCutscene.hx +++ b/source/funkin/game/cutscenes/DialogueCutscene.hx @@ -50,7 +50,7 @@ class DialogueCutscene extends ScriptedCutscene { } public override function onErrorScriptLoading() { - Logs.trace('Could not find script for dialogue cutscene at "${scriptPath}"', WARNING, YELLOW); + //Logs.trace('Could not find script for dialogue cutscene at "${scriptPath}"', WARNING, YELLOW); // Too many warnings honestly, stawp - Nex } var parentDisabler:FunkinParentDisabler; @@ -62,11 +62,11 @@ class DialogueCutscene extends ScriptedCutscene { var event = EventManager.get(DialogueStructureEvent).recycle(dialogueData); event.dialogueData = new Access(Xml.parse(Assets.getText(dialoguePath)).firstElement()); dialogueScript.call('structureLoaded', [event]); - if(event.cancelled) return; + if (event.cancelled) return; dialogueData = event.dialogueData; // Add characters - for(char in dialogueData.nodes.char) { + for (char in dialogueData.nodes.char) { if (!char.has.name) continue; if (charMap.exists(char.att.name)) { Logs.warn('2 dialogue characters share the same name (${char.att.name}, ${char.att.name}). The old character has been replaced.'); @@ -74,16 +74,16 @@ class DialogueCutscene extends ScriptedCutscene { } var leChar:DialogueCharacter = new DialogueCharacter(char.att.name, char.getAtt('position').getDefault('default')); - if(char.has.defaultAnim) leChar.defaultAnim = char.att.defaultAnim; + if (char.has.defaultAnim) leChar.defaultAnim = char.att.defaultAnim; add(charMap[char.att.name] = leChar); } var useDef:Bool = false; - if(dialogueData.has.forceBoxDefaultTxtSound && dialogueData.att.forceBoxDefaultTxtSound == "true") + if (dialogueData.has.forceBoxDefaultTxtSound && dialogueData.att.forceBoxDefaultTxtSound == "true") useDef = true; // Add lines - for(node in dialogueData.nodes.line) { + for (node in dialogueData.nodes.line) { var formats = XMLUtil.getTextFormats(XMLUtil.fixSpacingInNode(node)); var volume:Null = 0.8; var line:DialogueLine = { @@ -101,8 +101,8 @@ class DialogueCutscene extends ScriptedCutscene { textSound: null }; - if(node.has.textSound) line.textSound = FlxG.sound.load(Paths.sound(node.att.textSound)); - else if(!useDef) { + if (node.has.textSound) line.textSound = FlxG.sound.load(Paths.sound(node.att.textSound)); + else if (!useDef) { var char:DialogueCharacter = charMap[line.char]; if(char != null && char.charData != null && char.charData.has.textSound) line.textSound = FlxG.sound.load(Paths.sound(char.charData.att.textSound)); @@ -190,16 +190,16 @@ class DialogueCutscene extends ScriptedCutscene { public override function close() { var event = new CancellableEvent(); - for(c in charMap) c.dialogueCharScript.call("close", [event]); - dialogueBox.dialogueBoxScript.call("close", [event]); + for (c in charMap) c.dialogueCharScript.call("close", [event]); + if (dialogueBox != null) dialogueBox.dialogueBoxScript.call("close", [event]); dialogueScript.call("close", [event]); - if(event.cancelled) return; + if (event.cancelled) return; super.close(); } public override function destroy() { - if(curMusic != null && !curMusic.persist) curMusic.destroy(); + if (curMusic != null && !curMusic.persist) curMusic.destroy(); super.destroy(); cutscene = null; diff --git a/source/funkin/game/cutscenes/VideoCutscene.hx b/source/funkin/game/cutscenes/VideoCutscene.hx index 9216c340..9e5a50bd 100644 --- a/source/funkin/game/cutscenes/VideoCutscene.hx +++ b/source/funkin/game/cutscenes/VideoCutscene.hx @@ -62,6 +62,14 @@ class VideoCutscene extends Cutscene { video.antialiasing = true; video.autoPause = false; // Imma handle it better inside this class, mainly because of the pause menu - Nex video.bitmap.onEndReached.add(close); + video.bitmap.onFormatSetup.add(function() if (video.bitmap != null && video.bitmap.bitmapData != null) { + final width = video.bitmap.bitmapData.width; + final height = video.bitmap.bitmapData.height; + final scale:Float = Math.min(FlxG.width / width, FlxG.height / height); + video.setGraphicSize(Std.int(width * scale), Std.int(height * scale)); + video.updateHitbox(); + video.screenCenter(); + }); //cover = new FlxSprite(0, FlxG.height * 0.85).makeSolid(FlxG.width + 50, FlxG.height + 50, 0xFF000000); //cover.scrollFactor.set(0, 0); @@ -100,7 +108,7 @@ class VideoCutscene extends Cutscene { File.saveBytes(localPath, Assets.getBytes(path)); } - if(video.load(localPath)) new FlxTimer().start(0.001, function(_) {mutex.acquire(); onReady(); mutex.release();}); + if (video.load(localPath)) new FlxTimer().start(0.001, function(_) { mutex.acquire(); onReady(); mutex.release(); }); else { mutex.acquire(); close(); mutex.release(); } }); @@ -236,6 +244,7 @@ class VideoCutscene extends Cutscene { public override function destroy() { FlxG.cameras.remove(cutsceneCamera, true); + video.destroy(); super.destroy(); } #end diff --git a/source/funkin/menus/PauseSubState.hx b/source/funkin/menus/PauseSubState.hx index ccd63ea7..1d2db997 100644 --- a/source/funkin/menus/PauseSubState.hx +++ b/source/funkin/menus/PauseSubState.hx @@ -4,17 +4,18 @@ import flixel.sound.FlxSound; import funkin.backend.FunkinText; import flixel.tweens.FlxTween; import flixel.util.FlxColor; +import funkin.backend.FunkinText; import funkin.backend.scripting.Script; +import funkin.backend.scripting.events.NameEvent; import funkin.backend.scripting.events.menu.MenuChangeEvent; import funkin.backend.scripting.events.menu.pause.*; -import funkin.backend.scripting.events.NameEvent; import funkin.backend.system.Conductor; import funkin.backend.utils.FunkinParentDisabler; import funkin.editors.charter.Charter; import funkin.menus.StoryMenuState; import funkin.options.OptionsMenu; -import funkin.options.keybinds.KeybindsOptions; import funkin.options.TreeMenu; +import funkin.options.keybinds.KeybindsOptions; class PauseSubState extends MusicBeatSubstate { @@ -22,14 +23,13 @@ class PauseSubState extends MusicBeatSubstate var grpMenuShit:FlxTypedGroup; - // to translate these you need to convert them into ids - // Resume -> pause.resume - // Restart Song -> pause.restart - // Change Controls -> pause.changeControls - // Change Options -> pause.changeOptions - // Exit to menu -> pause.exitToMenu - // Exit to charter -> pause.exitToCharter + var levelInfo:FunkinText; + var levelDifficulty:FunkinText; + var deathCounter:FunkinText; + var multiplayerText:FunkinText; + var menuItems:Array; + var curSelected:Int = 0; var pauseMusic:FlxSound; @@ -66,7 +66,6 @@ class PauseSubState extends MusicBeatSubstate menuItems = event.options; - pauseMusic = FlxG.sound.load(Paths.music(event.music), 0, true); pauseMusic.persist = false; pauseMusic.group = FlxG.sound.defaultMusicGroup; @@ -85,17 +84,16 @@ class PauseSubState extends MusicBeatSubstate PlayState.coopMode ? 'pause.opponentMode' : null; - var levelInfo:FunkinText = new FunkinText(20, 15, 0, PlayState.SONG.meta.displayName, 32, false); - var levelDifficulty:FunkinText = new FunkinText(20, 15, 0, TU.translateDiff(PlayState.difficulty).toUpperCase(), 32, false); - var deathCounter:FunkinText = new FunkinText(20, 15, 0, TU.translate("pause.deathCounter", [PlayState.deathCounter]), 32, false); - var multiplayerText:FunkinText = null; + levelInfo = new FunkinText(20, 15, 0, PlayState.SONG.meta.displayName, 32, false); + levelDifficulty = new FunkinText(20, 15, 0, TU.translateDiff(PlayState.difficulty).toUpperCase(), 32, false); + deathCounter = new FunkinText(20, 15, 0, TU.translate("pause.deathCounter", [PlayState.deathCounter]), 32, false); + multiplayerText = null; if(multiplayerInfo != null) multiplayerText = new FunkinText(20, 15, 0, TU.translate(multiplayerInfo), 32, false); for(k=>label in [levelInfo, levelDifficulty, deathCounter, multiplayerText]) { if(label == null) continue; label.scrollFactor.set(); - label.updateHitbox(); label.alpha = 0; label.x = FlxG.width - (label.width + 20); label.y = 15 + (32 * k); diff --git a/source/funkin/menus/credits/CreditsCodename.hx b/source/funkin/menus/credits/CreditsCodename.hx index 93486d34..70e172dc 100644 --- a/source/funkin/menus/credits/CreditsCodename.hx +++ b/source/funkin/menus/credits/CreditsCodename.hx @@ -92,7 +92,7 @@ class CreditsCodename extends funkin.options.OptionsScreen { }); Options.contributors = contributors; } - Logs.trace('[CreditsCodename] Contributors list Updated!', VERBOSE); + Logs.verbose('[CreditsCodename] Contributors list Updated!'); var errorOnMain:Bool = false; var idk2 = GitHub.getOrganizationMembers(Flags.REPO_OWNER, function(e) { @@ -103,7 +103,7 @@ class CreditsCodename extends funkin.options.OptionsScreen { }); if(!errorOnMain) { Options.mainDevs = [for(m in idk2) m.id]; - Logs.trace('[CreditsCodename] Main Devs list Updated!', VERBOSE); + Logs.verbose('[CreditsCodename] Main Devs list Updated!'); } return true; diff --git a/source/funkin/menus/credits/CreditsMain.hx b/source/funkin/menus/credits/CreditsMain.hx index 8cdcd932..3f059fc4 100644 --- a/source/funkin/menus/credits/CreditsMain.hx +++ b/source/funkin/menus/credits/CreditsMain.hx @@ -42,7 +42,7 @@ class CreditsMain extends TreeMenu { optionsTree.add(Type.createInstance(CreditsCodename, [])); })); items.push(new TextOption("Friday Night Funkin'", TU.translate("credits.selectBase"), function() { - CoolUtil.openURL("https://ninja-muffin24.itch.io/funkin"); + CoolUtil.openURL(Flags.URL_FNF_ITCH); })); main = new OptionsScreen(TU.translate("credits.name"), TU.translate("credits.madePossible"), items); diff --git a/source/funkin/options/TreeMenu.hx b/source/funkin/options/TreeMenu.hx index fb4d13c1..6a47fd6d 100644 --- a/source/funkin/options/TreeMenu.hx +++ b/source/funkin/options/TreeMenu.hx @@ -8,6 +8,7 @@ import funkin.backend.FunkinText; import funkin.editors.ui.UIState; import funkin.menus.MainMenuState; import funkin.options.type.OptionType; +import funkin.options.type.TextOption; import funkin.backend.system.framerate.Framerate; class TreeMenu extends UIState { @@ -19,13 +20,13 @@ class TreeMenu extends UIState { public static var lastState:Class = null; // Static for fixing the softlock bugs when resetting the state - Nex - public function new() { + public function new(scriptsAllowed:Bool = true, ?scriptName:String) { if(lastState == null) lastState = Type.getClass(FlxG.state); - super(); + super(scriptsAllowed, scriptName); } public override function createPost() { - if (main == null) throw "\"main\" variable has not been set in extended class!"; + if (main == null) main = new OptionsScreen("Fallback Treemenu", "Please set the \"main\" variable in your extended class before createPost", [new TextOption("Oops! No Options", "This doesn't look like it was supposed to happen...", () -> FlxG.resetState() ) ]); FlxG.camera.scroll.set(-FlxG.width, 0); @@ -142,4 +143,4 @@ typedef OptionCategory = { typedef OptionTypeDef = { var type:Class; var args:Array; -} \ No newline at end of file +}