mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-09-03 20:28:04 +00:00
Compare commits
160 commits
85aa4a8839
...
4d79af5eb1
Author | SHA1 | Date | |
---|---|---|---|
|
4d79af5eb1 | ||
|
d95f239dfb | ||
|
495690f41c | ||
|
b166cd9a7e | ||
|
7f82b48e3f | ||
|
1fc611d130 | ||
|
57a276d17c | ||
|
9b1b22c9d5 | ||
|
f6de4c54d3 | ||
|
e3aceacb59 | ||
|
546375087c | ||
|
c093e0ca1c | ||
|
7c6efba577 | ||
|
6f5e3a50d2 | ||
|
2d0d5f8a2e | ||
|
826249f78c | ||
|
0af4c82723 | ||
|
c16e45049b | ||
|
ae00e14a5b | ||
|
42a9c43127 | ||
|
17ece1423a | ||
|
6540faefdd | ||
|
eb24d4d19e | ||
|
01a2458c12 | ||
|
38e7e230d8 | ||
|
84f119036b | ||
|
74a783c3db | ||
|
09d5926455 | ||
|
5f8b7787cb | ||
|
a7156978a1 | ||
|
65349f4714 | ||
|
93ad7e8932 | ||
|
df388dfaa6 | ||
|
c142add8a1 | ||
|
a75c41b813 | ||
|
7fd74edf2b | ||
|
44370c2653 | ||
|
1fbb7604dd | ||
|
0e52744718 | ||
|
feb55b2625 | ||
|
4341a53486 | ||
|
0566cd3e58 | ||
|
a2f7fa9ef4 | ||
|
3a30b681b6 | ||
|
0bd4ce4c97 | ||
|
df0d977e6c | ||
|
1df0cb95f6 | ||
|
ce83e962bf | ||
|
fb293ebcd2 | ||
|
bb7b00cf77 | ||
|
e16391a05c | ||
|
5aba4b54a5 | ||
|
cb611f77a0 | ||
|
b5345e1da2 | ||
|
8d6590e765 | ||
|
e39b32bab0 | ||
|
d5754c5da2 | ||
|
fbe83be936 | ||
|
8d14df77ff | ||
|
55358463f8 | ||
|
4ea99656f2 | ||
|
34ce13c5df | ||
|
1d8679941e | ||
|
086f28fef1 | ||
|
fb4967c94b | ||
|
293b70bbed | ||
|
64f4620b5a | ||
|
9c1e22309b | ||
|
4ecef6db74 | ||
|
b128741075 | ||
|
86e69cfbd1 | ||
|
aa8690fce3 | ||
|
e281bdddca | ||
|
19fdda7cd9 | ||
|
d72b989bf5 | ||
|
cd99905bdf | ||
|
3f82f3792b | ||
|
1d8ed5198c | ||
|
8cd3785e3c | ||
|
7e01e7332b | ||
|
c3a837b054 | ||
|
a92567886c | ||
|
7d707cb16f | ||
|
4cbfaefc1a | ||
|
705e6b3308 | ||
|
56878befef | ||
|
44cdbb08c4 | ||
|
d6fe54ee79 | ||
|
32c775ef3f | ||
|
1605514424 | ||
|
743e8b13c2 | ||
|
cf89d672e7 | ||
|
661ddb15f7 | ||
|
72fa82716d | ||
|
a069ca2dc6 | ||
|
90a2d7a1ad | ||
|
3170346b83 | ||
|
e6d737125e | ||
|
3d88fbb11f | ||
|
0d6bc2bedd | ||
|
da5f691865 | ||
|
f63cbf073a | ||
|
30721c3a30 | ||
|
2b1f346097 | ||
|
12117557c7 | ||
|
6b0e607af0 | ||
|
2263b36cd7 | ||
|
2dcc528847 | ||
|
5cb33e895c | ||
|
1b91f3b57c | ||
|
e5e3270fef | ||
|
e003a38cab | ||
|
890d1dafcb | ||
|
9d2cfa9686 | ||
|
e6fd5d9b12 | ||
|
967397311b | ||
|
542f59ef72 | ||
|
065ee74aea | ||
|
312b5c8812 | ||
|
e9aa6872a3 | ||
|
4f9b63f22c | ||
|
962519e7f0 | ||
|
34bae4a431 | ||
|
79478080f6 | ||
|
65a3ccc8fe | ||
|
4ac851c387 | ||
|
70d5730b70 | ||
|
c527fed70c | ||
|
054a5cd00b | ||
|
19c5de8fe2 | ||
|
dbc26fd621 | ||
|
eb1986b246 | ||
|
d661d93184 | ||
|
4a07d0a347 | ||
|
832f01345f | ||
|
e8d41c938c | ||
|
a94bd7f36c | ||
|
c185f10e65 | ||
|
52f3c63071 | ||
|
e71062b914 | ||
|
3aa6a36b5e | ||
|
a89fa9c121 | ||
|
cb2015f51a | ||
|
139ce3847c | ||
|
87b40c1203 | ||
|
b9852c316b | ||
|
444697620c | ||
|
6abeefb15d | ||
|
530bd1f11d | ||
|
76c0dea92b | ||
|
2d7a2202f5 | ||
|
1f18a3d1f4 | ||
|
0d57f61ffa | ||
|
9fa70775b9 | ||
|
463afb43c0 | ||
|
2833827fbf | ||
|
01cd72e805 | ||
|
72e0ff6c9b | ||
|
82367dffc2 | ||
|
96a1796905 |
11
CHANGELOG.md
11
CHANGELOG.md
|
@ -53,7 +53,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- You can import them in another script as usual.
|
||||
- Added support for renaming imported classes using the `as` keyword. (Thanks KoloInDaCrib!)
|
||||
- Fixed `try`/`catch` blocks not working properly. (Thanks NotHyper-474!)
|
||||
- Fixed null-safe field access not working properly for functions (ex. `class?.someFunction()). (Thanks KoloInDaCrib!)
|
||||
- Fixed null-safe field access not working properly for functions (ex. `class?.someFunction()`). (Thanks KoloInDaCrib!)
|
||||
- Fixed Linux being case-sensitive with filenames. (Thanks mikolka9144!)
|
||||
|
||||
### Fixed
|
||||
|
||||
|
@ -88,6 +89,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
* @Smokey555 made their first contribution in [#3318](https://github.com/FunkinCrew/Funkin/pull/3318)
|
||||
* @CCobaltDev made their first contribution in [#3318](https://github.com/FunkinCrew/Funkin/pull/3318)
|
||||
* @mikolka9144 made their first contribution in [polymod#212](https://github.com/larsiusprime/polymod/pull/212)
|
||||
|
||||
|
||||
|
||||
|
@ -705,6 +707,7 @@ This patch resolves a critical issue that could cause user's save data to become
|
|||
|
||||
## [0.5.0] - 2024-09-12
|
||||
The Playable Pico Update!
|
||||
|
||||
### Added
|
||||
|
||||
- Added a new Character Select screen to switch between playable characters in Freeplay.
|
||||
|
@ -825,7 +828,7 @@ The Playable Pico Update!
|
|||
### Fixed
|
||||
|
||||
- Control binds in the controls menu no longer overlap their names.
|
||||
- Attempting to exit the gameover screen and retry the song at the same time no longer crashes the game. ([thanks DMMaster636 for the PR!](https://github.com/FunkinCrew/Funkin/pull/2709))
|
||||
- Attempting to exit the gameover screen and retry the song at the same time no longer crashes the game. ([thanks DM-kun for the PR!](https://github.com/FunkinCrew/Funkin/pull/2709))
|
||||
- Botplay mode now handles the player's animations properly during hold notes. ([thanks Hundrec!](https://github.com/FunkinCrew/Funkin/pull/2683))
|
||||
- Camera movement now pauses when the game is paused. ([thanks Matriculaso!](https://github.com/FunkinCrew/Funkin/pull/2684))
|
||||
- Pico's gameplay sprite no longer appears on the gameover screen when dying from an explosion in 2hot.
|
||||
|
@ -839,13 +842,14 @@ The Playable Pico Update!
|
|||
## New Contributors for 0.4.1
|
||||
|
||||
* @Hundrec made their first contribution in [#2661](https://github.com/FunkinCrew/Funkin/pull/2661)
|
||||
* @DMMaster636 made their first contribution in [#2709](https://github.com/FunkinCrew/Funkin/pull/2709)
|
||||
* @DM-kun made their first contribution in [#2709](https://github.com/FunkinCrew/Funkin/pull/2709)
|
||||
* @eltociear made their first contribution in [#2730](https://github.com/FunkinCrew/Funkin/pull/2730)
|
||||
|
||||
|
||||
|
||||
## [0.4.0] - 2024-06-06
|
||||
The Pit Stop 1 update!
|
||||
|
||||
### Added
|
||||
|
||||
- 2 new Erect remixes, Eggnog and Satin Panties. Check them out from the Freeplay menu!
|
||||
|
@ -1017,6 +1021,7 @@ The Pit Stop 1 update!
|
|||
|
||||
## [0.3.0] - 2024-04-30
|
||||
The Weekend 1 update!
|
||||
|
||||
### Added
|
||||
|
||||
- New Story Level: Weekend 1, starring Pico, Darnell, and Nene.
|
||||
|
|
17
README.md
17
README.md
|
@ -1,14 +1,25 @@
|
|||
# Friday Night Funkin'
|
||||
<div align='center'><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d2/Friday_Night_Funkin%27_logo.svg/2560px-Friday_Night_Funkin%27_logo.svg.png" width="800">
|
||||
|
||||
Friday Night Funkin' is a rhythm game. Built using HaxeFlixel for Ludum Dare 47.
|
||||
<h2>Friday Night Funkin' is a rhythm game. Built using HaxeFlixel for <a href="https://ldjam.com/events/ludum-dare/47">Ludum Dare 47.</a></h2>
|
||||
|
||||
This game was made with love to Newgrounds and its community. Extra love to Tom Fulp.
|
||||
|
||||
</div>
|
||||
|
||||
- [Playable web demo on Newgrounds!](https://www.newgrounds.com/portal/view/770371)
|
||||
- [Demo download builds for Windows, Mac, and Linux from Itch.io!](https://ninja-muffin24.itch.io/funkin)
|
||||
- [Download Android builds from Google Play!](https://play.google.com/store/apps/details?id=me.funkin.fnf)
|
||||
- [Download iOS builds from the App Store!](https://apps.apple.com/app/id6740428530)
|
||||
|
||||
<div align='center'>
|
||||
<table>
|
||||
<tr>
|
||||
<td><img src="https://fridaynightfunkin.wiki.gg/images/d/d7/Title_Card.gif" alt="Title Screen" width="350"/></td>
|
||||
<td><img src="https://fridaynightfunkin.wiki.gg/images/9/99/Menu.png" alt="Main Menu" width="350"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
# Getting Started
|
||||
|
||||
**PLEASE USE THE LINKS ABOVE IF YOU JUST WANT TO PLAY THE GAME**
|
||||
|
@ -52,4 +63,4 @@ Full credits can be found in-game, or in the `credits.json` file which is locate
|
|||
## Special Thanks
|
||||
- [Tom Fulp](https://twitter.com/tomfulp) - For being a great guy and for Newgrounds
|
||||
- [JohnnyUtah](https://twitter.com/JohnnyUtahNG/) - Voice of Tankman
|
||||
- [L0Litsmonica](https://twitter.com/L0Litsmonica) - Voice of Mommy Mearest
|
||||
- [L0Litsmonica](https://twitter.com/L0Litsmonica) - Voice of Mommy Mearest
|
2
art
2
art
|
@ -1 +1 @@
|
|||
Subproject commit 67e550dbd22a8ea429eecc8ce078a36f74ea7723
|
||||
Subproject commit 094ff109197e35d21342bdf2d51132be23948d3f
|
2
assets
2
assets
|
@ -1 +1 @@
|
|||
Subproject commit 69c02fa5019f603324a7d2ae362327a1eef9d109
|
||||
Subproject commit 562cc34c473c6999ea26f13a3f83ccebf6e15a9b
|
64
astc-compression-data.json
Normal file
64
astc-compression-data.json
Normal file
|
@ -0,0 +1,64 @@
|
|||
{
|
||||
"input": "./assets",
|
||||
"output": "./astc-textures/",
|
||||
"quality": "medium",
|
||||
"blocksize": "10x10",
|
||||
"colorprofile": "cl",
|
||||
"custom": [
|
||||
{
|
||||
"asset": "assets/week1/images/erect/server.png",
|
||||
"blocksize": "8x8"
|
||||
},
|
||||
{
|
||||
"asset": "assets/week1/images/erect/crowd.png",
|
||||
"blocksize": "8x8"
|
||||
},
|
||||
{
|
||||
"asset": "assets/week1/image/erect/bg.png",
|
||||
"blocksize": "8x8"
|
||||
},
|
||||
{
|
||||
"asset": "assets/week1/image/erect/lights.png",
|
||||
"blocksize": "6x6"
|
||||
},
|
||||
{
|
||||
"asset": "assets/week2/images/erect/stairsDark.png",
|
||||
"blocksize": "6x6"
|
||||
},
|
||||
{
|
||||
"asset": "assets/week2/images/erect/stairsLight.png",
|
||||
"blocksize": "6x6"
|
||||
}
|
||||
],
|
||||
"excludes": [
|
||||
"assets/preload/images/cursor/",
|
||||
"assets/preload/images/freeplay/",
|
||||
"assets/preload/images/icons/",
|
||||
"assets/preload/images/fonts/",
|
||||
"assets/preload/images/titleEnter.png",
|
||||
"assets/preload/images/titleEnter_mobile.png",
|
||||
"assets/preload/images/soundtray/",
|
||||
"assets/preload/images/stageBuild/",
|
||||
"assets/preload/images/ui/popup/pixel/*",
|
||||
"assets/shared/images/characters/abotPixel/*",
|
||||
"assets/shared/images/characters/bfPixel.png",
|
||||
"assets/shared/images/characters/bfPixelsDEAD.png",
|
||||
"assets/shared/images/characters/gfPixel.png",
|
||||
"assets/shared/images/characters/nenePixel/*",
|
||||
"assets/shared/images/characters/picoPixel/*",
|
||||
"assets/shared/images/characters/senpai.png",
|
||||
"assets/shared/images/characters/spirit.png",
|
||||
"assets/shared/images/ui/chart-editor/",
|
||||
"assets/shared/images/ui/countdown/pixel/*",
|
||||
"assets/shared/images/resultScreen/*",
|
||||
"assets/shared/images/resultScreen/clearPercent/",
|
||||
"assets/shared/images/resultScreen/rankText/",
|
||||
"assets/week1/*",
|
||||
"assets/week1/images/erect/brightLightSmall.png",
|
||||
"assets/week1/images/erect/lightAbove.png",
|
||||
"assets/week1/images/erect/lightgreen.png",
|
||||
"assets/week1/images/erect/lightred.png",
|
||||
"assets/week1/images/erect/orangeLight.png",
|
||||
"assets/week6/"
|
||||
]
|
||||
}
|
|
@ -80,7 +80,7 @@
|
|||
{
|
||||
"props": {
|
||||
"ignoreExtern": true,
|
||||
"format": "^[a-zA-Z0-9]+(?:_[a-zA-Z0-9]+)*$",
|
||||
"format": "^?:_[a-zA-Z0-9]+(?:_[a-zA-Z0-9]+)*$",
|
||||
"tokens": ["INLINE", "NOTINLINE"]
|
||||
},
|
||||
"type": "ConstantName"
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
assets/preload/images/cursor/*
|
||||
assets/preload/images/freeplay/*
|
||||
assets/preload/images/icons/*
|
||||
assets/preload/images/titleEnter.png
|
||||
assets/preload/images/titleEnter_mobile.png
|
||||
assets/preload/images/soundtray/*
|
||||
assets/preload/images/stageBuild/*
|
||||
assets/preload/images/ui/popup/pixel/
|
||||
assets/shared/images/characters/abotPixel/
|
||||
assets/shared/images/characters/bfPixel.png
|
||||
assets/shared/images/characters/bfPixelsDEAD.png
|
||||
assets/shared/images/characters/gfPixel.png
|
||||
assets/shared/images/characters/nenePixel/
|
||||
assets/shared/images/characters/picoPixel/
|
||||
assets/shared/images/characters/senpai.png
|
||||
assets/shared/images/characters/spirit.png
|
||||
assets/shared/images/resultScreen/*
|
||||
assets/shared/images/ui/chart-editor/*
|
||||
assets/shared/images/ui/countdown/pixel/
|
||||
assets/week1/
|
||||
assets/week6/*
|
26
hmm.json
26
hmm.json
|
@ -11,41 +11,41 @@
|
|||
"name": "astc-compressor",
|
||||
"type": "git",
|
||||
"dir": null,
|
||||
"ref": "8c9f56927c523df7b849352c6951f04112fe15cc",
|
||||
"ref": "9b0819150b67bf0d49145f250099b75d21be5839",
|
||||
"url": "https://github.com/KarimAkra/astc-compressor"
|
||||
},
|
||||
{
|
||||
"name": "extension-admob",
|
||||
"type": "git",
|
||||
"dir": null,
|
||||
"ref": "a53d5916bdcb2e48913f94d9ae1d949b049dcdc1",
|
||||
"ref": "02334589ff9603a5f483077a44395009644f6274",
|
||||
"url": "https://github.com/FunkinCrew/extension-admob"
|
||||
},
|
||||
{
|
||||
"name": "extension-androidtools",
|
||||
"type": "haxelib",
|
||||
"version": "2.2.1"
|
||||
"version": "2.2.2"
|
||||
},
|
||||
{
|
||||
"name": "extension-haptics",
|
||||
"type": "haxelib",
|
||||
"version": "1.0.3"
|
||||
"version": "1.0.4"
|
||||
},
|
||||
{
|
||||
"name": "extension-iapcore",
|
||||
"type": "haxelib",
|
||||
"version": "1.0.3"
|
||||
"version": "1.0.4"
|
||||
},
|
||||
{
|
||||
"name": "extension-iarcore",
|
||||
"type": "haxelib",
|
||||
"version": "1.0.2"
|
||||
"version": "1.0.3"
|
||||
},
|
||||
{
|
||||
"name": "flixel",
|
||||
"type": "git",
|
||||
"dir": null,
|
||||
"ref": "08fc955ca87f192a971719a675f1d3b21709725d",
|
||||
"ref": "ac2a34fe4b3400bc04218f46320a65af0f337fc0",
|
||||
"url": "https://github.com/FunkinCrew/flixel"
|
||||
},
|
||||
{
|
||||
|
@ -59,7 +59,7 @@
|
|||
"name": "flxanimate",
|
||||
"type": "git",
|
||||
"dir": null,
|
||||
"ref": "39c1572add28869c558b218fffed13df1b64f376",
|
||||
"ref": "49214278b9124823582cdcecd94f4a1de9a4b36b",
|
||||
"url": "https://github.com/FunkinCrew/flxanimate"
|
||||
},
|
||||
{
|
||||
|
@ -104,14 +104,14 @@
|
|||
"name": "hscript",
|
||||
"type": "git",
|
||||
"dir": null,
|
||||
"ref": "d60bb2947fa609fdc875ccfae89666a6984eeaf2",
|
||||
"ref": "8c1d238b069ef97cec13f5121b29d2afe2b8985d",
|
||||
"url": "https://github.com/FunkinCrew/hscript"
|
||||
},
|
||||
{
|
||||
"name": "hxcpp",
|
||||
"type": "git",
|
||||
"dir": null,
|
||||
"ref": "4e24283a047f11bded6affabbc9ec405156e026e",
|
||||
"ref": "5a0dc3f644dc676a4a092b7e6c8edc8be941f024",
|
||||
"url": "https://github.com/FunkinCrew/hxcpp"
|
||||
},
|
||||
{
|
||||
|
@ -170,7 +170,7 @@
|
|||
"name": "lime",
|
||||
"type": "git",
|
||||
"dir": null,
|
||||
"ref": "c750ebf6b48c4bc018abe9855fbae5ffdbc4771a",
|
||||
"ref": "e5f8c27124598505917a001588b560244731adfb",
|
||||
"url": "https://github.com/FunkinCrew/lime"
|
||||
},
|
||||
{
|
||||
|
@ -219,14 +219,14 @@
|
|||
"name": "polymod",
|
||||
"type": "git",
|
||||
"dir": null,
|
||||
"ref": "866f19edbcd872b3358f9a41f2f6a24c71c191d1",
|
||||
"ref": "db5dcf3ac4cb59197188a4442d75d4e76b350f40",
|
||||
"url": "https://github.com/larsiusprime/polymod"
|
||||
},
|
||||
{
|
||||
"name": "thx.core",
|
||||
"type": "git",
|
||||
"dir": null,
|
||||
"ref": "76d87418fadd92eb8e1b61f004cff27d656e53dd",
|
||||
"ref": "2bf2b992e06159510f595554e6b952e47922f128",
|
||||
"url": "https://github.com/fponticelli/thx.core"
|
||||
},
|
||||
{
|
||||
|
|
147
project.hxp
147
project.hxp
|
@ -5,6 +5,7 @@ import hxp.*;
|
|||
import lime.tools.*;
|
||||
import sys.FileSystem;
|
||||
import sys.io.File;
|
||||
import haxe.io.Bytes;
|
||||
import haxe.io.Path;
|
||||
import haxe.ds.Map;
|
||||
|
||||
|
@ -58,6 +59,11 @@ class Project extends HXProject
|
|||
*/
|
||||
static final SOURCE_DIR:String = "source";
|
||||
|
||||
/**
|
||||
* The relative location of the templates folder.
|
||||
*/
|
||||
static final TEMPLATES_DIR:String = "templates";
|
||||
|
||||
/**
|
||||
* The fully qualified class path for the game's preloader.
|
||||
* Particularly important on HTML5 but we use it on all platforms.
|
||||
|
@ -103,30 +109,11 @@ class Project extends HXProject
|
|||
|
||||
static final ANDROID_EXTENSIONS:Array<String> = ["funkin.extensions.CallbackUtil"];
|
||||
|
||||
//
|
||||
// ASTC COMPRESSION
|
||||
//
|
||||
|
||||
/**
|
||||
* The quality of the compression process.
|
||||
* This doesn't exactly reduce the quality of the outputted texture..
|
||||
* But it changes how hard the CPU gotta work to maintin the quality and details of the image while compressing.
|
||||
* possible values: fastest, fast, medium, thorough, exhaustive.
|
||||
*/
|
||||
static var ASTC_QUALITY:String = "medium";
|
||||
|
||||
/**
|
||||
* The team ID to use for the iOS app. Configured in XCode.
|
||||
*/
|
||||
static var IOS_TEAM_ID:String = "Z7G7AVNGSH";
|
||||
|
||||
/**
|
||||
* The block size of the ASTC compressed textures.
|
||||
* Higher block size means lower quality and lighter file size for the generated compressed textures.
|
||||
* possible block sizes: 4x4, 4x6, 6x6, 8x8 ... 12x12.
|
||||
*/
|
||||
static var ASTC_BLOCKSIZE:String = "10x10";
|
||||
|
||||
/**
|
||||
* A list of asset file globs to exclude from ASTC compression when creating optimized mobile builds.
|
||||
*/
|
||||
|
@ -330,10 +317,10 @@ class Project extends HXProject
|
|||
static final FEATURE_HAPTICS:FeatureFlag = "FEATURE_HAPTICS";
|
||||
|
||||
/**
|
||||
* `-DFEATURE_INPUT_OFFSETS`
|
||||
* `-DFEATURE_LAG_ADJUSTMENT`
|
||||
* If this flag is enabled, the input offsets menu will be available to configure your audio and visual offsets.
|
||||
*/
|
||||
static final FEATURE_INPUT_OFFSETS:FeatureFlag = "FEATURE_INPUT_OFFSETS";
|
||||
static final FEATURE_LAG_ADJUSTMENT:FeatureFlag = "FEATURE_LAG_ADJUSTMENT";
|
||||
|
||||
/**
|
||||
* `-DFEATURE_LOG_TRACE`
|
||||
|
@ -498,16 +485,10 @@ class Project extends HXProject
|
|||
configureOutputDir();
|
||||
configurePolymod();
|
||||
configureHaxelibs();
|
||||
configureASTCTextures();
|
||||
configureAssets();
|
||||
configureIcons();
|
||||
|
||||
readASTCExclusion();
|
||||
|
||||
if (FEATURE_COMPRESSED_TEXTURES.isEnabled(this))
|
||||
{
|
||||
runASTCCompressor();
|
||||
}
|
||||
|
||||
if (FEATURE_MOBILE_ADVERTISEMENTS.isEnabled(this))
|
||||
{
|
||||
configureAdMobKeys();
|
||||
|
@ -566,6 +547,9 @@ class Project extends HXProject
|
|||
// If for some reason we have multiple source directories, we can add more entries here.
|
||||
this.sources.push(SOURCE_DIR);
|
||||
|
||||
// Templates stuff
|
||||
this.templatePaths.push(TEMPLATES_DIR);
|
||||
|
||||
// Tell Lime to run some prebuild and postbuild scripts.
|
||||
this.preBuildCallbacks.push(buildHaxeCLICommand(PREBUILD_HX));
|
||||
this.postBuildCallbacks.push(buildHaxeCLICommand(POSTBUILD_HX));
|
||||
|
@ -829,7 +813,7 @@ class Project extends HXProject
|
|||
FEATURE_STAGE_EDITOR.apply(this, !(isWeb() || isMobile()));
|
||||
|
||||
// Should be true except on web builds (some asset stuff breaks it)
|
||||
FEATURE_INPUT_OFFSETS.apply(this, !isWeb());
|
||||
FEATURE_LAG_ADJUSTMENT.apply(this, !isWeb());
|
||||
|
||||
// Should be true except on web and mobile builds.
|
||||
// Screenshots doesn't work there, and mobile has its own screenshots anyway.
|
||||
|
@ -890,7 +874,7 @@ class Project extends HXProject
|
|||
|
||||
if (FEATURE_LOG_TRACE.isDisabled(this))
|
||||
{
|
||||
addHaxeFlag("--no-traces");
|
||||
setHaxedef("no-traces");
|
||||
}
|
||||
|
||||
// Disable the built in pause screen when unfocusing the game.
|
||||
|
@ -983,7 +967,7 @@ class Project extends HXProject
|
|||
|
||||
function configureAndroid()
|
||||
{
|
||||
javaPaths.push(Path.join([SOURCE_DIR, 'funkin/mobile/external/android/java']));
|
||||
javaPaths.push(Path.join([SOURCE_DIR, 'funkin/external/android/java']));
|
||||
|
||||
if (isRelease())
|
||||
{
|
||||
|
@ -1251,27 +1235,7 @@ class Project extends HXProject
|
|||
if (isAndroid())
|
||||
{
|
||||
// Adaptive icons
|
||||
// TODO: Add Adapative Icons in Lime
|
||||
templatePaths.push("templates");
|
||||
|
||||
var androidTheme:String = "@style/LimeAppMainTheme";
|
||||
if (window.fullscreen != null && window.fullscreen)
|
||||
{
|
||||
androidTheme += "Fullscreen";
|
||||
}
|
||||
|
||||
final iconXmlChild:Dynamic = {
|
||||
"android:label": meta.title,
|
||||
"android:allowBackup": "true",
|
||||
"android:theme": androidTheme,
|
||||
"android:hardwareAccelerated": "true",
|
||||
"android:allowNativeHeapPointerTagging": ANDROID_TARGET_SDK_VERSION >= 30 ? "false" : null,
|
||||
"android:largeHeap": "true",
|
||||
"android:icon": "@mipmap/ic_launcher",
|
||||
"android:roundIcon": "@mipmap/ic_launcher_round"
|
||||
};
|
||||
|
||||
config.set('android.application', iconXmlChild);
|
||||
adaptiveIcon = new AdaptiveIcon('art/icons/android/', true);
|
||||
}
|
||||
else if (isIOS())
|
||||
{
|
||||
|
@ -1303,7 +1267,24 @@ class Project extends HXProject
|
|||
addIcon("art/icons/icon64.png", 64);
|
||||
addIcon("art/icons/iconOG.png");
|
||||
|
||||
info('Done configuring icons.');
|
||||
}
|
||||
|
||||
info('Done configuring icons.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the astc textures.
|
||||
*/
|
||||
function configureASTCTextures()
|
||||
{
|
||||
if (command != "display")
|
||||
{
|
||||
readASTCExclusion();
|
||||
|
||||
if (FEATURE_COMPRESSED_TEXTURES.isEnabled(this))
|
||||
{
|
||||
runASTCCompressor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1703,7 +1684,8 @@ class Project extends HXProject
|
|||
*/
|
||||
public function error(message:String):Void
|
||||
{
|
||||
Log.error('${message}');
|
||||
Sys.stderr().write(Bytes.ofString('[ERROR] ${message}'));
|
||||
Sys.exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1713,7 +1695,7 @@ class Project extends HXProject
|
|||
{
|
||||
if (command != "display")
|
||||
{
|
||||
Log.info('[INFO] ${message}');
|
||||
Sys.println('[INFO] ${message}');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1740,46 +1722,67 @@ class Project extends HXProject
|
|||
var env = new Map<String, Dynamic>();
|
||||
for (line in envFile.split('\n'))
|
||||
{
|
||||
if (line == "" || line.startsWith("#")) continue;
|
||||
if (line.length <= 0 || line.startsWith("#") || shouldExcludeEnvKey(line)) continue;
|
||||
|
||||
var parts = line.split('=');
|
||||
if (parts.length != 2) continue;
|
||||
var index:Int = line.indexOf('=');
|
||||
|
||||
env.set(parts[0], parts[1]);
|
||||
if (index == -1) continue;
|
||||
|
||||
var field:String = line.substr(0, index);
|
||||
var value:String = line.substr(index + 1);
|
||||
|
||||
env.set(field, value);
|
||||
}
|
||||
|
||||
return env;
|
||||
}
|
||||
|
||||
private function shouldExcludeEnvKey(key:String):Bool
|
||||
{
|
||||
final android:Bool = key.startsWith('ANDROID_');
|
||||
final ios:Bool = key.startsWith('IOS_');
|
||||
final mobile:Bool = key.startsWith('MOBILE_') || ios || android;
|
||||
final web:Bool = key.startsWith('WEB_');
|
||||
final desktop:Bool = key.startsWith('DESKTOP_');
|
||||
|
||||
if (isWeb() && (mobile || desktop)) return true;
|
||||
if (isDesktop() && (mobile || web)) return true;
|
||||
if (isAndroid() && (ios || web || desktop)) return true;
|
||||
if (isIOS() && (android || web || desktop)) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function readASTCExclusion():Void
|
||||
{
|
||||
astcExcludes = File.getContent('./compression-excludes.txt').trim().split('\n');
|
||||
@:nullSafety(Off)
|
||||
astcExcludes = haxe.Json.parse(File.getContent('./astc-compression-data.json')).excludes;
|
||||
|
||||
for (i in 0...astcExcludes.length)
|
||||
astcExcludes[i] = astcExcludes[i].trim();
|
||||
}
|
||||
|
||||
public function isASTCExcluded(filePath:String):Bool
|
||||
public function isASTCExcluded(file:String):Bool
|
||||
{
|
||||
for (exclusion in astcExcludes)
|
||||
{
|
||||
if (exclusion.endsWith("/*"))
|
||||
if (exclusion.endsWith("/"))
|
||||
{
|
||||
var normalizedFilePath = Path.normalize(filePath);
|
||||
var normalizedExclusion = Path.normalize(exclusion.substr(0, exclusion.length - 2));
|
||||
var normalizedFilePath = Path.normalize(file);
|
||||
var normalizedExclusion = Path.normalize(exclusion);
|
||||
|
||||
if (normalizedFilePath.startsWith(normalizedExclusion)) return true;
|
||||
}
|
||||
else if (exclusion.endsWith("/"))
|
||||
else if (exclusion.endsWith("/*"))
|
||||
{
|
||||
var normalizedExclusion = Path.normalize(exclusion);
|
||||
var fileDirectory = Path.directory(Path.normalize(filePath));
|
||||
var normalizedExclusion = Path.normalize(exclusion.substr(0, exclusion.length - 2));
|
||||
var fileDirectory = Path.directory(Path.normalize(file));
|
||||
|
||||
if (fileDirectory == normalizedExclusion) return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (filePath == exclusion) return true;
|
||||
if (file == exclusion) return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1790,12 +1793,8 @@ class Project extends HXProject
|
|||
{
|
||||
info('Compressing ASTC textures...');
|
||||
|
||||
var args:Array<String> = ['run', 'astc-compressor'];
|
||||
args = args.concat(['-i', './assets']);
|
||||
args = args.concat(['-o', './astc-textures/assets/']);
|
||||
args = args.concat(['-blocksize', ASTC_BLOCKSIZE]);
|
||||
args = args.concat(['-quality', ASTC_QUALITY]);
|
||||
args = args.concat(['-excludes', './compression-excludes.txt']);
|
||||
var args:Array<String> = ['run', 'astc-compressor', 'compress-from-json'];
|
||||
args = args.concat(['-json', './astc-compression-data.json']);
|
||||
|
||||
Sys.command('haxelib', args);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ class Postbuild
|
|||
|
||||
var buildTime:Float = roundToTwoDecimals(end - start);
|
||||
|
||||
trace('Build took: ${buildTime} seconds');
|
||||
Sys.println('[INFO] Build took: ${buildTime} seconds');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,28 +9,16 @@ class Prebuild
|
|||
{
|
||||
static inline final BUILD_TIME_FILE:String = '.build_time';
|
||||
|
||||
static final NG_CREDS_PATH:String = './source/funkin/api/newgrounds/NewgroundsCredentials.hx';
|
||||
|
||||
static final NG_CREDS_TEMPLATE:String = "package funkin.api.newgrounds;
|
||||
|
||||
class NewgroundsCredentials
|
||||
{
|
||||
public static final APP_ID:String = #if API_NG_APP_ID haxe.macro.Compiler.getDefine(\"API_NG_APP_ID\") #else 'INSERT APP ID HERE' #end;
|
||||
public static final ENCRYPTION_KEY:String = #if API_NG_ENC_KEY haxe.macro.Compiler.getDefine(\"API_NG_ENC_KEY\") #else 'INSERT ENCRYPTION KEY HERE' #end;
|
||||
}";
|
||||
|
||||
static function main():Void
|
||||
{
|
||||
var start:Float = Sys.time();
|
||||
trace('[PREBUILD] Performing pre-build tasks...');
|
||||
// Sys.println('[INFO] Performing pre-build tasks...');
|
||||
|
||||
saveBuildTime();
|
||||
|
||||
buildCredsFile();
|
||||
|
||||
var end:Float = Sys.time();
|
||||
var duration:Float = end - start;
|
||||
trace('[PREBUILD] Finished pre-build tasks in $duration seconds.');
|
||||
// Sys.println('[INFO] Finished pre-build tasks in $duration seconds.');
|
||||
}
|
||||
|
||||
static function saveBuildTime():Void
|
||||
|
@ -41,20 +29,4 @@ class NewgroundsCredentials
|
|||
fo.writeDouble(now);
|
||||
fo.close();
|
||||
}
|
||||
|
||||
static function buildCredsFile():Void
|
||||
{
|
||||
if (sys.FileSystem.exists(NG_CREDS_PATH))
|
||||
{
|
||||
trace('[PREBUILD] NewgroundsCredentials.hx already exists, skipping.');
|
||||
}
|
||||
else
|
||||
{
|
||||
trace('[PREBUILD] Creating NewgroundsCredentials.hx...');
|
||||
|
||||
var fileContents:String = NG_CREDS_TEMPLATE;
|
||||
|
||||
sys.io.File.saveContent(NG_CREDS_PATH, fileContents);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -417,7 +417,7 @@ class Conductor
|
|||
// If the song is playing, limit the song position to the length of the song or beginning of the song.
|
||||
if (FlxG.sound.music != null && FlxG.sound.music.playing)
|
||||
{
|
||||
this.songPosition = FlxMath.bound(Math.min(this.combinedOffset, 0), songPos, currentLength);
|
||||
this.songPosition = Math.min(this.combinedOffset, 0).clamp(songPos, currentLength);
|
||||
this.songPositionDelta += FlxG.elapsed * 1000 * FlxG.sound.music.pitch;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -117,10 +117,7 @@ class FunkinMemory
|
|||
*/
|
||||
public static function cacheTexture(key:String):Void
|
||||
{
|
||||
if (currentCachedTextures.exists(key))
|
||||
{
|
||||
return; // Already cached.
|
||||
}
|
||||
if (currentCachedTextures.exists(key)) return;
|
||||
|
||||
if (previousCachedTextures.exists(key))
|
||||
{
|
||||
|
@ -135,13 +132,13 @@ class FunkinMemory
|
|||
if (graphic == null)
|
||||
{
|
||||
FlxG.log.warn('Failed to cache graphic: $key');
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
trace('Successfully cached graphic: $key');
|
||||
graphic.persist = true;
|
||||
currentCachedTextures.set(key, graphic);
|
||||
}
|
||||
|
||||
trace('Successfully cached graphic: $key');
|
||||
graphic.persist = true;
|
||||
currentCachedTextures.set(key, graphic);
|
||||
forceRender(graphic);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -150,26 +147,54 @@ class FunkinMemory
|
|||
*/
|
||||
static function permanentCacheTexture(key:String):Void
|
||||
{
|
||||
if (permanentCachedTextures.exists(key))
|
||||
{
|
||||
return; // Already cached.
|
||||
}
|
||||
if (permanentCachedTextures.exists(key)) return;
|
||||
|
||||
var graphic:Null<FlxGraphic> = FlxGraphic.fromAssetKey(key, false, null, true);
|
||||
if (graphic == null)
|
||||
{
|
||||
FlxG.log.warn('Failed to cache graphic: $key');
|
||||
}
|
||||
else
|
||||
{
|
||||
trace('Successfully cached graphic: $key');
|
||||
graphic.persist = true;
|
||||
permanentCachedTextures.set(key, graphic);
|
||||
return;
|
||||
}
|
||||
|
||||
trace('Successfully cached graphic: $key');
|
||||
graphic.persist = true;
|
||||
permanentCachedTextures.set(key, graphic);
|
||||
forceRender(graphic);
|
||||
currentCachedTextures = permanentCachedTextures;
|
||||
}
|
||||
|
||||
/**
|
||||
* Forces the GPU to load and upload a FlxGraphic.
|
||||
*/
|
||||
private static function forceRender(graphic:FlxGraphic):Void
|
||||
{
|
||||
if (graphic == null) return;
|
||||
|
||||
var bmp:Null<FlxGraphic> = FlxG.bitmap.get(graphic.key);
|
||||
if (bmp != null && bmp.bitmap != null) var _:Int = bmp.bitmap.width; // Trigger
|
||||
|
||||
// Draws sprite and actually caches it.
|
||||
var sprite = new flixel.FlxSprite();
|
||||
sprite.loadGraphic(graphic);
|
||||
sprite.draw(); // Draw sprite and load it into game's memory.
|
||||
sprite.destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, if graphic with given path cached in memory.
|
||||
*/
|
||||
public static inline function isGraphicCached(path:String):Bool
|
||||
return permanentCachedTextures.exists(path) || currentCachedTextures.exists(path) || previousCachedTextures.exists(path);
|
||||
|
||||
public static function getCachedGraphic(path:String):Null<FlxGraphic>
|
||||
{
|
||||
if (permanentCachedTextures.exists(path)) return permanentCachedTextures.get(path);
|
||||
if (currentCachedTextures.exists(path)) return currentCachedTextures.get(path);
|
||||
if (previousCachedTextures.exists(path)) return previousCachedTextures.get(path); // just in case
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the cache for purging unused textures.
|
||||
*/
|
||||
|
|
|
@ -82,11 +82,8 @@ class InitState extends FlxState
|
|||
// GAME SETUP
|
||||
//
|
||||
|
||||
// Setup window events (like callbacks for onWindowClose)
|
||||
// and fullscreen keybind setup
|
||||
// Setup window events (like callbacks for onWindowClose) and fullscreen keybind setup
|
||||
WindowUtil.initWindowEvents();
|
||||
// Disable the thing on Windows where it tries to send a bug report to Microsoft because why do they care?
|
||||
WindowUtil.disableCrashHandler();
|
||||
|
||||
#if FEATURE_DEBUG_TRACY
|
||||
funkin.util.WindowUtil.initTracy();
|
||||
|
@ -114,7 +111,7 @@ class InitState extends FlxState
|
|||
|
||||
#if ios
|
||||
// Setup Audio session
|
||||
funkin.mobile.external.ios.AudioSession.initialize();
|
||||
funkin.external.ios.AudioSession.initialize();
|
||||
#end
|
||||
|
||||
// This ain't a pixel art game! (most of the time)
|
||||
|
@ -202,7 +199,7 @@ class InitState extends FlxState
|
|||
//
|
||||
#if android
|
||||
FlxG.android.preventDefaultKeys = [flixel.input.android.FlxAndroidKey.BACK];
|
||||
funkin.mobile.external.android.CallbackUtil.init();
|
||||
funkin.external.android.CallbackUtil.init();
|
||||
#end
|
||||
|
||||
//
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package funkin.api.discord;
|
||||
|
||||
import funkin.util.macro.EnvironmentConfigMacro;
|
||||
#if FEATURE_DISCORD_RPC
|
||||
import hxdiscord_rpc.Discord;
|
||||
import hxdiscord_rpc.Types.DiscordButton;
|
||||
|
@ -11,7 +12,7 @@ import sys.thread.Thread;
|
|||
@:nullSafety
|
||||
class DiscordClient
|
||||
{
|
||||
static final CLIENT_ID:String = "816168432860790794";
|
||||
static final CLIENT_ID:Null<String> = EnvironmentConfigMacro.environmentConfig?.get("DESKTOP_DISCORD_CLIENT_ID");
|
||||
|
||||
public static var instance(get, never):DiscordClient;
|
||||
static var _instance:Null<DiscordClient> = null;
|
||||
|
@ -40,12 +41,28 @@ class DiscordClient
|
|||
{
|
||||
trace('[DISCORD] Initializing connection...');
|
||||
|
||||
// Discord.initialize(CLIENT_ID, handlers, true, null);
|
||||
Discord.Initialize(CLIENT_ID, cpp.RawPointer.addressOf(handlers), 1, "");
|
||||
if (!hasValidCredentials())
|
||||
{
|
||||
FlxG.log.warn("Tried to initialize Discord connection, but credentials are invalid!");
|
||||
return;
|
||||
}
|
||||
|
||||
@:nullSafety(Off)
|
||||
{
|
||||
Discord.Initialize(CLIENT_ID, cpp.RawPointer.addressOf(handlers), 1, "");
|
||||
}
|
||||
|
||||
createDaemon();
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns `false` if the client ID is invalid.
|
||||
*/
|
||||
static function hasValidCredentials():Bool
|
||||
{
|
||||
return !(CLIENT_ID == null || CLIENT_ID == "" || (CLIENT_ID != null && CLIENT_ID.contains(" ")));
|
||||
}
|
||||
|
||||
var daemon:Null<Thread> = null;
|
||||
|
||||
function createDaemon():Void
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package funkin.api.newgrounds;
|
||||
|
||||
import funkin.util.macro.EnvironmentConfigMacro;
|
||||
import funkin.save.Save;
|
||||
import funkin.api.newgrounds.Medals.Medal;
|
||||
#if FEATURE_NEWGROUNDS
|
||||
|
@ -17,7 +18,11 @@ import io.newgrounds.objects.User;
|
|||
@:nullSafety
|
||||
class NewgroundsClient
|
||||
{
|
||||
static final APP_ID:Null<String> = EnvironmentConfigMacro.environmentConfig?.get("API_NG_APP_ID");
|
||||
static final ENCRYPTION_KEY:Null<String> = EnvironmentConfigMacro.environmentConfig?.get("API_NG_ENC_KEY");
|
||||
|
||||
public static var instance(get, never):NewgroundsClient;
|
||||
|
||||
static var _instance:Null<NewgroundsClient> = null;
|
||||
|
||||
static function get_instance():NewgroundsClient
|
||||
|
@ -37,8 +42,8 @@ class NewgroundsClient
|
|||
trace('[NEWGROUNDS] Initializing client...');
|
||||
|
||||
#if FEATURE_NEWGROUNDS_DEBUG
|
||||
trace('[NEWGROUNDS] App ID: ${NewgroundsCredentials.APP_ID}');
|
||||
trace('[NEWGROUNDS] Encryption Key: ${NewgroundsCredentials.ENCRYPTION_KEY}');
|
||||
trace('[NEWGROUNDS] App ID: ${APP_ID}');
|
||||
trace('[NEWGROUNDS] Encryption Key: ${ENCRYPTION_KEY}');
|
||||
#end
|
||||
|
||||
if (!hasValidCredentials())
|
||||
|
@ -47,9 +52,12 @@ class NewgroundsClient
|
|||
return;
|
||||
}
|
||||
|
||||
var debug = #if FEATURE_NEWGROUNDS_DEBUG true #else false #end;
|
||||
NG.create(NewgroundsCredentials.APP_ID, getSessionId(), debug, onLoginResolved);
|
||||
NG.core.setupEncryption(NewgroundsCredentials.ENCRYPTION_KEY);
|
||||
@:nullSafety(Off)
|
||||
{
|
||||
NG.create(APP_ID, getSessionId(), #if FEATURE_NEWGROUNDS_DEBUG true #else false #end, onLoginResolved);
|
||||
|
||||
NG.core.setupEncryption(ENCRYPTION_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
public function init()
|
||||
|
@ -168,12 +176,12 @@ class NewgroundsClient
|
|||
*/
|
||||
static function hasValidCredentials():Bool
|
||||
{
|
||||
return !(NewgroundsCredentials.APP_ID == null
|
||||
|| NewgroundsCredentials.APP_ID == ""
|
||||
|| NewgroundsCredentials.APP_ID.contains(" ")
|
||||
|| NewgroundsCredentials.ENCRYPTION_KEY == null
|
||||
|| NewgroundsCredentials.ENCRYPTION_KEY == ""
|
||||
|| NewgroundsCredentials.ENCRYPTION_KEY.contains(" "));
|
||||
return !(APP_ID == null
|
||||
|| APP_ID == ""
|
||||
|| (APP_ID != null && APP_ID.contains(" "))
|
||||
|| ENCRYPTION_KEY == null
|
||||
|| ENCRYPTION_KEY == ""
|
||||
|| (ENCRYPTION_KEY != null && ENCRYPTION_KEY.contains(" ")));
|
||||
}
|
||||
|
||||
function onLoginResolved(outcome:LoginOutcome):Void
|
||||
|
|
|
@ -72,7 +72,7 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
|
|||
override function set_volume(value:Float):Float
|
||||
{
|
||||
// Uncap the volume.
|
||||
_volume = FlxMath.bound(value, 0.0, MAX_VOLUME);
|
||||
_volume = value.clamp(0.0, MAX_VOLUME);
|
||||
updateTransform();
|
||||
return _volume;
|
||||
}
|
||||
|
@ -568,8 +568,8 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
|
|||
if (_sound == null) return;
|
||||
|
||||
// Create a channel manually if the sound is considered important.
|
||||
var pan:Float = FlxMath.bound(SoundMixer.__soundTransform.pan + _transform.pan, -1, 1);
|
||||
var volume:Float = FlxMath.bound(SoundMixer.__soundTransform.volume * _transform.volume, 0, MAX_VOLUME);
|
||||
var pan:Float = (SoundMixer.__soundTransform.pan + _transform.pan).clamp(-1, 1);
|
||||
var volume:Float = (SoundMixer.__soundTransform.volume * _transform.volume).clamp(0, MAX_VOLUME);
|
||||
|
||||
var audioSource:AudioSource = new AudioSource(_sound.__buffer);
|
||||
audioSource.offset = Std.int(startTime);
|
||||
|
|
|
@ -1117,6 +1117,23 @@ class SongNoteDataRaw implements ICloneable<SongNoteDataRaw>
|
|||
return 'SongNoteData(${this.time}ms, ' + (this.length > 0 ? '[${this.length}ms hold]' : '') + ' ${this.data}'
|
||||
+ (this.kind != '' ? ' [kind: ${this.kind}])' : ')');
|
||||
}
|
||||
|
||||
public function buildTooltip():String
|
||||
{
|
||||
if ((this.kind?.length ?? 0) == 0) return "";
|
||||
|
||||
var result:String = 'Kind: ${this.kind}';
|
||||
if (this.params.length == 0) return result;
|
||||
|
||||
result += "\nParams:";
|
||||
|
||||
for (param in params)
|
||||
{
|
||||
result += '\n- ${param.name}: ${param.value}';
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package funkin.mobile.external.android;
|
||||
package funkin.external.android;
|
||||
|
||||
#if android
|
||||
import lime.system.JNI;
|
||||
import flixel.util.FlxSignal;
|
||||
|
||||
|
@ -9,7 +10,6 @@ import flixel.util.FlxSignal;
|
|||
@:unreflective
|
||||
class CallbackUtil
|
||||
{
|
||||
#if android
|
||||
/**
|
||||
* The result code for `DATA_FOLDER_CLOSED` activity.
|
||||
*/
|
||||
|
@ -42,7 +42,6 @@ class CallbackUtil
|
|||
initCallBackJNI(new CallbackHandler());
|
||||
}
|
||||
}
|
||||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,8 +49,7 @@ class CallbackUtil
|
|||
*/
|
||||
class CallbackHandler #if (lime >= "8.0.0") implements JNISafety #end
|
||||
{
|
||||
#if android
|
||||
@:allow(funkin.mobile.external.android.CallbackUtil)
|
||||
@:allow(funkin.external.android.CallbackUtil)
|
||||
function new():Void {}
|
||||
|
||||
/**
|
||||
|
@ -68,5 +66,5 @@ class CallbackHandler #if (lime >= "8.0.0") implements JNISafety #end
|
|||
{
|
||||
if (CallbackUtil.onActivityResult != null) CallbackUtil.onActivityResult.dispatch(requestCode, resultCode);
|
||||
}
|
||||
#end
|
||||
}
|
||||
#end
|
|
@ -1,12 +1,12 @@
|
|||
package funkin.mobile.external.android;
|
||||
package funkin.external.android;
|
||||
|
||||
#if android
|
||||
/**
|
||||
* A Utility class to manage the Application's Data folder on Android.
|
||||
*/
|
||||
@:unreflective
|
||||
class DataFolderUtil
|
||||
{
|
||||
#if android
|
||||
/**
|
||||
* Opens the data folder on an Android device using JNI.
|
||||
*/
|
||||
|
@ -19,5 +19,5 @@ class DataFolderUtil
|
|||
openDataFolderJNI(CallbackUtil.DATA_FOLDER_CLOSED);
|
||||
}
|
||||
}
|
||||
#end
|
||||
}
|
||||
#end
|
|
@ -1,4 +1,4 @@
|
|||
package funkin.mobile.external.android;
|
||||
package funkin.external.android;
|
||||
|
||||
#if android
|
||||
import lime.system.JNI;
|
|
@ -1,5 +1,6 @@
|
|||
package funkin.mobile.external.android;
|
||||
package funkin.external.android;
|
||||
|
||||
#if android
|
||||
import lime.math.Rectangle;
|
||||
import lime.system.JNI;
|
||||
|
||||
|
@ -9,7 +10,6 @@ import lime.system.JNI;
|
|||
@:unreflective
|
||||
class ScreenUtil
|
||||
{
|
||||
#if android
|
||||
/**
|
||||
* Retrieves the dimensions of display cutouts (such as notches) on Android devices.
|
||||
*
|
||||
|
@ -48,5 +48,5 @@ class ScreenUtil
|
|||
|
||||
return [];
|
||||
}
|
||||
#end
|
||||
}
|
||||
#end
|
|
@ -1,9 +1,10 @@
|
|||
package funkin.mobile.external.ios;
|
||||
package funkin.external.ios;
|
||||
|
||||
#if ios
|
||||
/**
|
||||
* A Utility class to manage iOS audio.
|
||||
*/
|
||||
@:build(funkin.mobile.macros.LinkerMacro.xml('project/Build.xml'))
|
||||
@:build(funkin.util.macro.LinkerMacro.xml('project/Build.xml'))
|
||||
@:include('AudioSession.hpp')
|
||||
@:unreflective
|
||||
extern class AudioSession
|
||||
|
@ -13,3 +14,4 @@ extern class AudioSession
|
|||
@:native('setActive')
|
||||
static function setActive(active:Bool):Void;
|
||||
}
|
||||
#end
|
|
@ -1,9 +1,10 @@
|
|||
package funkin.mobile.external.ios;
|
||||
package funkin.external.ios;
|
||||
|
||||
#if ios
|
||||
/**
|
||||
* A Utility class to get iOS screen related informations.
|
||||
*/
|
||||
@:build(funkin.mobile.macros.LinkerMacro.xml('project/Build.xml'))
|
||||
@:build(funkin.util.macro.LinkerMacro.xml('project/Build.xml'))
|
||||
@:include('ScreenUtil.hpp')
|
||||
@:unreflective
|
||||
extern class ScreenUtil
|
||||
|
@ -14,3 +15,4 @@ extern class ScreenUtil
|
|||
@:native('getScreenSize')
|
||||
static function getScreenSize(width:cpp.RawPointer<Float>, height:cpp.RawPointer<Float>):Void;
|
||||
}
|
||||
#end
|
75
source/funkin/external/windows/WinAPI.hx
vendored
Normal file
75
source/funkin/external/windows/WinAPI.hx
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
package funkin.external.windows;
|
||||
|
||||
#if (windows && cpp)
|
||||
/**
|
||||
* This class provides handling for Windows API-related functions.
|
||||
*/
|
||||
@:build(funkin.util.macro.LinkerMacro.xml('project/Build.xml'))
|
||||
@:include('winapi.hpp')
|
||||
extern class WinAPI
|
||||
{
|
||||
/**
|
||||
* Shows a message box with an error icon.
|
||||
*
|
||||
* @param message The message to display.
|
||||
* @param title The title of the message box.
|
||||
*/
|
||||
@:native('WINAPI_ShowError')
|
||||
static function showError(message:cpp.ConstCharStar, title:cpp.ConstCharStar):Void;
|
||||
|
||||
/**
|
||||
* Shows a message box with a warning icon.
|
||||
*
|
||||
* @param message The message to display.
|
||||
* @param title The title of the message box.
|
||||
*/
|
||||
@:native('WINAPI_ShowWarning')
|
||||
static function showWarning(message:cpp.ConstCharStar, title:cpp.ConstCharStar):Void;
|
||||
|
||||
/**
|
||||
* Shows a message box with an information icon.
|
||||
*
|
||||
* @param message The message to display.
|
||||
* @param title The title of the message box.
|
||||
*/
|
||||
@:native('WINAPI_ShowInformation')
|
||||
static function showInformation(message:cpp.ConstCharStar, title:cpp.ConstCharStar):Void;
|
||||
|
||||
/**
|
||||
* Shows a message box with a question icon.
|
||||
*
|
||||
* @param message The message to display.
|
||||
* @param title The title of the message box.
|
||||
*/
|
||||
@:native('WINAPI_ShowQuestion')
|
||||
static function showQuestion(message:cpp.ConstCharStar, title:cpp.ConstCharStar):Void;
|
||||
|
||||
/**
|
||||
* Disables the "Report to Microsoft" dialog that appears when the application crashes.
|
||||
*/
|
||||
@:native('WINAPI_DisableErrorReporting')
|
||||
static function disableErrorReporting():Void;
|
||||
|
||||
/**
|
||||
* Disables Windows ghosting, which prevents the system from marking unresponsive windows as "Not Responding."
|
||||
*/
|
||||
@:native('WINAPI_DisableWindowsGhosting')
|
||||
static function disableWindowsGhosting():Void;
|
||||
|
||||
/**
|
||||
* Sets the dark mode for the active window.
|
||||
*
|
||||
* @param enable A boolean value indicating whether to enable (true) or disable (false) dark mode.
|
||||
*/
|
||||
@:native('WINAPI_SetDarkMode')
|
||||
static function setDarkMode(enable:Bool):Void;
|
||||
|
||||
/**
|
||||
* Checks if the system is using dark mode.
|
||||
*
|
||||
* @return True if system is in dark mode, false otherwise.
|
||||
*/
|
||||
@:native('WINAPI_IsSystemDarkMode')
|
||||
static function isSystemDarkMode():Bool;
|
||||
}
|
||||
#end
|
36
source/funkin/external/windows/project/Build.xml
vendored
Normal file
36
source/funkin/external/windows/project/Build.xml
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xml>
|
||||
<pragma once="true" />
|
||||
|
||||
<files id="haxe">
|
||||
<compilerflag value="-I${this_dir}/include" />
|
||||
</files>
|
||||
|
||||
<files id="__main__">
|
||||
<compilerflag value="-I${this_dir}/include" />
|
||||
</files>
|
||||
|
||||
<files id="winapi">
|
||||
<compilerflag value="-I${this_dir}/include" />
|
||||
|
||||
<file name="${this_dir}/src/winapi.cpp" />
|
||||
</files>
|
||||
|
||||
<target id="haxe">
|
||||
<section if="mingw">
|
||||
<lib name="-luser32" />
|
||||
<lib name="-lkernel32" />
|
||||
<lib name="-ldwmapi" />
|
||||
<lib name="-ladvapi32" />
|
||||
</section>
|
||||
|
||||
<section if="windows" unless="mingw">
|
||||
<lib name="user32.lib" />
|
||||
<lib name="kernel32.lib" />
|
||||
<lib name="dwmapi.lib" />
|
||||
<lib name="advapi32.lib" />
|
||||
</section>
|
||||
|
||||
<files id="winapi" />
|
||||
</target>
|
||||
</xml>
|
51
source/funkin/external/windows/project/include/winapi.hpp
vendored
Normal file
51
source/funkin/external/windows/project/include/winapi.hpp
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
#pragma once
|
||||
|
||||
/**
|
||||
* @brief Shows an error message box
|
||||
* @param message The error message to display
|
||||
* @param title The title of the message box
|
||||
*/
|
||||
void WINAPI_ShowError(const char *message, const char *title);
|
||||
|
||||
/**
|
||||
* @brief Shows a warning message box
|
||||
* @param message The warning message to display
|
||||
* @param title The title of the message box
|
||||
*/
|
||||
void WINAPI_ShowWarning(const char *message, const char *title);
|
||||
|
||||
/**
|
||||
* @brief Shows an information message box
|
||||
* @param message The information message to display
|
||||
* @param title The title of the message box
|
||||
*/
|
||||
void WINAPI_ShowInformation(const char *message, const char *title);
|
||||
|
||||
/**
|
||||
* @brief Shows a question message box with OK/Cancel buttons
|
||||
* @param message The question message to display
|
||||
* @param title The title of the message box
|
||||
*/
|
||||
void WINAPI_ShowQuestion(const char *message, const char *title);
|
||||
|
||||
/**
|
||||
* @brief Disables Windows error reporting dialogs
|
||||
*/
|
||||
void WINAPI_DisableErrorReporting();
|
||||
|
||||
/**
|
||||
* @brief Disables Windows ghosting for the current process
|
||||
*/
|
||||
void WINAPI_DisableWindowsGhosting();
|
||||
|
||||
/**
|
||||
* @brief Sets dark mode for the active window
|
||||
* @param enable True to enable dark mode, false to disable
|
||||
*/
|
||||
void WINAPI_SetDarkMode(bool enable);
|
||||
|
||||
/**
|
||||
* @brief Checks if the system is using dark mode
|
||||
* @return True if system is in dark mode, false otherwise
|
||||
*/
|
||||
bool WINAPI_IsSystemDarkMode();
|
75
source/funkin/external/windows/project/src/winapi.cpp
vendored
Normal file
75
source/funkin/external/windows/project/src/winapi.cpp
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
#define WIN32_LEAN_AND_MEAN // Excludes rarely-used APIs like cryptography, DDE, RPC, and shell functions, reducing compile time and binary size.
|
||||
#define NOMINMAX // Prevents Windows from defining min() and max() macros, which can conflict with standard C++ functions.
|
||||
#define NOCRYPT // Excludes Cryptographic APIs, such as Encrypt/Decrypt functions.
|
||||
#define NOCOMM // Excludes serial communication APIs, such as COM port handling.
|
||||
#define NOKANJI // Excludes Kanji character set support (not needed unless working with Japanese text processing).
|
||||
#define NOHELP // Excludes Windows Help APIs, removing functions related to WinHelp and other help systems.
|
||||
|
||||
#include <windows.h>
|
||||
#include <psapi.h>
|
||||
#include <dwmapi.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void WINAPI_ShowError(const char *message, const char *title)
|
||||
{
|
||||
MessageBox(GetActiveWindow(), message, title, MB_OK | MB_ICONERROR);
|
||||
}
|
||||
|
||||
void WINAPI_ShowWarning(const char *message, const char *title)
|
||||
{
|
||||
MessageBox(GetActiveWindow(), message, title, MB_OK | MB_ICONWARNING);
|
||||
}
|
||||
|
||||
void WINAPI_ShowInformation(const char *message, const char *title)
|
||||
{
|
||||
MessageBox(GetActiveWindow(), message, title, MB_OK | MB_ICONINFORMATION);
|
||||
}
|
||||
|
||||
void WINAPI_ShowQuestion(const char *message, const char *title)
|
||||
{
|
||||
MessageBox(GetActiveWindow(), message, title, MB_OKCANCEL | MB_ICONQUESTION);
|
||||
}
|
||||
|
||||
void WINAPI_DisableErrorReporting()
|
||||
{
|
||||
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
|
||||
}
|
||||
|
||||
void WINAPI_DisableWindowsGhosting()
|
||||
{
|
||||
DisableProcessWindowsGhosting();
|
||||
}
|
||||
|
||||
void WINAPI_SetDarkMode(bool enable)
|
||||
{
|
||||
HWND window = GetActiveWindow();
|
||||
|
||||
int darkMode = enable ? 1 : 0;
|
||||
|
||||
if (DwmSetWindowAttribute(window, 20, &darkMode, sizeof(darkMode)) != S_OK)
|
||||
DwmSetWindowAttribute(window, 19, &darkMode, sizeof(darkMode));
|
||||
|
||||
UpdateWindow(window);
|
||||
}
|
||||
|
||||
bool WINAPI_IsSystemDarkMode()
|
||||
{
|
||||
HKEY hKey;
|
||||
DWORD dwValue = 0;
|
||||
DWORD dwSize = sizeof(DWORD);
|
||||
DWORD dwType = REG_DWORD;
|
||||
|
||||
if (RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
|
||||
{
|
||||
if (RegQueryValueEx(hKey, "AppsUseLightTheme", NULL, &dwType, (LPBYTE)&dwValue, &dwSize) == ERROR_SUCCESS)
|
||||
{
|
||||
RegCloseKey(hKey);
|
||||
return dwValue == 0;
|
||||
}
|
||||
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
|
@ -12,6 +12,7 @@ import flixel.math.FlxPoint;
|
|||
import flixel.graphics.frames.FlxFrame.FlxFrameAngle;
|
||||
import flixel.FlxCamera;
|
||||
import openfl.system.System;
|
||||
import funkin.FunkinMemory;
|
||||
|
||||
using StringTools;
|
||||
|
||||
|
@ -23,20 +24,6 @@ using StringTools;
|
|||
@:nullSafety
|
||||
class FunkinSprite extends FlxSprite
|
||||
{
|
||||
/**
|
||||
* An internal list of all the textures cached with `cacheTexture`.
|
||||
* This excludes any temporary textures like those from `FlxText` or `makeSolidColor`.
|
||||
*/
|
||||
static var currentCachedTextures:Map<String, FlxGraphic> = [];
|
||||
|
||||
/**
|
||||
* An internal list of textures that were cached in the previous state.
|
||||
* We don't know whether we want to keep them cached or not.
|
||||
*/
|
||||
static var previousCachedTextures:Map<String, FlxGraphic> = [];
|
||||
|
||||
static var permanentCachedTextures:Map<String, FlxGraphic> = [];
|
||||
|
||||
/**
|
||||
* @param x Starting X position
|
||||
* @param y Starting Y position
|
||||
|
@ -216,122 +203,40 @@ class FunkinSprite extends FlxSprite
|
|||
return FlxG.bitmap.get(key) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure the texture with the given key is cached.
|
||||
* @param key The key of the texture to cache.
|
||||
*/
|
||||
@:deprecated("Use FunkinMemory.cacheTexture() instead")
|
||||
public static function cacheTexture(key:String):Void
|
||||
{
|
||||
// We don't want to cache the same texture twice.
|
||||
if (currentCachedTextures.exists(key)) return;
|
||||
|
||||
if (previousCachedTextures.exists(key))
|
||||
{
|
||||
// Move the graphic from the previous cache to the current cache.
|
||||
var graphic = previousCachedTextures.get(key);
|
||||
previousCachedTextures.remove(key);
|
||||
if (graphic != null) currentCachedTextures.set(key, graphic);
|
||||
return;
|
||||
}
|
||||
|
||||
// Else, texture is currently uncached.
|
||||
var graphic:FlxGraphic = FlxGraphic.fromAssetKey(key, false, null, true);
|
||||
if (graphic == null)
|
||||
{
|
||||
FlxG.log.warn('Failed to cache graphic: $key');
|
||||
}
|
||||
else
|
||||
{
|
||||
trace('Successfully cached graphic: $key');
|
||||
graphic.persist = true;
|
||||
currentCachedTextures.set(key, graphic);
|
||||
}
|
||||
FunkinMemory.cacheTexture(Paths.image(key));
|
||||
}
|
||||
|
||||
@:deprecated("Use FunkinMemory.permanentCacheTexture() instead")
|
||||
public static function permanentCacheTexture(key:String):Void
|
||||
{
|
||||
// We don't want to cache the same texture twice.
|
||||
if (permanentCachedTextures.exists(key)) return;
|
||||
|
||||
// Else, texture is currently uncached.
|
||||
var graphic:FlxGraphic = FlxGraphic.fromAssetKey(key, false, null, true);
|
||||
if (graphic == null)
|
||||
{
|
||||
FlxG.log.warn('Failed to cache graphic: $key');
|
||||
}
|
||||
else
|
||||
{
|
||||
trace('Successfully cached graphic: $key');
|
||||
graphic.persist = true;
|
||||
permanentCachedTextures.set(key, graphic);
|
||||
}
|
||||
|
||||
currentCachedTextures = permanentCachedTextures;
|
||||
@:privateAccess FunkinMemory.permanentCacheTexture(Paths.image(key));
|
||||
}
|
||||
|
||||
@:deprecated("Use FunkinMemory.cacheTexture() instead")
|
||||
public static function cacheSparrow(key:String):Void
|
||||
{
|
||||
cacheTexture(Paths.image(key));
|
||||
FunkinMemory.cacheTexture(Paths.image(key));
|
||||
}
|
||||
|
||||
@:deprecated("Use FunkinMemory.cacheTexture() instead")
|
||||
public static function cachePacker(key:String):Void
|
||||
{
|
||||
cacheTexture(Paths.image(key));
|
||||
FunkinMemory.cacheTexture(Paths.image(key));
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this, then `cacheTexture` to keep the textures we still need, then `purgeCache` to remove the textures that we won't be using anymore.
|
||||
*/
|
||||
@:deprecated("Use FunkinMemory.preparePurgeTextureCache() instead")
|
||||
public static function preparePurgeCache():Void
|
||||
{
|
||||
previousCachedTextures = currentCachedTextures;
|
||||
|
||||
for (graphicKey in previousCachedTextures.keys())
|
||||
{
|
||||
if (!permanentCachedTextures.exists(graphicKey)) continue;
|
||||
previousCachedTextures.remove(graphicKey);
|
||||
}
|
||||
|
||||
currentCachedTextures = permanentCachedTextures;
|
||||
FunkinMemory.preparePurgeTextureCache();
|
||||
}
|
||||
|
||||
@:deprecated("Use FunkinMemory.purgeCache() instead")
|
||||
public static function purgeCache():Void
|
||||
{
|
||||
// Everything that is in previousCachedTextures but not in currentCachedTextures should be destroyed.
|
||||
for (graphicKey in previousCachedTextures.keys())
|
||||
{
|
||||
var graphic = previousCachedTextures.get(graphicKey);
|
||||
if (graphic == null) continue;
|
||||
FlxG.bitmap.remove(graphic);
|
||||
graphic.destroy();
|
||||
previousCachedTextures.remove(graphicKey);
|
||||
}
|
||||
@:privateAccess
|
||||
if (FlxG.bitmap._cache == null)
|
||||
{
|
||||
@:privateAccess
|
||||
FlxG.bitmap._cache = new Map();
|
||||
System.gc();
|
||||
return;
|
||||
}
|
||||
|
||||
@:privateAccess
|
||||
for (key in FlxG.bitmap._cache.keys())
|
||||
{
|
||||
var obj:Null<FlxGraphic> = FlxG.bitmap.get(key);
|
||||
if (obj == null) continue;
|
||||
if (obj.persist) continue;
|
||||
if (permanentCachedTextures.exists(key)) continue;
|
||||
if (!(obj.useCount <= 0 || key.contains("characters") || key.contains("charSelect") || key.contains("results"))) continue;
|
||||
|
||||
FlxG.bitmap.removeKey(key);
|
||||
obj.destroy();
|
||||
}
|
||||
openfl.Assets.cache.clear("songs");
|
||||
openfl.Assets.cache.clear("sounds");
|
||||
openfl.Assets.cache.clear("music");
|
||||
|
||||
System.gc();
|
||||
FunkinMemory.purgeCache();
|
||||
}
|
||||
|
||||
static function isGraphicCached(graphic:FlxGraphic):Bool
|
||||
|
|
|
@ -298,7 +298,7 @@ class PreciseInputManager extends FlxKeyManager<FlxKey, PreciseInputList>
|
|||
// trace(timestamp);
|
||||
updateKeyStates(key, true);
|
||||
|
||||
if (getInputByKey(key)?.justPressed ?? false)
|
||||
if (getInputByKey(key)?.justPressed ?? false && enabled)
|
||||
{
|
||||
onInputPressed.dispatch(
|
||||
{
|
||||
|
@ -320,7 +320,7 @@ class PreciseInputManager extends FlxKeyManager<FlxKey, PreciseInputList>
|
|||
|
||||
updateKeyStates(key, false);
|
||||
|
||||
if (getInputByKey(key)?.justReleased ?? false)
|
||||
if (getInputByKey(key)?.justReleased ?? false && enabled)
|
||||
{
|
||||
onInputReleased.dispatch(
|
||||
{
|
||||
|
@ -344,7 +344,7 @@ class PreciseInputManager extends FlxKeyManager<FlxKey, PreciseInputList>
|
|||
|
||||
updateButtonStates(gamepad, buttonId, true);
|
||||
|
||||
if (getInputByButton(gamepad, buttonId)?.justPressed ?? false)
|
||||
if (getInputByButton(gamepad, buttonId)?.justPressed ?? false && enabled)
|
||||
{
|
||||
onInputPressed.dispatch(
|
||||
{
|
||||
|
@ -368,7 +368,7 @@ class PreciseInputManager extends FlxKeyManager<FlxKey, PreciseInputList>
|
|||
|
||||
updateButtonStates(gamepad, buttonId, false);
|
||||
|
||||
if (getInputByButton(gamepad, buttonId)?.justReleased ?? false)
|
||||
if (getInputByButton(gamepad, buttonId)?.justReleased ?? false && enabled)
|
||||
{
|
||||
onInputReleased.dispatch(
|
||||
{
|
||||
|
|
|
@ -125,7 +125,7 @@ class ControlsHandler
|
|||
@:noCompletion
|
||||
private static function get_hasExternalInputDevice():Bool
|
||||
{
|
||||
return FlxG.gamepads.numActiveGamepads > 0;
|
||||
return FlxG.gamepads.numActiveGamepads > 0 #if android || extension.androidtools.Tools.isChromebook() #end;
|
||||
}
|
||||
|
||||
@:noCompletion
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
package funkin.mobile.macros;
|
||||
|
||||
import haxe.macro.Context;
|
||||
import haxe.macro.Expr;
|
||||
import haxe.xml.Printer;
|
||||
import sys.FileSystem;
|
||||
|
||||
using haxe.io.Path;
|
||||
|
||||
/**
|
||||
* This class provides a macro to include an XML build file in the metadata of a Haxe class.
|
||||
* The file must be located relative to the directory of the Haxe class that uses this macro.
|
||||
*/
|
||||
@:nullSafety
|
||||
class LinkerMacro
|
||||
{
|
||||
/**
|
||||
* Adds an XML `<include>` element to the class's metadata, pointing to a specified build file.
|
||||
* @param file_name The name of the XML file to include. Defaults to `Build.xml` if not provided.
|
||||
* @return An array of fields that are processed during the build.
|
||||
*/
|
||||
public static macro function xml(?file_name:String = 'Build.xml'):Array<Field>
|
||||
{
|
||||
final pos:Position = Context.currentPos();
|
||||
final sourcePath:String = FileSystem.absolutePath(Context.getPosInfos(pos).file.directory()).removeTrailingSlashes();
|
||||
final fileToInclude:String = Path.join([sourcePath, file_name?.length > 0 ? file_name : 'Build.xml']);
|
||||
|
||||
if (!FileSystem.exists(fileToInclude)) Context.error('The specified file "$fileToInclude" could not be found at "$sourcePath".', pos);
|
||||
|
||||
final includeElement:Xml = Xml.createElement('include');
|
||||
includeElement.set('name', fileToInclude);
|
||||
Context.getLocalClass().get().meta.add(':buildXml', [
|
||||
{expr: EConst(CString(Printer.print(includeElement, true))), pos: pos}], pos);
|
||||
|
||||
return Context.getBuildFields();
|
||||
}
|
||||
}
|
|
@ -270,7 +270,7 @@ class ControlsSchemeMenu extends MusicBeatSubState
|
|||
*/
|
||||
function setSelection(index:Int):Void
|
||||
{
|
||||
final newIndex:Int = Math.floor(FlxMath.bound(index, 0, hitboxShowcases.length - 1));
|
||||
final newIndex:Int = Math.floor(index.clamp(0, hitboxShowcases.length - 1));
|
||||
|
||||
if (currentIndex != newIndex)
|
||||
{
|
||||
|
@ -348,7 +348,7 @@ class ControlsSchemeMenu extends MusicBeatSubState
|
|||
hitboxShowcases.x = MathUtil.smoothLerpPrecision(hitboxShowcases.x, showcasesTargetX, elapsed, 0.5);
|
||||
|
||||
final minShowcasesX:Float = -1500 * availableSchemes.length;
|
||||
hitboxShowcases.x = FlxMath.bound(hitboxShowcases.x, minShowcasesX, 400);
|
||||
hitboxShowcases.x = hitboxShowcases.x.clamp(minShowcasesX, 400);
|
||||
|
||||
final targetIndex:Int = Math.round(hitboxShowcases.x / -1500);
|
||||
|
||||
|
@ -356,8 +356,9 @@ class ControlsSchemeMenu extends MusicBeatSubState
|
|||
}
|
||||
else
|
||||
{
|
||||
hitboxShowcases.x = MathUtil.smoothLerpPrecision(hitboxShowcases.x, (-1500 * currentIndex) + (-1500 / (availableSchemes.length + 1) * currentIndex), elapsed, 0.5);
|
||||
hitboxShowcases.x = MathUtil.smoothLerpPrecision(hitboxShowcases.x, (-1500 * currentIndex) + (-1500 / (availableSchemes.length + 1) * currentIndex),
|
||||
elapsed, 0.5);
|
||||
}
|
||||
#end
|
||||
}
|
||||
#end
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ class AdMobUtil
|
|||
/**
|
||||
* AdMob publisher ID used for the application.
|
||||
*/
|
||||
static final ADMOB_PUBLISHER:String = EnvironmentConfigMacro.environmentConfig.get("GLOBAL_ADMOB_PUBLISHER");
|
||||
static final ADMOB_PUBLISHER:String = EnvironmentConfigMacro.environmentConfig.get("MOBILE_GLOBAL_ADMOB_PUBLISHER");
|
||||
|
||||
/**
|
||||
* Test ad unit IDs for development and testing purposes.
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package funkin.mobile.util;
|
||||
|
||||
#if ios
|
||||
import funkin.mobile.external.ios.ScreenUtil as NativeScreenUtil;
|
||||
import funkin.external.ios.ScreenUtil as NativeScreenUtil;
|
||||
#elseif android
|
||||
import funkin.mobile.external.android.ScreenUtil as NativeScreenUtil;
|
||||
import funkin.external.android.ScreenUtil as NativeScreenUtil;
|
||||
#end
|
||||
import lime.math.Rectangle;
|
||||
import lime.system.System;
|
||||
|
|
54
source/funkin/modding/ModStore.hx
Normal file
54
source/funkin/modding/ModStore.hx
Normal file
|
@ -0,0 +1,54 @@
|
|||
package funkin.modding;
|
||||
|
||||
import haxe.ds.StringMap;
|
||||
|
||||
/**
|
||||
* Temporary persistent data storage for mods to use.
|
||||
*/
|
||||
@:nullSafety
|
||||
class ModStore
|
||||
{
|
||||
/**
|
||||
* All registered stores for this session.
|
||||
*/
|
||||
public static final stores:StringMap<Dynamic> = new StringMap<Dynamic>();
|
||||
|
||||
/**
|
||||
* Attempts to register a new store with the given ID and return it.
|
||||
* If a store with the same ID already exists, that store will be returned instead (discards `data`).
|
||||
*
|
||||
* @id The unique ID for this store.
|
||||
* @data Optional initial data, uses an empty object by default.
|
||||
* @return The store data at the given ID.
|
||||
*/
|
||||
public static function register(id:String, ?data:Dynamic):Dynamic
|
||||
{
|
||||
if (stores.exists(id)) return stores.get(id);
|
||||
stores.set(id, data ??= {});
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to get a store by ID.
|
||||
*
|
||||
* @id The target ID of the store.
|
||||
* @return The store data, or `null` if the store did not exist.
|
||||
*/
|
||||
public static function get(id:String):Null<Dynamic>
|
||||
{
|
||||
return stores.get(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to remove a store by ID and return it.
|
||||
*
|
||||
* @id The target ID of the store.
|
||||
* @return The store data, or `null` if the store did not exist.
|
||||
*/
|
||||
public static function remove(id:String):Null<Dynamic>
|
||||
{
|
||||
var data:Null<Dynamic> = stores.get(id);
|
||||
stores.remove(id);
|
||||
return data;
|
||||
}
|
||||
}
|
|
@ -5,19 +5,6 @@ import polymod.Polymod;
|
|||
@:nullSafety
|
||||
class PolymodErrorHandler
|
||||
{
|
||||
/**
|
||||
* Show a popup with the given text.
|
||||
* This displays a system popup, it WILL interrupt the game.
|
||||
* Make sure to only use this when it's important, like when there's a script error.
|
||||
*
|
||||
* @param name The name at the top of the popup.
|
||||
* @param desc The body text of the popup.
|
||||
*/
|
||||
public static function showAlert(name:String, desc:String):Void
|
||||
{
|
||||
lime.app.Application.current.window.alert(desc, name);
|
||||
}
|
||||
|
||||
public static function onPolymodError(error:PolymodError):Void
|
||||
{
|
||||
// Perform an action based on the error code.
|
||||
|
@ -37,12 +24,12 @@ class PolymodErrorHandler
|
|||
// A syntax error when parsing a script.
|
||||
logError(error.message);
|
||||
// Notify the user via popup.
|
||||
showAlert('Polymod Script Parsing Error', error.message);
|
||||
funkin.util.WindowUtil.showError('Polymod Script Parsing Error', error.message);
|
||||
case SCRIPT_RUNTIME_EXCEPTION:
|
||||
// A runtime error when running a script.
|
||||
logError(error.message);
|
||||
// Notify the user via popup.
|
||||
showAlert('Polymod Script Exception', error.message);
|
||||
funkin.util.WindowUtil.showError('Polymod Script Exception', error.message);
|
||||
case SCRIPT_CLASS_MODULE_NOT_FOUND:
|
||||
// A scripted class tried to reference an unknown class or module.
|
||||
logError(error.message);
|
||||
|
@ -54,13 +41,12 @@ class PolymodErrorHandler
|
|||
msg += '\nCheck to ensure the class exists and is spelled correctly.';
|
||||
|
||||
// Notify the user via popup.
|
||||
showAlert('Polymod Script Import Error', msg);
|
||||
funkin.util.WindowUtil.showError('Polymod Script Import Error', msg);
|
||||
case SCRIPT_CLASS_MODULE_BLACKLISTED:
|
||||
// A scripted class tried to reference a blacklisted class or module.
|
||||
logError(error.message);
|
||||
// Notify the user via popup.
|
||||
showAlert('Polymod Script Blacklist Violation', error.message);
|
||||
|
||||
funkin.util.WindowUtil.showError('Polymod Script Blacklist Violation', error.message);
|
||||
default:
|
||||
// Log the message based on its severity.
|
||||
switch (error.severity)
|
||||
|
|
|
@ -21,7 +21,6 @@ import funkin.util.MathUtil;
|
|||
import funkin.effects.RetroCameraFade;
|
||||
import flixel.math.FlxPoint;
|
||||
import funkin.util.TouchUtil;
|
||||
import openfl.utils.Assets;
|
||||
#if FEATURE_MOBILE_ADVERTISEMENTS
|
||||
import funkin.mobile.util.AdMobUtil;
|
||||
#end
|
||||
|
@ -102,18 +101,6 @@ class GameOverSubState extends MusicBeatSubState
|
|||
|
||||
var canInput:Bool = false;
|
||||
|
||||
var justDied:Bool = true;
|
||||
|
||||
var isSpecialAnimation:Bool = false;
|
||||
|
||||
var gameOverVibrationPreset:VibrationPreset =
|
||||
{
|
||||
period: 0,
|
||||
duration: Constants.DEFAULT_VIBRATION_DURATION,
|
||||
amplitude: Constants.MIN_VIBRATION_AMPLITUDE,
|
||||
sharpness: Constants.DEFAULT_VIBRATION_SHARPNESS
|
||||
};
|
||||
|
||||
public function new(params:GameOverParams)
|
||||
{
|
||||
super();
|
||||
|
@ -175,7 +162,7 @@ class GameOverSubState extends MusicBeatSubState
|
|||
if ((parentPlayState?.isMinimalMode ?? true)) {}
|
||||
else
|
||||
{
|
||||
boyfriend = parentPlayState?.currentStage.getBoyfriend(true);
|
||||
boyfriend = parentPlayState?.currentStage?.getBoyfriend(true);
|
||||
if (boyfriend != null)
|
||||
{
|
||||
boyfriend.canPlayOtherAnims = true;
|
||||
|
@ -198,16 +185,17 @@ class GameOverSubState extends MusicBeatSubState
|
|||
addBackButton(FlxG.width - 230, FlxG.height - 200, FlxColor.WHITE, goBack);
|
||||
#end
|
||||
|
||||
HapticUtil.vibrate(0, Constants.DEFAULT_VIBRATION_DURATION);
|
||||
|
||||
// Allow input a second later to prevent accidental gameover skips.
|
||||
new FlxTimer().start(1, function(tmr:FlxTimer) {
|
||||
canInput = true;
|
||||
});
|
||||
}
|
||||
|
||||
@:nullSafety(Off)
|
||||
function setCameraTarget():Void
|
||||
{
|
||||
if ((parentPlayState?.isMinimalMode ?? true) || boyfriend == null) return;
|
||||
if (parentPlayState == null || parentPlayState.isMinimalMode || boyfriend == null) return;
|
||||
|
||||
// Assign a camera follow point to the boyfriend's position.
|
||||
cameraFollowPoint = new FlxObject(parentPlayState.cameraFollowPoint.x, parentPlayState.cameraFollowPoint.y, 1, 1);
|
||||
|
@ -218,6 +206,7 @@ class GameOverSubState extends MusicBeatSubState
|
|||
cameraFollowPoint.y += offsets[1];
|
||||
add(cameraFollowPoint);
|
||||
|
||||
@:nullSafety(Off)
|
||||
FlxG.camera.target = null;
|
||||
FlxG.camera.follow(cameraFollowPoint, LOCKON, Constants.DEFAULT_CAMERA_FOLLOW_RATE / 2);
|
||||
targetCameraZoom = (parentPlayState?.currentStage?.camZoom ?? 1.0) * boyfriend.getDeathCameraZoom();
|
||||
|
@ -330,9 +319,6 @@ class GameOverSubState extends MusicBeatSubState
|
|||
}
|
||||
}
|
||||
|
||||
// Handle vibrations on update.
|
||||
if (HapticUtil.hapticsAvailable) handleAnimationVibrations();
|
||||
|
||||
// Start death music before firstDeath gets replaced
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
@ -408,7 +394,7 @@ class GameOverSubState extends MusicBeatSubState
|
|||
// Readd Boyfriend to the stage.
|
||||
boyfriend.isDead = false;
|
||||
remove(boyfriend);
|
||||
parentPlayState?.currentStage.addCharacter(boyfriend, BF);
|
||||
parentPlayState?.currentStage?.addCharacter(boyfriend, BF);
|
||||
}
|
||||
|
||||
// Snap reset the camera which may have changed because of the player character data.
|
||||
|
@ -454,7 +440,7 @@ class GameOverSubState extends MusicBeatSubState
|
|||
#else
|
||||
resetPlaying();
|
||||
#end
|
||||
});
|
||||
}, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -578,11 +564,11 @@ class GameOverSubState extends MusicBeatSubState
|
|||
PlayStatePlaylist.reset();
|
||||
}
|
||||
|
||||
var stickerPackId:Null<String> = parentPlayState?.currentChart.stickerPack;
|
||||
var stickerPackId:Null<String> = parentPlayState?.currentChart?.stickerPack;
|
||||
|
||||
if (stickerPackId == null)
|
||||
{
|
||||
var playerCharacterId:Null<String> = PlayerRegistry.instance.getCharacterOwnerId(parentPlayState?.currentChart.characters.player);
|
||||
var playerCharacterId:Null<String> = PlayerRegistry.instance.getCharacterOwnerId(parentPlayState?.currentChart?.characters.player);
|
||||
var playerCharacter:Null<PlayableCharacter> = PlayerRegistry.instance.fetchEntry(playerCharacterId ?? Constants.DEFAULT_CHARACTER);
|
||||
|
||||
if (playerCharacter != null)
|
||||
|
@ -615,108 +601,6 @@ class GameOverSubState extends MusicBeatSubState
|
|||
|
||||
var hasPlayedDeathQuote:Bool = false;
|
||||
|
||||
/**
|
||||
* Used for death haptics.
|
||||
*/
|
||||
var startedTimerHaptics:Bool = false;
|
||||
|
||||
/**
|
||||
* Unique vibrations for each death animation.
|
||||
*/
|
||||
function handleAnimationVibrations():Void
|
||||
{
|
||||
if ((parentPlayState?.isMinimalMode ?? true) || boyfriend == null) return;
|
||||
|
||||
if (justDied)
|
||||
{
|
||||
if (isSpecialAnimation)
|
||||
{
|
||||
HapticUtil.vibrate(0, Constants.DEFAULT_VIBRATION_DURATION * 5);
|
||||
trace("It's a special game over animation.");
|
||||
}
|
||||
else
|
||||
{
|
||||
HapticUtil.vibrate(0, Constants.DEFAULT_VIBRATION_DURATION);
|
||||
}
|
||||
justDied = false;
|
||||
}
|
||||
|
||||
if (boyfriend.animation == null) return;
|
||||
|
||||
final curFrame:Int = (boyfriend.animation.curAnim != null) ? boyfriend.animation.curAnim.curFrame : -1;
|
||||
if (boyfriend.characterId.startsWith("bf"))
|
||||
{
|
||||
// BF's mic drops.
|
||||
if (boyfriend.getCurrentAnimation().startsWith('firstDeath') && curFrame == 27)
|
||||
{
|
||||
HapticUtil.vibrateByPreset(gameOverVibrationPreset);
|
||||
}
|
||||
|
||||
// BF's balls pulsating.
|
||||
if (boyfriend.getCurrentAnimation().startsWith('deathLoop') && (curFrame == 0 || curFrame == 18))
|
||||
{
|
||||
HapticUtil.vibrateByPreset(gameOverVibrationPreset);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Pico dies because of Darnell beating him up.
|
||||
if (boyfriend.characterId == "pico-blazin")
|
||||
{
|
||||
if (!startedTimerHaptics)
|
||||
{
|
||||
startedTimerHaptics = true;
|
||||
|
||||
new FlxTimer().start(0.5, function(tmr:FlxTimer) {
|
||||
// Pico falls on his knees.
|
||||
HapticUtil.vibrateByPreset(gameOverVibrationPreset);
|
||||
|
||||
new FlxTimer().start(0.6, function(tmr:FlxTimer) {
|
||||
// Pico falls "asleep". :)
|
||||
HapticUtil.vibrateByPreset(gameOverVibrationPreset);
|
||||
});
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (boyfriend.characterId.startsWith("pico") && boyfriend.characterId != "pico-holding-nene")
|
||||
{
|
||||
if (isSpecialAnimation)
|
||||
{
|
||||
if (startedTimerHaptics) return;
|
||||
|
||||
startedTimerHaptics = true;
|
||||
|
||||
// Death by Darnell's can.
|
||||
new FlxTimer().start(1.85, function(tmr:FlxTimer) {
|
||||
// Pico falls on his knees.
|
||||
HapticUtil.vibrateByPreset(gameOverVibrationPreset);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
// Pico falls on his back.
|
||||
if (boyfriend.getCurrentAnimation().startsWith('firstDeath') && curFrame == 20)
|
||||
{
|
||||
HapticUtil.vibrateByPreset(gameOverVibrationPreset);
|
||||
}
|
||||
|
||||
// Blood firework woohoo!!!!
|
||||
if (boyfriend.getCurrentAnimation().startsWith('deathLoop') && curFrame % 2 == 0)
|
||||
{
|
||||
final randomAmplitude:Float = FlxG.random.float(Constants.MIN_VIBRATION_AMPLITUDE / 100, Constants.MIN_VIBRATION_AMPLITUDE);
|
||||
final randomDuration:Float = FlxG.random.float(Constants.DEFAULT_VIBRATION_DURATION / 10, Constants.DEFAULT_VIBRATION_DURATION);
|
||||
|
||||
HapticUtil.vibrate(0, randomDuration, randomAmplitude);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public override function destroy():Void
|
||||
{
|
||||
super.destroy();
|
||||
|
|
|
@ -18,9 +18,9 @@ class GitarooPause extends MusicBeatState
|
|||
|
||||
var replaySelect:Bool = false;
|
||||
|
||||
var previousParams:PlayStateParams;
|
||||
var previousParams:Null<PlayStateParams>;
|
||||
|
||||
public function new(previousParams:PlayStateParams):Void
|
||||
public function new(?previousParams:PlayStateParams):Void
|
||||
{
|
||||
super();
|
||||
|
||||
|
|
|
@ -213,6 +213,11 @@ class PauseSubState extends MusicBeatSubState
|
|||
*/
|
||||
var menuEntryText:FlxTypedSpriteGroup<AtlasText>;
|
||||
|
||||
/**
|
||||
* Callback that gets called once substate gets open.
|
||||
*/
|
||||
var onPause:Void->Void;
|
||||
|
||||
// ===============
|
||||
// Audio Variables
|
||||
// ===============
|
||||
|
@ -222,10 +227,11 @@ class PauseSubState extends MusicBeatSubState
|
|||
// Constructor
|
||||
// ===============
|
||||
|
||||
public function new(?params:PauseSubStateParams)
|
||||
public function new(?params:PauseSubStateParams, ?onPause:Void->Void)
|
||||
{
|
||||
super();
|
||||
this.currentMode = params?.mode ?? Standard;
|
||||
this.onPause = onPause;
|
||||
}
|
||||
|
||||
// ===============
|
||||
|
@ -244,6 +250,8 @@ class PauseSubState extends MusicBeatSubState
|
|||
AdMobUtil.addBanner(extension.admob.AdmobBannerSize.BANNER, extension.admob.AdmobBannerAlign.TOP_LEFT);
|
||||
#end
|
||||
|
||||
if (onPause != null) onPause();
|
||||
|
||||
super.create();
|
||||
|
||||
startPauseMusic();
|
||||
|
@ -286,6 +294,7 @@ class PauseSubState extends MusicBeatSubState
|
|||
hapticTimer.cancel();
|
||||
hapticTimer = null;
|
||||
pauseMusic.stop();
|
||||
onPause = null;
|
||||
}
|
||||
|
||||
// ===============
|
||||
|
@ -444,7 +453,7 @@ class PauseSubState extends MusicBeatSubState
|
|||
offsetText.y = FlxG.height - (offsetText.height + offsetText.height + 40);
|
||||
offsetTextInfo.y = offsetText.y + offsetText.height + 4;
|
||||
|
||||
#if !mobile
|
||||
#if (!mobile && FEATURE_LAG_ADJUSTMENT)
|
||||
metadata.add(offsetText);
|
||||
metadata.add(offsetTextInfo);
|
||||
#end
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -527,8 +527,7 @@ class ResultState extends MusicBeatSubState
|
|||
bgFlash.visible = true;
|
||||
FlxTween.tween(bgFlash, {alpha: 0}, 5 / 24);
|
||||
// NOTE: Only divide if totalNotes > 0 to prevent divide-by-zero errors.
|
||||
var clearPercentFloat = params.scoreData.tallies.totalNotes == 0 ? 0.0 : (params.scoreData.tallies.sick + params.scoreData.tallies.good
|
||||
- params.scoreData.tallies.missed) / params.scoreData.tallies.totalNotes * 100;
|
||||
var clearPercentFloat = params.scoreData.tallies.totalNotes == 0 ? 0.0 : Scoring.tallyCompletion(params.scoreData.tallies) * 100;
|
||||
clearPercentTarget = Math.floor(clearPercentFloat);
|
||||
// Prevent off-by-one errors.
|
||||
|
||||
|
@ -744,6 +743,7 @@ class ResultState extends MusicBeatSubState
|
|||
super.draw();
|
||||
|
||||
songName.clipRect = FlxRect.get(Math.max(0, 520 - songName.x), 0, FlxG.width, songName.height);
|
||||
clearPercentSmall.forEachAlive(spr -> spr.clipRect = FlxRect.get(Math.max(0, 520 - spr.x), 0, FlxG.width, spr.height));
|
||||
|
||||
// PROBABLY SHOULD FIX MEMORY FREE OR WHATEVER THE PUT() FUNCTION DOES !!!! FEELS LIKE IT STUTTERS!!!
|
||||
|
||||
|
@ -751,105 +751,6 @@ class ResultState extends MusicBeatSubState
|
|||
// maskShaderSongName.frameUV = songName.frame.uv;
|
||||
}
|
||||
|
||||
private function handleAnimationVibrations()
|
||||
{
|
||||
for (atlas in characterAtlasAnimations)
|
||||
{
|
||||
if (atlas == null || atlas.sprite == null) continue;
|
||||
|
||||
switch (rank)
|
||||
{
|
||||
case ScoringRank.PERFECT | ScoringRank.PERFECT_GOLD:
|
||||
switch (playerCharacterId)
|
||||
{
|
||||
// Feel the bed fun :freaky:
|
||||
case "bf":
|
||||
if (atlas.sprite.anim.curFrame > 87 && atlas.sprite.anim.curFrame % 5 == 0)
|
||||
{
|
||||
HapticUtil.vibrate(0, 0.01, Constants.MAX_VIBRATION_AMPLITUDE);
|
||||
break;
|
||||
}
|
||||
|
||||
// GF slams into the wall.
|
||||
if (atlas.sprite.anim.curFrame == 51)
|
||||
{
|
||||
HapticUtil.vibrate(0, 0.01, (Constants.MAX_VIBRATION_AMPLITUDE / 3) * 2.5);
|
||||
break;
|
||||
}
|
||||
|
||||
// Pico drop-kicking Nene.
|
||||
case "pico":
|
||||
if (atlas.sprite.anim.curFrame == 52)
|
||||
{
|
||||
HapticUtil.vibrate(Constants.DEFAULT_VIBRATION_PERIOD, Constants.DEFAULT_VIBRATION_DURATION * 5, Constants.MAX_VIBRATION_AMPLITUDE);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
case ScoringRank.GREAT | ScoringRank.EXCELLENT:
|
||||
switch (playerCharacterId)
|
||||
{
|
||||
// Pico explodes the targets with a rocket launcher.
|
||||
case "pico":
|
||||
// Pico shoots.
|
||||
if (atlas.sprite.anim.curFrame == 45)
|
||||
{
|
||||
HapticUtil.vibrate(0, 0.01, (Constants.MAX_VIBRATION_AMPLITUDE / 3) * 2.5);
|
||||
break;
|
||||
}
|
||||
|
||||
// The targets explode.
|
||||
if (atlas.sprite.anim.curFrame == 50)
|
||||
{
|
||||
HapticUtil.vibrate(Constants.DEFAULT_VIBRATION_PERIOD, Constants.DEFAULT_VIBRATION_DURATION, Constants.MAX_VIBRATION_AMPLITUDE);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
case ScoringRank.GOOD:
|
||||
switch (playerCharacterId)
|
||||
{
|
||||
// Pico shooting the targets.
|
||||
case "pico":
|
||||
if (atlas.sprite.anim.curFrame % 2 != 0) continue;
|
||||
|
||||
final frames:Array<Array<Int>> = [[40, 50], [80, 90], [140, 157]];
|
||||
for (i in 0...frames.length)
|
||||
{
|
||||
if (atlas.sprite.anim.curFrame < frames[i][0] || atlas.sprite.anim.curFrame > frames[i][1]) continue;
|
||||
|
||||
HapticUtil.vibrate(0, 0.01, Constants.MAX_VIBRATION_AMPLITUDE);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
case ScoringRank.SHIT:
|
||||
switch (playerCharacterId)
|
||||
{
|
||||
// BF falling and GF slams on BF with her ass.
|
||||
case "bf":
|
||||
if (atlas.sprite.anim.curFrame == 5 || atlas.sprite.anim.curFrame == 90)
|
||||
{
|
||||
HapticUtil.vibrate(Constants.DEFAULT_VIBRATION_PERIOD * 2, Constants.DEFAULT_VIBRATION_DURATION * 2, Constants.MAX_VIBRATION_AMPLITUDE);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override function update(elapsed:Float):Void
|
||||
{
|
||||
maskShaderDifficulty.swagSprX = difficulty.x;
|
||||
|
@ -1035,8 +936,6 @@ class ResultState extends MusicBeatSubState
|
|||
#end
|
||||
}
|
||||
|
||||
if (HapticUtil.hapticsAvailable) handleAnimationVibrations();
|
||||
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
||||
|
|
|
@ -580,7 +580,7 @@ class AnimateAtlasCharacter extends BaseCharacter
|
|||
|
||||
override function set_alpha(value:Float):Float
|
||||
{
|
||||
value = FlxMath.bound(value, 0, 1);
|
||||
value = value.clamp(0, 1);
|
||||
|
||||
if (exists && alpha != value)
|
||||
{
|
||||
|
|
|
@ -288,33 +288,22 @@ class CharacterDataParser
|
|||
{
|
||||
var charPath:String = "freeplay/icons/";
|
||||
|
||||
// FunkinCrew please dont skin me alive for copying pixelated icon and changing it a tiny bit
|
||||
switch (char)
|
||||
final charIDParts:Array<String> = char.split("-");
|
||||
var iconName:String = "";
|
||||
for (i in 0...charIDParts.length)
|
||||
{
|
||||
case "bf-christmas" | "bf-car" | "bf-pixel" | "bf-holding-gf" | "bf-dark":
|
||||
charPath += "bfpixel";
|
||||
case "monster-christmas":
|
||||
charPath += "monsterpixel";
|
||||
case "mom" | "mom-car":
|
||||
charPath += "mommypixel";
|
||||
case "pico-blazin" | "pico-playable" | "pico-speaker" | "pico-pixel" | "pico-holding-nene":
|
||||
charPath += "picopixel";
|
||||
case "gf-christmas" | "gf-car" | "gf-pixel" | "gf-tankmen" | "gf-dark":
|
||||
charPath += "gfpixel";
|
||||
case "dad":
|
||||
charPath += "dadpixel";
|
||||
case "darnell-blazin":
|
||||
charPath += "darnellpixel";
|
||||
case "senpai-angry":
|
||||
charPath += "senpaipixel";
|
||||
case "spooky-dark":
|
||||
charPath += "spookypixel";
|
||||
case "tankman-atlas" | "tankman-bloody":
|
||||
charPath += "tankmanpixel";
|
||||
case "pico-christmas" | "pico-dark":
|
||||
charPath += "picopixel";
|
||||
default:
|
||||
charPath += '${char}pixel';
|
||||
iconName += charIDParts[i];
|
||||
|
||||
if (Assets.exists(Paths.image(charPath + '${iconName}pixel')))
|
||||
{
|
||||
charPath += '${iconName}pixel';
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i < charIDParts.length - 1) iconName += '-';
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Assets.exists(Paths.image(charPath)))
|
||||
|
|
|
@ -94,6 +94,7 @@ class MultiSparrowCharacter extends BaseCharacter
|
|||
{
|
||||
trace('Concatenating multi-sparrow atlas: ${asset}');
|
||||
subTexture.parent.destroyOnNoUse = false;
|
||||
FunkinMemory.cacheTexture(Paths.image(asset));
|
||||
}
|
||||
|
||||
texture.addAtlas(subTexture);
|
||||
|
|
|
@ -151,10 +151,12 @@ class HealthIcon extends FunkinSprite
|
|||
*/
|
||||
public function toggleOldIcon():Void
|
||||
{
|
||||
final playState:Null<PlayState> = PlayState.instance;
|
||||
if (playState == null || playState.currentStage == null) return;
|
||||
if (characterId == 'bf-old')
|
||||
{
|
||||
isPixel = PlayState.instance.currentStage.getBoyfriend().isPixel;
|
||||
PlayState.instance.currentStage.getBoyfriend().initHealthIcon(false);
|
||||
isPixel = playState.currentStage.getBoyfriend()?.isPixel ?? false;
|
||||
playState.currentStage.getBoyfriend()?.initHealthIcon(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -66,7 +66,7 @@ class VideoCutscene
|
|||
if (!openfl.Assets.exists(filePath))
|
||||
{
|
||||
// Display a popup.
|
||||
// lime.app.Application.current.window.alert('Video file does not exist: ${filePath}', 'Error playing video');
|
||||
// funkin.util.WindowUtil.showError('Error playing video', 'Video file does not exist: ${filePath}');
|
||||
// return;
|
||||
|
||||
// TODO: After moving videos to their own library,
|
||||
|
|
|
@ -10,6 +10,9 @@ class NoteSprite extends FunkinSprite
|
|||
{
|
||||
static final DIRECTION_COLORS:Array<String> = ['purple', 'blue', 'green', 'red'];
|
||||
|
||||
/**
|
||||
* The hold note sprite for this note.
|
||||
*/
|
||||
public var holdNoteSprite:SustainTrail;
|
||||
|
||||
var hsvShader:HSVShader;
|
||||
|
@ -95,8 +98,23 @@ class NoteSprite extends FunkinSprite
|
|||
return this.direction;
|
||||
}
|
||||
|
||||
/**
|
||||
* The note data associated with this note sprite.
|
||||
* This is used to store the strum time, length, and other properties.
|
||||
*/
|
||||
public var noteData:SongNoteData;
|
||||
|
||||
/**
|
||||
* If this note kind is scoreable (i.e., counted towards score and accuracy)
|
||||
* Only accessible in scripts
|
||||
* Defaults to true
|
||||
*/
|
||||
public var scoreable:Bool = true;
|
||||
|
||||
/**
|
||||
* Whether this note is a hold note.
|
||||
* This is true if the length is greater than 0.
|
||||
*/
|
||||
public var isHoldNote(get, never):Bool;
|
||||
|
||||
function get_isHoldNote():Bool
|
||||
|
@ -238,6 +256,7 @@ class NoteSprite extends FunkinSprite
|
|||
this.hasBeenHit = false;
|
||||
this.mayHit = false;
|
||||
this.hasMissed = false;
|
||||
this.holdNoteSprite = null;
|
||||
|
||||
this.hsvShader.hue = 1.0;
|
||||
this.hsvShader.saturation = 1.0;
|
||||
|
|
|
@ -17,6 +17,7 @@ import funkin.play.notes.NoteVibrationsHandler;
|
|||
import funkin.data.song.SongData.SongNoteData;
|
||||
import funkin.util.SortUtil;
|
||||
import funkin.util.GRhythmUtil;
|
||||
import funkin.play.notes.notekind.NoteKind;
|
||||
import funkin.play.notes.notekind.NoteKindManager;
|
||||
import flixel.math.FlxPoint;
|
||||
#if mobile
|
||||
|
@ -96,9 +97,9 @@ class Strumline extends FlxSpriteGroup
|
|||
/**
|
||||
* Reset the scroll speed to the current chart's scroll speed.
|
||||
*/
|
||||
public function resetScrollSpeed():Void
|
||||
public function resetScrollSpeed(?newScrollSpeed:Float):Void
|
||||
{
|
||||
scrollSpeed = PlayState.instance?.currentChart?.scrollSpeed ?? 1.0;
|
||||
scrollSpeed = newScrollSpeed ?? PlayState.instance?.currentChart?.scrollSpeed ?? 1.0;
|
||||
}
|
||||
|
||||
var _conductorInUse:Null<Conductor>;
|
||||
|
@ -183,7 +184,7 @@ class Strumline extends FlxSpriteGroup
|
|||
|
||||
static final BACKGROUND_PAD:Int = 16;
|
||||
|
||||
public function new(noteStyle:NoteStyle, isPlayer:Bool)
|
||||
public function new(noteStyle:NoteStyle, isPlayer:Bool, ?scrollSpeed:Float)
|
||||
{
|
||||
super();
|
||||
|
||||
|
@ -235,14 +236,13 @@ class Strumline extends FlxSpriteGroup
|
|||
if (inArrowContorlSchemeMode && isPlayer) this.background.x -= 100;
|
||||
#end
|
||||
this.add(this.background);
|
||||
strumlineScale = new FlxCallbackPoint(strumlineScaleCallback);
|
||||
|
||||
strumlineScale = new FlxCallbackPoint(strumlineScaleCallback);
|
||||
|
||||
this.refresh();
|
||||
|
||||
this.onNoteIncoming = new FlxTypedSignal<NoteSprite->Void>();
|
||||
resetScrollSpeed();
|
||||
resetScrollSpeed(scrollSpeed);
|
||||
|
||||
for (i in 0...KEY_COUNT)
|
||||
{
|
||||
|
@ -643,8 +643,6 @@ class Strumline extends FlxSpriteGroup
|
|||
if (holdNote.cover != null && isPlayer)
|
||||
{
|
||||
holdNote.cover.playEnd();
|
||||
|
||||
trace("Sustain Note Splash Vibration");
|
||||
}
|
||||
else if (holdNote.cover != null)
|
||||
{
|
||||
|
@ -948,7 +946,6 @@ class Strumline extends FlxSpriteGroup
|
|||
{
|
||||
if (note == null) return;
|
||||
note.visible = false;
|
||||
notes.remove(note, false);
|
||||
note.kill();
|
||||
|
||||
if (note.holdNoteSprite != null)
|
||||
|
@ -1103,6 +1100,7 @@ class Strumline extends FlxSpriteGroup
|
|||
|
||||
if (noteSprite != null)
|
||||
{
|
||||
var noteKind:NoteKind = NoteKindManager.getNoteKind(note.kind);
|
||||
var noteKindStyle:NoteStyle = NoteKindManager.getNoteStyle(note.kind, this.noteStyle.id) ?? this.noteStyle;
|
||||
noteSprite.setupNoteGraphic(noteKindStyle);
|
||||
|
||||
|
@ -1127,6 +1125,7 @@ class Strumline extends FlxSpriteGroup
|
|||
noteSprite.x -= (noteSprite.width - Strumline.STRUMLINE_SIZE) / 2; // Center it
|
||||
noteSprite.x -= NUDGE;
|
||||
noteSprite.y = -9999;
|
||||
if (noteKind != null) noteSprite.scoreable = noteKind.scoreable;
|
||||
}
|
||||
|
||||
return noteSprite;
|
||||
|
|
|
@ -283,7 +283,7 @@ class SustainTrail extends FlxSprite
|
|||
return;
|
||||
}
|
||||
|
||||
var clipHeight:Float = FlxMath.bound(sustainHeight(sustainLength - (songTime - strumTime), parentStrumline?.scrollSpeed ?? 1.0), 0, graphicHeight);
|
||||
var clipHeight:Float = sustainHeight(sustainLength - (songTime - strumTime), parentStrumline?.scrollSpeed ?? 1.0).clamp(0, graphicHeight);
|
||||
if (clipHeight <= 0.1)
|
||||
{
|
||||
visible = false;
|
||||
|
|
|
@ -28,6 +28,13 @@ class NoteKind implements INoteScriptedClass
|
|||
*/
|
||||
public var params:Array<NoteKindParam>;
|
||||
|
||||
/**
|
||||
* If this note kind is scoreable (ie, counted towards score and accuracy)
|
||||
* Only accessible in scripts
|
||||
* Defaults to true
|
||||
*/
|
||||
public var scoreable:Bool = true;
|
||||
|
||||
public function new(noteKind:String, description:String = "", ?noteStyleId:String, ?params:Array<NoteKindParam>)
|
||||
{
|
||||
this.noteKind = noteKind;
|
||||
|
|
|
@ -11,7 +11,21 @@ import funkin.play.notes.notekind.NoteKind.NoteKindParam;
|
|||
|
||||
class NoteKindManager
|
||||
{
|
||||
static var noteKinds:Map<String, NoteKind> = [];
|
||||
/**
|
||||
* A map of all note kinds, keyed by their name.
|
||||
* This is used to retrieve note kinds by their name.
|
||||
*/
|
||||
public static var noteKinds:Map<String, NoteKind> = [];
|
||||
|
||||
/**
|
||||
* Retrieve a note kind by its name.
|
||||
* @param noteKind The name of the note kind.
|
||||
* @return The note kind, or null if it doesn't exist.
|
||||
*/
|
||||
public static function getNoteKind(noteKind:String):Null<NoteKind>
|
||||
{
|
||||
return noteKinds.get(noteKind);
|
||||
}
|
||||
|
||||
public static function loadScripts():Void
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package funkin.play.scoring;
|
||||
|
||||
import funkin.save.Save.SaveScoreData;
|
||||
import funkin.save.Save.SaveScoreTallyData;
|
||||
|
||||
/**
|
||||
* Which system to use when scoring and judging notes.
|
||||
|
@ -374,8 +375,7 @@ class Scoring
|
|||
if (scoreData.tallies.totalNotes == 0) return null;
|
||||
|
||||
// Perfect (Platinum) is a Sick Full Clear
|
||||
var isPerfectGold = scoreData.tallies.sick == scoreData.tallies.totalNotes;
|
||||
if (isPerfectGold)
|
||||
if (scoreData.tallies.sick == scoreData.tallies.totalNotes)
|
||||
{
|
||||
return ScoringRank.PERFECT_GOLD;
|
||||
}
|
||||
|
@ -384,21 +384,21 @@ class Scoring
|
|||
|
||||
// Final Grade = (Sick + Good - Miss) / (Total Notes)
|
||||
|
||||
var grade = (scoreData.tallies.sick + scoreData.tallies.good - scoreData.tallies.missed) / scoreData.tallies.totalNotes;
|
||||
var completionAmount:Float = Scoring.tallyCompletion(scoreData.tallies);
|
||||
|
||||
if (grade == Constants.RANK_PERFECT_THRESHOLD)
|
||||
if (completionAmount == Constants.RANK_PERFECT_THRESHOLD)
|
||||
{
|
||||
return ScoringRank.PERFECT;
|
||||
}
|
||||
else if (grade >= Constants.RANK_EXCELLENT_THRESHOLD)
|
||||
else if (completionAmount >= Constants.RANK_EXCELLENT_THRESHOLD)
|
||||
{
|
||||
return ScoringRank.EXCELLENT;
|
||||
}
|
||||
else if (grade >= Constants.RANK_GREAT_THRESHOLD)
|
||||
else if (completionAmount >= Constants.RANK_GREAT_THRESHOLD)
|
||||
{
|
||||
return ScoringRank.GREAT;
|
||||
}
|
||||
else if (grade >= Constants.RANK_GOOD_THRESHOLD)
|
||||
else if (completionAmount >= Constants.RANK_GOOD_THRESHOLD)
|
||||
{
|
||||
return ScoringRank.GOOD;
|
||||
}
|
||||
|
@ -407,6 +407,21 @@ class Scoring
|
|||
return ScoringRank.SHIT;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the "completion" of a song, based on how many GOOD and SICK notes were hit, minus how many were missed
|
||||
* Top secret funkin crew patented algorithm
|
||||
* TODO: Could possibly move more of the "tallying" related handling here.
|
||||
* In FreeplayState we make sure it's clamped between 0 and 1, and we probably always want to assume that?
|
||||
*
|
||||
* @param tallies
|
||||
* @return Float Completion, as a float value between 0 and 1. If `tallies` is `null`, we return 0;
|
||||
*/
|
||||
public static function tallyCompletion(?tallies:SaveScoreTallyData):Float
|
||||
{
|
||||
if (tallies == null) return 0.0;
|
||||
return (tallies.sick + tallies.good - tallies.missed) / tallies.totalNotes;
|
||||
}
|
||||
}
|
||||
|
||||
enum abstract ScoringRank(String)
|
||||
|
|
|
@ -187,6 +187,7 @@ class Save
|
|||
theme: ChartEditorTheme.Light,
|
||||
playtestStartTime: false,
|
||||
downscroll: false,
|
||||
showNoteKinds: true,
|
||||
metronomeVolume: 1.0,
|
||||
hitsoundVolumePlayer: 1.0,
|
||||
hitsoundVolumeOpponent: 1.0,
|
||||
|
@ -358,6 +359,23 @@ class Save
|
|||
return data.optionsChartEditor.downscroll;
|
||||
}
|
||||
|
||||
public var chartEditorShowNoteKinds(get, set):Bool;
|
||||
|
||||
function get_chartEditorShowNoteKinds():Bool
|
||||
{
|
||||
if (data.optionsChartEditor.showNoteKinds == null) data.optionsChartEditor.showNoteKinds = true;
|
||||
|
||||
return data.optionsChartEditor.showNoteKinds;
|
||||
}
|
||||
|
||||
function set_chartEditorShowNoteKinds(value:Bool):Bool
|
||||
{
|
||||
// Set and apply.
|
||||
data.optionsChartEditor.showNoteKinds = value;
|
||||
flush();
|
||||
return data.optionsChartEditor.showNoteKinds;
|
||||
}
|
||||
|
||||
public var chartEditorPlaytestStartTime(get, set):Bool;
|
||||
|
||||
function get_chartEditorPlaytestStartTime():Bool
|
||||
|
@ -882,14 +900,12 @@ class Save
|
|||
return;
|
||||
}
|
||||
|
||||
var newCompletion = (newScoreData.tallies.sick + newScoreData.tallies.good) / newScoreData.tallies.totalNotes;
|
||||
var previousCompletion = (previousScoreData.tallies.sick + previousScoreData.tallies.good) / previousScoreData.tallies.totalNotes;
|
||||
|
||||
// Set the high score and the high rank separately.
|
||||
var newScore:SaveScoreData =
|
||||
{
|
||||
score: (previousScoreData.score > newScoreData.score) ? previousScoreData.score : newScoreData.score,
|
||||
tallies: (previousRank > newRank || previousCompletion > newCompletion) ? previousScoreData.tallies : newScoreData.tallies
|
||||
tallies: (previousRank > newRank
|
||||
|| Scoring.tallyCompletion(previousScoreData.tallies) > Scoring.tallyCompletion(newScoreData.tallies)) ? previousScoreData.tallies : newScoreData.tallies
|
||||
};
|
||||
|
||||
song.set(difficultyId, newScore);
|
||||
|
@ -1204,7 +1220,7 @@ class Save
|
|||
{
|
||||
var msg = 'There was an error loading your save data in slot ${slot}.';
|
||||
msg += '\nPlease report this issue to the developers.';
|
||||
lime.app.Application.current.window.alert(msg, "Save Data Failure");
|
||||
funkin.util.WindowUtil.showError("Save Data Failure", msg);
|
||||
|
||||
// Don't touch that slot anymore.
|
||||
// Instead, load the next available slot.
|
||||
|
@ -1391,7 +1407,7 @@ class Save
|
|||
var msg = 'There was an error loading your save data from Newgrounds.';
|
||||
msg += '\n${errorMsg}';
|
||||
msg += '\nAre you sure you are connected to the internet?';
|
||||
lime.app.Application.current.window.alert(msg, "Newgrounds Save Slot Failure");
|
||||
funkin.util.WindowUtil.showError("Newgrounds Save Slot Failure", msg);
|
||||
});
|
||||
}
|
||||
#end
|
||||
|
@ -1844,6 +1860,12 @@ typedef SaveDataChartEditorOptions =
|
|||
*/
|
||||
var ?downscroll:Bool;
|
||||
|
||||
/**
|
||||
* Show Note Kind Indicator in the Chart Editor.
|
||||
* @default `true`
|
||||
*/
|
||||
var ?showNoteKinds:Bool;
|
||||
|
||||
/**
|
||||
* Metronome volume in the Chart Editor.
|
||||
* @default `1.0`
|
||||
|
|
|
@ -41,7 +41,7 @@ class SaveDataMigrator
|
|||
var message:String = 'Error migrating save data, expected ${Save.SAVE_DATA_VERSION}.';
|
||||
var slot:Int = Save.archiveBadSaveData(inputData);
|
||||
var fullMessage:String = 'An error occurred migrating your save data.\n${message}\nInvalid data has been moved to save slot ${slot}.';
|
||||
lime.app.Application.current.window.alert(fullMessage, "Save Data Failure");
|
||||
funkin.util.WindowUtil.showError("Save Data Failure", fullMessage);
|
||||
return new Save(Save.getDefault());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import funkin.modding.PolymodHandler;
|
|||
import funkin.modding.events.ScriptEvent;
|
||||
import funkin.modding.module.ModuleHandler;
|
||||
import funkin.util.SortUtil;
|
||||
import funkin.util.WindowUtil;
|
||||
import funkin.input.Controls;
|
||||
#if mobile
|
||||
import funkin.graphics.FunkinCamera;
|
||||
|
@ -156,7 +157,11 @@ class MusicBeatState extends FlxTransitionableState implements IEventHandler
|
|||
function handleFunctionControls():Void
|
||||
{
|
||||
// Emergency exit button.
|
||||
if (FlxG.keys.justPressed.F4) FlxG.switchState(() -> new MainMenuState());
|
||||
if (FlxG.keys.justPressed.F4)
|
||||
{
|
||||
FlxG.switchState(() -> new MainMenuState());
|
||||
WindowUtil.setWindowTitle('Friday Night Funkin\'');
|
||||
}
|
||||
}
|
||||
|
||||
override function update(elapsed:Float)
|
||||
|
|
|
@ -10,6 +10,7 @@ import funkin.modding.IScriptedClass.IEventHandler;
|
|||
import funkin.modding.module.ModuleHandler;
|
||||
import funkin.modding.PolymodHandler;
|
||||
import funkin.util.SortUtil;
|
||||
import funkin.util.WindowUtil;
|
||||
import flixel.util.FlxSort;
|
||||
import funkin.input.Controls;
|
||||
#if mobile
|
||||
|
@ -140,7 +141,11 @@ class MusicBeatSubState extends FlxSubState implements IEventHandler
|
|||
super.update(elapsed);
|
||||
|
||||
// Emergency exit button.
|
||||
if (FlxG.keys.justPressed.F4) FlxG.switchState(() -> new MainMenuState());
|
||||
if (FlxG.keys.justPressed.F4)
|
||||
{
|
||||
FlxG.switchState(() -> new MainMenuState());
|
||||
WindowUtil.setWindowTitle('Friday Night Funkin\'');
|
||||
}
|
||||
|
||||
// Display Conductor info in the watch window.
|
||||
FlxG.watch.addQuick("musicTime", FlxG.sound.music?.time ?? 0.0);
|
||||
|
|
|
@ -21,33 +21,25 @@ class PixelatedIcon extends FlxFilteredSprite
|
|||
{
|
||||
var charPath:String = "freeplay/icons/";
|
||||
|
||||
switch (char)
|
||||
final charIDParts:Array<String> = char.split("-");
|
||||
var iconName:String = "";
|
||||
for (i in 0...charIDParts.length)
|
||||
{
|
||||
case "bf-christmas" | "bf-car" | "bf-pixel" | "bf-holding-gf":
|
||||
charPath += "bfpixel";
|
||||
case "monster-christmas":
|
||||
charPath += "monsterpixel";
|
||||
case "mom" | "mom-car":
|
||||
charPath += "mommypixel";
|
||||
case "pico-blazin" | "pico-playable" | "pico-speaker" | "pico-pixel" | "pico-holding-nene":
|
||||
charPath += "picopixel";
|
||||
case "gf-christmas" | "gf-car" | "gf-pixel" | "gf-tankmen":
|
||||
charPath += "gfpixel";
|
||||
case "dad":
|
||||
charPath += "dadpixel";
|
||||
case "darnell-blazin":
|
||||
charPath += "darnellpixel";
|
||||
case "senpai-angry":
|
||||
charPath += "senpaipixel";
|
||||
case "spooky-dark":
|
||||
charPath += "spookypixel";
|
||||
case "tankman-atlas" | "tankman-bloody":
|
||||
charPath += "tankmanpixel";
|
||||
default:
|
||||
charPath += '${char}pixel';
|
||||
iconName += charIDParts[i];
|
||||
|
||||
if (Assets.exists(Paths.image(charPath + '${iconName}pixel')))
|
||||
{
|
||||
charPath += '${iconName}pixel';
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i < charIDParts.length - 1) iconName += '-';
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!openfl.utils.Assets.exists(Paths.image(charPath)))
|
||||
if (!Assets.exists(Paths.image(charPath)))
|
||||
{
|
||||
trace('[WARN] Character ${char} has no freeplay icon.');
|
||||
this.visible = false;
|
||||
|
@ -58,7 +50,7 @@ class PixelatedIcon extends FlxFilteredSprite
|
|||
this.visible = true;
|
||||
}
|
||||
|
||||
var isAnimated = openfl.utils.Assets.exists(Paths.file('images/$charPath.xml'));
|
||||
var isAnimated = Assets.exists(Paths.file('images/$charPath.xml'));
|
||||
|
||||
if (isAnimated)
|
||||
{
|
||||
|
|
|
@ -140,7 +140,7 @@ class CharSelectGF extends FlxAtlasSprite implements IBPMSyncedScriptedClass
|
|||
alphaDiff /= 100; // flash exports alpha as a whole number
|
||||
|
||||
alpha += alphaDiff;
|
||||
alpha = FlxMath.bound(alpha, 0, 1);
|
||||
alpha = alpha.clamp(0, 1);
|
||||
x += xDiff;
|
||||
y += yDiff;
|
||||
|
||||
|
|
|
@ -271,6 +271,12 @@ class CharSelectSubState extends MusicBeatSubState
|
|||
nametag.midpointX += cutoutSize;
|
||||
add(nametag);
|
||||
|
||||
@:privateAccess
|
||||
{
|
||||
nametag.midpointY += 200;
|
||||
FlxTween.tween(nametag, {midpointY: nametag.midpointY - 200}, 1, {ease: FlxEase.expoOut});
|
||||
}
|
||||
|
||||
nametag.scrollFactor.set();
|
||||
|
||||
FlxG.debugger.addTrackerProfile(new TrackerProfile(FlxSprite, ["x", "y", "alpha", "scale", "blend"]));
|
||||
|
@ -739,6 +745,7 @@ class CharSelectSubState extends MusicBeatSubState
|
|||
FlxTween.tween(cursorConfirmed, {alpha: 0}, 0.8, {ease: FlxEase.expoOut});
|
||||
|
||||
FlxTween.tween(barthing, {y: barthing.y + 80}, 0.8, {ease: FlxEase.backIn});
|
||||
FlxTween.tween(nametag, {y: nametag.y + 80}, 0.8, {ease: FlxEase.backIn});
|
||||
FlxTween.tween(dipshitBacking, {y: dipshitBacking.y + 210}, 0.8, {ease: FlxEase.backIn});
|
||||
FlxTween.tween(chooseDipshit, {y: chooseDipshit.y + 200}, 0.8, {ease: FlxEase.backIn});
|
||||
FlxTween.tween(dipshitBlur, {y: dipshitBlur.y + 220}, 0.8, {ease: FlxEase.backIn});
|
||||
|
|
|
@ -15,17 +15,18 @@ class CreditsDataHandler
|
|||
static final CREDITS_DATA_PATH:String = "assets/data/credits.json";
|
||||
#end
|
||||
|
||||
#if macro
|
||||
public static function debugPrint(data:Null<CreditsData>):Void
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
trace('CreditsData(NULL)');
|
||||
Sys.println('[INFO] CreditsData(NULL)');
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.entries == null || data.entries.length == 0)
|
||||
{
|
||||
trace('CreditsData(EMPTY)');
|
||||
Sys.println('[INFO] CreditsData(EMPTY)');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -36,8 +37,9 @@ class CreditsDataHandler
|
|||
lineCount += entry?.body?.length ?? 0;
|
||||
}
|
||||
|
||||
trace('CreditsData($entryCount entries containing $lineCount lines)');
|
||||
Sys.println('[INFO] CreditsData($entryCount entries containing $lineCount lines)');
|
||||
}
|
||||
#end
|
||||
|
||||
/**
|
||||
* If for some reason the full credits won't load,
|
||||
|
|
|
@ -10,7 +10,7 @@ class CreditsDataMacro
|
|||
public static macro function loadCreditsData():haxe.macro.Expr.ExprOf<CreditsData>
|
||||
{
|
||||
#if !display
|
||||
trace('Hardcoding credits data...');
|
||||
Sys.println('[INFO] Hardcoding credits data...');
|
||||
var json = CreditsDataMacro.fetchJSON();
|
||||
|
||||
if (json == null)
|
||||
|
|
|
@ -293,6 +293,7 @@ class CreditsState extends MusicBeatState
|
|||
|
||||
function exit():Void
|
||||
{
|
||||
FlxG.keys.enabled = false;
|
||||
FlxG.switchState(() -> new MainMenuState());
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import flixel.math.FlxPoint;
|
|||
import flixel.FlxObject;
|
||||
import flixel.FlxSprite;
|
||||
import funkin.ui.MusicBeatSubState;
|
||||
import funkin.ui.FullScreenScaleMode;
|
||||
import funkin.audio.FunkinSound;
|
||||
import funkin.ui.TextMenuList;
|
||||
import funkin.ui.debug.charting.ChartEditorState;
|
||||
|
@ -37,7 +38,7 @@ class DebugMenuSubState extends MusicBeatSubState
|
|||
// Create the green background.
|
||||
var menuBG = new FlxSprite().loadGraphic(Paths.image('menuDesat'));
|
||||
menuBG.color = 0xFF4CAF50;
|
||||
menuBG.setGraphicSize(Std.int(menuBG.width * 1.1));
|
||||
menuBG.setGraphicSize(Std.int(menuBG.width * 1.1 * FullScreenScaleMode.wideScale.x));
|
||||
menuBG.updateHitbox();
|
||||
menuBG.screenCenter();
|
||||
menuBG.scrollFactor.set(0, 0);
|
||||
|
|
|
@ -100,6 +100,7 @@ class DebugBoundingState extends FlxState
|
|||
offsetAnimationDropdown = offsetEditorDialog.findComponent("animationDropdown", DropDown);
|
||||
|
||||
offsetEditorDialog.cameras = [hudCam];
|
||||
offsetEditorDialog.closable = false;
|
||||
|
||||
add(offsetEditorDialog);
|
||||
offsetEditorDialog.showDialog(false);
|
||||
|
|
|
@ -94,6 +94,9 @@ import haxe.ui.components.Button;
|
|||
import haxe.ui.components.DropDown;
|
||||
import haxe.ui.components.Label;
|
||||
import haxe.ui.components.Slider;
|
||||
import haxe.ui.containers.dialogs.Dialogs;
|
||||
import haxe.ui.containers.dialogs.Dialog.DialogButton;
|
||||
import haxe.ui.containers.dialogs.MessageBox.MessageBoxType;
|
||||
import haxe.ui.containers.dialogs.CollapsibleDialog;
|
||||
import haxe.ui.containers.menus.Menu;
|
||||
import haxe.ui.containers.menus.MenuBar;
|
||||
|
@ -631,6 +634,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
return isViewDownscroll;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to show an indicator if a note is of a non-default kind.
|
||||
*/
|
||||
var showNoteKindIndicators:Bool = false;
|
||||
|
||||
/**
|
||||
* The current theme used by the editor.
|
||||
* Dictates the appearance of many UI elements.
|
||||
|
@ -1855,6 +1863,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
*/
|
||||
var menubarItemDownscroll:MenuCheckBox;
|
||||
|
||||
/**
|
||||
* The `View -> Note Kind Indicator` menu item.
|
||||
*/
|
||||
var menubarItemViewIndicators:MenuCheckBox;
|
||||
|
||||
/**
|
||||
* The `View -> Increase Difficulty` menu item.
|
||||
*/
|
||||
|
@ -2358,6 +2371,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
noteSnapQuantIndex = save.chartEditorNoteQuant;
|
||||
currentLiveInputStyle = save.chartEditorLiveInputStyle;
|
||||
isViewDownscroll = save.chartEditorDownscroll;
|
||||
showNoteKindIndicators = save.chartEditorShowNoteKinds;
|
||||
playtestStartTime = save.chartEditorPlaytestStartTime;
|
||||
currentTheme = save.chartEditorTheme;
|
||||
metronomeVolume = save.chartEditorMetronomeVolume;
|
||||
|
@ -2368,7 +2382,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
menubarItemVolumeInstrumental.value = Std.int(save.chartEditorInstVolume * 100);
|
||||
menubarItemVolumeVocalsPlayer.value = Std.int(save.chartEditorPlayerVoiceVolume * 100);
|
||||
menubarItemVolumeVocalsOpponent.value = Std.int(save.chartEditorOpponentVoiceVolume * 100);
|
||||
menubarItemPlaybackSpeed.value = Std.int(save.chartEditorPlaybackSpeed * 100);
|
||||
menubarItemPlaybackSpeed.value = Std.int(save.chartEditorPlaybackSpeed * 100.0);
|
||||
}
|
||||
|
||||
public function writePreferences(hasBackup:Bool):Void
|
||||
|
@ -2387,6 +2401,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
save.chartEditorNoteQuant = noteSnapQuantIndex;
|
||||
save.chartEditorLiveInputStyle = currentLiveInputStyle;
|
||||
save.chartEditorDownscroll = isViewDownscroll;
|
||||
save.chartEditorShowNoteKinds = showNoteKindIndicators;
|
||||
save.chartEditorPlaytestStartTime = playtestStartTime;
|
||||
save.chartEditorTheme = currentTheme;
|
||||
save.chartEditorMetronomeVolume = metronomeVolume;
|
||||
|
@ -2519,7 +2534,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
add(gridTiledSprite);
|
||||
gridTiledSprite.zIndex = 10;
|
||||
|
||||
gridGhostNote = new ChartEditorNoteSprite(this);
|
||||
gridGhostNote = new ChartEditorNoteSprite(this, true);
|
||||
gridGhostNote.alpha = 0.6;
|
||||
gridGhostNote.noteData = new SongNoteData(0, 0, 0, "", []);
|
||||
gridGhostNote.visible = false;
|
||||
|
@ -3089,6 +3104,9 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
menubarItemDownscroll.onClick = event -> isViewDownscroll = event.value;
|
||||
menubarItemDownscroll.selected = isViewDownscroll;
|
||||
|
||||
menubarItemViewIndicators.onClick = event -> showNoteKindIndicators = menubarItemViewIndicators.selected;
|
||||
menubarItemViewIndicators.selected = showNoteKindIndicators;
|
||||
|
||||
menubarItemDifficultyUp.onClick = _ -> incrementDifficulty(1);
|
||||
menubarItemDifficultyDown.onClick = _ -> incrementDifficulty(-1);
|
||||
|
||||
|
@ -3171,8 +3189,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
|
||||
menubarItemPlaybackSpeed.onChange = event -> {
|
||||
var pitch:Float = (event.value.toFloat() * 2.0) / 100.0;
|
||||
pitch = Math.floor(pitch / 0.05) * 0.05; // Round to nearest 5%
|
||||
pitch = Math.max(0.05, Math.min(2.0, pitch)); // Clamp to 5% to 200%
|
||||
pitch = Math.round(pitch / 0.05) * 0.05; // Round to nearest 5%
|
||||
pitch = pitch.clamp(0.05, 2.0); // Clamp to 5% to 200%
|
||||
#if FLX_PITCH
|
||||
if (audioInstTrack != null) audioInstTrack.pitch = pitch;
|
||||
audioVocalTrackGroup.pitch = pitch;
|
||||
|
@ -3921,6 +3939,9 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
selectionSquare.width = selectionSquare.height = GRID_SIZE;
|
||||
selectionSquare.color = FlxColor.RED;
|
||||
}
|
||||
|
||||
// Additional cleanup on notes.
|
||||
if (noteTooltipsDirty) noteSprite.updateTooltipText();
|
||||
}
|
||||
|
||||
for (eventSprite in renderedEvents.members)
|
||||
|
@ -4726,12 +4747,15 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
dragLengthCurrent = dragLengthSteps;
|
||||
}
|
||||
|
||||
var sameHold:Bool = (gridGhostHoldNote.noteData == currentPlaceNoteData);
|
||||
|
||||
gridGhostHoldNote.visible = true;
|
||||
gridGhostHoldNote.noteData = currentPlaceNoteData;
|
||||
gridGhostHoldNote.noteDirection = currentPlaceNoteData.getDirection();
|
||||
gridGhostHoldNote.setHeightDirectly(dragLengthPixels, true);
|
||||
gridGhostHoldNote.setHeightDirectly(dragLengthPixels, sameHold);
|
||||
gridGhostHoldNote.noteStyle = NoteKindManager.getNoteStyleId(currentPlaceNoteData.kind, currentSongNoteStyle) ?? currentSongNoteStyle;
|
||||
gridGhostHoldNote.updateHoldNotePosition(renderedHoldNotes);
|
||||
gridGhostHoldNote.updateHoldNoteGraphic();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5163,7 +5187,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
|
||||
var variationMetadata:Null<SongMetadata> = songMetadata.get(selectedVariation);
|
||||
if (variationMetadata != null)
|
||||
variationMetadata.playData.difficulties.sort(SortUtil.defaultsThenAlphabetically.bind(Constants.DEFAULT_DIFFICULTY_LIST_FULL));
|
||||
variationMetadata.playData.difficulties.sort(SortUtil.defaultsThenAlphabetically.bind(Constants.DEFAULT_DIFFICULTY_LIST_FULL));
|
||||
|
||||
var difficultyToolbox:ChartEditorDifficultyToolbox = cast this.getToolbox(CHART_EDITOR_TOOLBOX_DIFFICULTY_LAYOUT);
|
||||
if (difficultyToolbox == null) return;
|
||||
|
@ -5599,7 +5623,20 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
@:nullSafety(Off)
|
||||
function quitChartEditor():Void
|
||||
{
|
||||
autoSave();
|
||||
if (saveDataDirty)
|
||||
{
|
||||
Dialogs.messageBox("You are about to leave the editor without saving.\n\nAre you sure?", "Leave Editor", MessageBoxType.TYPE_YESNO, true,
|
||||
function(button:DialogButton) {
|
||||
if (button == DialogButton.YES)
|
||||
{
|
||||
autoSave();
|
||||
quitChartEditor();
|
||||
}
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
stopWelcomeMusic();
|
||||
// TODO: PR Flixel to make onComplete nullable.
|
||||
if (audioInstTrack != null) audioInstTrack.onComplete = null;
|
||||
|
@ -5859,9 +5896,9 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
var startTimestamp:Float = 0;
|
||||
if (playtestStartTime) startTimestamp = scrollPositionInMs + playheadPositionInMs;
|
||||
|
||||
var playbackRate:Float = ((menubarItemPlaybackSpeed.value ?? 1.0) * 2.0) / 100.0;
|
||||
playbackRate = Math.floor(playbackRate / 0.05) * 0.05; // Round to nearest 5%
|
||||
playbackRate = Math.max(0.05, Math.min(2.0, playbackRate)); // Clamp to 5% to 200%
|
||||
var playbackRate:Float = ((menubarItemPlaybackSpeed.value / 100.0) ?? 0.5) * 2.0;
|
||||
playbackRate = Math.round(playbackRate / 0.05) * 0.05; // Round to nearest 5%
|
||||
playbackRate = playbackRate.clamp(0.05, 2.0); // Clamp to 5% to 200%
|
||||
|
||||
var targetSong:Song;
|
||||
try
|
||||
|
@ -6296,7 +6333,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
{
|
||||
currentScrollEase = Math.max(0, targetScrollPosition);
|
||||
currentScrollEase = Math.min(currentScrollEase, songLengthInPixels);
|
||||
scrollPositionInPixels = MathUtil.snap(MathUtil.smoothLerpPrecision(scrollPositionInPixels, currentScrollEase, FlxG.elapsed, SCROLL_EASE_DURATION, 1 / 1000), currentScrollEase, 1 / 1000);
|
||||
scrollPositionInPixels = MathUtil.snap(MathUtil.smoothLerpPrecision(scrollPositionInPixels, currentScrollEase, FlxG.elapsed, SCROLL_EASE_DURATION,
|
||||
1 / 1000), currentScrollEase, 1 / 1000);
|
||||
moveSongToScrollPosition();
|
||||
}
|
||||
|
||||
|
@ -6331,20 +6369,30 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
|
||||
fadeInWelcomeMusic(WELCOME_MUSIC_FADE_IN_DELAY, WELCOME_MUSIC_FADE_IN_DURATION);
|
||||
|
||||
// Reapply the volume.
|
||||
var instTargetVolume:Float = menubarItemVolumeInstrumental.value / 100.0 ?? 1.0;
|
||||
var vocalPlayerTargetVolume:Float = menubarItemVolumeVocalsPlayer.value / 100.0 ?? 1.0;
|
||||
var vocalOpponentTargetVolume:Float = menubarItemVolumeVocalsOpponent.value / 100.0 ?? 1.0;
|
||||
// Reapply the volume and playback rate.
|
||||
var instTargetVolume:Float = (menubarItemVolumeInstrumental.value / 100.0) ?? 1.0;
|
||||
var vocalPlayerTargetVolume:Float = (menubarItemVolumeVocalsPlayer.value / 100.0) ?? 1.0;
|
||||
var vocalOpponentTargetVolume:Float = (menubarItemVolumeVocalsOpponent.value / 100.0) ?? 1.0;
|
||||
|
||||
var playbackRate = ((menubarItemPlaybackSpeed.value / 100.0) ?? 0.5) * 2.0;
|
||||
playbackRate = Math.round(playbackRate / 0.05) * 0.05; // Round to nearest 5%
|
||||
playbackRate = playbackRate.clamp(0.05, 2.0); // Clamp to 5% to 200%
|
||||
|
||||
if (audioInstTrack != null)
|
||||
{
|
||||
audioInstTrack.volume = instTargetVolume;
|
||||
#if FLX_PITCH
|
||||
audioInstTrack.pitch = playbackRate;
|
||||
#end
|
||||
audioInstTrack.onComplete = null;
|
||||
}
|
||||
if (audioVocalTrackGroup != null)
|
||||
{
|
||||
audioVocalTrackGroup.playerVolume = vocalPlayerTargetVolume;
|
||||
audioVocalTrackGroup.opponentVolume = vocalOpponentTargetVolume;
|
||||
#if FLX_PITCH
|
||||
audioVocalTrackGroup.pitch = playbackRate;
|
||||
#end
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6499,6 +6547,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
|
||||
public function postLoadInstrumental():Void
|
||||
{
|
||||
// Reapply the volume and playback rate.
|
||||
var instTargetVolume:Float = ((menubarItemVolumeInstrumental.value / 100) ?? 1.0);
|
||||
var playbackRate:Float = ((menubarItemPlaybackSpeed.value / 100.0) ?? 0.5) * 2.0;
|
||||
playbackRate = Math.round(playbackRate / 0.05) * 0.05; // Round to nearest 5%
|
||||
playbackRate = playbackRate.clamp(0.05, 2.0); // Clamp to 5% to 200%
|
||||
if (audioInstTrack != null)
|
||||
{
|
||||
// Prevent the time from skipping back to 0 when the song ends.
|
||||
|
@ -6511,6 +6564,10 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
}
|
||||
audioVocalTrackGroup.pause();
|
||||
};
|
||||
audioInstTrack.volume = instTargetVolume;
|
||||
#if FLX_PITCH
|
||||
audioInstTrack.pitch = playbackRate;
|
||||
#end
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -6527,6 +6584,25 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
healthIconsDirty = true;
|
||||
}
|
||||
|
||||
public function postLoadVocals():Void
|
||||
{
|
||||
// Reapply the volume and playback rate.
|
||||
var vocalPlayerTargetVolume:Float = (menubarItemVolumeVocalsPlayer.value / 100.0) ?? 1.0;
|
||||
var vocalOpponentTargetVolume:Float = (menubarItemVolumeVocalsOpponent.value / 100.0) ?? 1.0;
|
||||
var playbackRate:Float = ((menubarItemPlaybackSpeed.value / 100.0) ?? 0.5) * 2.0;
|
||||
playbackRate = Math.round(playbackRate / 0.05) * 0.05; // Round to nearest 5%
|
||||
playbackRate = playbackRate.clamp(0.05, 2.0); // Clamp to 5% to 200%
|
||||
|
||||
if (audioVocalTrackGroup != null)
|
||||
{
|
||||
audioVocalTrackGroup.playerVolume = vocalPlayerTargetVolume;
|
||||
audioVocalTrackGroup.opponentVolume = vocalOpponentTargetVolume;
|
||||
#if FLX_PITCH
|
||||
audioVocalTrackGroup.pitch = playbackRate;
|
||||
#end
|
||||
}
|
||||
}
|
||||
|
||||
function hardRefreshOffsetsToolbox():Void
|
||||
{
|
||||
var offsetsToolbox:ChartEditorOffsetsToolbox = cast this.getToolbox(CHART_EDITOR_TOOLBOX_OFFSETS_LAYOUT);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package funkin.ui.debug.charting.components;
|
||||
|
||||
import flixel.text.FlxText;
|
||||
import flixel.util.FlxColor;
|
||||
import flixel.FlxObject;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.graphics.frames.FlxFramesCollection;
|
||||
|
@ -10,6 +12,9 @@ import funkin.data.song.SongData.SongNoteData;
|
|||
import funkin.data.notestyle.NoteStyleRegistry;
|
||||
import funkin.play.notes.notestyle.NoteStyle;
|
||||
import funkin.play.notes.NoteDirection;
|
||||
import haxe.ui.tooltips.ToolTipRegionOptions;
|
||||
import funkin.util.HaxeUIUtil;
|
||||
import haxe.ui.tooltips.ToolTipManager;
|
||||
|
||||
/**
|
||||
* A sprite that can be used to display a note in a chart.
|
||||
|
@ -63,11 +68,21 @@ class ChartEditorNoteSprite extends FlxSprite
|
|||
return overrideData;
|
||||
}
|
||||
|
||||
public function new(parent:ChartEditorState)
|
||||
public var isGhost:Bool = false;
|
||||
public var tooltip:ToolTipRegionOptions;
|
||||
|
||||
/**
|
||||
* An indicator if the note is a note kind different than Default ("").
|
||||
*/
|
||||
public var kindIndicator:FlxText = new FlxText(5, 5, 100, '*', 16);
|
||||
|
||||
public function new(parent:ChartEditorState, isGhost:Bool = false)
|
||||
{
|
||||
super();
|
||||
|
||||
this.parentState = parent;
|
||||
this.isGhost = isGhost;
|
||||
this.tooltip = HaxeUIUtil.buildTooltip('N/A');
|
||||
|
||||
var entries:Array<String> = NoteStyleRegistry.instance.listEntryIds();
|
||||
|
||||
|
@ -89,6 +104,8 @@ class ChartEditorNoteSprite extends FlxSprite
|
|||
{
|
||||
addNoteStyleAnimations(fetchNoteStyle(entry));
|
||||
}
|
||||
|
||||
kindIndicator.setFormat("VCR OSD Mono", 24, FlxColor.YELLOW, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
|
||||
}
|
||||
|
||||
static var noteFrameCollection:Null<FlxFramesCollection> = null;
|
||||
|
@ -156,6 +173,7 @@ class ChartEditorNoteSprite extends FlxSprite
|
|||
if (this.noteData == null)
|
||||
{
|
||||
this.kill();
|
||||
updateTooltipPosition();
|
||||
return this.noteData;
|
||||
}
|
||||
|
||||
|
@ -167,7 +185,7 @@ class ChartEditorNoteSprite extends FlxSprite
|
|||
|
||||
// Update the position to match the note data.
|
||||
updateNotePosition();
|
||||
|
||||
updateTooltipText();
|
||||
return this.noteData;
|
||||
}
|
||||
|
||||
|
@ -194,6 +212,50 @@ class ChartEditorNoteSprite extends FlxSprite
|
|||
this.x += origin.x;
|
||||
this.y += origin.y;
|
||||
}
|
||||
|
||||
this.updateTooltipPosition();
|
||||
}
|
||||
|
||||
public function updateTooltipText():Void
|
||||
{
|
||||
if (this.noteData == null) return;
|
||||
if (this.isGhost) return;
|
||||
this.tooltip.tipData = {text: this.noteData.buildTooltip()};
|
||||
}
|
||||
|
||||
public function updateTooltipPosition():Void
|
||||
{
|
||||
// No tooltip for ghost sprites.
|
||||
if (this.isGhost) return;
|
||||
|
||||
if (this.noteData == null || (this.tooltip.tipData?.text ?? "").length == 0)
|
||||
{
|
||||
// Disable the tooltip.
|
||||
ToolTipManager.instance.unregisterTooltipRegion(this.tooltip);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Update the position.
|
||||
this.tooltip.left = this.x;
|
||||
this.tooltip.top = this.y;
|
||||
this.tooltip.width = this.width;
|
||||
this.tooltip.height = this.height;
|
||||
|
||||
// Enable the tooltip.
|
||||
ToolTipManager.instance.registerTooltipRegion(this.tooltip);
|
||||
}
|
||||
}
|
||||
|
||||
override public function draw()
|
||||
{
|
||||
super.draw();
|
||||
|
||||
if (!parentState.showNoteKindIndicators) return;
|
||||
if ((this.noteData?.kind ?? "").length == 0) return; // Do not render the note kind indicator if the note kind is default.
|
||||
|
||||
kindIndicator.x = this.x;
|
||||
kindIndicator.y = this.y;
|
||||
kindIndicator.draw();
|
||||
}
|
||||
|
||||
function get_noteStyle():Null<String>
|
||||
|
|
|
@ -137,6 +137,8 @@ class ChartEditorAudioHandler
|
|||
result = playVocals(state, DAD, opponentId, instId);
|
||||
// if (!result) return false;
|
||||
|
||||
state.postLoadVocals();
|
||||
|
||||
state.hardRefreshOffsetsToolbox();
|
||||
|
||||
state.hardRefreshFreeplayToolbox();
|
||||
|
|
|
@ -207,7 +207,7 @@ class ChartEditorFreeplayToolbox extends ChartEditorBaseToolbox
|
|||
{
|
||||
// Move the playhead if it would go out of view.
|
||||
var prevPlayheadRelativePos = playheadRelativePos;
|
||||
playheadRelativePos = FlxMath.bound(playheadRelativePos, 0, waveformScrollview.width - PLAYHEAD_RIGHT_PAD);
|
||||
playheadRelativePos = playheadRelativePos.clamp(0, waveformScrollview.width - PLAYHEAD_RIGHT_PAD);
|
||||
trace('newPos: ${playheadRelativePos}');
|
||||
var diff = playheadRelativePos - prevPlayheadRelativePos;
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ class ChartEditorOffsetsToolbox extends ChartEditorBaseToolbox
|
|||
{
|
||||
// Move the playhead if it would go out of view.
|
||||
var prevPlayheadRelativePos = playheadRelativePos;
|
||||
playheadRelativePos = FlxMath.bound(playheadRelativePos, 0, waveformScrollview.width - PLAYHEAD_RIGHT_PAD);
|
||||
playheadRelativePos = playheadRelativePos.clamp(0, waveformScrollview.width - PLAYHEAD_RIGHT_PAD);
|
||||
var diff = playheadRelativePos - prevPlayheadRelativePos;
|
||||
|
||||
if (diff != 0)
|
||||
|
|
|
@ -11,8 +11,6 @@ import funkin.data.stage.StageData;
|
|||
import funkin.data.stage.StageRegistry;
|
||||
import funkin.ui.debug.stageeditor.StageEditorState.StageEditorDialogType;
|
||||
|
||||
using funkin.util.tools.FloatTools;
|
||||
|
||||
@:build(haxe.ui.macros.ComponentMacros.build("assets/exclude/data/ui/stage-editor/dialogs/welcome.xml"))
|
||||
class WelcomeDialog extends Dialog
|
||||
{
|
||||
|
|
|
@ -192,7 +192,7 @@ class AssetDataHandler
|
|||
|
||||
for (daFrame in obj.frames.frames)
|
||||
{
|
||||
xml += ' <SubTexture name="${daFrame.name}" x="${daFrame.frame.x}" y="${daFrame.frame.y}" width="${daFrame.frame.width}" height="${daFrame.frame.height}" frameX="${- daFrame.offset.x}" frameY="${- daFrame.offset.y}" frameWidth="${daFrame.sourceSize.x}" frameHeight="${daFrame.sourceSize.y}" flipX="${daFrame.flipX}" flipY="${daFrame.flipY}"/>\n';
|
||||
xml += ' <SubTexture name="${daFrame.name}" x="${daFrame.frame.x}" y="${daFrame.frame.y}" width="${daFrame.frame.width}" height="${daFrame.frame.height}" frameX="${- daFrame.offset.x}" frameY="${- daFrame.offset.y}" frameWidth="${daFrame.sourceSize.x}" frameHeight="${daFrame.sourceSize.y}" flipX="${daFrame.flipX}" flipY="${daFrame.flipY}" rotated="${daFrame.angle == -90}"/>\n';
|
||||
}
|
||||
|
||||
xml += "</TextureAtlas>";
|
||||
|
|
|
@ -170,6 +170,8 @@ class AlbumRoll extends FlxSpriteGroup
|
|||
*/
|
||||
public function playIntro():Void
|
||||
{
|
||||
this.visible = true;
|
||||
|
||||
if (albumTitle != null) albumTitle.visible = false;
|
||||
newAlbumArt.visible = true;
|
||||
newAlbumArt.playAnimation('intro', true);
|
||||
|
@ -186,6 +188,7 @@ class AlbumRoll extends FlxSpriteGroup
|
|||
|
||||
public function skipIntro():Void
|
||||
{
|
||||
this.visible = true;
|
||||
// Weird workaround
|
||||
newAlbumArt.playAnimation('switch', true);
|
||||
if (albumTitle != null) albumTitle.animation.play('switch');
|
||||
|
@ -210,7 +213,7 @@ class AlbumRoll extends FlxSpriteGroup
|
|||
}
|
||||
|
||||
albumTitle = FunkinSprite.createSparrow((FlxG.width - 355) - FullScreenScaleMode.gameNotchSize.x, 500, assetKey);
|
||||
albumTitle.visible = albumTitle.frames != null && newAlbumArt.visible;
|
||||
albumTitle.visible = this.visible && (albumTitle.frames != null && newAlbumArt.visible) && difficultyStars.visible;
|
||||
albumTitle.animation.addByPrefix('idle', 'idle0', 24, true);
|
||||
albumTitle.animation.addByPrefix('switch', 'switch0', 24, false);
|
||||
add(albumTitle);
|
||||
|
|
|
@ -4,70 +4,80 @@ import flixel.FlxObject;
|
|||
import flixel.group.FlxSpriteGroup;
|
||||
import flixel.text.FlxText;
|
||||
import flixel.util.FlxSort;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.util.FlxDestroyUtil;
|
||||
import flixel.util.FlxColor;
|
||||
|
||||
// its kinda like marqeee html lol!
|
||||
@:nullSafety
|
||||
class BGScrollingText extends FlxSpriteGroup
|
||||
{
|
||||
var grpTexts:FlxTypedSpriteGroup<FlxText>;
|
||||
var grpTexts:FlxTypedSpriteGroup<FlxSprite>;
|
||||
var sourceText:FlxText;
|
||||
|
||||
public var widthShit:Float = FlxG.width;
|
||||
public var placementOffset:Float = 20;
|
||||
public var speed:Float = 1;
|
||||
public var size(default, set):Int = 48;
|
||||
|
||||
public var funnyColor(default, set):Int = 0xFFFFFFFF;
|
||||
public var funnyColor(default, set):FlxColor = 0xFFFFFFFF;
|
||||
|
||||
public function new(x:Float, y:Float, text:String, widthShit:Float = 100, ?bold:Bool = false, ?size:Int = 48)
|
||||
{
|
||||
super(x, y);
|
||||
|
||||
grpTexts = new FlxTypedSpriteGroup<FlxText>();
|
||||
add(grpTexts);
|
||||
grpTexts = new FlxTypedSpriteGroup<FlxSprite>();
|
||||
|
||||
this.widthShit = widthShit;
|
||||
if (size != null) this.size = size;
|
||||
|
||||
var testText:FlxText = new FlxText(0, 0, 0, text, this.size);
|
||||
testText.font = "5by7";
|
||||
testText.bold = bold ?? false;
|
||||
testText.updateHitbox();
|
||||
grpTexts.add(testText);
|
||||
// Only keep one FlxText graphic at a time for batching
|
||||
sourceText = new FlxText(0, 0, 0, text, size ?? this.size);
|
||||
sourceText.font = "5by7";
|
||||
sourceText.bold = bold ?? false;
|
||||
|
||||
var needed:Int = Math.ceil(widthShit / testText.frameWidth) + 1;
|
||||
@:privateAccess
|
||||
sourceText.regenGraphic();
|
||||
|
||||
var needed:Int = Math.ceil(widthShit / sourceText.frameWidth) + 1;
|
||||
|
||||
for (i in 0...needed)
|
||||
{
|
||||
var lmfao:Int = i + 1;
|
||||
|
||||
var coolText:FlxText = new FlxText((lmfao * testText.frameWidth) + (lmfao * 20), 0, 0, text, this.size);
|
||||
|
||||
coolText.font = "5by7";
|
||||
coolText.bold = bold ?? false;
|
||||
coolText.updateHitbox();
|
||||
var coolText = new FlxSprite((i * sourceText.frameWidth) + (i * 20), 0);
|
||||
grpTexts.add(coolText);
|
||||
}
|
||||
|
||||
if (size != null) this.size = size;
|
||||
|
||||
add(grpTexts);
|
||||
}
|
||||
|
||||
function reloadGraphics()
|
||||
{
|
||||
if (grpTexts != null)
|
||||
{
|
||||
@:privateAccess
|
||||
sourceText.regenGraphic();
|
||||
grpTexts.forEach(function(txt:FlxSprite) {
|
||||
txt.loadGraphic(sourceText.graphic);
|
||||
txt.updateHitbox();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function set_size(value:Int):Int
|
||||
{
|
||||
if (grpTexts != null)
|
||||
{
|
||||
grpTexts.forEach(function(txt:FlxText) {
|
||||
txt.size = value;
|
||||
});
|
||||
}
|
||||
sourceText.size = value;
|
||||
reloadGraphics();
|
||||
this.size = value;
|
||||
return value;
|
||||
}
|
||||
|
||||
function set_funnyColor(col:Int):Int
|
||||
function set_funnyColor(value:FlxColor):FlxColor
|
||||
{
|
||||
grpTexts.forEach(function(txt) {
|
||||
txt.color = col;
|
||||
});
|
||||
|
||||
return col;
|
||||
sourceText.color = value;
|
||||
reloadGraphics();
|
||||
this.funnyColor = value;
|
||||
return value;
|
||||
}
|
||||
|
||||
override public function update(elapsed:Float)
|
||||
|
@ -106,4 +116,10 @@ class BGScrollingText extends FlxSpriteGroup
|
|||
return FlxSort.byValues(Order, Obj1.x, Obj2.x);
|
||||
});
|
||||
}
|
||||
|
||||
override function destroy():Void
|
||||
{
|
||||
super.destroy();
|
||||
sourceText = FlxDestroyUtil.destroy(sourceText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,8 +81,6 @@ class FreeplayDJ extends FlxAtlasSprite
|
|||
|
||||
public override function update(elapsed:Float):Void
|
||||
{
|
||||
super.update(elapsed);
|
||||
|
||||
switch (currentState)
|
||||
{
|
||||
case Intro:
|
||||
|
@ -185,6 +183,10 @@ class FreeplayDJ extends FlxAtlasSprite
|
|||
default:
|
||||
// I shit myself.
|
||||
}
|
||||
|
||||
// Call the superclass function AFTER updating the current state and playing the next animation.
|
||||
// This ensures that FlxAnimate starts rendering the new animation immediately.
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
||||
function onFinishAnim(name:String):Void
|
||||
|
|
|
@ -31,6 +31,7 @@ import funkin.input.Controls;
|
|||
import funkin.modding.events.ScriptEvent;
|
||||
import funkin.modding.events.ScriptEventDispatcher;
|
||||
import funkin.play.PlayStatePlaylist;
|
||||
import funkin.play.scoring.Scoring;
|
||||
import funkin.play.scoring.Scoring.ScoringRank;
|
||||
import funkin.play.song.Song;
|
||||
import funkin.save.Save;
|
||||
|
@ -119,6 +120,11 @@ class FreeplayState extends MusicBeatSubState
|
|||
*/
|
||||
public static final SONGS_POS_MULTI:Float = 0.75;
|
||||
|
||||
/**
|
||||
* For positioning the difficulty dots.
|
||||
*/
|
||||
public static final DEFAULT_DOTS_GROUP_POS:Array<Int> = [260, 170];
|
||||
|
||||
var songs:Array<Null<FreeplaySongData>> = [];
|
||||
|
||||
var curSelected:Int = 0;
|
||||
|
@ -169,17 +175,6 @@ class FreeplayState extends MusicBeatSubState
|
|||
return grpCapsules.members[curSelected];
|
||||
}
|
||||
|
||||
var coolColors:Array<Int> = [
|
||||
0xFF9271FD,
|
||||
0xFF9271FD,
|
||||
0xFF223344,
|
||||
0xFF941653,
|
||||
0xFFFC96D7,
|
||||
0xFFA0D1FF,
|
||||
0xFFFF78BF,
|
||||
0xFFF6B604
|
||||
];
|
||||
|
||||
var grpCapsules:FlxTypedGroup<SongMenuItem>;
|
||||
|
||||
var dj:Null<FreeplayDJ> = null;
|
||||
|
@ -315,7 +310,7 @@ class FreeplayState extends MusicBeatSubState
|
|||
grpCapsules = new FlxTypedGroup<SongMenuItem>();
|
||||
grpDifficulties = new FlxTypedSpriteGroup<DifficultySprite>(-300, 80);
|
||||
|
||||
difficultyDots = new FlxTypedSpriteGroup<DifficultyDot>(203, 170);
|
||||
difficultyDots = new FlxTypedSpriteGroup<DifficultyDot>(DEFAULT_DOTS_GROUP_POS[0], DEFAULT_DOTS_GROUP_POS[1]);
|
||||
letterSort = new LetterSort((CUTOUT_WIDTH * SONGS_POS_MULTI) + 400, 75);
|
||||
rankBg = new FunkinSprite(0, 0);
|
||||
rankVignette = new FlxSprite(0, 0).loadGraphic(Paths.image('freeplay/rankVignette'));
|
||||
|
@ -495,6 +490,7 @@ class FreeplayState extends MusicBeatSubState
|
|||
}
|
||||
|
||||
albumRoll.albumId = null;
|
||||
albumRoll.visible = false;
|
||||
albumRoll.applyExitMovers(exitMovers, exitMoversCharSel);
|
||||
add(albumRoll);
|
||||
|
||||
|
@ -503,7 +499,7 @@ class FreeplayState extends MusicBeatSubState
|
|||
|
||||
if (fromCharSelect)
|
||||
{
|
||||
blackOverlayBullshitLOLXD.x = backingImage.x;
|
||||
blackOverlayBullshitLOLXD.visible = false;
|
||||
overhangStuff.y = -100;
|
||||
backingCard.skipIntroTween();
|
||||
}
|
||||
|
@ -703,6 +699,9 @@ class FreeplayState extends MusicBeatSubState
|
|||
ease: FlxEase.expoOut,
|
||||
onUpdate: function(_) {
|
||||
angleMaskShader.extraColor = backingImage.color;
|
||||
},
|
||||
onComplete: function(_) {
|
||||
blackOverlayBullshitLOLXD.visible = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -764,6 +763,11 @@ class FreeplayState extends MusicBeatSubState
|
|||
albumRoll.skipIntro();
|
||||
albumRoll.showStars();
|
||||
}
|
||||
else if (fromCharSelect)
|
||||
{
|
||||
albumRoll.skipIntro();
|
||||
albumRoll.showStars();
|
||||
}
|
||||
|
||||
refreshDots(5, Constants.DEFAULT_DIFFICULTY_LIST_FULL.indexOf(currentDifficulty), Constants.DEFAULT_DIFFICULTY_LIST_FULL.indexOf(currentDifficulty));
|
||||
fadeDots(true);
|
||||
|
@ -1270,7 +1274,6 @@ class FreeplayState extends MusicBeatSubState
|
|||
});
|
||||
|
||||
new FlxTimer().start(2, _ -> {
|
||||
// dj.fistPump();
|
||||
prepForNewRank = false;
|
||||
});
|
||||
}
|
||||
|
@ -1295,9 +1298,22 @@ class FreeplayState extends MusicBeatSubState
|
|||
function refreshDots(amount:Int, index:Int, prevIndex:Int):Void
|
||||
{
|
||||
var distance:Int = 30;
|
||||
var groupOffset:Float = 14.7;
|
||||
var shiftAmt:Float = (distance * amount) / 2;
|
||||
var daSong:Null<FreeplaySongData> = currentCapsule.freeplayData;
|
||||
final maxDotsPerRow:Int = 8;
|
||||
|
||||
if (difficultyDots.group.members.length > maxDotsPerRow)
|
||||
{
|
||||
difficultyDots.x = DEFAULT_DOTS_GROUP_POS[0] - groupOffset * (maxDotsPerRow - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
difficultyDots.x = DEFAULT_DOTS_GROUP_POS[0] - groupOffset * (difficultyDots.group.members.length - 1);
|
||||
}
|
||||
|
||||
var curRow:Int = 0;
|
||||
var curDot:Int = 0;
|
||||
for (i in 0...difficultyDots.group.members.length)
|
||||
{
|
||||
// if (difficultyDots.group.members[i] == null) continue;
|
||||
|
@ -1329,7 +1345,16 @@ class FreeplayState extends MusicBeatSubState
|
|||
}
|
||||
|
||||
difficultyDots.group.members[i].visible = true;
|
||||
difficultyDots.group.members[i].x = (CUTOUT_WIDTH * DJ_POS_MULTI) + ((difficultyDots.x + (distance * i)) - shiftAmt);
|
||||
difficultyDots.group.members[i].x = (CUTOUT_WIDTH * DJ_POS_MULTI) + ((difficultyDots.x + (distance * curDot)) - shiftAmt);
|
||||
difficultyDots.group.members[i].y = DEFAULT_DOTS_GROUP_POS[1] + distance * curRow;
|
||||
|
||||
curDot++;
|
||||
|
||||
if (curDot >= maxDotsPerRow)
|
||||
{
|
||||
curDot = 0;
|
||||
curRow++;
|
||||
}
|
||||
|
||||
if (daSong?.data.hasDifficulty(diffId, daSong?.data.getFirstValidVariation(diffId, currentCharacter)) == false)
|
||||
{
|
||||
|
@ -1582,12 +1607,10 @@ class FreeplayState extends MusicBeatSubState
|
|||
}
|
||||
|
||||
if (controls.FREEPLAY_FAVORITE && controls.active) favoriteSong();
|
||||
|
||||
if (controls.FREEPLAY_JUMP_TO_TOP && controls.active) changeSelection(-curSelected);
|
||||
|
||||
if (controls.FREEPLAY_JUMP_TO_BOTTOM && controls.active) changeSelection(grpCapsules.countLiving() - curSelected - 1);
|
||||
|
||||
calculateCompletion();
|
||||
lerpScoreDisplays();
|
||||
|
||||
handleInputs(elapsed);
|
||||
|
||||
|
@ -1597,7 +1620,7 @@ class FreeplayState extends MusicBeatSubState
|
|||
if (allowPicoBulletsVibration) HapticUtil.vibrate(0, 0.01, (Constants.MAX_VIBRATION_AMPLITUDE / 3) * 2.5);
|
||||
}
|
||||
|
||||
function calculateCompletion():Void
|
||||
function lerpScoreDisplays():Void
|
||||
{
|
||||
lerpScore = MathUtil.snap(MathUtil.smoothLerpPrecision(lerpScore, intendedScore, FlxG.elapsed, 0.2), intendedScore, 1);
|
||||
lerpCompletion = MathUtil.snap(MathUtil.smoothLerpPrecision(lerpCompletion, intendedCompletion, FlxG.elapsed, 0.5), intendedCompletion, 1 / 100);
|
||||
|
@ -1617,7 +1640,7 @@ class FreeplayState extends MusicBeatSubState
|
|||
// sets the text of the completion percentage. Perhaps eventually we may want to generalize this,
|
||||
// but for now we can just clamp the values between 0 and 100.
|
||||
// Fixes issue where it rounds to negative integer overflow on Windows? Which occurs when switching to an unranked song?
|
||||
txtCompletion.text = '${FlxMath.clamp(Math.floor(lerpCompletion * 100), 0, 100)}';
|
||||
txtCompletion.text = '${Math.floor(lerpCompletion * 100).clamp(0, 100)}';
|
||||
|
||||
// Right align the completion percentage
|
||||
switch (txtCompletion.text.length)
|
||||
|
@ -1862,7 +1885,7 @@ class FreeplayState extends MusicBeatSubState
|
|||
{
|
||||
var dpiScale = FlxG.stage.window.display.dpi / 160;
|
||||
|
||||
dpiScale = FlxMath.clamp(dpiScale, 0.5, #if android 1 #else 2 #end);
|
||||
dpiScale = dpiScale.clamp(0.5, #if android 1 #else 2 #end);
|
||||
|
||||
var moveLength = delta / FlxG.updateFramerate / dpiScale;
|
||||
_moveLength += Math.abs(moveLength);
|
||||
|
@ -1889,7 +1912,7 @@ class FreeplayState extends MusicBeatSubState
|
|||
_flickEnded = false;
|
||||
var dpiScale = FlxG.stage.window.display.dpi / 160;
|
||||
|
||||
dpiScale = FlxMath.clamp(dpiScale, 0.5, #if android 1 #else 2 #end);
|
||||
dpiScale = dpiScale.clamp(0.5, #if android 1 #else 2 #end);
|
||||
var velocityMove = flickVelocity * elapsed / dpiScale;
|
||||
_moveLength += Math.abs(velocityMove);
|
||||
curSelectedFloat -= velocityMove;
|
||||
|
@ -1906,7 +1929,7 @@ class FreeplayState extends MusicBeatSubState
|
|||
}
|
||||
}
|
||||
|
||||
curSelectedFloat = FlxMath.clamp(curSelectedFloat, 0, grpCapsules.countLiving() - 1);
|
||||
curSelectedFloat = curSelectedFloat.clamp(0, grpCapsules.countLiving() - 1);
|
||||
curSelected = Math.round(curSelectedFloat);
|
||||
|
||||
for (i in 0...grpCapsules.members.length)
|
||||
|
@ -2179,8 +2202,6 @@ class FreeplayState extends MusicBeatSubState
|
|||
*/
|
||||
function changeDiff(change:Int = 0, force:Bool = false, capsuleAnim:Bool = false):Void
|
||||
{
|
||||
if (!controls.active) return;
|
||||
|
||||
if (capsuleAnim)
|
||||
{
|
||||
if (currentCapsule != null)
|
||||
|
@ -2275,11 +2296,10 @@ class FreeplayState extends MusicBeatSubState
|
|||
|
||||
var songScore:Null<SaveScoreData> = Save.instance.getSongScore(daSong.data.id, currentDifficulty, currentVariation);
|
||||
intendedScore = songScore?.score ?? 0;
|
||||
intendedCompletion = songScore == null ? 0.0 : Math.max(0,
|
||||
((songScore.tallies.sick + songScore.tallies.good - songScore.tallies.missed) / songScore.tallies.totalNotes));
|
||||
intendedCompletion = Math.max(0, Scoring.tallyCompletion(songScore?.tallies));
|
||||
rememberedDifficulty = currentDifficulty;
|
||||
if (!capsuleAnim) generateSongList(currentFilter, false, true, true);
|
||||
currentCapsule.refreshDisplay((prepForNewRank == true) ? false : true);
|
||||
currentCapsule.refreshDisplay(!prepForNewRank);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2351,7 +2371,7 @@ class FreeplayState extends MusicBeatSubState
|
|||
|
||||
// Set the album graphic and play the animation if relevant.
|
||||
var newAlbumId:Null<String> = daSong?.data.getAlbumId(currentDifficulty, currentVariation);
|
||||
if (albumRoll.albumId != newAlbumId)
|
||||
if (albumRoll.albumId != newAlbumId && (currentVariation != previousVariation || controls.active) && !fromCharSelect)
|
||||
{
|
||||
albumRoll.albumId = newAlbumId;
|
||||
albumRoll.skipIntro();
|
||||
|
@ -2390,11 +2410,6 @@ class FreeplayState extends MusicBeatSubState
|
|||
{
|
||||
trace('RANDOM SELECTED');
|
||||
|
||||
controls.active = false;
|
||||
#if NO_FEATURE_TOUCH_CONTROLS
|
||||
letterSort.inputEnabled = false;
|
||||
#end
|
||||
|
||||
var availableSongCapsules:Array<SongMenuItem> = grpCapsules.members.filter(function(cap:SongMenuItem) {
|
||||
// Dead capsules are ones which were removed from the list when changing filters.
|
||||
return cap.alive && cap.freeplayData != null;
|
||||
|
@ -2420,6 +2435,10 @@ class FreeplayState extends MusicBeatSubState
|
|||
// Seeing if I can do an animation...
|
||||
curSelected = grpCapsules.members.indexOf(targetSong);
|
||||
changeSelection(0); // Trigger an update.
|
||||
controls.active = false;
|
||||
#if NO_FEATURE_TOUCH_CONTROLS
|
||||
letterSort.inputEnabled = false;
|
||||
#end
|
||||
|
||||
// Act like we hit Confirm on that song.
|
||||
capsuleOnConfirmDefault(targetSong);
|
||||
|
@ -2587,26 +2606,28 @@ class FreeplayState extends MusicBeatSubState
|
|||
new FlxTimer().start(styleData?.getStartDelay(), function(tmr:FlxTimer) {
|
||||
FunkinSound.emptyPartialQueue();
|
||||
|
||||
Paths.setCurrentLevel(cap?.freeplayData?.levelId);
|
||||
LoadingState.loadPlayState(
|
||||
{
|
||||
targetSong: targetSong,
|
||||
targetDifficulty: currentDifficulty,
|
||||
targetVariation: currentVariation,
|
||||
targetInstrumental: targetInstId,
|
||||
practiceMode: false,
|
||||
minimalMode: false,
|
||||
funnyCam.fade(FlxColor.BLACK, 0.2, false, function() {
|
||||
Paths.setCurrentLevel(cap?.freeplayData?.levelId);
|
||||
LoadingState.loadPlayState(
|
||||
{
|
||||
targetSong: targetSong,
|
||||
targetDifficulty: currentDifficulty,
|
||||
targetVariation: currentVariation,
|
||||
targetInstrumental: targetInstId,
|
||||
practiceMode: false,
|
||||
minimalMode: false,
|
||||
|
||||
#if FEATURE_DEBUG_FUNCTIONS
|
||||
botPlayMode: FlxG.keys.pressed.SHIFT,
|
||||
#else
|
||||
botPlayMode: false,
|
||||
#end
|
||||
// TODO: Make these an option! It's currently only accessible via chart editor.
|
||||
// startTimestamp: 0.0,
|
||||
// playbackRate: 0.5,
|
||||
// botPlayMode: true,
|
||||
}, true);
|
||||
#if FEATURE_DEBUG_FUNCTIONS
|
||||
botPlayMode: FlxG.keys.pressed.SHIFT,
|
||||
#else
|
||||
botPlayMode: false,
|
||||
#end
|
||||
// TODO: Make these an option! It's currently only accessible via chart editor.
|
||||
// startTimestamp: 0.0,
|
||||
// playbackRate: 0.5,
|
||||
// botPlayMode: true,
|
||||
}, true);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -2654,6 +2675,7 @@ class FreeplayState extends MusicBeatSubState
|
|||
|
||||
capsule.targetPos.y = capsule.intendedY(index - curSelectedFloat);
|
||||
capsule.targetPos.x = capsule.intendedX(index - curSelectedFloat) + (CUTOUT_WIDTH * SONGS_POS_MULTI);
|
||||
if (index + 0.5 < curSelectedFloat) capsule.targetPos.y -= 100;
|
||||
}
|
||||
|
||||
if (curSelected != prevSelected)
|
||||
|
@ -2693,26 +2715,18 @@ class FreeplayState extends MusicBeatSubState
|
|||
|
||||
if (!prepForNewRank && curSelected != prevSelected) FunkinSound.playOnce(Paths.sound('scrollMenu'), 0.4);
|
||||
|
||||
var daSongCapsule:SongMenuItem = currentCapsule;
|
||||
if (daSongCapsule.freeplayData != null)
|
||||
{
|
||||
var songScore:Null<SaveScoreData> = Save.instance.getSongScore(daSongCapsule.freeplayData.data.id, currentDifficulty, currentVariation);
|
||||
intendedScore = songScore?.score ?? 0;
|
||||
intendedCompletion = songScore == null ? 0.0 : ((songScore.tallies.sick +
|
||||
songScore.tallies.good - songScore.tallies.missed) / songScore.tallies.totalNotes);
|
||||
rememberedSongId = daSongCapsule.freeplayData.data.id;
|
||||
changeDiff();
|
||||
daSongCapsule.refreshDisplay((prepForNewRank == true) ? false : true);
|
||||
}
|
||||
var songScore:Null<SaveScoreData> = Save.instance.getSongScore(currentCapsule.freeplayData?.data.id ?? "", currentDifficulty, currentVariation);
|
||||
intendedScore = songScore?.score ?? 0;
|
||||
|
||||
intendedCompletion = Scoring.tallyCompletion(songScore?.tallies);
|
||||
rememberedSongId = currentCapsule.freeplayData?.data.id;
|
||||
|
||||
if (currentCapsule.freeplayData == null) albumRoll.albumId = null;
|
||||
|
||||
changeDiff();
|
||||
if (currentCapsule.freeplayData == null) currentCapsule.refreshDisplay();
|
||||
else
|
||||
{
|
||||
intendedScore = 0;
|
||||
intendedCompletion = 0.0;
|
||||
rememberedSongId = null;
|
||||
albumRoll.albumId = null;
|
||||
changeDiff();
|
||||
daSongCapsule.refreshDisplay();
|
||||
}
|
||||
currentCapsule.refreshDisplay(!prepForNewRank);
|
||||
|
||||
for (index => capsule in grpCapsules.members)
|
||||
{
|
||||
|
@ -2725,16 +2739,15 @@ class FreeplayState extends MusicBeatSubState
|
|||
|
||||
capsule.targetPos.y = capsule.intendedY(index - curSelected);
|
||||
capsule.targetPos.x = capsule.intendedX(index - curSelected) + (CUTOUT_WIDTH * SONGS_POS_MULTI);
|
||||
if (index < curSelected #if FEATURE_TOUCH_CONTROLS
|
||||
&& ControlsHandler.usingExternalInputDevice #end) capsule.targetPos.y -= 100; // another 100 for good measure
|
||||
if (index < curSelected) capsule.targetPos.y -= 100; // another 100 for good measure
|
||||
}
|
||||
|
||||
if (grpCapsules.countLiving() > 0 && !prepForNewRank && controls.active)
|
||||
{
|
||||
playCurSongPreview(daSongCapsule);
|
||||
playCurSongPreview(currentCapsule);
|
||||
currentCapsule.selected = true;
|
||||
|
||||
// switchBackingImage(daSongCapsule.freeplayData);
|
||||
// switchBackingImage(currentCapsule.freeplayData);
|
||||
}
|
||||
|
||||
// Small vibrations every selection change.
|
||||
|
@ -2752,7 +2765,7 @@ class FreeplayState extends MusicBeatSubState
|
|||
overrideExisting: true,
|
||||
restartTrack: false
|
||||
});
|
||||
FlxG.sound.music.fadeIn(2, 0, 0.8);
|
||||
FlxG.sound.music.fadeIn(2, 0, 0.7);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2789,7 +2802,7 @@ class FreeplayState extends MusicBeatSubState
|
|||
end: 0.2
|
||||
},
|
||||
onLoad: function() {
|
||||
FlxG.sound.music.fadeIn(2, 0, 0.4);
|
||||
FlxG.sound.music.fadeIn(2, 0, 0.7);
|
||||
}
|
||||
});
|
||||
if (songDifficulty != null)
|
||||
|
|
|
@ -148,18 +148,22 @@ class LetterSort extends FlxSpriteGroup
|
|||
|
||||
public function changeSelection(diff:Int = 0, playSound:Bool = true):Void
|
||||
{
|
||||
doLetterChangeAnims(diff);
|
||||
@:privateAccess
|
||||
if (instance.controls.active)
|
||||
{
|
||||
doLetterChangeAnims(diff);
|
||||
|
||||
var multiPosOrNeg:Float = diff > 0 ? 1 : -1;
|
||||
var multiPosOrNeg:Float = diff > 0 ? 1 : -1;
|
||||
|
||||
// if we're moving left (diff < 0), we want control of the right arrow, and vice versa
|
||||
var arrowToMove:FlxSprite = diff < 0 ? leftArrow : rightArrow;
|
||||
arrowToMove.offset.x = 3 * multiPosOrNeg;
|
||||
// if we're moving left (diff < 0), we want control of the right arrow, and vice versa
|
||||
var arrowToMove:FlxSprite = diff < 0 ? leftArrow : rightArrow;
|
||||
arrowToMove.offset.x = 3 * multiPosOrNeg;
|
||||
|
||||
new FlxTimer().start(2 / 24, function(_) {
|
||||
arrowToMove.offset.x = 0;
|
||||
});
|
||||
if (playSound && diff != 0) FunkinSound.playOnce(Paths.sound('scrollMenu'), 0.4);
|
||||
new FlxTimer().start(2 / 24, function(_) {
|
||||
arrowToMove.offset.x = 0;
|
||||
});
|
||||
if (playSound && diff != 0) FunkinSound.playOnce(Paths.sound('scrollMenu'), 0.4);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -49,8 +49,6 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
|
||||
public var fakeRanking:FreeplayRank;
|
||||
|
||||
var ranks:Array<String> = ["fail", "average", "great", "excellent", "perfect", "perfectsick"];
|
||||
|
||||
public var targetPos:FlxPoint = new FlxPoint();
|
||||
public var doLerp:Bool = false;
|
||||
public var doJumpIn:Bool = false;
|
||||
|
@ -69,12 +67,9 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
|
||||
public var newText:FlxSprite;
|
||||
|
||||
// public var weekType:FlxSprite;
|
||||
public var bigNumbers:Array<CapsuleNumber> = [];
|
||||
|
||||
public var smallNumbers:Array<CapsuleNumber> = [];
|
||||
|
||||
public var weekNumbers:Array<CapsuleNumber> = [];
|
||||
var difficultyNumbers:Array<CapsuleNumber> = []; // referred to as "bignumbers" in the .fla file!
|
||||
var bpmNumbers:Array<CapsuleNumber> = []; // referred to as "smallnumbers" in the .fla file!
|
||||
var weekNumbers:Array<CapsuleNumber> = [];
|
||||
|
||||
var impactThing:FunkinSprite;
|
||||
|
||||
|
@ -131,18 +126,18 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
|
||||
for (i in 0...2)
|
||||
{
|
||||
var bigNumber:CapsuleNumber = new CapsuleNumber(466 + (i * 30), 32, true, 0);
|
||||
add(bigNumber);
|
||||
var num:CapsuleNumber = new CapsuleNumber(466 + (i * 30), 32, true, 0);
|
||||
add(num);
|
||||
|
||||
bigNumbers.push(bigNumber);
|
||||
difficultyNumbers.push(num);
|
||||
}
|
||||
|
||||
for (i in 0...3)
|
||||
{
|
||||
var smallNumber:CapsuleNumber = new CapsuleNumber(185 + (i * 11), 88.5, false, 0);
|
||||
add(smallNumber);
|
||||
var num:CapsuleNumber = new CapsuleNumber(185 + (i * 11), 88.5, false, 0);
|
||||
add(num);
|
||||
|
||||
smallNumbers.push(smallNumber);
|
||||
bpmNumbers.push(num);
|
||||
}
|
||||
|
||||
// doesn't get added, simply is here to help with visibility of things for the pop in!
|
||||
|
@ -334,38 +329,38 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
shiftX = 186;
|
||||
}
|
||||
|
||||
for (i in 0...smallNumbers.length)
|
||||
for (i in 0...bpmNumbers.length)
|
||||
{
|
||||
smallNumbers[i].x = this.x + (shiftX + (i * 11));
|
||||
bpmNumbers[i].x = this.x + (shiftX + (i * 11));
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (newBPM < 100)
|
||||
{
|
||||
smallNumbers[i].digit = 0;
|
||||
bpmNumbers[i].digit = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
smallNumbers[i].digit = Math.floor(newBPM / 100) % 10;
|
||||
bpmNumbers[i].digit = Math.floor(newBPM / 100) % 10;
|
||||
}
|
||||
|
||||
case 1:
|
||||
if (newBPM < 10)
|
||||
{
|
||||
smallNumbers[i].digit = 0;
|
||||
bpmNumbers[i].digit = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
smallNumbers[i].digit = Math.floor(newBPM / 10) % 10;
|
||||
bpmNumbers[i].digit = Math.floor(newBPM / 10) % 10;
|
||||
|
||||
if (Math.floor(newBPM / 10) % 10 == 1) tempShift = -4;
|
||||
}
|
||||
case 2:
|
||||
smallNumbers[i].digit = newBPM % 10;
|
||||
bpmNumbers[i].digit = newBPM % 10;
|
||||
default:
|
||||
trace('why the fuck is this being called');
|
||||
}
|
||||
smallNumbers[i].x += tempShift;
|
||||
bpmNumbers[i].x += tempShift;
|
||||
}
|
||||
// diffRatingSprite.loadGraphic(Paths.image('freeplay/diffRatings/diff${ratingPadded}'));
|
||||
// diffRatingSprite.visible = false;
|
||||
|
@ -439,21 +434,21 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
{
|
||||
var ratingPadded:String = newRating < 10 ? '0$newRating' : '$newRating';
|
||||
|
||||
for (i in 0...bigNumbers.length)
|
||||
for (i in 0...difficultyNumbers.length)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (newRating < 10)
|
||||
{
|
||||
bigNumbers[i].digit = 0;
|
||||
difficultyNumbers[i].digit = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
bigNumbers[i].digit = Math.floor(newRating / 10);
|
||||
difficultyNumbers[i].digit = Math.floor(newRating / 10);
|
||||
}
|
||||
case 1:
|
||||
bigNumbers[i].digit = newRating % 10;
|
||||
difficultyNumbers[i].digit = newRating % 10;
|
||||
default:
|
||||
trace('why the fuck is this being called');
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ import funkin.modding.IScriptedClass.IStateChangingScriptedClass;
|
|||
import funkin.modding.events.ScriptEvent;
|
||||
import funkin.ui.FullScreenScaleMode;
|
||||
import funkin.util.BitmapUtil;
|
||||
import openfl.utils.Assets;
|
||||
|
||||
/**
|
||||
* A class for the backing cards so they dont have to be part of freeplayState......
|
||||
|
|
|
@ -10,7 +10,6 @@ import funkin.graphics.adobeanimate.FlxAtlasSprite;
|
|||
import funkin.modding.events.ScriptEvent;
|
||||
import openfl.display.BlendMode;
|
||||
import funkin.util.BitmapUtil;
|
||||
import openfl.utils.Assets;
|
||||
|
||||
class NewCharacterCard extends BackingCard
|
||||
{
|
||||
|
|
|
@ -268,10 +268,8 @@ class MainMenuState extends MusicBeatState
|
|||
// reset camera when debug menu is closed
|
||||
subStateClosed.add(_ -> resetCamStuff(false));
|
||||
|
||||
// TODO: Why does this specific function break with null safety?
|
||||
@:nullSafety(Off)
|
||||
subStateOpened.add((sub:FlxSubState) -> {
|
||||
if (Type.getClass(sub) == FreeplayState)
|
||||
if (Std.isOfType(sub, FreeplayState))
|
||||
{
|
||||
new FlxTimer().start(0.5, _ -> {
|
||||
magenta.visible = false;
|
||||
|
@ -405,9 +403,9 @@ class MainMenuState extends MusicBeatState
|
|||
{
|
||||
super.finishTransIn();
|
||||
canInteract = true;
|
||||
FlxG.keys.enabled = true;
|
||||
if (menuItems != null)
|
||||
{
|
||||
menuItems.busy = false;
|
||||
menuItems.enabled = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -545,6 +545,7 @@ class OffsetMenu extends Page<OptionsState.OptionsMenuPageName>
|
|||
if (FlxG.sound.music.time < _lastTime)
|
||||
{
|
||||
localConductor.update(FlxG.sound.music.time, !calibrating);
|
||||
b = localConductor.currentBeatTime;
|
||||
|
||||
// Update arrows to be the correct distance away from the receptor.
|
||||
var lastArrowBeat:Float = 0;
|
||||
|
@ -558,7 +559,7 @@ class OffsetMenu extends Page<OptionsState.OptionsMenuPageName>
|
|||
}
|
||||
if (calibrating)
|
||||
{
|
||||
arrowBeat = lastArrowBeat + 2;
|
||||
arrowBeat = lastArrowBeat;
|
||||
}
|
||||
else
|
||||
arrowBeat = 4;
|
||||
|
@ -566,6 +567,10 @@ class OffsetMenu extends Page<OptionsState.OptionsMenuPageName>
|
|||
testStrumline.clean();
|
||||
testStrumline.noteData = [];
|
||||
testStrumline.nextNoteIndex = 0;
|
||||
trace('Restarting conductor');
|
||||
|
||||
_lastTime = FlxG.sound.music.time;
|
||||
return;
|
||||
}
|
||||
|
||||
_lastBeat = b;
|
||||
|
@ -608,7 +613,7 @@ class OffsetMenu extends Page<OptionsState.OptionsMenuPageName>
|
|||
countText.text = 'Current Offset: ' + Std.int(appliedOffsetLerp) + 'ms';
|
||||
|
||||
var toRemove:Array<ArrowData> = [];
|
||||
|
||||
var _lastArrowBeat:Float = 0;
|
||||
// Update arrows
|
||||
for (i in 0...arrows.length)
|
||||
{
|
||||
|
@ -629,12 +634,13 @@ class OffsetMenu extends Page<OptionsState.OptionsMenuPageName>
|
|||
arrow.sprite.alpha -= elapsed * 5;
|
||||
}
|
||||
|
||||
if (arrow.sprite.alpha <= 0)
|
||||
if (arrow.beat == _lastArrowBeat || arrow.sprite.alpha <= 0)
|
||||
{
|
||||
toRemove.push(arrow);
|
||||
arrow.sprite.kill();
|
||||
// arrow.debugText.kill();
|
||||
continue;
|
||||
}
|
||||
_lastArrowBeat = arrow.beat;
|
||||
}
|
||||
|
||||
// Remove arrows that are marked for removal.
|
||||
|
@ -969,4 +975,11 @@ class OffsetMenu extends Page<OptionsState.OptionsMenuPageName>
|
|||
preferenceItems.add(item.lefthandText);
|
||||
return item;
|
||||
}
|
||||
|
||||
override public function destroy()
|
||||
{
|
||||
MenuTypedList.pauseInput = false;
|
||||
exitCalibration(true);
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ class OptionsState extends MusicBeatState
|
|||
var options:OptionsMenu = optionsCodex.addPage(Options, new OptionsMenu(saveData));
|
||||
var preferences:PreferencesMenu = optionsCodex.addPage(Preferences, new PreferencesMenu());
|
||||
var controls:ControlsMenu = optionsCodex.addPage(Controls, new ControlsMenu());
|
||||
#if FEATURE_INPUT_OFFSETS
|
||||
#if FEATURE_LAG_ADJUSTMENT
|
||||
var offsets:OffsetMenu = optionsCodex.addPage(Offsets, new OffsetMenu());
|
||||
#end
|
||||
|
||||
|
@ -82,7 +82,7 @@ class OptionsState extends MusicBeatState
|
|||
options.onExit.add(exitToMainMenu);
|
||||
controls.onExit.add(exitControls);
|
||||
preferences.onExit.add(optionsCodex.switchPage.bind(Options));
|
||||
#if FEATURE_INPUT_OFFSETS
|
||||
#if FEATURE_LAG_ADJUSTMENT
|
||||
offsets.onExit.add(exitOffsets);
|
||||
#end
|
||||
saveData.onExit.add(optionsCodex.switchPage.bind(Options));
|
||||
|
@ -138,6 +138,7 @@ class OptionsState extends MusicBeatState
|
|||
{
|
||||
optionsCodex.currentPage.enabled = false;
|
||||
// TODO: Animate this transition?
|
||||
FlxG.keys.enabled = false;
|
||||
FlxG.switchState(() -> new MainMenuState());
|
||||
}
|
||||
}
|
||||
|
@ -174,8 +175,8 @@ class OptionsMenu extends Page<OptionsMenuPageName>
|
|||
// createItem("CONTROL SCHEMES", function() {
|
||||
// FlxG.state.openSubState(new ControlsSchemeMenu());
|
||||
// });
|
||||
#if FEATURE_INPUT_OFFSETS
|
||||
createItem("INPUT OFFSETS", function() {
|
||||
#if FEATURE_LAG_ADJUSTMENT
|
||||
createItem("LAG ADJUSTMENT", function() {
|
||||
FlxG.sound.music.fadeOut(0.5, 0, function(tw) {
|
||||
FunkinSound.playMusic('offsetsLoop',
|
||||
{
|
||||
|
@ -198,7 +199,7 @@ class OptionsMenu extends Page<OptionsMenuPageName>
|
|||
#end
|
||||
#if android
|
||||
createItem("OPEN DATA FOLDER", function() {
|
||||
funkin.mobile.external.android.DataFolderUtil.openDataFolder();
|
||||
funkin.external.android.DataFolderUtil.openDataFolder();
|
||||
});
|
||||
#end
|
||||
#if FEATURE_NEWGROUNDS
|
||||
|
|
|
@ -65,7 +65,6 @@ class PreferencesMenu extends Page<OptionsState.OptionsMenuPageName>
|
|||
createPrefDescription();
|
||||
|
||||
camFollow = new FlxObject(FlxG.width / 2, 0, 140, 70);
|
||||
if (items != null) camFollow.y = items.selectedItem.y;
|
||||
|
||||
menuCamera.follow(camFollow, null, 0.085);
|
||||
var margin = 160;
|
||||
|
@ -73,7 +72,6 @@ class PreferencesMenu extends Page<OptionsState.OptionsMenuPageName>
|
|||
menuCamera.minScrollY = 0;
|
||||
|
||||
items.onChange.add(function(selected) {
|
||||
camFollow.y = selected.y;
|
||||
itemDesc.text = preferenceDesc[items.selectedIndex];
|
||||
});
|
||||
|
||||
|
@ -204,6 +202,9 @@ class PreferencesMenu extends Page<OptionsState.OptionsMenuPageName>
|
|||
{
|
||||
super.update(elapsed);
|
||||
|
||||
// Positions the camera to the selected item.
|
||||
if (items != null) camFollow.y = items.selectedItem.y;
|
||||
|
||||
// Indent the selected item.
|
||||
items.forEach(function(daItem:TextMenuItem) {
|
||||
var thyOffset:Int = 0;
|
||||
|
|
|
@ -148,6 +148,6 @@ class NumberPreferenceItem extends TextMenuItem
|
|||
function toFixed(value:Float):Float
|
||||
{
|
||||
var multiplier:Float = Math.pow(10, precision);
|
||||
return Math.floor(value * multiplier) / multiplier;
|
||||
return Math.round(value * multiplier) / multiplier;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import funkin.ui.transition.stickers.StickerSubState;
|
|||
import funkin.util.MathUtil;
|
||||
import funkin.util.SwipeUtil;
|
||||
import funkin.util.TouchUtil;
|
||||
import openfl.utils.Assets;
|
||||
import funkin.ui.FullScreenScaleMode;
|
||||
#if FEATURE_DISCORD_RPC
|
||||
import funkin.api.discord.DiscordClient;
|
||||
|
@ -605,12 +604,14 @@ class StoryMenuState extends MusicBeatState
|
|||
|
||||
var targetVariation:String = targetSong.getFirstValidVariation(PlayStatePlaylist.campaignDifficulty);
|
||||
|
||||
LoadingState.loadPlayState(
|
||||
{
|
||||
targetSong: targetSong,
|
||||
targetDifficulty: PlayStatePlaylist.campaignDifficulty,
|
||||
targetVariation: targetVariation
|
||||
}, true);
|
||||
FlxG.camera.fade(FlxColor.BLACK, 0.2, false, function() {
|
||||
LoadingState.loadPlayState(
|
||||
{
|
||||
targetSong: targetSong,
|
||||
targetDifficulty: PlayStatePlaylist.campaignDifficulty,
|
||||
targetVariation: targetVariation
|
||||
}, true);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -708,6 +709,7 @@ class StoryMenuState extends MusicBeatState
|
|||
if (exitingMenu || selectedLevel) return;
|
||||
|
||||
exitingMenu = true;
|
||||
FlxG.keys.enabled = false;
|
||||
FlxG.switchState(() -> new MainMenuState());
|
||||
FunkinSound.playOnce(Paths.sound('cancelMenu'));
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ class AttractState extends MusicBeatState
|
|||
}
|
||||
else
|
||||
{
|
||||
holdDelta = Math.max(0, FlxMath.lerp(holdDelta, -0.1, FlxMath.bound(elapsed * 3, 0, 1)));
|
||||
holdDelta = Math.max(0, FlxMath.lerp(holdDelta, -0.1, (elapsed * 3).clamp(0, 1)));
|
||||
pie.scale.x = pie.scale.y = FlxMath.lerp(pie.scale.x, 1, Math.exp(-elapsed * 160.0));
|
||||
}
|
||||
|
||||
|
|
|
@ -228,11 +228,11 @@ class TitleState extends MusicBeatState
|
|||
{
|
||||
FlxG.bitmapLog.add(FlxG.camera.buffer);
|
||||
|
||||
#if desktop
|
||||
#if (desktop || android)
|
||||
// Pressing BACK on the title screen should close the game.
|
||||
// This lets you exit without leaving fullscreen mode.
|
||||
// Only applicable on desktop.
|
||||
if (controls.BACK)
|
||||
// Only applicable on desktop and Android.
|
||||
if (#if android FlxG.android.justReleased.BACK || #end controls.BACK)
|
||||
{
|
||||
openfl.Lib.application.window.close();
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ class TitleState extends MusicBeatState
|
|||
|
||||
if (gamepad != null)
|
||||
{
|
||||
if (gamepad.justPressed.START) pressedEnter = true;
|
||||
if (gamepad.justPressed.START || gamepad.justPressed.ACCEPT) pressedEnter = true;
|
||||
}
|
||||
|
||||
// If you spam Enter, we should skip the transition.
|
||||
|
|
|
@ -12,6 +12,7 @@ import funkin.graphics.shaders.ScreenWipeShader;
|
|||
import funkin.play.PlayState;
|
||||
import funkin.play.PlayStatePlaylist;
|
||||
import funkin.play.song.Song.SongDifficulty;
|
||||
import funkin.play.stage.Stage;
|
||||
import haxe.io.Path;
|
||||
import lime.app.Future;
|
||||
import lime.app.Promise;
|
||||
|
@ -21,6 +22,7 @@ import lime.utils.Assets as LimeAssets;
|
|||
import openfl.filters.ShaderFilter;
|
||||
import openfl.utils.Assets as OpenFLAssets;
|
||||
|
||||
@:nullSafety
|
||||
class LoadingState extends MusicBeatSubState
|
||||
{
|
||||
inline static var MIN_TIME = 1.0;
|
||||
|
@ -30,18 +32,21 @@ class LoadingState extends MusicBeatSubState
|
|||
var target:NextState;
|
||||
var playParams:Null<PlayStateParams>;
|
||||
var stopMusic:Bool = false;
|
||||
var callbacks:MultiCallback;
|
||||
var callbacks:Null<MultiCallback>;
|
||||
var danceLeft:Bool = false;
|
||||
|
||||
var loadBar:FlxSprite;
|
||||
var funkay:FlxSprite;
|
||||
|
||||
function new(target:NextState, stopMusic:Bool, playParams:Null<PlayStateParams> = null)
|
||||
function new(target:NextState, stopMusic:Bool, ?playParams:PlayStateParams)
|
||||
{
|
||||
super();
|
||||
this.target = target;
|
||||
this.playParams = playParams;
|
||||
this.stopMusic = stopMusic;
|
||||
|
||||
this.loadBar = new FunkinSprite(0, FlxG.height - 20).makeSolidColor(0, 10, 0xFFff16d2);
|
||||
this.funkay = FunkinSprite.create('funkay');
|
||||
}
|
||||
|
||||
override function create():Void
|
||||
|
@ -49,14 +54,12 @@ class LoadingState extends MusicBeatSubState
|
|||
var bg:FunkinSprite = new FunkinSprite().makeSolidColor(FlxG.width, FlxG.height, 0xFFcaff4d);
|
||||
add(bg);
|
||||
|
||||
funkay = FunkinSprite.create('funkay');
|
||||
funkay.setGraphicSize(0, FlxG.height);
|
||||
funkay.updateHitbox();
|
||||
add(funkay);
|
||||
funkay.scrollFactor.set();
|
||||
funkay.screenCenter();
|
||||
|
||||
loadBar = new FunkinSprite(0, FlxG.height - 20).makeSolidColor(0, 10, 0xFFff16d2);
|
||||
add(loadBar);
|
||||
|
||||
initSongsManifest().onComplete(function(lib) {
|
||||
|
@ -66,15 +69,21 @@ class LoadingState extends MusicBeatSubState
|
|||
if (playParams != null)
|
||||
{
|
||||
// Load and cache the song's charts.
|
||||
if (playParams.targetSong != null)
|
||||
if (playParams.targetSong == null)
|
||||
{
|
||||
playParams.targetSong.cacheCharts(true);
|
||||
throw 'Invalid parameter: Target song should not be null';
|
||||
}
|
||||
|
||||
playParams.targetSong.cacheCharts(true);
|
||||
|
||||
// Preload the song for the play state.
|
||||
var difficulty:String = playParams.targetDifficulty ?? Constants.DEFAULT_DIFFICULTY;
|
||||
var variation:String = playParams.targetVariation ?? Constants.DEFAULT_VARIATION;
|
||||
var targetChart:SongDifficulty = playParams.targetSong?.getDifficulty(difficulty, variation);
|
||||
var targetChart:Null<SongDifficulty> = playParams.targetSong.getDifficulty(difficulty, variation);
|
||||
if (targetChart == null)
|
||||
{
|
||||
throw 'Couldn\'t retrieve chart data for song "${playParams.targetSong.songName}" on difficulty "$difficulty" and variation "$variation"';
|
||||
}
|
||||
var instPath:String = targetChart.getInstPath(playParams.targetInstrumental);
|
||||
var voicesPaths:Array<String> = targetChart.buildVoiceList();
|
||||
|
||||
|
@ -105,9 +114,9 @@ class LoadingState extends MusicBeatSubState
|
|||
// library.types.set(symbolPath, SOUND);
|
||||
// @:privateAccess
|
||||
// library.pathGroups.set(symbolPath, [library.__cacheBreak(symbolPath)]);
|
||||
var callback = callbacks.add('song:' + path);
|
||||
var callback = callbacks?.add('song:' + path);
|
||||
Assets.loadSound(path).onComplete(function(_) {
|
||||
callback();
|
||||
if (callback != null) callback();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -120,9 +129,9 @@ class LoadingState extends MusicBeatSubState
|
|||
@:privateAccess
|
||||
if (!LimeAssets.libraryPaths.exists(library)) throw 'Missing library: ' + library;
|
||||
|
||||
var callback = callbacks.add('library:' + library);
|
||||
var callback = callbacks?.add('library:' + library);
|
||||
Assets.loadLibrary(library).onComplete(function(_) {
|
||||
callback();
|
||||
if (callback != null) callback();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -177,6 +186,7 @@ class LoadingState extends MusicBeatSubState
|
|||
function onLoad():Void
|
||||
{
|
||||
// Stop the instrumental.
|
||||
@:nullSafety(Off)
|
||||
if (stopMusic && FlxG.sound.music != null)
|
||||
{
|
||||
FlxG.sound.music.destroy();
|
||||
|
@ -197,7 +207,7 @@ class LoadingState extends MusicBeatSubState
|
|||
|
||||
static function getSongPath():String
|
||||
{
|
||||
return Paths.inst(PlayState.instance.currentSong.id);
|
||||
return Paths.inst(PlayState.instance?.currentSong.id ?? throw 'Cannot retrieve song path');
|
||||
}
|
||||
|
||||
static var stageDirectory:String = "shared";
|
||||
|
@ -211,10 +221,10 @@ class LoadingState extends MusicBeatSubState
|
|||
*/
|
||||
public static function loadPlayState(params:PlayStateParams, shouldStopMusic = false, asSubState = false, ?onConstruct:PlayState->Void):Void
|
||||
{
|
||||
var daChart:Null<SongDifficulty> = params.targetSong.getDifficulty(params.targetDifficulty ?? Constants.DEFAULT_DIFFICULTY,
|
||||
var daChart:Null<SongDifficulty> = params.targetSong?.getDifficulty(params.targetDifficulty ?? Constants.DEFAULT_DIFFICULTY,
|
||||
params.targetVariation ?? Constants.DEFAULT_VARIATION);
|
||||
|
||||
var daStage = funkin.data.stage.StageRegistry.instance.fetchEntry(daChart?.stage ?? Constants.DEFAULT_STAGE);
|
||||
var daStage:Null<Stage> = funkin.data.stage.StageRegistry.instance.fetchEntry(daChart?.stage ?? Constants.DEFAULT_STAGE);
|
||||
stageDirectory = daStage?._data?.directory ?? "shared";
|
||||
Paths.setCurrentLevel(stageDirectory);
|
||||
|
||||
|
@ -249,6 +259,7 @@ class LoadingState extends MusicBeatSubState
|
|||
}
|
||||
#else
|
||||
// All assets preloaded, switch directly to play state (defualt on other targets).
|
||||
@:nullSafety(Off)
|
||||
if (shouldStopMusic && FlxG.sound.music != null)
|
||||
{
|
||||
FlxG.sound.music.destroy();
|
||||
|
@ -257,7 +268,7 @@ class LoadingState extends MusicBeatSubState
|
|||
|
||||
// Load and cache the song's charts.
|
||||
// Don't do this if we already provided the music and charts.
|
||||
if (params?.targetSong != null && !params.overrideMusic)
|
||||
if (!(params.overrideMusic ?? false))
|
||||
{
|
||||
params.targetSong.cacheCharts(true);
|
||||
}
|
||||
|
@ -272,7 +283,8 @@ class LoadingState extends MusicBeatSubState
|
|||
var songDifficulty = params.targetSong.getDifficulty(params.targetDifficulty, params.targetVariation);
|
||||
if (songDifficulty != null)
|
||||
{
|
||||
var noteStyle = NoteStyleRegistry.instance.fetchEntry(songDifficulty.noteStyle);
|
||||
var noteStyle = NoteStyleRegistry.instance.fetchEntry(songDifficulty.noteStyle ?? '');
|
||||
if (noteStyle == null) noteStyle = NoteStyleRegistry.instance.fetchDefault();
|
||||
FunkinMemory.cacheNoteStyle(noteStyle);
|
||||
}
|
||||
|
||||
|
@ -439,7 +451,7 @@ class LoadingState extends MusicBeatSubState
|
|||
var libraryPaths = LimeAssets.libraryPaths;
|
||||
if (libraryPaths.exists(id))
|
||||
{
|
||||
path = libraryPaths[id];
|
||||
path = libraryPaths[id] ?? path;
|
||||
rootPath = Path.directory(path);
|
||||
}
|
||||
else
|
||||
|
@ -490,17 +502,18 @@ class LoadingState extends MusicBeatSubState
|
|||
}
|
||||
}
|
||||
|
||||
@:nullSafety
|
||||
class MultiCallback
|
||||
{
|
||||
public var callback:Void->Void;
|
||||
public var logId:String = null;
|
||||
public var logId:Null<String>;
|
||||
public var length(default, null) = 0;
|
||||
public var numRemaining(default, null) = 0;
|
||||
|
||||
var unfired = new Map<String, Void->Void>();
|
||||
var fired = new Array<String>();
|
||||
|
||||
public function new(callback:Void->Void, logId:String = null)
|
||||
public function new(callback:Void->Void, ?logId:String)
|
||||
{
|
||||
this.callback = callback;
|
||||
this.logId = logId;
|
||||
|
@ -511,8 +524,7 @@ class MultiCallback
|
|||
id = '$length:$id';
|
||||
length++;
|
||||
numRemaining++;
|
||||
var func:Void->Void = null;
|
||||
func = function() {
|
||||
var func:Void->Void = function() {
|
||||
if (unfired.exists(id))
|
||||
{
|
||||
unfired.remove(id);
|
||||
|
|
|
@ -44,7 +44,7 @@ class HapticUtil
|
|||
final hapticsModes:Array<HapticsMode> = targetHapticsModes ?? [HapticsMode.ALL];
|
||||
if (!hapticsModes.contains(Preferences.hapticsMode)) return;
|
||||
|
||||
final amplitudeValue = FlxMath.bound(amplitude * Preferences.hapticsIntensityMultiplier, 0, Constants.MAX_VIBRATION_AMPLITUDE);
|
||||
final amplitudeValue = (amplitude * Preferences.hapticsIntensityMultiplier).clamp(0, Constants.MAX_VIBRATION_AMPLITUDE);
|
||||
|
||||
if (period > 0)
|
||||
{
|
||||
|
|
|
@ -7,13 +7,6 @@ using StringTools;
|
|||
/**
|
||||
* Utilities for operating on the current window, such as changing the title.
|
||||
*/
|
||||
#if (cpp && windows)
|
||||
@:cppFileCode('
|
||||
#include <iostream>
|
||||
#include <windows.h>
|
||||
#include <psapi.h>
|
||||
')
|
||||
#end
|
||||
@:nullSafety
|
||||
class WindowUtil
|
||||
{
|
||||
|
@ -122,7 +115,7 @@ class WindowUtil
|
|||
windowExit.dispatch(exitCode);
|
||||
});
|
||||
|
||||
#if desktop
|
||||
#if (desktop || html5)
|
||||
openfl.Lib.current.stage.addEventListener(openfl.events.KeyboardEvent.KEY_DOWN, (e:openfl.events.KeyboardEvent) -> {
|
||||
for (key in PlayerSettings.player1.controls.getKeysForAction(WINDOW_FULLSCREEN))
|
||||
{
|
||||
|
@ -147,18 +140,6 @@ class WindowUtil
|
|||
_initializedWindowEvents = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns off that annoying "Report to Microsoft" dialog that pops up when the game crashes.
|
||||
*/
|
||||
public static function disableCrashHandler():Void
|
||||
{
|
||||
#if (cpp && windows)
|
||||
untyped __cpp__('SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);');
|
||||
#else
|
||||
// Do nothing.
|
||||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the title of the application window.
|
||||
* @param value The title to use.
|
||||
|
@ -168,6 +149,62 @@ class WindowUtil
|
|||
lime.app.Application.current.window.title = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows an error dialog with an error icon.
|
||||
* @param name The title of the dialog window.
|
||||
* @param desc The error message to display.
|
||||
*/
|
||||
public static function showError(name:String, desc:String):Void
|
||||
{
|
||||
#if (windows && cpp)
|
||||
funkin.external.windows.WinAPI.showError(desc, name);
|
||||
#else
|
||||
lime.app.Application.current.window.alert(desc, name);
|
||||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a warning dialog with a warning icon.
|
||||
* @param name The title of the dialog window.
|
||||
* @param desc The warning message to display.
|
||||
*/
|
||||
public static function showWarning(name:String, desc:String):Void
|
||||
{
|
||||
#if (windows && cpp)
|
||||
funkin.external.windows.WinAPI.showWarning(desc, name);
|
||||
#else
|
||||
lime.app.Application.current.window.alert(desc, name);
|
||||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows an information dialog with an information icon.
|
||||
* @param name The title of the dialog window.
|
||||
* @param desc The information message to display.
|
||||
*/
|
||||
public static function showInformation(name:String, desc:String):Void
|
||||
{
|
||||
#if (windows && cpp)
|
||||
funkin.external.windows.WinAPI.showInformation(desc, name);
|
||||
#else
|
||||
lime.app.Application.current.window.alert(desc, name);
|
||||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a question dialog with a question icon and OK/Cancel buttons.
|
||||
* @param name The title of the dialog window.
|
||||
* @param desc The question message to display.
|
||||
*/
|
||||
public static function showQuestion(name:String, desc:String):Void
|
||||
{
|
||||
#if (windows && cpp)
|
||||
funkin.external.windows.WinAPI.showQuestion(desc, name);
|
||||
#else
|
||||
lime.app.Application.current.window.alert(desc, name);
|
||||
#end
|
||||
}
|
||||
|
||||
public static function setVSyncMode(value:lime.ui.WindowVSyncMode):Void
|
||||
{
|
||||
// vsync crap dont worky on mac rn derp
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue