This commit is contained in:
lunarcleint
2024-03-19 04:37:38 -07:00
94 changed files with 1312 additions and 370 deletions
+9 -6
View File
@@ -2,6 +2,7 @@
name: Linux Build
on:
push:
workflow_dispatch:
jobs:
build:
name: Linux Build
@@ -34,16 +35,18 @@ jobs:
- name: Building the game
run: |
haxelib run lime build linux
- name: Tar files
run: tar -zcvf CodenameEngine.tar.gz export/release/linux/bin
- name: Uploading artifact (entire build)
uses: actions/upload-artifact@v2
with:
name: Codename Engine
path: export/release/linux/bin
- name: Uploading artifact (executable)
uses: actions/upload-artifact@v2
with:
name: Update-Linux
path: export/release/linux/bin/CodenameEngine
path: CodenameEngine.tar.gz
# - name: Uploading artifact (executable)
# uses: actions/upload-artifact@v2
# with:
# name: Update-Linux
# path: export/release/linux/bin/CodenameEngine
- name: Clearing already existing cache
uses: actions/github-script@v6
with:
+9 -6
View File
@@ -2,6 +2,7 @@
name: Mac OS Build
on:
push:
workflow_dispatch:
jobs:
build:
name: Mac OS Build
@@ -31,16 +32,18 @@ jobs:
- name: Building the game
run: |
haxelib run lime build mac
- name: Tar files
run: tar -zcvf CodenameEngine.tar.gz export/release/macos/bin
- name: Uploading artifact (entire build)
uses: actions/upload-artifact@v2
with:
name: Codename Engine
path: export/release/macos/bin
- name: Uploading artifact (executable)
uses: actions/upload-artifact@v2
with:
name: Update-Mac
path: export/release/macos/bin/CodenameEngine
path: CodenameEngine.tar.gz
# - name: Uploading artifact (executable)
# uses: actions/upload-artifact@v2
# with:
# name: Update-Mac
# path: export/release/macos/bin/CodenameEngine
- name: Clearing already existing cache
uses: actions/github-script@v6
with:
+5 -5
View File
@@ -37,11 +37,11 @@ jobs:
with:
name: Codename Engine
path: export/release/windows/bin
- name: Uploading artifact (executable)
uses: actions/upload-artifact@v2
with:
name: Update-Windows
path: export/release/windows/bin/CodenameEngine.exe
# - name: Uploading artifact (executable)
# uses: actions/upload-artifact@v2
# with:
# name: Update-Windows
# path: export/release/windows/bin/CodenameEngine.exe
- name: Clearing already existing cache
uses: actions/github-script@v6
with:
+2 -2
View File
@@ -1,6 +1,6 @@
{
"editor.detectIndentation": false,
"editor.insertSpaces": false,
"editor.detectIndentation": false,
"editor.insertSpaces": false,
"files.associations": {
"*.hx": "haxe",
"*.hscript": "haxe",
+2 -2
View File
@@ -5,7 +5,7 @@ _**QOL = Quality of Life**_
<details>
<summary><h2>Player QOL Features</h2></summary>
- New input system
- New accuracy and misses system, added to fix the base game UI.
- New options, including:
@@ -72,7 +72,7 @@ _**QOL = Quality of Life**_
- Weeks are located in `data/weeks/weeks/`
- If you need to rearrange the weeks in-game, you can use the `data/weeks/weeks.txt` file.
- Editors for Charts and Characters (Stage coming soon)
- Undos/Redos supported
- Undos/Redos supported
- Warning on closing unsaved work
- Clean UI (for ocd freaks)
- Mature Chart editor (Character editor rework soon)
+27 -27
View File
@@ -1,30 +1,30 @@
__ /
/ _ _ |_ |_ . _
\__) (- |_ |_ | | )
__
|_ _ _ _ |
| | (- (_| |( \/
/
_ _ _
(_) | ) (_|
__
|_ _ . _| _ _ . _ |_ |_ _ _ |_
| | | (_| (_| \/ | ) | (_) | ) |_ \/ (- (_| | )
/ _/ /
__ /
/ _ _ |_ |_ . _
\__) (- |_ |_ | | )
__
|_ _ _ _ |
| | (- (_| |( \/
/
_ _ _
(_) | ) (_|
__
|_ _ . _| _ _ . _ |_ |_ _ _ |_
| | | (_| (_| \/ | ) | (_) | ) |_ \/ (- (_| | )
/ _/ /
HEY
Thanks for downloadin Friday Night FUNKIN'
If you downloaded this from any other place than ninja-muffin24.itch.io/FUNKIN
You might be in DANGER!!!
You might be in DANGER!!!
The Itch.io release is the only official source for the desktop (PC, Mac, Linux) versions of the game!
As of right now, the game is FREE! If you paid for it, you got SCAMMED!
Now that that's out of the way....
THANKS FOR DOWNLOADIN.
THANKS FOR DOWNLOADIN.
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-
PERMISSIONS XDDDD
@@ -77,16 +77,16 @@ I love Tom Fulp.
- Cameron ♪(´▽`)
##################################################################################
_ _ _____ _ _ ____ ____ ___ _ _ _ _ ____ ____
| \ | | | ____| | | | | / ___| | _ \ / _ \ | | | | | \ | | | _ \ / ___|
| \| | | _| | | /\ | | | | _ | |_) | | | | | | | | | | \| | | | | | \___ \
_ _ _____ _ _ ____ ____ ___ _ _ _ _ ____ ____
| \ | | | ____| | | | | / ___| | _ \ / _ \ | | | | | \ | | | _ \ / ___|
| \| | | _| | | /\ | | | | _ | |_) | | | | | | | | | | \| | | | | | \___ \
| |\ | | |___ \ V V / | |_| | | _ < | |_| | | |_| | | |\ | | |_| | ___) |
|_| \_| |_____| \_/\_/ \____| |_| \_\ \___/ \___/ |_| \_| |____/ |____/
_ _ _ ___ ___ __ _ _ _ _ _
|_ | | |_ |_) \_/ | |_| | |\ | /__ |_ |_ | | |_ |_) \_/ / \ |\ | |_
|_| \_| |_____| \_/\_/ \____| |_| \_\ \___/ \___/ |_| \_| |____/ |____/
_ _ _ ___ ___ __ _ _ _ _ _
|_ | | |_ |_) \_/ | |_| | |\ | /__ |_ |_ | | |_ |_) \_/ / \ |\ | |_
|_ \/ |_ | \ | | | | _|_ | \| \_| o |_)\/ |_ \/ |_ | \ | \_/ | \| |_ o
/ /
/ /
##################################################################################
i stole this from stamper.
+1 -1
View File
@@ -1,3 +1,3 @@
//
function update(elapsed:Float)
if (FlxG.keys.justPressed.F5) FlxG.resetState();
if (FlxG.keys.justPressed.F5) FlxG.resetState();
+2 -2
View File
@@ -35,8 +35,8 @@ function onNoteCreation(event) {
note.updateHitbox();
}
function onPostNoteCreation(event) {
var splashes = event.note;
function onPostNoteCreation(event) {
var splashes = event.note;
if (pixelSplashes)
splashes.splash = "pixel-default";
}
+1 -1
View File
@@ -1,5 +1,5 @@
<!DOCTYPE codename-engine-splashes>
<splashes sprite="game/splashes/default" alpha="0.6">
<splashes sprite="game/splashes/default" alpha="0.6">
<strum id="0"> <!-- LEFT -->
<anim name="splashleft1" anim="note impact 1 purple" fps="24" x="0" y="0" />
<anim name="splashleft2" anim="note impact 2 purple" fps="24" x="0" y="0" />
+1 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE codename-engine-splashes>
<!--Pixel Splashes by APurples!!-->
<splashes sprite="stages/school/ui/pixel-splashes" alpha="0.6" antialiasing="false" scale="3.5">
<splashes sprite="stages/school/ui/pixel-splashes" alpha="0.6" antialiasing="false" scale="3.5">
<strum id="0"> <!-- LEFT -->
<anim name="splashleft1" anim="splash purple 1" fps="24" x="-1" y="-2" />
<anim name="splashleft2" anim="splash purple 2" fps="24" x="-1" y="-2" />
+1 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE codename-engine-splashes>
<!--Pixel Splashes by APurples!!-->
<splashes sprite="stages/school/ui/pixel-secret-splashes" alpha="0.6" antialiasing="false" scale="3.5">
<splashes sprite="stages/school/ui/pixel-secret-splashes" alpha="0.6" antialiasing="false" scale="3.5">
<strum id="0"> <!-- LEFT -->
<anim name="splashleft1" anim="splash purple 1" fps="24" x="-3"/>
</strum>
+1 -1
View File
@@ -1,5 +1,5 @@
<!DOCTYPE codename-engine-splashes>
<splashes sprite="game/splashes/secret" alpha="0.6" scale="0.75">
<splashes sprite="game/splashes/secret" alpha="0.6" scale="0.75">
<strum id="0"> <!-- LEFT -->
<anim name="splash purple" anim="splash purple" fps="24" x="0" y="0" />
</strum>
+5 -5
View File
@@ -7,23 +7,23 @@
<!-- ONLY FOR INSTANCES WITH LOW MEMORY MODE DISABLED -->
<high-memory>
<!-- DANCERS !-->
<sprite name="dancer1" x="130" y="80" sprite="limoDancer" scroll="0.4" zoomfactor="0.55" type="onbeat">
<sprite name="dancer1" x="130" y="80" sprite="limoDancer" scroll="0.4" zoomfactor="0.55" type="onbeat" beatInterval="1">
<anim name="danceLeft" anim="bg dancer sketch PINK" loop="false" indices="0,1,2,3,4,5,6,7,8,9,10,11,12,13,14" />
<anim name="danceRight" anim="bg dancer sketch PINK" loop="false" indices="15,16,17,18,19,20,21,22,23,24,25,26,27,28,29" />
</sprite>
<sprite name="dancer2" x="500" y="80" sprite="limoDancer" scroll="0.4" zoomfactor="0.55" type="onbeat">
<sprite name="dancer2" x="500" y="80" sprite="limoDancer" scroll="0.4" zoomfactor="0.55" type="onbeat" beatInterval="1">
<anim name="danceLeft" anim="bg dancer sketch PINK" loop="false" indices="0,1,2,3,4,5,6,7,8,9,10,11,12,13,14" />
<anim name="danceRight" anim="bg dancer sketch PINK" loop="false" indices="15,16,17,18,19,20,21,22,23,24,25,26,27,28,29" />
</sprite>
<sprite name="dancer3" x="870" y="80" sprite="limoDancer" scroll="0.4" zoomfactor="0.55" type="onbeat">
<sprite name="dancer3" x="870" y="80" sprite="limoDancer" scroll="0.4" zoomfactor="0.55" type="onbeat" beatInterval="1">
<anim name="danceLeft" anim="bg dancer sketch PINK" loop="false" indices="0,1,2,3,4,5,6,7,8,9,10,11,12,13,14" />
<anim name="danceRight" anim="bg dancer sketch PINK" loop="false" indices="15,16,17,18,19,20,21,22,23,24,25,26,27,28,29" />
</sprite>
<sprite name="dancer4" x="1240" y="80" sprite="limoDancer" scroll="0.4" zoomfactor="0.55" type="onbeat">
<sprite name="dancer4" x="1240" y="80" sprite="limoDancer" scroll="0.4" zoomfactor="0.55" type="onbeat" beatInterval="1">
<anim name="danceLeft" anim="bg dancer sketch PINK" loop="false" indices="0,1,2,3,4,5,6,7,8,9,10,11,12,13,14" />
<anim name="danceRight" anim="bg dancer sketch PINK" loop="false" indices="15,16,17,18,19,20,21,22,23,24,25,26,27,28,29" />
</sprite>
<sprite name="dancer5" x="1610" y="80" sprite="limoDancer" scroll="0.4" zoomfactor="0.55" type="onbeat">
<sprite name="dancer5" x="1610" y="80" sprite="limoDancer" scroll="0.4" zoomfactor="0.55" type="onbeat" beatInterval="1">
<anim name="danceLeft" anim="bg dancer sketch PINK" loop="false" indices="0,1,2,3,4,5,6,7,8,9,10,11,12,13,14" />
<anim name="danceRight" anim="bg dancer sketch PINK" loop="false" indices="15,16,17,18,19,20,21,22,23,24,25,26,27,28,29" />
</sprite>
+5 -5
View File
@@ -1,17 +1,17 @@
<!DOCTYPE codename-engine-stage>
<stage zoom="0.8" name="mall" folder="stages/mall/" startCamPosY="450" startCamPosX="500">
<sprite name="bg" x="-1000" y="-500" sprite="bgWalls" scroll="0.2"/>
<high-memory>
<sprite name="upperBoppers" x="-240" y="-90" sprite="upperBop" scroll="0.2" type="onbeat"/>
<sprite name="upperBoppers" x="-240" y="-90" sprite="upperBop" scroll="0.2" type="onbeat" beatInterval="1"/>
</high-memory>
<sprite name="bgEscalator" x="-1100" y="-600" sprite="bgEscalator" scroll="0.3" scale="0.9" updateHitbox="true"/>
<sprite name="tree" x="370" y="-250" sprite="christmasTree" scroll="0.4"/>
<sprite name="bottomBoppers" x="-300" y="140" sprite="bottomBop" scroll="0.9" type="onbeat" />
<sprite name="bottomBoppers" x="-300" y="140" sprite="bottomBop" scroll="0.9" type="onbeat" beatInterval="1"/>
<sprite name="fgSnow" x="-600" y="700" sprite="fgSnow"/>
<high-memory>
<sprite name="santa" x="-840" y="150" sprite="santa" type="onbeat"/>
<sprite name="santa" x="-840" y="150" sprite="santa" type="onbeat" beatInterval="1"/>
</high-memory>
+8 -8
View File
@@ -15,7 +15,7 @@
<high-memory>
<sprite name="smokeLeft" x="-200" y="-100" sprite="smokeLeft" scroll="0.4" zoomfactor="0.6"/>
<sprite name="smokeRight" x="1100" y="-100" sprite="smokeRight" scroll="0.4" zoomfactor="0.6"/>
<sprite name="tankWatchtower" x="100" y="50" sprite="tankWatchtower" scroll="0.5" type="onbeat" beatInterval="2" zoomfactor="0.7"/>
<sprite name="tankWatchtower" x="100" y="50" sprite="tankWatchtower" scroll="0.5" type="onbeat" zoomfactor="0.7"/>
</high-memory>
<sprite name="tankRolling" x="300" y="300" sprite="tankRolling" scroll="0.5" zoomfactor="0.8" type="loop"/>
<sprite name="tankGround" x="-420" y="-150" sprite="tankGround" scale="1.15" updateHitbox="true" zoomfactor="1.0"/>
@@ -26,13 +26,13 @@
<boyfriend x="810"/>
<!-- FOREGROUND TANKMANS -->
<high-memory>
<sprite name="tank0" x="-500" y="650" sprite="tank0" scrollx="1.7" scrolly="1.5" type="onbeat" beatInterval="2" zoomfactor="1.25"/>
<sprite name="tank1" x="-300" y="750" sprite="tank1" scrollx="2" scrolly="0.2" type="onbeat" beatInterval="2" zoomfactor="1.25"/>
<sprite name="tank2" x="450" y="940" sprite="tank2" scroll="1.5" type="onbeat" beatInterval="2" zoomfactor="1.25"/>
<sprite name="tank4" x="1300" y="900" sprite="tank4" scroll="1.5" type="onbeat" beatInterval="2" zoomfactor="1.25"/>
<sprite name="tank5" x="1620" y="700" sprite="tank5" scroll="1.5" type="onbeat" beatInterval="2" zoomfactor="1.25"/>
<sprite name="tank3" x="1300" y="1200" sprite="tank3" scrollx="3.5" scrolly="2.5" type="onbeat" beatInterval="2" zoomfactor="1.25"/>
<sprite name="tank0" x="-500" y="650" sprite="tank0" scrollx="1.7" scrolly="1.5" type="onbeat" zoomfactor="1.25"/>
<sprite name="tank1" x="-300" y="750" sprite="tank1" scrollx="2" scrolly="0.2" type="onbeat" zoomfactor="1.25"/>
<sprite name="tank2" x="450" y="940" sprite="tank2" scroll="1.5" type="onbeat" zoomfactor="1.25"/>
<sprite name="tank4" x="1300" y="900" sprite="tank4" scroll="1.5" type="onbeat" zoomfactor="1.25"/>
<sprite name="tank5" x="1620" y="700" sprite="tank5" scroll="1.5" type="onbeat" zoomfactor="1.25"/>
<sprite name="tank3" x="1300" y="1200" sprite="tank3" scrollx="3.5" scrolly="2.5" type="onbeat" zoomfactor="1.25"/>
</high-memory>
</stage>
@@ -10,7 +10,7 @@
<SubTexture name="add-bottomleft" x="0" y="30" width="11" height="4"/>
<SubTexture name="add-bottom" x="11" y="30" width="19" height="4"/>
<SubTexture name="add-bottomright" x="30" y="30" width="18" height="4"/>
<SubTexture name="edit-topleft" x="0" y="34" width="11" height="4"/>
<SubTexture name="edit-top" x="11" y="34" width="19" height="4"/>
<SubTexture name="edit-topright" x="30" y="34" width="18" height="4"/>
+1 -1
View File
@@ -8,7 +8,7 @@
<SubTexture name="middleleft" x="0" y="1" width="1" height="21"/>
<SubTexture name="middle" x="1" y="1" width="94" height="21"/>
<SubTexture name="middleright" x="95" y="1" width="1" height="21"/>
<SubTexture name="bottomleft" x="0" y="22" width="1" height="1"/>
<SubTexture name="bottom" x="1" y="22" width="94" height="1"/>
<SubTexture name="bottomright" x="95" y="22" width="1" height="1"/>
+7 -7
View File
@@ -6,12 +6,12 @@ uniform vec2 blueOff;
void main()
{
vec2 uv = getCamPos(openfl_TextureCoordv);
vec4 col;
col.r = textureCam(bitmap, uv + redOff).r;
col.g = textureCam(bitmap, uv + greenOff).g;
col.b = textureCam(bitmap, uv + blueOff).b;
col.a = texture2D(bitmap, openfl_TextureCoordv).a;
vec2 uv = getCamPos(openfl_TextureCoordv);
vec4 col;
col.r = textureCam(bitmap, uv + redOff).r;
col.g = textureCam(bitmap, uv + greenOff).g;
col.b = textureCam(bitmap, uv + blueOff).b;
col.a = texture2D(bitmap, openfl_TextureCoordv).a;
gl_FragColor = col;
gl_FragColor = col;
}
+3 -3
View File
@@ -6,10 +6,10 @@ uniform float strength;
void main() {
vec2 uv = getCamPos(openfl_TextureCoordv);
vec3 col = pow(textureCam(bitmap, uv).rgb, vec3(1.0 / strength));
vec3 col = pow(textureCam(bitmap, uv).rgb, vec3(1.0 / strength));
float vignette = mix(1.0, 1.0 - amount, distance(uv, vec2(0.5)));
col = pow(mix(col * color, col, vignette), vec3(strength));
float vignette = mix(1.0, 1.0 - amount, distance(uv, vec2(0.5)));
col = pow(mix(col * color, col, vignette), vec3(strength));
gl_FragColor = vec4(col, 1.0);
}
+3 -3
View File
@@ -3,9 +3,9 @@
// Used in colorwheel
vec3 hsvToRgb(vec3 c) { //hsv.x = hue, hsv.y = saturation, hsv.z = value
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
uniform float hue;
+4 -4
View File
@@ -21,7 +21,7 @@ function postUpdate(elapsed) {
}
}
// for(s in strumLines) {
// for(i in 0...4) {
// var n = s.members[i];
@@ -29,7 +29,7 @@ function postUpdate(elapsed) {
// n.angle = 180;
// }
// }
// if (curSection != null)
// defaultCamZoom = curSection.mustHitSection ? 0.9 : 0.5;
// if (curSection != null)
// defaultCamZoom = curSection.mustHitSection ? 0.9 : 0.5;
}
+1 -1
View File
@@ -1 +1 @@
{"events":[{"params":[1],"time":0,"type":1},{"params":[0],"time":9600,"type":1},{"params":[1],"time":14400,"type":1},{"params":[0],"time":19200,"type":1},{"params":[1],"time":24000,"type":1},{"params":[0],"time":28800,"type":1},{"params":[1],"time":33600,"type":1},{"params":[0],"time":38400,"type":1},{"params":[1],"time":43200,"type":1},{"params":[0],"time":48000,"type":1},{"params":[1],"time":50400,"type":1}],"strumLines":[{"notes":[{"id":0,"sLen":0,"time":9600,"type":0},{"id":3,"sLen":0,"time":10800,"type":0},{"id":0,"sLen":0,"time":12000,"type":0},{"id":3,"sLen":0,"time":13200,"type":0},{"id":2,"sLen":0,"time":19200,"type":0},{"id":1,"sLen":0,"time":20400,"type":0},{"id":2,"sLen":0,"time":21600,"type":0},{"id":1,"sLen":0,"time":22800,"type":0},{"id":0,"sLen":0,"time":28800,"type":0},{"id":2,"sLen":0,"time":30000,"type":0},{"id":1,"sLen":0,"time":31200,"type":0},{"id":3,"sLen":0,"time":32400,"type":0},{"id":1,"sLen":0,"time":38400,"type":0},{"id":1,"sLen":0,"time":39000,"type":0},{"id":2,"sLen":0,"time":39600,"type":0},{"id":1,"sLen":0,"time":40800,"type":0},{"id":1,"sLen":0,"time":41400,"type":0},{"id":3,"sLen":0,"time":42000,"type":0},{"id":1,"sLen":0,"time":48000,"type":0},{"id":2,"sLen":0,"time":48300,"type":0},{"id":3,"sLen":0,"time":48600,"type":0},{"id":2,"sLen":0,"time":48900,"type":0},{"id":3,"sLen":0,"time":49800,"type":0}],"position":"girlfriend","type":0,"characters":["gf"]},{"notes":[{"id":0,"sLen":0,"time":14400,"type":0},{"id":3,"sLen":0,"time":15600,"type":0},{"id":0,"sLen":0,"time":16800,"type":0},{"id":3,"sLen":0,"time":18000,"type":0},{"id":2,"sLen":0,"time":24000,"type":0},{"id":1,"sLen":0,"time":25200,"type":0},{"id":2,"sLen":0,"time":26400,"type":0},{"id":1,"sLen":0,"time":27600,"type":0},{"id":0,"sLen":0,"time":33600,"type":0},{"id":2,"sLen":0,"time":34800,"type":0},{"id":1,"sLen":0,"time":36000,"type":0},{"id":3,"sLen":0,"time":37200,"type":0},{"id":1,"sLen":0,"time":43200,"type":0},{"id":1,"sLen":0,"time":43800,"type":0},{"id":2,"sLen":0,"time":44400,"type":0},{"id":1,"sLen":0,"time":45600,"type":0},{"id":1,"sLen":0,"time":46200,"type":0},{"id":3,"sLen":0,"time":46800,"type":0},{"id":1,"sLen":0,"time":50400,"type":0},{"id":2,"sLen":0,"time":50700,"type":0},{"id":3,"sLen":0,"time":51000,"type":0},{"id":2,"sLen":0,"time":51300,"type":0},{"id":3,"sLen":0,"time":52200,"type":0},{"id":3,"sLen":0,"time":52800,"type":0},{"id":1,"sLen":0,"time":53400,"type":0},{"id":0,"sLen":0,"time":54000,"type":0},{"id":1,"sLen":0,"time":54600,"type":0},{"id":2,"sLen":0,"time":55200,"type":0},{"id":3,"sLen":0,"time":55800,"type":0},{"id":0,"sLen":0,"time":56400,"type":0},{"id":2,"sLen":0,"time":57000,"type":0},{"id":1,"sLen":750,"time":57600,"type":0}],"position":"boyfriend","type":1,"characters":["bf"]}],"codenameChart":true,"scrollSpeed":1,"noteTypes":[]}
{"codenameChart":true,"strumLines":[{"position":"girlfriend","notes":[{"id":0,"sLen":0,"time":9600,"type":0},{"id":3,"sLen":0,"time":10800,"type":0},{"id":0,"sLen":0,"time":12000,"type":0},{"id":3,"sLen":0,"time":13200,"type":0},{"id":2,"sLen":0,"time":19200,"type":0},{"id":1,"sLen":0,"time":20400,"type":0},{"id":2,"sLen":0,"time":21600,"type":0},{"id":1,"sLen":0,"time":22800,"type":0},{"id":0,"sLen":0,"time":28800,"type":0},{"id":2,"sLen":0,"time":30000,"type":0},{"id":1,"sLen":0,"time":31200,"type":0},{"id":3,"sLen":0,"time":32400,"type":0},{"id":1,"sLen":0,"time":38400,"type":0},{"id":1,"sLen":0,"time":39000,"type":0},{"id":2,"sLen":0,"time":39600,"type":0},{"id":1,"sLen":0,"time":40800,"type":0},{"id":1,"sLen":0,"time":41400,"type":0},{"id":3,"sLen":0,"time":42000,"type":0},{"id":1,"sLen":0,"time":48000,"type":0},{"id":2,"sLen":0,"time":48300,"type":0},{"id":3,"sLen":0,"time":48600,"type":0},{"id":2,"sLen":0,"time":48900,"type":0},{"id":3,"sLen":0,"time":49800,"type":0}],"visible":true,"type":0,"characters":["gf"]},{"position":"boyfriend","notes":[{"id":0,"sLen":0,"time":14400,"type":0},{"id":3,"sLen":0,"time":15600,"type":0},{"id":0,"sLen":0,"time":16800,"type":0},{"id":3,"sLen":0,"time":18000,"type":0},{"id":2,"sLen":0,"time":24000,"type":0},{"id":1,"sLen":0,"time":25200,"type":0},{"id":2,"sLen":0,"time":26400,"type":0},{"id":1,"sLen":0,"time":27600,"type":0},{"id":0,"sLen":0,"time":33600,"type":0},{"id":2,"sLen":0,"time":34800,"type":0},{"id":1,"sLen":0,"time":36000,"type":0},{"id":3,"sLen":0,"time":37200,"type":0},{"id":1,"sLen":0,"time":43200,"type":0},{"id":1,"sLen":0,"time":43800,"type":0},{"id":2,"sLen":0,"time":44400,"type":0},{"id":1,"sLen":0,"time":45600,"type":0},{"id":1,"sLen":0,"time":46200,"type":0},{"id":3,"sLen":0,"time":46800,"type":0},{"id":1,"sLen":0,"time":50400,"type":0},{"id":2,"sLen":0,"time":50700,"type":0},{"id":3,"sLen":0,"time":51000,"type":0},{"id":2,"sLen":0,"time":51300,"type":0},{"id":3,"sLen":0,"time":52200,"type":0},{"id":3,"sLen":0,"time":52800,"type":0},{"id":1,"sLen":0,"time":53400,"type":0},{"id":0,"sLen":0,"time":54000,"type":0},{"id":1,"sLen":0,"time":54600,"type":0},{"id":2,"sLen":0,"time":55200,"type":0},{"id":3,"sLen":0,"time":55800,"type":0},{"id":0,"sLen":0,"time":56400,"type":0},{"id":2,"sLen":0,"time":57000,"type":0},{"id":1,"sLen":750,"time":57600,"type":0}],"visible":true,"type":1,"characters":["bf"]}],"scrollSpeed":1,"noteTypes":[]}
+1 -1
View File
@@ -1 +1 @@
{"events":[{"params":[1],"time":0,"type":1},{"params":[0],"time":9600,"type":1},{"params":[1],"time":14400,"type":1},{"params":[0],"time":19200,"type":1},{"params":[1],"time":24000,"type":1},{"params":[0],"time":28800,"type":1},{"params":[1],"time":33600,"type":1},{"params":[0],"time":38400,"type":1},{"params":[1],"time":43200,"type":1},{"params":[0],"time":48000,"type":1},{"params":[1],"time":50400,"type":1}],"strumLines":[{"notes":[{"id":0,"sLen":0,"time":9600,"type":0},{"id":3,"sLen":0,"time":10800,"type":0},{"id":0,"sLen":0,"time":12000,"type":0},{"id":3,"sLen":0,"time":13200,"type":0},{"id":2,"sLen":0,"time":19200,"type":0},{"id":1,"sLen":0,"time":20400,"type":0},{"id":2,"sLen":0,"time":21600,"type":0},{"id":1,"sLen":0,"time":22800,"type":0},{"id":0,"sLen":0,"time":28800,"type":0},{"id":2,"sLen":0,"time":30000,"type":0},{"id":1,"sLen":0,"time":31200,"type":0},{"id":3,"sLen":0,"time":32400,"type":0},{"id":1,"sLen":0,"time":38400,"type":0},{"id":1,"sLen":0,"time":39000,"type":0},{"id":2,"sLen":0,"time":39600,"type":0},{"id":1,"sLen":0,"time":40800,"type":0},{"id":1,"sLen":0,"time":41400,"type":0},{"id":3,"sLen":0,"time":42000,"type":0},{"id":1,"sLen":0,"time":48000,"type":0},{"id":2,"sLen":0,"time":48300,"type":0},{"id":3,"sLen":0,"time":48600,"type":0},{"id":2,"sLen":0,"time":48900,"type":0},{"id":3,"sLen":0,"time":49800,"type":0}],"position":"girlfriend","type":0,"characters":["gf"]},{"notes":[{"id":0,"sLen":0,"time":14400,"type":0},{"id":3,"sLen":0,"time":15600,"type":0},{"id":0,"sLen":0,"time":16800,"type":0},{"id":3,"sLen":0,"time":18000,"type":0},{"id":2,"sLen":0,"time":24000,"type":0},{"id":1,"sLen":0,"time":25200,"type":0},{"id":2,"sLen":0,"time":26400,"type":0},{"id":1,"sLen":0,"time":27600,"type":0},{"id":0,"sLen":0,"time":33600,"type":0},{"id":2,"sLen":0,"time":34800,"type":0},{"id":1,"sLen":0,"time":36000,"type":0},{"id":3,"sLen":0,"time":37200,"type":0},{"id":1,"sLen":0,"time":43200,"type":0},{"id":1,"sLen":0,"time":43800,"type":0},{"id":2,"sLen":0,"time":44400,"type":0},{"id":1,"sLen":0,"time":45600,"type":0},{"id":1,"sLen":0,"time":46200,"type":0},{"id":3,"sLen":0,"time":46800,"type":0},{"id":1,"sLen":0,"time":50400,"type":0},{"id":2,"sLen":0,"time":50700,"type":0},{"id":3,"sLen":0,"time":51000,"type":0},{"id":2,"sLen":0,"time":51300,"type":0},{"id":3,"sLen":0,"time":52200,"type":0},{"id":3,"sLen":0,"time":52800,"type":0},{"id":1,"sLen":0,"time":53400,"type":0},{"id":0,"sLen":0,"time":54000,"type":0},{"id":1,"sLen":0,"time":54600,"type":0},{"id":2,"sLen":0,"time":55200,"type":0},{"id":3,"sLen":0,"time":55800,"type":0},{"id":0,"sLen":0,"time":56400,"type":0},{"id":2,"sLen":0,"time":57000,"type":0},{"id":1,"sLen":750,"time":57600,"type":0},{"id":0,"sLen":0,"time":62400,"type":0},{"id":1,"sLen":0,"time":62550,"type":0},{"id":2,"sLen":0,"time":62700,"type":0},{"id":3,"sLen":0,"time":62850,"type":0},{"id":2,"sLen":0,"time":63000,"type":0},{"id":1,"sLen":0,"time":63150,"type":0},{"id":0,"sLen":0,"time":63300,"type":0},{"id":1,"sLen":0,"time":63450,"type":0},{"id":2,"sLen":0,"time":63600,"type":0},{"id":3,"sLen":0,"time":63750,"type":0},{"id":2,"sLen":0,"time":63900,"type":0},{"id":3,"sLen":0,"time":64050,"type":0},{"id":2,"sLen":0,"time":64200,"type":0},{"id":3,"sLen":0,"time":64350,"type":0},{"id":0,"sLen":0,"time":64650,"type":0},{"id":1,"sLen":0,"time":64500,"type":0}],"position":"boyfriend","type":1,"characters":["bf"]}],"codenameChart":true,"scrollSpeed":1,"noteTypes":[]}
{"codenameChart":true,"strumLines":[{"position":"girlfriend","notes":[{"id":0,"sLen":0,"time":9600,"type":0},{"id":3,"sLen":0,"time":10800,"type":0},{"id":0,"sLen":0,"time":12000,"type":0},{"id":3,"sLen":0,"time":13200,"type":0},{"id":2,"sLen":0,"time":19200,"type":0},{"id":1,"sLen":0,"time":20400,"type":0},{"id":2,"sLen":0,"time":21600,"type":0},{"id":1,"sLen":0,"time":22800,"type":0},{"id":0,"sLen":0,"time":28800,"type":0},{"id":2,"sLen":0,"time":30000,"type":0},{"id":1,"sLen":0,"time":31200,"type":0},{"id":3,"sLen":0,"time":32400,"type":0},{"id":1,"sLen":0,"time":38400,"type":0},{"id":1,"sLen":0,"time":39000,"type":0},{"id":2,"sLen":0,"time":39600,"type":0},{"id":1,"sLen":0,"time":40800,"type":0},{"id":1,"sLen":0,"time":41400,"type":0},{"id":3,"sLen":0,"time":42000,"type":0},{"id":1,"sLen":0,"time":48000,"type":0},{"id":2,"sLen":0,"time":48300,"type":0},{"id":3,"sLen":0,"time":48600,"type":0},{"id":2,"sLen":0,"time":48900,"type":0},{"id":3,"sLen":0,"time":49800,"type":0}],"visible":true,"type":0,"characters":["gf"]},{"position":"boyfriend","notes":[{"id":0,"sLen":0,"time":14400,"type":0},{"id":3,"sLen":0,"time":15600,"type":0},{"id":0,"sLen":0,"time":16800,"type":0},{"id":3,"sLen":0,"time":18000,"type":0},{"id":2,"sLen":0,"time":24000,"type":0},{"id":1,"sLen":0,"time":25200,"type":0},{"id":2,"sLen":0,"time":26400,"type":0},{"id":1,"sLen":0,"time":27600,"type":0},{"id":0,"sLen":0,"time":33600,"type":0},{"id":2,"sLen":0,"time":34800,"type":0},{"id":1,"sLen":0,"time":36000,"type":0},{"id":3,"sLen":0,"time":37200,"type":0},{"id":1,"sLen":0,"time":43200,"type":0},{"id":1,"sLen":0,"time":43800,"type":0},{"id":2,"sLen":0,"time":44400,"type":0},{"id":1,"sLen":0,"time":45600,"type":0},{"id":1,"sLen":0,"time":46200,"type":0},{"id":3,"sLen":0,"time":46800,"type":0},{"id":1,"sLen":0,"time":50400,"type":0},{"id":2,"sLen":0,"time":50700,"type":0},{"id":3,"sLen":0,"time":51000,"type":0},{"id":2,"sLen":0,"time":51300,"type":0},{"id":3,"sLen":0,"time":52200,"type":0},{"id":3,"sLen":0,"time":52800,"type":0},{"id":1,"sLen":0,"time":53400,"type":0},{"id":0,"sLen":0,"time":54000,"type":0},{"id":1,"sLen":0,"time":54600,"type":0},{"id":2,"sLen":0,"time":55200,"type":0},{"id":3,"sLen":0,"time":55800,"type":0},{"id":0,"sLen":0,"time":56400,"type":0},{"id":2,"sLen":0,"time":57000,"type":0},{"id":1,"sLen":750,"time":57600,"type":0},{"id":0,"sLen":0,"time":62400,"type":0},{"id":1,"sLen":0,"time":62550,"type":0},{"id":2,"sLen":0,"time":62700,"type":0},{"id":3,"sLen":0,"time":62850,"type":0},{"id":2,"sLen":0,"time":63000,"type":0},{"id":1,"sLen":0,"time":63150,"type":0},{"id":0,"sLen":0,"time":63300,"type":0},{"id":1,"sLen":0,"time":63450,"type":0},{"id":2,"sLen":0,"time":63600,"type":0},{"id":3,"sLen":0,"time":63750,"type":0},{"id":2,"sLen":0,"time":63900,"type":0},{"id":3,"sLen":0,"time":64050,"type":0},{"id":2,"sLen":0,"time":64200,"type":0},{"id":3,"sLen":0,"time":64350,"type":0},{"id":1,"sLen":0,"time":64500,"type":0},{"id":0,"sLen":0,"time":64650,"type":0}],"visible":true,"type":1,"characters":["bf"]}],"scrollSpeed":1,"noteTypes":[]}
+1 -1
View File
@@ -1 +1 @@
{"events":[{"params":[1],"time":0,"type":1},{"params":[0],"time":9600,"type":1},{"params":[1],"time":14400,"type":1},{"params":[0],"time":19200,"type":1},{"params":[1],"time":24000,"type":1},{"params":[0],"time":28800,"type":1},{"params":[1],"time":33600,"type":1},{"params":[0],"time":38400,"type":1},{"params":[1],"time":43200,"type":1},{"params":[0],"time":48000,"type":1},{"params":[1],"time":50400,"type":1}],"strumLines":[{"notes":[{"id":0,"sLen":0,"time":9600,"type":0},{"id":3,"sLen":0,"time":10800,"type":0},{"id":0,"sLen":0,"time":12000,"type":0},{"id":3,"sLen":0,"time":13200,"type":0},{"id":2,"sLen":0,"time":19200,"type":0},{"id":1,"sLen":0,"time":20400,"type":0},{"id":2,"sLen":0,"time":21600,"type":0},{"id":1,"sLen":0,"time":22800,"type":0},{"id":0,"sLen":0,"time":28800,"type":0},{"id":2,"sLen":0,"time":30000,"type":0},{"id":1,"sLen":0,"time":31200,"type":0},{"id":3,"sLen":0,"time":32400,"type":0},{"id":1,"sLen":0,"time":38400,"type":0},{"id":1,"sLen":0,"time":39000,"type":0},{"id":2,"sLen":0,"time":39600,"type":0},{"id":1,"sLen":0,"time":40800,"type":0},{"id":1,"sLen":0,"time":41400,"type":0},{"id":3,"sLen":0,"time":42000,"type":0},{"id":1,"sLen":0,"time":48000,"type":0},{"id":2,"sLen":0,"time":48300,"type":0},{"id":3,"sLen":0,"time":48600,"type":0},{"id":2,"sLen":0,"time":48900,"type":0},{"id":3,"sLen":0,"time":49800,"type":0}],"position":"girlfriend","type":0,"characters":["gf"]},{"notes":[{"id":0,"sLen":0,"time":14400,"type":0},{"id":3,"sLen":0,"time":15600,"type":0},{"id":0,"sLen":0,"time":16800,"type":0},{"id":3,"sLen":0,"time":18000,"type":0},{"id":2,"sLen":0,"time":24000,"type":0},{"id":1,"sLen":0,"time":25200,"type":0},{"id":2,"sLen":0,"time":26400,"type":0},{"id":1,"sLen":0,"time":27600,"type":0},{"id":0,"sLen":0,"time":33600,"type":0},{"id":2,"sLen":0,"time":34800,"type":0},{"id":1,"sLen":0,"time":36000,"type":0},{"id":3,"sLen":0,"time":37200,"type":0},{"id":1,"sLen":0,"time":43200,"type":0},{"id":1,"sLen":0,"time":43800,"type":0},{"id":2,"sLen":0,"time":44400,"type":0},{"id":1,"sLen":0,"time":45600,"type":0},{"id":1,"sLen":0,"time":46200,"type":0},{"id":3,"sLen":0,"time":46800,"type":0},{"id":1,"sLen":0,"time":50400,"type":0},{"id":2,"sLen":0,"time":50700,"type":0},{"id":3,"sLen":0,"time":51000,"type":0},{"id":2,"sLen":0,"time":51300,"type":0},{"id":3,"sLen":0,"time":52200,"type":0},{"id":3,"sLen":0,"time":52800,"type":0},{"id":1,"sLen":0,"time":53400,"type":0},{"id":0,"sLen":0,"time":54000,"type":0},{"id":1,"sLen":0,"time":54600,"type":0},{"id":2,"sLen":0,"time":55200,"type":0},{"id":3,"sLen":0,"time":55800,"type":0},{"id":0,"sLen":0,"time":56400,"type":0},{"id":2,"sLen":0,"time":57000,"type":0},{"id":1,"sLen":750,"time":57600,"type":0}],"position":"boyfriend","type":1,"characters":["bf"]}],"codenameChart":true,"scrollSpeed":1,"noteTypes":[]}
{"codenameChart":true,"strumLines":[{"position":"girlfriend","notes":[{"id":0,"sLen":0,"time":9600,"type":0},{"id":3,"sLen":0,"time":10800,"type":0},{"id":0,"sLen":0,"time":12000,"type":0},{"id":3,"sLen":0,"time":13200,"type":0},{"id":2,"sLen":0,"time":19200,"type":0},{"id":1,"sLen":0,"time":20400,"type":0},{"id":2,"sLen":0,"time":21600,"type":0},{"id":1,"sLen":0,"time":22800,"type":0},{"id":0,"sLen":0,"time":28800,"type":0},{"id":2,"sLen":0,"time":30000,"type":0},{"id":1,"sLen":0,"time":31200,"type":0},{"id":3,"sLen":0,"time":32400,"type":0},{"id":1,"sLen":0,"time":38400,"type":0},{"id":1,"sLen":0,"time":39000,"type":0},{"id":2,"sLen":0,"time":39600,"type":0},{"id":1,"sLen":0,"time":40800,"type":0},{"id":1,"sLen":0,"time":41400,"type":0},{"id":3,"sLen":0,"time":42000,"type":0},{"id":1,"sLen":0,"time":48000,"type":0},{"id":2,"sLen":0,"time":48300,"type":0},{"id":3,"sLen":0,"time":48600,"type":0},{"id":2,"sLen":0,"time":48900,"type":0},{"id":3,"sLen":0,"time":49800,"type":0}],"visible":true,"type":0,"characters":["gf"]},{"position":"boyfriend","notes":[{"id":0,"sLen":0,"time":14400,"type":0},{"id":3,"sLen":0,"time":15600,"type":0},{"id":0,"sLen":0,"time":16800,"type":0},{"id":3,"sLen":0,"time":18000,"type":0},{"id":2,"sLen":0,"time":24000,"type":0},{"id":1,"sLen":0,"time":25200,"type":0},{"id":2,"sLen":0,"time":26400,"type":0},{"id":1,"sLen":0,"time":27600,"type":0},{"id":0,"sLen":0,"time":33600,"type":0},{"id":2,"sLen":0,"time":34800,"type":0},{"id":1,"sLen":0,"time":36000,"type":0},{"id":3,"sLen":0,"time":37200,"type":0},{"id":1,"sLen":0,"time":43200,"type":0},{"id":1,"sLen":0,"time":43800,"type":0},{"id":2,"sLen":0,"time":44400,"type":0},{"id":1,"sLen":0,"time":45600,"type":0},{"id":1,"sLen":0,"time":46200,"type":0},{"id":3,"sLen":0,"time":46800,"type":0},{"id":1,"sLen":0,"time":50400,"type":0},{"id":2,"sLen":0,"time":50700,"type":0},{"id":3,"sLen":0,"time":51000,"type":0},{"id":2,"sLen":0,"time":51300,"type":0},{"id":3,"sLen":0,"time":52200,"type":0},{"id":3,"sLen":0,"time":52800,"type":0},{"id":1,"sLen":0,"time":53400,"type":0},{"id":0,"sLen":0,"time":54000,"type":0},{"id":1,"sLen":0,"time":54600,"type":0},{"id":2,"sLen":0,"time":55200,"type":0},{"id":3,"sLen":0,"time":55800,"type":0},{"id":0,"sLen":0,"time":56400,"type":0},{"id":2,"sLen":0,"time":57000,"type":0},{"id":1,"sLen":750,"time":57600,"type":0}],"visible":true,"type":1,"characters":["bf"]}],"scrollSpeed":1,"noteTypes":[]}
+1
View File
@@ -0,0 +1 @@
{"events":[{"params":[1],"name":"Camera Movement","time":0},{"params":[0],"name":"Camera Movement","time":9600},{"params":[1],"name":"Camera Movement","time":14400},{"params":[0,"cheer"],"name":"Play Animation","time":18000},{"params":[1,"hey"],"name":"Play Animation","time":18600},{"params":[0],"name":"Camera Movement","time":19200},{"params":[1],"name":"Camera Movement","time":24000},{"params":[0,"cheer"],"time":27600,"name":"Play Animation"},{"params":[1,"hey"],"time":28200,"name":"Play Animation"},{"params":[0],"name":"Camera Movement","time":28800},{"params":[1],"name":"Camera Movement","time":33600},{"params":[0],"name":"Camera Movement","time":38400},{"params":[1],"name":"Camera Movement","time":43200},{"params":[0],"name":"Camera Movement","time":48000},{"params":[1],"name":"Camera Movement","time":50400}]}
+8
View File
@@ -0,0 +1,8 @@
var lastFocused:Int = null;
var zoomin:FlxTween = null;
function onNoteHit(event)
event.enableCamZooming = false;
function onCameraMove(_) if(zoomin == null && lastFocused != (lastFocused = curCameraTarget))
zoomin = FlxTween.tween(FlxG.camera, {zoom: curCameraTarget == 0 ? 1.3 : 1}, (Conductor.stepCrochet * 4 / 1000), {ease: FlxEase.elasticInOut, onComplete: function(_) zoomin = null});
+1 -1
View File
@@ -2,7 +2,7 @@
<libraries>
<!-- OpenFL & Lime (Required for Flixel) -->
<lib name="openfl" version="9.2.2"/>
<lib name="lime" version="8.0.2"/>
<lib name="lime" version="8.1.2"/>
<!-- Flixel -->
<git name="flixel" url="https://github.com/FNF-CNE-Devs/flixel" />
+1 -1
View File
@@ -7,7 +7,7 @@
package="com.yoshman29.codenameengine"
version="0.1.0" company="Yoshman29" />
<!--
<!--
CHANGE THE SAVE PATH & NAME FOR YOUR MOD HERE!
-->
<app save-path="YoshiCrafter29/CodenameEngine" save-name="save-default" mod-saves="true" />
+13 -1
View File
@@ -41,7 +41,10 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
public var debugMode:Bool = false;
public var animDatas:Map<String, AnimData> = [];
public var beatInterval:Int = 1;
/**
* ODD interval -> asynced; EVEN interval -> synced
*/
public var beatInterval(default, set):Int = 2;
public var beatOffset:Int = 0;
public var skipNegativeBeats:Bool = false;
@@ -358,4 +361,13 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
return animateAtlas != null ? (animateAtlas.anim.finished) : (animation.curAnim != null ? animation.curAnim.finished : true);
}
#end
// Getter / Setters
@:noCompletion private function set_beatInterval(v:Int) {
if (v < 1)
v = 1;
return beatInterval = v;
}
}
+1 -1
View File
@@ -53,7 +53,7 @@ class MusicBeatTransition extends MusicBeatSubstate {
finish();
}
});
super.create();
}
+21 -2
View File
@@ -51,10 +51,11 @@ class ModsFolder {
*/
private static var __firstTime:Bool = true;
/**
* Initialises `mods` folder by adding callbacks and such.
* Initialises `mods` folder.
*/
public static function init() {
if(!getModsList().contains(Options.lastLoadedMod))
Options.lastLoadedMod = null;
}
/**
@@ -89,6 +90,24 @@ class ModsFolder {
#end
}
public static function getModsList():Array<String> {
var mods:Array<String> = [];
#if MOD_SUPPORT
for(modFolder in FileSystem.readDirectory(modsPath)) {
if (FileSystem.isDirectory('${modsPath}${modFolder}')) {
mods.push(modFolder);
} else {
var ext = Path.extension(modFolder).toLowerCase();
switch(ext) {
case 'zip':
// is a zip mod!!
mods.push(Path.withoutExtension(modFolder));
}
}
}
#end
return mods;
}
public static function getLoadedMods():Array<String> {
var libs = [];
for (i in Paths.assetsTree.libraries) {
+1 -1
View File
@@ -100,7 +100,7 @@ class Paths
}
return getPath('images/$key.$ext', library);
}
inline static public function script(key:String, ?library:String, isAssetsPath:Bool = false) {
var scriptPath = isAssetsPath ? key : getPath(key, library);
if (!OpenFlAssets.exists(scriptPath)) {
+2 -2
View File
@@ -206,11 +206,11 @@ class Chart {
var chartPath = '${songFolderPath}/charts/${difficulty.trim()}.json';
var metaPath = '${songFolderPath}/meta.json';
File.saveContent(chartPath, Json.stringify(filteredChart, null, saveSettings.prettyPrint == true ? "\t" : null));
CoolUtil.safeSaveFile(chartPath, Json.stringify(filteredChart, null, saveSettings.prettyPrint == true ? "\t" : null));
// idk how null reacts to it so better be sure
if (saveSettings.overrideExistingMeta == true || !FileSystem.exists(metaPath))
File.saveContent(metaPath, Json.stringify(meta, null, saveSettings.prettyPrint == true ? "\t" : null));
CoolUtil.safeSaveFile(metaPath, Json.stringify(meta, null, saveSettings.prettyPrint == true ? "\t" : null));
#end
return filteredChart;
}
+1 -2
View File
@@ -59,8 +59,7 @@ typedef ChartEvent = {
var params:Array<Dynamic>;
}
@:enum
abstract ChartStrumLineType(Int) from Int to Int {
enum abstract ChartStrumLineType(Int) from Int to Int {
/**
* STRUMLINE IS MARKED AS OPPONENT - WILL BE PLAYED BY CPU, OR PLAYED BY PLAYER IF OPPONENT MODE IS ON
*/
+1 -1
View File
@@ -13,7 +13,7 @@ class EventsData {
public static var defaultEventsList:Array<String> = ["HScript Call", "Camera Movement", "Add Camera Zoom", "Camera Modulo Change", "Camera Flash", "BPM Change", "Scroll Speed Change", "Alt Animation Toggle", "Play Animation"];
public static var defaultEventsParams:Map<String, Array<EventParamInfo>> = [
"HScript Call" => [
{name: "Function Name", type: TString, defValue: "myFunc"},
{name: "Function Name", type: TString, defValue: "myFunc"},
{name: "Function Parameters (String split with commas)", type: TString, defValue: ""}
],
"Camera Movement" => [{name: "Camera Target", type: TStrumLine, defValue: 0}],
@@ -5,7 +5,7 @@ package funkin.backend.scripting;
*/
class DummyScript extends Script {
public var variables:Map<String, Dynamic> = [];
public override function get(v:String) {return variables.get(v);}
public override function set(v:String, v2:Dynamic) {return variables.set(v, v2);}
public override function onCall(method:String, parameters:Array<Dynamic>):Dynamic {
@@ -5,11 +5,6 @@ import flixel.FlxState;
import funkin.backend.system.interfaces.IBeatReceiver;
import flixel.util.FlxSignal.FlxTypedSignal;
/**
* ...
* @author
*/
typedef BPMChangeEvent =
{
var stepTime:Float;
+1 -1
View File
@@ -120,7 +120,6 @@ class Main extends Sprite
ShaderResizeFix.init();
Logs.init();
Paths.init();
ModsFolder.init();
DiscordUtil.init();
#if GLOBAL_SCRIPT
funkin.backend.scripting.GlobalScript.init();
@@ -159,6 +158,7 @@ class Main extends Sprite
FlxG.mouse.useSystemCursor = true;
ModsFolder.init();
#if MOD_SUPPORT
ModsFolder.switchMod(modToLoad.getDefault(Options.lastLoadedMod));
#end
+2 -2
View File
@@ -41,7 +41,7 @@ class MainState extends FlxState {
else if (addon.startsWith("[HIGH]")) _highPriorityAddons.insert(0, addon);
else _noPriorityAddons.insert(0, addon);
}
for (addon in _lowPriorityAddons)
for (addon in _lowPriorityAddons)
Paths.assetsTree.addLibrary(ModsFolder.loadModLib('${ModsFolder.addonsPath}$addon', StringTools.ltrim(addon.substr("[LOW]".length))));
}
if (ModsFolder.currentModFolder != null)
@@ -68,7 +68,7 @@ class MainState extends FlxState {
#if sys
sys.FileSystem.createDirectory('./.temp/');
#if windows Sys.command("attrib +h .temp"); #end
#if windows new funkin.backend.utils.native.HiddenProcess("attrib +h .temp"); #end
#end
}
}
@@ -13,7 +13,7 @@ class FlixelInfo extends FramerateCategory {
var c:Int = 0;
for(_ in FlxG.bitmap._cache.keys())
c++;
_text = 'State: ${Type.getClassName(Type.getClass(FlxG.state))}';
_text += '\nObject Count: ${FlxG.state.members.length}';
_text += '\nCamera Count: ${FlxG.cameras.list.length}';
@@ -27,7 +27,7 @@ class FlixelInfo extends FramerateCategory {
_text += '\nPoint Count: ${points._count}';
#end
}
this.text.text = _text;
super.__enterFrame(t);
}
@@ -7,7 +7,7 @@ import openfl.text.TextField;
class MemoryCounter extends Sprite {
public var memoryText:TextField;
public var memoryPeakText:TextField;
public var memory:Float = 0;
public var memoryPeak:Float = 0;
@@ -14,7 +14,7 @@ class StatsInfo extends FramerateCategory {
_text = "totalDC: " + Context3DStats.totalDrawCalls();
_text += "\nstageDC: " + Context3DStats.contextDrawCalls(DrawCallContext.STAGE);
_text += "\nstage3DDC: " + Context3DStats.contextDrawCalls(DrawCallContext.STAGE3D);
this.text.text = _text;
super.__enterFrame(t);
}
@@ -179,12 +179,12 @@ class GitHub {
return r;
}
private static function isRedirect(status:Int):Bool {
switch (status) {
switch (status) {
// 301: Moved Permanently, 302: Found (Moved Temporarily), 307: Temporary Redirect, 308: Permanent Redirect - Nex
case 301 | 302 | 307 | 308 :
trace("Redirected with status code: " + status);
case 301 | 302 | 307 | 308 :
trace("Redirected with status code: " + status);
return true;
}
}
return false;
}
private static function __parseGitHubException(obj:Dynamic):GitHubException {
@@ -1,9 +1,7 @@
package funkin.backend.system.macros;
#if macro
import sys.io.Process;
import haxe.macro.Context;
import haxe.macro.Compiler;
import haxe.macro.Expr;
#end
@@ -1,17 +1,8 @@
package funkin.backend.system.macros;
#if macro
import haxe.macro.Type.ClassType;
import Type.ValueType;
import haxe.macro.Expr.Function;
import haxe.macro.Expr;
import haxe.macro.Type.MetaAccess;
import haxe.macro.Type.FieldKind;
import haxe.macro.Type.ClassField;
import haxe.macro.Type.VarAccess;
import haxe.macro.*;
import Sys;
import haxe.io.Path;
using StringTools;
using haxe.macro.PositionTools;
@@ -39,7 +39,7 @@ class Macros {
}
}
Compiler.include("funkin", #if !UPDATE_CHECKING ['funkin.backend.system.updating'] #end);
Compiler.include("funkin", [#if !UPDATE_CHECKING 'funkin.backend.system.updating' #end]);
}
public static function initMacros() {
@@ -6,7 +6,6 @@ import haxe.macro.Expr;
using StringTools;
/**
* Macro used in the options class to add getters for the SOLO keybinds.
*/
@@ -3,7 +3,6 @@ package funkin.backend.system.macros;
#if macro
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.Expr.ExprDef;
#end
class Utils {
@@ -21,14 +21,14 @@ class AsyncUpdater {
public function new(releases:Array<GitHubRelease>) {
this.releases = releases;
}
public function execute() {
Main.execAsync(installUpdates);
}
#end
#if windows
#if windows
public static var executableGitHubName:String = "update-windows.exe";
public static var executableName:String = "CodenameEngine.exe";
#end
@@ -49,7 +49,7 @@ class AsyncUpdater {
public var lastTime:Float = 0;
public var oldBytesLoaded:Float = 0;
public function installUpdates() {
prepareInstallationEnvironment();
downloadFiles();
@@ -64,7 +64,7 @@ class AsyncUpdater {
progress.curFileName = e;
trace('extracting file ${path}');
var reader = ZipUtil.openZip(path);
progress.curZipProgress = new ZipProgress();
ZipUtil.uncompressZip(reader, './', null, progress.curZipProgress);
// FileSystem.deleteFile(path);
@@ -72,7 +72,7 @@ class AsyncUpdater {
if (executableReplaced = FileSystem.exists('$path$executableName')) {
progress.curFile = files.length;
progress.curFileName = executableName;
var progPath = Sys.programPath();
var bakFile = '${Path.withoutExtension(progPath)}.bak';
if (FileSystem.exists(bakFile))
@@ -133,7 +133,7 @@ class AsyncUpdater {
downloadStream.addEventListener(ProgressEvent.PROGRESS, function(e) {
progress.bytesLoaded = e.bytesLoaded;
progress.bytesTotal = e.bytesTotal;
var curTime = Lib.getTimer();
progress.downloadSpeed = (e.bytesLoaded - oldBytesLoaded) / ((curTime - lastTime) / 1000);
@@ -160,7 +160,7 @@ class AsyncUpdater {
public function prepareInstallationEnvironment() {
progress.step = PREPARING;
#if windows
path = '${Sys.getEnv("TEMP")}\\Codename Engine\\Updater\\';
#else
@@ -59,7 +59,7 @@ class UpdateScreen extends MusicBeatState {
overSound = FlxG.sound.load(Paths.sound('gameOverEnd'));
updater.execute();
FlxG.camera.addShader(rainbowShader = new CustomShader("engine/updaterShader"));
}
@@ -104,7 +104,7 @@ class UpdateScreen extends MusicBeatState {
// update is done, play bf's anim
FlxG.sound.music.stop();
overSound.play();
remove(generalProgress);
remove(partProgress);
generalProgress = FlxDestroyUtil.destroy(generalProgress);
@@ -11,7 +11,7 @@ using funkin.backend.system.github.GitHub;
class UpdateUtil {
public static final repoOwner:String = "YoshiCrafter29";
public static final repoName:String = "CodenameTestRepo";
public static function init() {
// deletes old bak file if it exists
#if sys
@@ -22,11 +22,11 @@ class UpdateUtil {
}
public static function checkForUpdates():UpdateCheckCallback {
var curTag = 'v${Application.current.meta.get('version')}';
var curTag = 'v${Application.current.meta.get('version')}';
trace(curTag);
var error = false;
var newUpdates = __doReleaseFiltering(GitHub.getReleases(repoOwner, repoName, function(e) {
error = true;
}), curTag);
@@ -35,7 +35,7 @@ class UpdateUtil {
success: false,
newUpdate: false
};
if (newUpdates.length <= 0) {
return {
success: true,
+44
View File
@@ -2,6 +2,7 @@ package funkin.backend.utils;
import flixel.text.FlxText;
import funkin.backend.utils.XMLUtil.TextFormat;
import flixel.util.typeLimit.OneOfTwo;
import flixel.tweens.FlxTween;
import flixel.system.frontEnds.SoundFrontEnd;
import flixel.sound.FlxSound;
@@ -9,6 +10,7 @@ import funkin.backend.system.Conductor;
import flixel.sound.FlxSoundGroup;
import haxe.Json;
import haxe.io.Path;
import haxe.io.Bytes;
import haxe.xml.Access;
import flixel.input.keyboard.FlxKey;
import lime.utils.Assets;
@@ -77,6 +79,48 @@ class CoolUtil
#end
}
/**
* Safe saves a file (even adding eventual missing folders) and shows a warning box instead of making the program crash
* @param path Path to save the file at.
* @param content Content of the file to save (as String or Bytes).
*/
@:noUsing public static function safeSaveFile(path:String, content:OneOfTwo<String, Bytes>, showErrorBox:Bool = true) {
#if sys
try {
addMissingFolders(Path.directory(path));
if(content is Bytes) sys.io.File.saveBytes(path, content);
else sys.io.File.saveContent(path, content);
} catch(e) {
var errMsg:String = 'Error while trying to save the file: ${Std.string(e).replace('\n', ' ')}';
Logs.traceColored([Logs.logText(errMsg, RED)], ERROR);
if(showErrorBox) funkin.backend.utils.NativeAPI.showMessageBox("Codename Engine Warning", errMsg, MSG_WARNING);
}
#end
}
/**
* Creates eventual missing folders to the specified `path`
*
* WARNING: eventual files in `path` will be considered as folders! Just to make possible folders be named as `songs.json` for example
*
* @param path Path to check.
* @return The initial Path.
*/
@:noUsing public static function addMissingFolders(path:String):String {
#if sys
var folders:Array<String> = path.split("/");
var currentPath:String = "";
for (folder in folders) {
currentPath += folder + "/";
if (!sys.FileSystem.exists(currentPath)) {
sys.FileSystem.createDirectory(currentPath);
}
}
#end
return path;
}
/**
* Shortcut to parse a JSON string
* @param str Path to the JSON string
@@ -79,6 +79,8 @@ class MemoryUtil {
public static inline function currentMemUsage() {
#if cpp
return Gc.memInfo64(Gc.MEM_INFO_USAGE);
#elseif hl
return Gc.stats().currentMemory;
#elseif sys
return cast(cast(System.totalMemory, UInt), Float);
#else
+6 -6
View File
@@ -180,13 +180,13 @@ class XMLUtil {
}
/**
* Creates a new sprite based on a XML node.
*/
* Creates a new sprite based on a XML node.
*/
public static inline function createSpriteFromXML(node:Access, parentFolder:String = "", defaultAnimType:XMLAnimType = BEAT, ?cl:Class<FunkinSprite>, ?args:Array<Dynamic>):FunkinSprite {
if(cl == null) cl = FunkinSprite;
if(args == null) args = [];
return loadSpriteFromXML(Type.createInstance(cl, args), node, parentFolder, defaultAnimType);
}
if(cl == null) cl = FunkinSprite;
if(args == null) args = [];
return loadSpriteFromXML(Type.createInstance(cl, args), node, parentFolder, defaultAnimType);
}
public static function extractAnimFromXML(anim:Access, animType:XMLAnimType = NONE, loop:Bool = false):AnimData {
var animData:AnimData = {
+2 -14
View File
@@ -1,8 +1,5 @@
package funkin.editors;
#if desktop
import sys.io.File;
#end
import haxe.io.Path;
import lime.ui.FileDialog;
@@ -30,13 +27,9 @@ class SaveSubstate extends MusicBeatSubstate {
super.create();
var fileDialog = new FileDialog();
fileDialog.onCancel.add(function() {
close();
});
fileDialog.onCancel.add(function() close());
fileDialog.onSelect.add(function(str) {
#if desktop
File.saveContent(str, data);
#end
CoolUtil.safeSaveFile(str, data);
close();
});
fileDialog.browse(SAVE, options.saveExt.getDefault(Path.extension(options.defaultSaveFile)), options.defaultSaveFile);
@@ -46,11 +39,6 @@ class SaveSubstate extends MusicBeatSubstate {
super.update(elapsed);
parent.persistentUpdate = false;
}
private function onError(_) {
// TODO: error handling
close();
}
}
typedef SaveSubstateData = {
+1 -1
View File
@@ -21,7 +21,7 @@ class SaveWarning {
if (warningFunc != null) warningFunc(closingWindow);
if (FlxG.state != null && FlxG.state is UIState) {
FlxG.state.openSubState(new UIWarningSubstate("Unsaved Changes!", "Your changes will be lost if you don't save them. (Can't be recovered)\n\n\nWould you like to Cancel?",
FlxG.state.openSubState(new UIWarningSubstate("Unsaved Changes!", "Your changes will be lost if you don't save them. (Can't be recovered)\n\n\nWould you like to Cancel?",
[
{
label: "Cancel",
@@ -52,7 +52,7 @@ class CharacterEditor extends UIState {
WindowUtils.endfix = " (Character Editor)";
SaveWarning.selectionClass = CharacterSelection;
SaveWarning.saveFunc = () -> {_file_save(null);};
topMenu = [
{
label: "File",
@@ -328,14 +328,14 @@ class CharacterEditor extends UIState {
function _file_save(_) {
#if sys
sys.io.File.saveContent(
CoolUtil.safeSaveFile(
'${Paths.getAssetsRoot()}/data/characters/${character.curCharacter}.xml',
buildCharacter()
);
undos.save();
return;
#end
#else
_file_saveas(_);
#end
}
function _file_saveas(_) {
@@ -181,8 +181,8 @@ class CharacterInfoScreen extends UISubstateWindow {
xml.set("antialiasing", antialiasingCheckbox.checked ? "true" : "false");
xml.set("sprite", spriteTextBox.label.text);
if (iconColorWheel.colorChanged)
xml.set("color", iconColorWheel.curColor.toHexString(false).replace("0x", "#"));
for (val in customPropertiesButtonList.buttons.members)
xml.set("color", iconColorWheel.curColor.toWebString());
for (val in customPropertiesButtonList.buttons.members)
xml.set(val.propertyText.label.text, val.valueText.label.text);
for (anim in character.animDatas)
+28 -28
View File
@@ -102,7 +102,7 @@ class Charter extends UIState {
WindowUtils.endfix = " (Chart Editor)";
SaveWarning.selectionClass = CharterSelection;
SaveWarning.saveFunc = () -> {_file_save(null);};
topMenu = [
{
label: "File",
@@ -504,7 +504,7 @@ class Charter extends UIState {
for(strL in PlayState.SONG.strumLines)
createStrumline(strumLines.members.length, strL, false, false);
// create notes
notesGroup.autoSort = false;
var noteCount:Int = 0;
@@ -721,11 +721,11 @@ class Charter extends UIState {
for (s in selection) {
if (s.draggable) {
var changePoint:FlxPoint = FlxPoint.get(verticalChange, horizontalChange);
if (!FlxG.keys.pressed.SHIFT)
if (!FlxG.keys.pressed.SHIFT)
changePoint.x -= ((s.step + verticalChange) - quantStepRounded(s.step+verticalChange, verticalChange > 0 ? 0.35 : 0.65));
var boundedChange:FlxPoint = changePoint.clone();
// Some maths, so cool bro -lunar (i dont know why i quopte my self here)
if (s.step + changePoint.x < 0) boundedChange.x += Math.abs(s.step + changePoint.x);
if (s.step + changePoint.x > __endStep-1) boundedChange.x -= (s.step + changePoint.x) - (__endStep-1);
@@ -754,7 +754,7 @@ class Charter extends UIState {
}
case NONE:
if (FlxG.mouse.justPressed)
FlxG.mouse.getWorldPosition(charterCamera, dragStartPos);
FlxG.mouse.getWorldPosition(charterCamera, dragStartPos);
if (gridBackdropDummy.hovered) {
// AUTO DETECT
@@ -763,11 +763,11 @@ class Charter extends UIState {
var id = Math.floor(mousePos.x / 40);
var mouseOnGrid = id >= 0 && id < 4 * gridBackdrops.strumlinesAmount && mousePos.y >= 0;
if (FlxG.mouse.justReleased) {
for (n in selection) n.selected = false;
selection = [];
if (mouseOnGrid && mousePos.y > 0 && mousePos.y < (__endStep)*40) {
var note = new CharterNote();
note.updatePos(
@@ -812,7 +812,7 @@ class Charter extends UIState {
var change:Float = Math.max((mousePos.y-(FlxG.keys.pressed.SHIFT ? dragStartPos.y : quantStep(dragStartPos.y))) / 40, -n.susLength);
n.tempSusLength = change;
if (!FlxG.keys.pressed.SHIFT)
if (!FlxG.keys.pressed.SHIFT)
n.tempSusLength -= (n.susLength + change) - quantStepRounded(n.susLength + change, change > 0 ? 0.35 : 0.65);
@:privateAccess n.__susInstaLerp = FlxG.keys.pressed.SHIFT;
});
@@ -829,7 +829,7 @@ class Charter extends UIState {
undoChanges.push({before: oldSusLen, after: n.susLength, note: n});
});
undos.addToUndo(CEditSustains(undoChanges));
gridActionType = NONE;
currentCursor = ARROW;
}
@@ -837,7 +837,7 @@ class Charter extends UIState {
addEventSpr.selectable = !selectionBox.visible;
var inBoundsY:Bool = (mousePos.y > 0 && mousePos.y < (__endStep)*40);
// Event Spr
if (mousePos.x < 0 && mousePos.x > -addEventSpr.bWidth && gridActionType == NONE && inBoundsY) {
addEventSpr.incorporeal = false;
@@ -979,7 +979,7 @@ class Charter extends UIState {
var i = 0;
var toBeDeleted:Selection = [];
for (note in notesGroup.members)
if (note.strumLineID == strumLineID) {
if (note.strumLineID == strumLineID) {
undoNotes.push(buildNote(note));
toBeDeleted.push(note);
}
@@ -1071,8 +1071,8 @@ class Charter extends UIState {
var buttonI:Int = 0;
for (button in quantButtons) {
button.visible = ((button.quant == quant) ||
(button.quant == quants[FlxMath.wrap(quants.indexOf(quant)-1, 0, quants.length-1)]) ||
button.visible = ((button.quant == quant) ||
(button.quant == quants[FlxMath.wrap(quants.indexOf(quant)-1, 0, quants.length-1)]) ||
(button.quant == quants[FlxMath.wrap(quants.indexOf(quant)+1, 0, quants.length-1)]));
button.selectable = button.visible;
if (!button.visible) continue;
@@ -1091,7 +1091,7 @@ class Charter extends UIState {
noteTypeText.y = Std.int((noteTopButton.bHeight - noteTypeText.height) / 2);
}
noteTypeText.text = '($noteType) ${noteTypes[noteType-1] == null ? "Default Note" : noteTypes[noteType-1]}';
super.update(elapsed);
if (FlxG.keys.justPressed.X)
@@ -1222,13 +1222,13 @@ class Charter extends UIState {
function _file_meta_save(_) {
#if sys
sys.io.File.saveContent(
CoolUtil.safeSaveFile(
'${Paths.getAssetsRoot()}/songs/${__song.toLowerCase()}/meta.json',
Json.stringify(PlayState.SONG.meta == null ? {} : PlayState.SONG.meta, null, "\t")
);
return;
#end
#else
_file_meta_saveas(_);
#end
}
function _file_meta_saveas(_) {
@@ -1239,13 +1239,13 @@ class Charter extends UIState {
function _file_events_save(_) {
#if sys
sys.io.File.saveContent(
CoolUtil.safeSaveFile(
'${Paths.getAssetsRoot()}/songs/${__song.toLowerCase()}/events.json',
Json.stringify({events: PlayState.SONG.events == null ? [] : PlayState.SONG.events})
);
return;
#end
#else
_file_events_saveas(_);
#end
}
function _file_events_saveas(_) {
@@ -1302,7 +1302,7 @@ class Charter extends UIState {
}
selection = sObjects;
_edit_copy(_); // to fix stupid bugs
undos.addToUndo(CCreateSelection(sObjects.copy()));
}
@@ -1320,7 +1320,7 @@ class Charter extends UIState {
function _edit_undo(_) {
if (strumLines.isDragging || selectionDragging || subState != null) return;
selection = [];
var undo = undos.undo();
switch(undo) {
@@ -1343,7 +1343,7 @@ class Charter extends UIState {
case CSelectionDrag(selectionDrags):
for (s in selectionDrags)
if (s.selectable.draggable) s.selectable.handleDrag(s.change * -1);
selection = [for (s in selectionDrags) s.selectable];
case CEditSustains(changes):
for(n in changes)
@@ -1523,7 +1523,7 @@ class Charter extends UIState {
null
];
for (_quant in quants)
for (_quant in quants)
newChilds.push({
label: '${_quant}x Grid Snap',
onSelect: (_) -> {setquant(_quant); buildSnapsUI();},
@@ -1542,7 +1542,7 @@ class Charter extends UIState {
function _note_selectall(_) {
selection = [for (note in notesGroup.members) note];
}
}
function _note_selectmeasure(_) {
selection = [for (note in notesGroup.members)
@@ -1671,7 +1671,7 @@ class Charter extends UIState {
}
notesGroup.sortNotes();
for(n in notesGroup.members) {
if (PlayState.SONG.strumLines[n.strumLineID] != null)
if (PlayState.SONG.strumLines[n.strumLineID] != null)
PlayState.SONG.strumLines[n.strumLineID].notes.push(buildNote(n));
}
buildEvents();
@@ -1738,7 +1738,7 @@ class Charter extends UIState {
newChanges[i] = CSelectionDrag([
for (selectionDrag in selectionDrags)
{
selectable: __relinkSingleSelection(selectionDrag.selectable),
selectable: __relinkSingleSelection(selectionDrag.selectable),
change: selectionDrag.change
}
]);
@@ -1782,7 +1782,7 @@ class Charter extends UIState {
songPosition: Conductor.songPosition,
playbackSpeed: playBackSlider.value,
quantSelected: quant,
noteTypeSelected: noteType,
noteTypeSelected: noteType,
strumlinesDraggable: strumLines.draggable,
hitSounds: [for (strumLine in strumLines.members) strumLine.hitsounds],
mutedVocals: [for (strumLine in strumLines.members) !(strumLine.vocals.volume > 0)],
@@ -46,7 +46,7 @@ class CharterBackdropGroup extends FlxTypedGroup<CharterBackdrop> {
public override function update(elapsed:Float) {
for (grid in members)
grid.active = grid.visible = false;
super.update(elapsed);
for (i => strumLine in strumLineGroup.members) {
@@ -74,7 +74,6 @@ class CharterBackdropGroup extends FlxTypedGroup<CharterBackdrop> {
grid.active = grid.visible = true;
grid.updateSprites();
}
}
public var draggingObj:CharterBackdrop = null;
@@ -135,7 +134,7 @@ class CharterBackdrop extends FlxTypedGroup<Dynamic> {
beatSeparator = new FlxBackdrop(null, Y, 0, 0);
beatSeparator.y = -1;
beatSeparator.visible = Options.charterShowBeats;
for(sep in [sectionSeparator, beatSeparator]) {
sep.makeSolid(1, 1, -1);
sep.alpha = 0.5;
@@ -51,7 +51,7 @@ class CharterEvent extends UISliceSprite implements ICharterSelectable {
if (Assets.exists(Paths.pack('events/$name'))) {
var packimg = Assets.getText(Paths.pack('events/$name')).split('________PACKSEP________')[3];
if (isBase64 = (packimg != null))
path = Assets.getText(Paths.pack('events/$name')).split('________PACKSEP________')[3];
path = Assets.getText(Paths.pack('events/$name')).split('________PACKSEP________')[3];
}
var spr = new FlxSprite().loadGraphic(isBase64 ? openfl.display.BitmapData.fromBase64(path.trim(), 'UTF8') : path);
return spr;
+2 -2
View File
@@ -31,7 +31,7 @@ class CharterNote extends UISprite implements ICharterSelectable {
public function new() {
super();
antialiasing = true; ID = -1;
loadGraphic(Paths.image('editors/charter/note'), true, 157, 154);
animation.add("note", [for(i in 0...frames.frames.length) i], 0, true);
@@ -154,7 +154,7 @@ class CharterNote extends UISprite implements ICharterSelectable {
if (strumLine != null) {
sustainSpr.alpha = alpha = !strumLine.strumLine.visible ? (__passed ? 0.2 : 0.4) : (__passed ? 0.6 : 1);
typeText.alpha = !strumLine.strumLine.visible ? (__passed ? 0.4 : 0.6) : (__passed ? 0.8 : 1);
typeText.alpha = !strumLine.strumLine.visible ? (__passed ? 0.4 : 0.6) : (__passed ? 0.8 : 1);
}
colorTransform.redMultiplier = colorTransform.greenMultiplier = colorTransform.blueMultiplier = selected ? 0.75 : 1;
@@ -64,7 +64,7 @@ class CharterNoteGroup extends FlxTypedGroup<CharterNote> {
if (autoSort && members.length != __lastSort)
sortNotes();
forEach((n) -> {
if(n.exists && n.active) {
n.cameras = n.__lastDrawCameras = cameras;
@@ -44,18 +44,18 @@ class CharterNoteHoverer extends CharterNote {
if (Charter.instance.gridActionType == NOTE_DRAG) {
var verticalChange:Float = (__mousePos.y - Charter.instance.dragStartPos.y) / 40;
var horizontalChange:Int = CoolUtil.floorInt((__mousePos.x - (Std.int(Charter.instance.dragStartPos.x / 40) * 40)) / 40);
for (s in Charter.selection) {
if (s != null && s.draggable && s is CharterNote) {
var draggingNote:CharterNote = cast(s, CharterNote);
y = (draggingNote.step + verticalChange);
if (!FlxG.keys.pressed.SHIFT)
if (!FlxG.keys.pressed.SHIFT)
y -= ((draggingNote.step + verticalChange)
- Charter.instance.quantStepRounded(draggingNote.step+verticalChange, verticalChange > 0 ? 0.35 : 0.65));
y *= 40;
var newID:Int = Std.int(FlxMath.bound(draggingNote.fullID + horizontalChange, 0, (Charter.instance.strumLines.members.length*4)-1));
x = (id=newID) * 40; y = FlxMath.bound(y, 0, (Charter.instance.__endStep*40) - height);
angle = switch(animation.curAnim.curFrame = (draggingNote.id % 4)) {
case 0: -90;
case 1: 180;
@@ -108,7 +108,7 @@ class NoteTypeButton extends UIButton {
var path:String = 'game/notes/default';
if (Assets.exists(Paths.image('game/notes/${notetype}')))
path = 'game/notes/${notetype}';
noteSpr.frames = Paths.getFrames(path);
noteSpr.animation.addByPrefix('scroll', 'green0');
noteSpr.animation.play("scroll");
@@ -29,7 +29,7 @@ class CharterSelection extends EditorTreeMenu {
for(s in freeplayList.songs) new EditorIconOption(s.name, "Press ACCEPT to choose a difficulty to edit.", s.icon, function() {
curSong = s;
var list:Array<OptionType> = [
for(d in s.difficulties) if (d != "")
for(d in s.difficulties) if (d != "")
new TextOption(d, "Press ACCEPT to edit the chart for the selected difficulty", function() {
FlxG.switchState(new Charter(s.name, d));
})
@@ -107,7 +107,7 @@ class CharterSelection extends EditorTreeMenu {
sys.FileSystem.createDirectory('$songFolder/charts');
// Save Files
sys.io.File.saveContent('$songFolder/meta.json', Json.stringify(creation.meta, "\t"));
CoolUtil.safeSaveFile('$songFolder/meta.json', Json.stringify(creation.meta, "\t"));
if (creation.instBytes != null) sys.io.File.saveBytes('$songFolder/song/Inst.${Paths.SOUND_EXT}', creation.instBytes);
if (creation.voicesBytes != null) sys.io.File.saveBytes('$songFolder/song/Voices.${Paths.SOUND_EXT}', creation.voicesBytes);
#end
@@ -145,9 +145,7 @@ class CharterSelection extends EditorTreeMenu {
var songFolder:String = '${Paths.getAssetsRoot()}/songs/${curSong.name}';
// Save Files
#if sys
sys.io.File.saveContent('$songFolder/charts/${name}.json', Json.stringify(data, "\t"));
#end
CoolUtil.safeSaveFile('$songFolder/charts/${name}.json', Json.stringify(data, "\t"));
// Add to List
curSong.difficulties.push(name);
@@ -160,7 +158,7 @@ class CharterSelection extends EditorTreeMenu {
var meta = Json.parse(sys.io.File.getContent('$songFolder/meta.json'));
if (meta.difficulties != null && !meta.difficulties.contains(name)) {
meta.difficulties.push(name);
sys.io.File.saveContent('$songFolder/meta.json', Json.stringify(meta));
CoolUtil.safeSaveFile('$songFolder/meta.json', Json.stringify(meta));
}
}
}
@@ -79,7 +79,7 @@ class CharterStrumLineGroup extends FlxTypedGroup<CharterStrumline> {
fixEvents();
}
public inline function fixEvents() {
public inline function fixEvents() {
for (i in Charter.instance.eventsGroup.members) {
for (j in i.events) {
var paramTypes:Array<EventParamInfo> = EventsData.getEventParams(j.name);
@@ -62,7 +62,7 @@ class CharterStrumlineButton extends UISprite {
if(UIState.state.isOverlapping(button, button.__rect)) {
buttonScale.set(0.95, 0.95);
if (FlxG.mouse.justReleased && onClick != null) {
onClick();
onClick();
if (animationOnClick) pressAnimation();
}
}
@@ -96,7 +96,7 @@ class CharterStrumlineButton extends UISprite {
scaleTween = FlxTween.tween(buttonScaleOffset, {x: .015 * (extra ? 3 : 1), y: .02 * (extra ? 3 : 1)}, .12, {ease: FlxEase.circOut})
.then(FlxTween.tween(buttonScaleOffset, {x: 0, y: 0}, .1 + FlxG.random.float(.1, .3), {ease: FlxEase.circIn}));
if (!extra) return;
if (!extra) return;
if (angleTween != null) angleTween.cancel(); button.angle = 0;
angleTween = FlxTween.tween(button, {angle: 360}, .5, {ease: FlxEase.circInOut});
@@ -63,7 +63,7 @@ class CharterStrumlineScreen extends UISubstateWindow {
var charFileList = Character.getList(true);
if (charFileList.length == 0) charFileList = Character.getList(false);
charactersList = new UIButtonList<CharacterButton>(15, title.y + title.height + 36, 250, 269, "", FlxPoint.get(250, 54), null, 0);
charactersList.addButton.callback = () -> charactersList.add(new CharacterButton(0, 0, "New Char", charFileList, charactersList));
charactersList.cameraSpacing = 0;
@@ -142,7 +142,7 @@ class CharterStrumlineScreen extends UISubstateWindow {
closeButton.color = 0xFFFF0000;
var suffixlist = ["NONE"];
for (i in Paths.getFolderContent('songs/${Charter.__song.toLowerCase()}/song'))
for (i in Paths.getFolderContent('songs/${Charter.__song.toLowerCase()}/song'))
if (i.startsWith("Voices")) {
i = haxe.io.Path.withoutExtension(i.substr("Voices".length));
if (i == "") continue;
+4 -4
View File
@@ -87,7 +87,7 @@ class UIAudioPlayer extends UIButton {
playingSprite.animation.play(sound.playing ? "playing" : "paused");
timeText.text = '${FlxStringUtil.formatTime(sound.time/1000, true)} / ${FlxStringUtil.formatTime(sound.length/1000)}';
if(timeBarPlayer.clipRect == null)
if(timeBarPlayer.clipRect == null)
timeBarPlayer.clipRect = new FlxRect(0, 0, timeBarPlayer.frameWidth, timeBarPlayer.frameHeight);
timeBarPlayer.clipRect.x = timeBarPlayer.frameWidth * (sound.time/sound.length);
@@ -106,13 +106,13 @@ class UIAudioPlayer extends UIButton {
var spritePos:FlxPoint = sprite.getScreenPosition(FlxPoint.get(), __lastDrawCameras[0]);
if (((mousePos.x > (spritePos.x)) && (mousePos.x < (spritePos.x) + timeBar.barWidth))
if (((mousePos.x > (spritePos.x)) && (mousePos.x < (spritePos.x) + timeBar.barWidth))
&& ((mousePos.y > (spritePos.y)) && (mousePos.y < (spritePos.y) + timeBar.barHeight))) {
if (FlxG.mouse.justPressed) {
draggingObj = sprite;
wasPlaying = draggingObj == timeBar ? sound.playing : false;
}
if (FlxG.mouse.pressed) {
if (draggingObj == timeBar) {
if (sound.playing) sound.pause();
@@ -137,7 +137,7 @@ class UIAudioPlayer extends UIButton {
super.destroy();
sound.stop();
@:privateAccess sound.reset();
@:privateAccess sound.reset();
bytes = null;
}
}
-1
View File
@@ -121,7 +121,6 @@ class UIButtonList<T:UIButton> extends UIWindow {
if (dragCallback != null) dragCallback(cast button, button.ID, i);
button.ID = i; // Ok back to normal :D
}
}
addButton.selectable = (hovered && !dragging);
+2 -2
View File
@@ -91,7 +91,7 @@ class UIColorwheel extends UISliceSprite {
}
inline function updateColorPickerSelector()
colorPickerSelector.selector.setPosition(colorPicker.x + (colorPicker.width *saturation) - 8, colorPicker.y + (colorPicker.height + (colorPicker.height * -brightness))- 8);
colorPickerSelector.selector.setPosition(colorPicker.x + (colorPicker.width *saturation) - 8, colorPicker.y + (colorPicker.height + (colorPicker.height * -brightness))- 8);
inline function updateColorPickerMouse(mousePos:FlxPoint) {
saturation = mousePos.x/colorPicker.width; brightness = 1 + -(mousePos.y/colorPicker.height);
@@ -108,7 +108,7 @@ class UIColorwheel extends UISliceSprite {
colorPickerSelector.curColor = color = curColor = FlxColor.fromHSB(hue, saturation, brightness); colorSliderSelector.curColor = FlxColor.fromHSB(hue, 1, 1);
updateColorPickerSelector(); updateColorSliderPickerSelector();
colorHexTextBox.label.text = curColorString = curColor.toHexString(false).replace("0x", "#");
colorHexTextBox.label.text = curColorString = curColor.toWebString();
for (numStepper in rgbNumSteppers) {
numStepper.label.text = Std.string(switch (numStepper.ID) {
default: curColor.red;
+5 -5
View File
@@ -55,7 +55,7 @@ class UISliceSprite extends UISprite {
frame = topleft;
setPosition(x, y);
__setSize(
topleft.frame.width * Math.min(bWidth/(topleft.frame.width*2), 1),
topleft.frame.width * Math.min(bWidth/(topleft.frame.width*2), 1),
topleft.frame.height * Math.min(bHeight/(topleft.frame.height*2), 1)
);
super.drawSuper();
@@ -72,7 +72,7 @@ class UISliceSprite extends UISprite {
setPosition(x + bWidth - (topright.frame.width * Math.min(bWidth/(topright.frame.width*2), 1)), y);
frame = topright;
__setSize(
topright.frame.width * Math.min(bWidth/(topright.frame.width*2), 1),
topright.frame.width * Math.min(bWidth/(topright.frame.width*2), 1),
topright.frame.height * Math.min(bHeight/(topright.frame.height*2), 1)
);
super.drawSuper();
@@ -110,7 +110,7 @@ class UISliceSprite extends UISprite {
frame = bottomleft;
setPosition(x, y + bHeight - (bottomleft.frame.height * Math.min(bHeight/(bottomleft.frame.height*2), 1)));
__setSize(
bottomleft.frame.width * Math.min(bWidth/(bottomleft.frame.width*2), 1),
bottomleft.frame.width * Math.min(bWidth/(bottomleft.frame.width*2), 1),
bottomleft.frame.height * Math.min(bHeight/(bottomleft.frame.height*2), 1)
);
super.drawSuper();
@@ -126,11 +126,11 @@ class UISliceSprite extends UISprite {
// BOTTOM RIGHT
frame = bottomright;
setPosition(
x + bWidth - (bottomright.frame.width * Math.min(bWidth/(bottomright.frame.width*2), 1)),
x + bWidth - (bottomright.frame.width * Math.min(bWidth/(bottomright.frame.width*2), 1)),
y + bHeight - (bottomright.frame.height * Math.min(bHeight/(bottomright.frame.height*2), 1))
);
__setSize(
bottomright.frame.width * Math.min(bWidth/(bottomright.frame.width*2), 1),
bottomright.frame.width * Math.min(bWidth/(bottomright.frame.width*2), 1),
bottomright.frame.height * Math.min(bHeight/(bottomright.frame.height*2), 1)
);
super.drawSuper();
+24 -24
View File
@@ -43,21 +43,21 @@ class UISlider extends UISprite {
makeGraphic(barWidth, 12, 0x00000000, true);
this.drawRoundRect(0, 0, barWidth, 12, 8, 6, 0xFFC0C0C0);
this.drawRoundRect(1, 1, barWidth-2, 12-2, 8, 5, 0xFF140013);
this.drawRoundRect(1, 1, barWidth-2, 12-2, 8, 5, 0xFF140013);
cursor = BUTTON;
progressbar = new UISprite(centered ? barWidth/2 : 0);
progressbar = new UISprite(centered ? barWidth/2 : 0);
progressbar.makeGraphic(barWidth, 8, 0x00000000, true);
progressbar.drawRoundRect(2, 0, barWidth-4, 8, 8, 2, 0xFFFFFFFF);
progressbar.origin.x = 0; progressbar.colorTransform.color = 0xFF67009B;
members.push(progressbar);
progressbar.origin.x = 0; progressbar.colorTransform.color = 0xFF67009B;
members.push(progressbar);
this.value = value;
visualProgress = __barProgress;
members.push(startText = new UIText(x, y, 0, Std.string(segments[0].start).replace("0.", ".")));
members.push(endText = new UIText(x + (barWidth) + 8, y, 0, Std.string(segments[segments.length-1].end).replace("0.", ".")));
for (i in 0...2) {
var selectableBar:UISprite = new UISprite(x,y);
selectableBar.loadGraphic(Paths.image("editors/ui/slider"));
@@ -91,14 +91,14 @@ class UISlider extends UISprite {
var visualProgress:Float = 0;
var __stepperWidth = 25;
public override function update(elapsed:Float) {
selectableHitbox.follow(this, 0, (height-selectableHitbox.height)/2);
__stepperWidth = valueStepper.label.text.length <= 0 ? 25 : Std.int(valueStepper.label.textField.width) + 12;
valueStepper.bWidth = Std.int(FlxMath.lerp(valueStepper.bWidth, __stepperWidth, 1/2.25));
valueStepper.follow(this, -startText.width-10 - valueStepper.bWidth - 4, (height-valueStepper.bHeight)/2);
var lastBarProgress:Float = __barProgress;
if (selectableHitbox.hovered && FlxG.mouse.pressed) {
@@ -111,13 +111,13 @@ class UISlider extends UISprite {
if (onChange != null) onChange(@:bypassAccessor value = __calcValue(__barProgress));
valueStepper.value = value;
}
visualProgress = FlxMath.lerp(visualProgress, __barProgress, 1/2.25);
progressbar.follow(this, progressCentered ? barWidth/2 : 0, (height-progressbar.height)/2);
progressbar.scale.x = FlxMath.bound(visualProgress-(progressCentered?0.5:0),-1,1);
progressbar.colorTransform.color = FlxColor.interpolate(progressbar.colorTransform.color, selectableHitbox.hovered ? 0xFF7F00BF : 0xFF67009B, 1/14);
selectableBar.follow(this, (visualProgress * barWidth) - (selectableBar.width/2), (height-selectableBar.height)/2); selectableBarHighlight.follow(selectableBar);
selectableBar.follow(this, (visualProgress * barWidth) - (selectableBar.width/2), (height-selectableBar.height)/2); selectableBarHighlight.follow(selectableBar);
selectableBarHighlight.alpha = FlxMath.lerp(selectableBarHighlight.alpha, selectableHitbox.hovered ? 0.1: 0, 1/14);
startText.follow(this, -startText.width-10, (height/2) - (startText.height/2));
@@ -128,13 +128,13 @@ class UISlider extends UISprite {
private function __calcValue(progress:Float):Float {
var totalProgress:Float = 0;
for (segment in segments) {
if (progress < totalProgress + segment.size) {
var relativeProgress = (progress - totalProgress) / segment.size;
return FlxMath.remapToRange(relativeProgress, 0, 1, segment.start, segment.end);
}
totalProgress += segment.size;
}
for (segment in segments) {
if (progress < totalProgress + segment.size) {
var relativeProgress = (progress - totalProgress) / segment.size;
return FlxMath.remapToRange(relativeProgress, 0, 1, segment.start, segment.end);
}
totalProgress += segment.size;
}
return segments[segments.length-1].end;
}
@@ -142,14 +142,14 @@ class UISlider extends UISprite {
if (value >= segments[segments.length-1].end) return 1;
if (value <= segments[0].start) return 0;
var totalProgress:Float = 0;
for (segment in segments) {
if (value >= segment.start && value <= segment.end) {
var relativeProgress = FlxMath.remapToRange(value, segment.start, segment.end, 0, 1);
return totalProgress + relativeProgress * segment.size;
}
totalProgress += segment.size;
}
var totalProgress:Float = 0;
for (segment in segments) {
if (value >= segment.start && value <= segment.end) {
var relativeProgress = FlxMath.remapToRange(value, segment.start, segment.end, 0, 1);
return totalProgress + relativeProgress * segment.size;
}
totalProgress += segment.size;
}
return -1;
}
}
+52 -41
View File
@@ -1,6 +1,5 @@
package funkin.game;
import haxe.xml.Printer;
import flixel.util.FlxColor;
import funkin.backend.FunkinSprite;
import flixel.graphics.frames.FlxFrame;
@@ -8,8 +7,6 @@ import flixel.math.FlxPoint;
import funkin.backend.system.interfaces.IBeatReceiver;
import funkin.backend.system.interfaces.IOffsetCompatible;
import funkin.backend.utils.XMLUtil;
import flixel.animation.FlxBaseAnimation;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.math.FlxRect;
import haxe.xml.Access;
import haxe.Exception;
@@ -35,12 +32,6 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
public var stunned(default, set):Bool = false;
private function set_stunned(b:Bool)
{
__stunnedTime = 0;
return stunned = b;
}
public var isPlayer:Bool = false;
public var isGF:Bool = false;
public var curCharacter:String = 'bf';
@@ -80,10 +71,10 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
{
var anims = ["singLEFT", "singDOWN", "singUP", "singRIGHT"];
var event = EventManager.get(DirectionAnimEvent).recycle('${anims[direction]}$suffix', direction, suffix, Context, Reversed, Frame, Force);
var event = EventManager.get(DirectionAnimEvent).recycle(anims[direction] + suffix, direction, suffix, Context, Reversed, Frame, Force);
script.call("onPlaySingAnim", [event]);
if (!event.cancelled)
playAnim(event.animName, event.force, Context, event.reversed, event.frame);
playAnim(event.animName, event.force, event.context, event.reversed, event.frame);
}
public function new(x:Float, y:Float, ?character:String = "bf", isPlayer:Bool = false, switchAnims:Bool = true)
@@ -157,9 +148,10 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
script.call("postCreate");
}
public function fixChar(switchAnims:Bool = false)
public function fixChar(switchAnims:Bool = false, autoInterval:Bool = false)
{
isDanceLeftDanceRight = (hasAnimation("danceLeft") && hasAnimation("danceRight"));
if (isDanceLeftDanceRight = (hasAnimation("danceLeft") && hasAnimation("danceRight")) && autoInterval)
beatInterval = 1;
// alternative to xor operator
// for people who dont believe it, heres the truth table
@@ -197,6 +189,10 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
if (__stunnedTime > 5 / 60)
stunned = false;
}
if (!__lockAnimThisFrame && lastAnimContext != DANCE)
tryDance();
__lockAnimThisFrame = false;
}
@@ -207,24 +203,23 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
*/
public function dance()
{
if (!debugMode)
{
var event = EventManager.get(DanceEvent).recycle(danced);
script.call("onDance", [event]);
if (event.cancelled)
return;
if(debugMode) return;
switch (curCharacter)
{
// hardcode custom dance animations here
default:
if (isDanceLeftDanceRight)
{
playAnim(((danced = !danced) ? 'danceLeft' : 'danceRight') + idleSuffix, DANCE);
}
else
playAnim('idle' + idleSuffix, DANCE);
}
var event = EventManager.get(DanceEvent).recycle(danced);
script.call("onDance", [event]);
if (event.cancelled)
return;
switch (curCharacter)
{
// hardcode custom dance animations here
default:
if (isDanceLeftDanceRight)
{
playAnim(((danced = !danced) ? 'danceLeft' : 'danceRight') + idleSuffix, DANCE);
}
else
playAnim('idle' + idleSuffix, DANCE);
}
}
@@ -250,17 +245,10 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
*/
public var danceOnBeat:Bool = true;
/**
* Interval at which the character will dance (higher number = slower dance)
*/
public var danceInterval:Int = 1;
public override function beatHit(curBeat:Int) {
script.call("beatHit", [curBeat]);
if (danceInterval < 1)
danceInterval = 1;
if (danceOnBeat && curBeat % danceInterval == 0 && !__lockAnimThisFrame)
if (danceOnBeat && (curBeat + beatOffset) % beatInterval == 0 && !__lockAnimThisFrame)
{
tryDance();
}
@@ -415,7 +403,10 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
if (xml.x.exists("antialiasing")) antialiasing = (xml.x.get("antialiasing") == "true");
if (xml.x.exists("sprite")) sprite = xml.x.get("sprite");
var tempList = ["isPlayer", "isGF", "x", "y", "gameOverChar", "camx", "camy", "holdTime", "flipX", "icon", "color", "scale", "antialiasing", "sprite"];
var hasInterval:Bool = xml.x.exists("interval");
if (hasInterval) beatInterval = Std.parseInt(xml.x.get("interval"));
var tempList = ["isPlayer", "isGF", "x", "y", "gameOverChar", "camx", "camy", "holdTime", "flipX", "icon", "color", "scale", "antialiasing", "sprite", "interval"];
var atts = [for (i in xml.x.attributes()) i];
for (i in atts)
if (!tempList.contains(i)) {
@@ -431,7 +422,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
XMLUtil.addXMLAnimation(this, anim);
}
fixChar(true);
fixChar(true, !hasInterval);
dance();
}
@@ -448,7 +439,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
xml.set("flipX", Std.string(flipX));
xml.set("icon", getIcon());
if (iconColor != null)
xml.set("color", iconColor.toHexString(false).replace("0x", "#"));
xml.set("color", iconColor.toWebString());
xml.set("scale", Std.string(scale.x));
xml.set("antialiasing", antialiasing == true ? "true" : "false");
xml.set("sprite", sprite);
@@ -474,6 +465,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
var offset:FlxPoint = getAnimOffset(anim.name);
animXml.set("x", Std.string(offset.x));
animXml.set("y", Std.string(offset.y));
offset.putWeak();
if (anim.indices.length > 0)
animXml.set("indices", anim.indices.join(","));
xml.addChild(animXml);
@@ -490,6 +482,25 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
return [for(a in xml.nodes.anim) if(a.has.name) a.att.name];
}
// Getters / Setters
@:noCompletion private function set_stunned(b:Bool)
{
__stunnedTime = 0;
return stunned = b;
}
// Backwards Compat
/**
* Interval at which the character will dance (higher number = slower dance)
*/
@:noCompletion public var danceInterval(get, set):Int;
@:noCompletion private function set_danceInterval(v:Int)
return beatInterval = v;
@:noCompletion private function get_danceInterval()
return beatInterval;
// Statics
public static function getIconFromCharName(?curCharacter:String) {
+35 -15
View File
@@ -8,14 +8,21 @@ class HealthIcon extends FlxSprite
*/
public var sprTracker:FlxSprite;
/**
* The currently showing icon
*/
public var curCharacter:String = null;
/**
* If the character is for the player
*/
public var isPlayer:Bool;
/**
* Health steps in this format:
* Min Percentage => Frame Index
*/
public var healthSteps:Map<Int, Int> = [
0 => 1, // losing icon
20 => 0, // normal icon
];
public var healthSteps:Map<Int, Int> = null;
/**
* Helper for HScript who can't make maps
@@ -40,21 +47,34 @@ class HealthIcon extends FlxSprite
{
super();
health = 0.5;
var path = Paths.image('icons/$char');
if (!Assets.exists(path)) path = Paths.image('icons/face');
loadGraphic(path, true, 150, 150);
animation.add(char, [for(i in 0...frames.frames.length) i], 0, false, isPlayer);
antialiasing = true;
animation.play(char);
if (frames.frames.length >= 3)
healthSteps[80] = 2; // winning icon
this.isPlayer = isPlayer;
setIcon(char);
scrollFactor.set();
}
public function setIcon(char:String, width:Int = 150, height:Int = 150) {
if(curCharacter != char || this.width != width || this.height != height) {
curCharacter = char;
var path = Paths.image('icons/$char');
if (!Assets.exists(path)) path = Paths.image('icons/face');
loadGraphic(path, true, width, height);
animation.add(char, [for(i in 0...frames.frames.length) i], 0, false, isPlayer);
antialiasing = true;
animation.play(char);
healthSteps = [
0 => 1, // losing icon
20 => 0, // normal icon
];
if (frames.frames.length >= 3)
healthSteps[80] = 2; // winning icon
}
}
override function update(elapsed:Float)
{
super.update(elapsed);
+4 -4
View File
@@ -649,7 +649,7 @@ class PlayState extends MusicBeatState
var strLine = new StrumLine(chars,
startingPos,
strumLine.strumScale == null ? 1 : strumLine.strumScale,
strumLine.type == 2 || (!coopMode && !((strumLine.type == 1 && !opponentMode) || (strumLine.type == 0 && opponentMode))),
strumLine.type == 2 || (!coopMode && !((strumLine.type == 1 && !opponentMode) || (strumLine.type == 0 && opponentMode))),
strumLine.type != 1, coopMode ? (strumLine.type == 1 ? controlsP1 : controlsP2) : controls,
strumLine.vocalsSuffix
);
@@ -758,7 +758,7 @@ class PlayState extends MusicBeatState
SaveWarning.selectionClass = CharterSelection;
SaveWarning.warningFunc = saveWarn;
SaveWarning.saveFunc = () -> {
@:privateAccess Chart.save('${Paths.getAssetsRoot()}/songs/${Charter.__song.toLowerCase()}',
@:privateAccess Chart.save('${Paths.getAssetsRoot()}/songs/${Charter.__song.toLowerCase()}',
PlayState.SONG, Charter.__diff.toLowerCase(), {saveMetaInChart: false, saveEventsInChart: true});
}
}
@@ -1846,10 +1846,10 @@ class PlayState extends MusicBeatState
private inline function get_playerStrums():StrumLine
return strumLines.members[1];
private inline function get_gfSpeed():Int
return (strumLines.members[2] != null && strumLines.members[2].characters[0] != null) ? strumLines.members[2].characters[0].danceInterval : 1;
return (strumLines.members[2] != null && strumLines.members[2].characters[0] != null) ? strumLines.members[2].characters[0].beatInterval : 1;
private inline function set_gfSpeed(v:Int):Int {
if (strumLines.members[2] != null && strumLines.members[2].characters[0] != null)
strumLines.members[2].characters[0].danceInterval = v;
strumLines.members[2].characters[0].beatInterval = v;
return v;
}
@@ -51,7 +51,7 @@ class ScriptedCutscene extends Cutscene {
script.call("destroy");
super.destroy();
}
// VIDEOS
#if REGION
public function startVideo(path:String, ?callback:Void->Void) {
+1 -1
View File
@@ -119,7 +119,7 @@ class FreeplayState extends MusicBeatState
DiscordUtil.changePresence("In the Menus", null);
super.create();
// LOAD CHARACTERS
bg = new FlxSprite(0, 0).loadAnimatedGraphic(Paths.image('menus/menuDesat'));
+4 -4
View File
@@ -19,25 +19,25 @@ class GitarooPause extends MusicBeatState
if (FlxG.sound.music != null)
FlxG.sound.music.stop();
var bg:FlxSprite = new FlxSprite().loadAnimatedGraphic(Paths.image('menus/pauseAlt//pauseBG'));
var bg:FlxSprite = new FlxSprite().loadAnimatedGraphic(Paths.image('menus/pauseAlt/pauseBG'));
add(bg);
var bf:FlxSprite = new FlxSprite(0, 30);
bf.frames = Paths.getFrames('menus/pauseAlt//bfLol');
bf.frames = Paths.getFrames('menus/pauseAlt/bfLol');
bf.animation.addByPrefix('lol', "funnyThing", 13);
bf.animation.play('lol');
add(bf);
bf.screenCenter(X);
replayButton = new FlxSprite(FlxG.width * 0.28, FlxG.height * 0.7);
replayButton.frames = Paths.getFrames('menus/pauseAlt//pauseUI');
replayButton.frames = Paths.getFrames('menus/pauseAlt/pauseUI');
replayButton.animation.addByPrefix('selected', 'bluereplay', 0, false);
replayButton.animation.appendByPrefix('selected', 'yellowreplay');
replayButton.animation.play('selected');
add(replayButton);
cancelButton = new FlxSprite(FlxG.width * 0.58, replayButton.y);
cancelButton.frames = Paths.getFrames('menus/pauseAlt//pauseUI');
cancelButton.frames = Paths.getFrames('menus/pauseAlt/pauseUI');
cancelButton.animation.addByPrefix('selected', 'bluecancel', 0, false);
cancelButton.animation.appendByPrefix('selected', 'cancelyellow');
cancelButton.animation.play('selected');
+1 -4
View File
@@ -101,9 +101,7 @@ class MainMenuState extends MusicBeatState
if (FlxG.keys.justPressed.SEVEN)
FlxG.switchState(new funkin.desktop.DesktopMain());
if (FlxG.keys.justPressed.EIGHT) {
#if sys
sys.io.File.saveContent("chart.json", Json.stringify(funkin.backend.chart.Chart.parse("dadbattle", "hard")));
#end
CoolUtil.safeSaveFile("chart.json", Json.stringify(funkin.backend.chart.Chart.parse("dadbattle", "hard")));
}
*/
}
@@ -118,7 +116,6 @@ class MainMenuState extends MusicBeatState
FlxG.switchState(new TitleState());
#if MOD_SUPPORT
// make it customisable
if (controls.SWITCHMOD) {
openSubState(new ModSwitchMenu());
persistentUpdate = false;
+1 -13
View File
@@ -22,19 +22,7 @@ class ModSwitchMenu extends MusicBeatSubstate {
bg.alpha = 0;
FlxTween.tween(bg, {alpha: 0.5}, 0.25, {ease: FlxEase.cubeOut});
for(modFolder in FileSystem.readDirectory(ModsFolder.modsPath)) {
if (FileSystem.isDirectory('${ModsFolder.modsPath}${modFolder}')) {
mods.push(modFolder);
} else {
var ext = Path.extension(modFolder).toLowerCase();
switch(ext) {
case 'zip':
// is a zip mod!!
mods.push(Path.withoutExtension(modFolder));
}
}
}
mods = ModsFolder.getModsList();
mods.push(null);
alphabets = new FlxTypedGroup<Alphabet>();
+1 -1
View File
@@ -161,7 +161,7 @@ class PauseSubState extends MusicBeatSubstate
else {
PlayState.resetSongInfos();
if (Charter.instance != null) Charter.instance.__clearStatics();
CoolUtil.playMenuSong();
FlxG.switchState(PlayState.isStoryMode ? new StoryMenuState() : new FreeplayState());
}
@@ -80,7 +80,7 @@ class PlaytestingWarningSubstate extends MusicBeatSubstate
if (controls.RIGHT_P) changeSelection(1);
if (controls.LEFT_P) changeSelection(-1);
for (i => option in options) {
option.x = FlxG.width * ((1+i)/4) - (option.fieldWidth/2);
switch(i) {
+1 -2
View File
@@ -276,7 +276,6 @@ class StoryMenuState extends MusicBeatState {
}
public function addCharacter(charName:String) {
var char:Access = null;
try {
char = new Access(Xml.parse(Assets.getText(Paths.xml('weeks/characters/$charName'))).firstElement());
@@ -307,7 +306,7 @@ class StoryMenuState extends MusicBeatState {
} else {
weeksFound = [for(c in Paths.getFolderContent('data/weeks/weeks/', false, source)) if (Path.extension(c).toLowerCase() == "xml") Path.withoutExtension(c)];
}
if (weeksFound.length > 0) {
for(s in weeksFound)
weeks.push(s);
+1 -1
View File
@@ -34,7 +34,7 @@ class TitleState extends MusicBeatState
MusicBeatState.skipTransIn = true;
startIntro();
super.create();
}
+6 -6
View File
@@ -65,7 +65,7 @@ class OptionsMenu extends TreeMenu {
}
}
})]);
var xmlPath = Paths.xml("config/options");
for(source in [funkin.backend.assets.AssetsLibraryList.AssetSource.SOURCE, funkin.backend.assets.AssetsLibraryList.AssetSource.MODS]) {
if (Paths.assetsTree.existsSpecific(xmlPath, "TEXT", source)) {
@@ -75,13 +75,13 @@ class OptionsMenu extends TreeMenu {
} catch(e) {
Logs.trace('Error while parsing options.xml: ${Std.string(e)}', ERROR);
}
if (access != null)
for(o in parseOptionsFromXML(access))
main.add(o);
}
}
}
public override function exit() {
@@ -123,7 +123,7 @@ class OptionsMenu extends TreeMenu {
Logs.trace("A choice option requires an \"id\" for option saving.", WARNING);
continue;
}
var optionOptions:Array<Dynamic> = [];
var optionDisplayOptions:Array<String> = [];
@@ -131,10 +131,10 @@ class OptionsMenu extends TreeMenu {
optionOptions.push(choice.att.value);
optionDisplayOptions.push(choice.att.name);
}
if(optionOptions.length > 0)
options.push(new ArrayOption(name, desc, optionOptions, optionDisplayOptions, node.att.id, null, FlxG.save.data));
case "menu":
options.push(new TextOption(name + " >", desc, function() {
optionsTree.add(new OptionsScreen(name, desc, parseOptionsFromXML(node)));
+1 -1
View File
@@ -71,7 +71,7 @@ class OptionsScreen extends FlxTypedSpriteGroup<OptionType> {
public function updateMenuDesc(?customTxt:String) {
if (parent.treeParent == null) return;
var text:String = members[curSelected].desc;
if (customTxt != null) text = customTxt;
parent.treeParent.updateDesc(text);
+1 -4
View File
@@ -53,10 +53,7 @@ class OptionsTree extends FlxTypedGroup<OptionsScreen> {
}
public function clearLastMenu() {
if (lastMenu != null) {
lastMenu.destroy();
lastMenu = null;
}
lastMenu = FlxDestroyUtil.destroy(lastMenu);
}
public override function destroy() {
@@ -52,10 +52,10 @@ class KeybindSetting extends FlxTypedSpriteGroup<FlxSprite> {
var min = Math.min(icon.scale.x, icon.scale.y);
icon.scale.set(min, min);
add(icon);
title.setPosition(100, 0);
}
setPosition(x, y);
}
@@ -192,7 +192,7 @@ class KeybindsOptions extends MusicBeatSubstate {
if (canSelect) {
changeSelection((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0));
if (controls.BACK) {
MusicBeatState.skipTransIn = true;
if (isSubState)
@@ -107,7 +107,7 @@ class NativeWindow
#if (!macro && lime_cffi)
handle = NativeCFFI.lime_window_create(parent.application.__backend.handle, width, height, flags, title);
#if (DARK_MODE_WINDOW && !macro)
funkin.backend.utils.NativeAPI.setDarkMode(title, true);
#end
@@ -0,0 +1,864 @@
package openfl.display;
#if !flash
import openfl.display._internal.Context3DGraphics;
import openfl.display.Bitmap;
import openfl.display.DisplayObject;
import openfl.display.Tilemap;
import openfl.events.EventDispatcher;
import openfl.events.RenderEvent;
import openfl.geom.ColorTransform;
import openfl.geom.Matrix;
import openfl.geom.Point;
import openfl.geom.Rectangle;
import openfl.text.TextField;
#if lime
import lime._internal.graphics.ImageCanvasUtil; // TODO
import lime.graphics.cairo.Cairo;
import lime.graphics.RenderContext;
import lime.graphics.RenderContextType;
#end
#if !openfl_debug
@:fileXml('tags="haxe,release"')
@:noDebug
#end
@:access(openfl.display._internal.Context3DGraphics)
@:access(lime.graphics.ImageBuffer)
@:access(openfl.display.Bitmap)
@:access(openfl.display.BitmapData)
@:access(openfl.display.DisplayObject)
@:access(openfl.display.Graphics)
@:access(openfl.display.Tilemap)
@:access(openfl.display3D.Context3D)
@:access(openfl.events.RenderEvent)
@:access(openfl.filters.BitmapFilter)
@:access(openfl.geom.ColorTransform)
@:access(openfl.geom.Rectangle)
@:access(openfl.geom.Transform)
@:access(openfl.text.TextField)
@:allow(openfl.display._internal)
@:allow(openfl.display)
@:allow(openfl.text)
class DisplayObjectRenderer extends EventDispatcher
{
@:noCompletion private var __allowSmoothing:Bool;
@:noCompletion private var __blendMode:BlendMode;
@:noCompletion private var __cleared:Bool;
@SuppressWarnings("checkstyle:Dynamic") @:noCompletion private var __context:#if lime RenderContext #else Dynamic #end;
@:noCompletion private var __overrideBlendMode:BlendMode;
@:noCompletion private var __pixelRatio:Float;
@:noCompletion private var __roundPixels:Bool;
@:noCompletion private var __stage:Stage;
@:noCompletion private var __tempColorTransform:ColorTransform;
@:noCompletion private var __transparent:Bool;
@SuppressWarnings("checkstyle:Dynamic") @:noCompletion private var __type:#if lime RenderContextType #else Dynamic #end;
@:noCompletion private var __worldAlpha:Float;
@:noCompletion private var __worldColorTransform:ColorTransform;
@:noCompletion private var __worldTransform:Matrix;
@:noCompletion private function new()
{
super();
__allowSmoothing = true;
__pixelRatio = 1;
__tempColorTransform = new ColorTransform();
__worldAlpha = 1;
}
@:noCompletion private function __clear():Void {}
@:noCompletion private function __getAlpha(value:Float):Float
{
return value * __worldAlpha;
}
@:noCompletion private function __getColorTransform(value:ColorTransform):ColorTransform
{
if (__worldColorTransform != null)
{
__tempColorTransform.__copyFrom(__worldColorTransform);
__tempColorTransform.__combine(value);
return __tempColorTransform;
}
else
{
return value;
}
}
@:noCompletion private function __popMask():Void {}
@:noCompletion private function __popMaskObject(object:DisplayObject, handleScrollRect:Bool = true):Void {}
@:noCompletion private function __popMaskRect():Void {}
@:noCompletion private function __pushMask(mask:DisplayObject):Void {}
@:noCompletion private function __pushMaskObject(object:DisplayObject, handleScrollRect:Bool = true):Void {}
@:noCompletion private function __pushMaskRect(rect:Rectangle, transform:Matrix):Void {}
@:noCompletion private function __render(object:IBitmapDrawable):Void {}
@:noCompletion private function __renderEvent(displayObject:DisplayObject):Void
{
var renderer = this;
#if lime
if (displayObject.__customRenderEvent != null && displayObject.__renderable)
{
displayObject.__customRenderEvent.allowSmoothing = renderer.__allowSmoothing;
displayObject.__customRenderEvent.objectMatrix.copyFrom(displayObject.__renderTransform);
displayObject.__customRenderEvent.objectColorTransform.__copyFrom(displayObject.__worldColorTransform);
displayObject.__customRenderEvent.renderer = renderer;
switch (renderer.__type)
{
case OPENGL:
if (!renderer.__cleared) renderer.__clear();
var renderer:OpenGLRenderer = cast renderer;
renderer.setShader(displayObject.__worldShader);
renderer.__context3D.__flushGL();
displayObject.__customRenderEvent.type = RenderEvent.RENDER_OPENGL;
case CAIRO:
displayObject.__customRenderEvent.type = RenderEvent.RENDER_CAIRO;
case DOM:
if (displayObject.stage != null && displayObject.__worldVisible)
{
displayObject.__customRenderEvent.type = RenderEvent.RENDER_DOM;
}
else
{
displayObject.__customRenderEvent.type = RenderEvent.CLEAR_DOM;
}
case CANVAS:
displayObject.__customRenderEvent.type = RenderEvent.RENDER_CANVAS;
default:
return;
}
renderer.__setBlendMode(displayObject.__worldBlendMode);
renderer.__pushMaskObject(displayObject);
displayObject.dispatchEvent(displayObject.__customRenderEvent);
renderer.__popMaskObject(displayObject);
if (renderer.__type == OPENGL)
{
var renderer:OpenGLRenderer = cast renderer;
renderer.setViewport();
}
}
#end
}
@:noCompletion private function __resize(width:Int, height:Int):Void {}
@:noCompletion private function __setBlendMode(value:BlendMode):Void {}
@:noCompletion private function __shouldCacheHardware(displayObject:DisplayObject, value:Null<Bool>):Null<Bool>
{
if (displayObject == null) return null;
switch (displayObject.__drawableType)
{
case SPRITE, STAGE:
if (value == true) return true;
value = __shouldCacheHardware_DisplayObject(displayObject, value);
if (value == true) return true;
if (displayObject.__children != null)
{
for (child in displayObject.__children)
{
value = __shouldCacheHardware_DisplayObject(child, value);
if (value == true) return true;
}
}
return value;
case TEXT_FIELD:
return value == true ? true : false;
case TILEMAP:
return true;
default:
return __shouldCacheHardware_DisplayObject(displayObject, value);
}
}
@:noCompletion private function __shouldCacheHardware_DisplayObject(displayObject:DisplayObject, value:Null<Bool>):Null<Bool>
{
if (value == true || displayObject.__filters != null) return true;
if (value == false || (displayObject.__graphics != null && !Context3DGraphics.isCompatible(displayObject.__graphics)))
{
return false;
}
return null;
}
@:noCompletion private function __updateCacheBitmap(displayObject:DisplayObject, force:Bool):Bool
{
if (displayObject == null) return false;
var renderer = this;
switch (displayObject.__drawableType)
{
case BITMAP:
var bitmap:Bitmap = cast displayObject;
// TODO: Handle filters without an intermediate draw
if (bitmap.__bitmapData == null
|| (bitmap.__filters == null #if lime && renderer.__type == OPENGL #end && bitmap.__cacheBitmap == null)) return false;
force = (bitmap.__bitmapData.image != null && bitmap.__bitmapData.image.version != bitmap.__imageVersion);
case TEXT_FIELD:
var textField:TextField = cast displayObject;
if (textField.__filters == null #if lime && renderer.__type == OPENGL #end && textField.__cacheBitmap == null
&& !textField.__domRender) return false;
if (force) textField.__renderDirty = true;
force = force || textField.__dirty;
case TILEMAP:
var tilemap:Tilemap = cast displayObject;
if (tilemap.__filters == null #if lime && renderer.__type == OPENGL #end && tilemap.__cacheBitmap == null) return false;
default:
}
#if lime
if (displayObject.__isCacheBitmapRender) return false;
#if openfl_disable_cacheasbitmap
return false;
#end
var colorTransform = ColorTransform.__pool.get();
colorTransform.__copyFrom(displayObject.__worldColorTransform);
if (renderer.__worldColorTransform != null) colorTransform.__combine(renderer.__worldColorTransform);
var updated = false;
// TODO: Do not force cacheAsBitmap on OpenGL once Scale-9 is properly supported in Context3DShape
if (displayObject.cacheAsBitmap
|| (renderer.__type != OPENGL && !colorTransform.__isDefault(true))
|| (renderer.__type == OPENGL && displayObject.scale9Grid != null))
{
var rect = null;
var needRender = (displayObject.__cacheBitmap == null
|| (displayObject.__renderDirty && (force || (displayObject.__children != null && displayObject.__children.length > 0)))
|| displayObject.opaqueBackground != displayObject.__cacheBitmapBackground);
var softwareDirty = needRender
|| (displayObject.__graphics != null && displayObject.__graphics.__softwareDirty)
|| !displayObject.__cacheBitmapColorTransform.__equals(colorTransform, true);
var hardwareDirty = needRender || (displayObject.__graphics != null && displayObject.__graphics.__hardwareDirty);
var renderType = renderer.__type;
if (softwareDirty || hardwareDirty)
{
#if !openfl_force_gl_cacheasbitmap
if (renderType == OPENGL)
{
if (#if !openfl_disable_gl_cacheasbitmap __shouldCacheHardware(displayObject, null) == false #else true #end)
{
#if (js && html5)
renderType = CANVAS;
#else
renderType = CAIRO;
#end
}
}
#end
if (softwareDirty && (renderType == CANVAS || renderType == CAIRO)) needRender = true;
if (hardwareDirty && renderType == OPENGL) needRender = true;
}
var updateTransform = (needRender || !displayObject.__cacheBitmap.__worldTransform.equals(displayObject.__worldTransform));
var hasFilters = #if !openfl_disable_filters displayObject.__filters != null #else false #end;
#if !openfl_enable_cacheasbitmap
if (renderer.__type == DOM && !hasFilters)
{
return false;
}
#end
if (hasFilters && !needRender)
{
for (filter in displayObject.__filters)
{
if (filter.__renderDirty)
{
needRender = true;
break;
}
}
}
if (displayObject.__cacheBitmapMatrix == null)
{
displayObject.__cacheBitmapMatrix = new Matrix();
}
var bitmapMatrix = (displayObject.__cacheAsBitmapMatrix != null ? displayObject.__cacheAsBitmapMatrix : displayObject.__renderTransform);
if (!needRender
&& (bitmapMatrix.a != displayObject.__cacheBitmapMatrix.a
|| bitmapMatrix.b != displayObject.__cacheBitmapMatrix.b
|| bitmapMatrix.c != displayObject.__cacheBitmapMatrix.c
|| bitmapMatrix.d != displayObject.__cacheBitmapMatrix.d))
{
needRender = true;
}
if (!needRender
&& renderer.__type != OPENGL
&& displayObject.__cacheBitmapData != null
&& displayObject.__cacheBitmapData.image != null
&& displayObject.__cacheBitmapData.image.version < displayObject.__cacheBitmapData.__textureVersion)
{
needRender = true;
}
// Ensure that cached bitmap is updated after changes to scrollRect
if (!needRender)
{
var current = displayObject;
while (current != null)
{
if (current.scrollRect != null)
{
// TODO: do we need to update transform if scroll rects haven't changed?
updateTransform = true;
break;
}
current = current.parent;
}
}
displayObject.__cacheBitmapMatrix.copyFrom(bitmapMatrix);
displayObject.__cacheBitmapMatrix.tx = 0;
displayObject.__cacheBitmapMatrix.ty = 0;
// TODO: Handle dimensions better if object has a scrollRect?
var bitmapWidth = 0, bitmapHeight = 0;
var filterWidth = 0, filterHeight = 0;
var offsetX = 0., offsetY = 0.;
#if (openfl_disable_hdpi || openfl_disable_hdpi_cacheasbitmap)
var pixelRatio = 1;
#else
var pixelRatio = __pixelRatio;
#end
if (updateTransform || needRender)
{
rect = Rectangle.__pool.get();
displayObject.__getFilterBounds(rect, displayObject.__cacheBitmapMatrix);
filterWidth = rect.width > 0 ? Math.ceil(rect.width * pixelRatio) : 0;
filterHeight = rect.height > 0 ? Math.ceil(rect.height * pixelRatio) : 0;
offsetX = rect.x > 0 ? Math.ceil(rect.x) : Math.floor(rect.x);
offsetY = rect.y > 0 ? Math.ceil(rect.y) : Math.floor(rect.y);
if (displayObject.__cacheBitmapData != null)
{
if (filterWidth > displayObject.__cacheBitmapData.width || filterHeight > displayObject.__cacheBitmapData.height)
{
bitmapWidth = Math.ceil(Math.max(filterWidth * 1.25, displayObject.__cacheBitmapData.width));
bitmapHeight = Math.ceil(Math.max(filterHeight * 1.25, displayObject.__cacheBitmapData.height));
needRender = true;
}
else
{
bitmapWidth = displayObject.__cacheBitmapData.width;
bitmapHeight = displayObject.__cacheBitmapData.height;
}
}
else
{
bitmapWidth = filterWidth;
bitmapHeight = filterHeight;
}
}
if (needRender)
{
updateTransform = true;
displayObject.__cacheBitmapBackground = displayObject.opaqueBackground;
if (filterWidth >= 0.5 && filterHeight >= 0.5)
{
var needsFill = (displayObject.opaqueBackground != null
&& (bitmapWidth != filterWidth || bitmapHeight != filterHeight));
var fillColor = displayObject.opaqueBackground != null ? (0xFF << 24) | displayObject.opaqueBackground : 0;
var bitmapColor = needsFill ? 0 : fillColor;
var allowFramebuffer = (renderer.__type == OPENGL);
if (displayObject.__cacheBitmapData == null
|| bitmapWidth > displayObject.__cacheBitmapData.width
|| bitmapHeight > displayObject.__cacheBitmapData.height)
{
displayObject.__cacheBitmapData = new BitmapData(bitmapWidth, bitmapHeight, true, bitmapColor);
if (displayObject.__cacheBitmap == null) displayObject.__cacheBitmap = new Bitmap();
displayObject.__cacheBitmap.__bitmapData = displayObject.__cacheBitmapData;
displayObject.__cacheBitmapRenderer = null;
}
else
{
displayObject.__cacheBitmapData.__fillRect(displayObject.__cacheBitmapData.rect, bitmapColor, allowFramebuffer);
}
if (needsFill)
{
rect.setTo(0, 0, filterWidth, filterHeight);
displayObject.__cacheBitmapData.__fillRect(rect, fillColor, allowFramebuffer);
}
}
else
{
ColorTransform.__pool.release(colorTransform);
displayObject.__cacheBitmap = null;
displayObject.__cacheBitmapData = null;
displayObject.__cacheBitmapData2 = null;
displayObject.__cacheBitmapData3 = null;
displayObject.__cacheBitmapRenderer = null;
if (displayObject.__drawableType == TEXT_FIELD)
{
var textField:TextField = cast displayObject;
if (textField.__cacheBitmap != null)
{
textField.__cacheBitmap.__renderTransform.tx -= textField.__offsetX * pixelRatio;
textField.__cacheBitmap.__renderTransform.ty -= textField.__offsetY * pixelRatio;
}
}
return true;
}
}
else
{
// Should we retain these longer?
displayObject.__cacheBitmapData = displayObject.__cacheBitmap.bitmapData;
displayObject.__cacheBitmapData2 = null;
displayObject.__cacheBitmapData3 = null;
}
if (updateTransform || needRender)
{
displayObject.__cacheBitmap.__worldTransform.copyFrom(displayObject.__worldTransform);
if (bitmapMatrix == displayObject.__renderTransform)
{
displayObject.__cacheBitmap.__renderTransform.identity();
displayObject.__cacheBitmap.__renderTransform.scale(1 / pixelRatio, 1 / pixelRatio);
displayObject.__cacheBitmap.__renderTransform.tx = displayObject.__renderTransform.tx + offsetX;
displayObject.__cacheBitmap.__renderTransform.ty = displayObject.__renderTransform.ty + offsetY;
}
else
{
displayObject.__cacheBitmap.__renderTransform.copyFrom(displayObject.__cacheBitmapMatrix);
displayObject.__cacheBitmap.__renderTransform.invert();
displayObject.__cacheBitmap.__renderTransform.concat(displayObject.__renderTransform);
displayObject.__cacheBitmap.__renderTransform.a *= 1 / pixelRatio;
displayObject.__cacheBitmap.__renderTransform.d *= 1 / pixelRatio;
displayObject.__cacheBitmap.__renderTransform.tx += offsetX;
displayObject.__cacheBitmap.__renderTransform.ty += offsetY;
}
}
displayObject.__cacheBitmap.smoothing = renderer.__allowSmoothing;
displayObject.__cacheBitmap.__renderable = displayObject.__renderable;
displayObject.__cacheBitmap.__worldAlpha = displayObject.__worldAlpha;
displayObject.__cacheBitmap.__worldBlendMode = displayObject.__worldBlendMode;
displayObject.__cacheBitmap.__worldShader = displayObject.__worldShader;
// displayObject.__cacheBitmap.__scrollRect = displayObject.__scrollRect;
// displayObject.__cacheBitmap.filters = displayObject.filters;
displayObject.__cacheBitmap.mask = displayObject.__mask;
if (needRender)
{
#if lime
if (displayObject.__cacheBitmapRenderer == null || renderType != displayObject.__cacheBitmapRenderer.__type)
{
if (renderType == OPENGL)
{
displayObject.__cacheBitmapRenderer = new OpenGLRenderer(cast(renderer, OpenGLRenderer).__context3D, displayObject.__cacheBitmapData);
}
else
{
if (displayObject.__cacheBitmapData.image == null)
{
var color = displayObject.opaqueBackground != null ? (0xFF << 24) | displayObject.opaqueBackground : 0;
displayObject.__cacheBitmapData = new BitmapData(bitmapWidth, bitmapHeight, true, color);
displayObject.__cacheBitmap.__bitmapData = displayObject.__cacheBitmapData;
}
#if (js && html5)
ImageCanvasUtil.convertToCanvas(displayObject.__cacheBitmapData.image);
displayObject.__cacheBitmapRenderer = new CanvasRenderer(displayObject.__cacheBitmapData.image.buffer.__srcContext);
#else
displayObject.__cacheBitmapRenderer = new CairoRenderer(new Cairo(displayObject.__cacheBitmapData.getSurface()));
#end
}
displayObject.__cacheBitmapRenderer.__worldTransform = new Matrix();
displayObject.__cacheBitmapRenderer.__worldColorTransform = new ColorTransform();
}
#else
return false;
#end
if (displayObject.__cacheBitmapColorTransform == null) displayObject.__cacheBitmapColorTransform = new ColorTransform();
displayObject.__cacheBitmapRenderer.__stage = displayObject.stage;
displayObject.__cacheBitmapRenderer.__allowSmoothing = renderer.__allowSmoothing;
displayObject.__cacheBitmapRenderer.__setBlendMode(NORMAL);
displayObject.__cacheBitmapRenderer.__worldAlpha = 1 / displayObject.__worldAlpha;
displayObject.__cacheBitmapRenderer.__worldTransform.copyFrom(displayObject.__renderTransform);
displayObject.__cacheBitmapRenderer.__worldTransform.invert();
displayObject.__cacheBitmapRenderer.__worldTransform.concat(displayObject.__cacheBitmapMatrix);
displayObject.__cacheBitmapRenderer.__worldTransform.tx -= offsetX;
displayObject.__cacheBitmapRenderer.__worldTransform.ty -= offsetY;
displayObject.__cacheBitmapRenderer.__worldTransform.scale(pixelRatio, pixelRatio);
displayObject.__cacheBitmapRenderer.__pixelRatio = pixelRatio;
displayObject.__cacheBitmapRenderer.__worldColorTransform.__copyFrom(colorTransform);
displayObject.__cacheBitmapRenderer.__worldColorTransform.__invert();
displayObject.__isCacheBitmapRender = true;
if (displayObject.__cacheBitmapRenderer.__type == OPENGL)
{
var parentRenderer:OpenGLRenderer = cast renderer;
var childRenderer:OpenGLRenderer = cast displayObject.__cacheBitmapRenderer;
var context = childRenderer.__context3D;
var cacheRTT = context.__state.renderToTexture;
var cacheRTTDepthStencil = context.__state.renderToTextureDepthStencil;
var cacheRTTAntiAlias = context.__state.renderToTextureAntiAlias;
var cacheRTTSurfaceSelector = context.__state.renderToTextureSurfaceSelector;
// var cacheFramebuffer = context.__contextState.__currentGLFramebuffer;
var cacheBlendMode = parentRenderer.__blendMode;
parentRenderer.__suspendClipAndMask();
childRenderer.__copyShader(parentRenderer);
// childRenderer.__copyState (parentRenderer);
displayObject.__cacheBitmapData.__setUVRect(context, 0, 0, filterWidth, filterHeight);
childRenderer.__setRenderTarget(displayObject.__cacheBitmapData);
if (displayObject.__cacheBitmapData.image != null)
displayObject.__cacheBitmapData.__textureVersion = displayObject.__cacheBitmapData.image.version
+ 1;
displayObject.__cacheBitmapData.__drawGL(displayObject, childRenderer);
if (hasFilters)
{
var needSecondBitmapData = true;
var needCopyOfOriginal = false;
for (filter in displayObject.__filters)
{
// if (filter.__needSecondBitmapData) {
// needSecondBitmapData = true;
// }
if (filter.__preserveObject)
{
needCopyOfOriginal = true;
}
}
var bitmap = displayObject.__cacheBitmapData;
var bitmap2 = null;
var bitmap3 = null;
// if (needSecondBitmapData) {
if (displayObject.__cacheBitmapData2 == null
|| bitmapWidth > displayObject.__cacheBitmapData2.width
|| bitmapHeight > displayObject.__cacheBitmapData2.height)
{
displayObject.__cacheBitmapData2 = new BitmapData(bitmapWidth, bitmapHeight, true, 0);
}
else
{
displayObject.__cacheBitmapData2.fillRect(displayObject.__cacheBitmapData2.rect, 0);
if (displayObject.__cacheBitmapData2.image != null)
{
displayObject.__cacheBitmapData2.__textureVersion = displayObject.__cacheBitmapData2.image.version + 1;
}
}
displayObject.__cacheBitmapData2.__setUVRect(context, 0, 0, filterWidth, filterHeight);
bitmap2 = displayObject.__cacheBitmapData2;
// } else {
// bitmap2 = bitmapData;
// }
if (needCopyOfOriginal)
{
if (displayObject.__cacheBitmapData3 == null
|| bitmapWidth > displayObject.__cacheBitmapData3.width
|| bitmapHeight > displayObject.__cacheBitmapData3.height)
{
displayObject.__cacheBitmapData3 = new BitmapData(bitmapWidth, bitmapHeight, true, 0);
}
else
{
displayObject.__cacheBitmapData3.fillRect(displayObject.__cacheBitmapData3.rect, 0);
if (displayObject.__cacheBitmapData3.image != null)
{
displayObject.__cacheBitmapData3.__textureVersion = displayObject.__cacheBitmapData3.image.version + 1;
}
}
displayObject.__cacheBitmapData3.__setUVRect(context, 0, 0, filterWidth, filterHeight);
bitmap3 = displayObject.__cacheBitmapData3;
}
childRenderer.__setBlendMode(NORMAL);
childRenderer.__worldAlpha = 1;
childRenderer.__worldTransform.identity();
childRenderer.__worldColorTransform.__identity();
// var sourceRect = bitmap.rect;
// if (__tempPoint == null) __tempPoint = new Point ();
// var destPoint = __tempPoint;
var shader, cacheBitmap;
for (filter in displayObject.__filters)
{
if (filter.__preserveObject)
{
childRenderer.__setRenderTarget(bitmap3);
childRenderer.__renderFilterPass(bitmap, childRenderer.__defaultDisplayShader, filter.__smooth);
}
for (i in 0...filter.__numShaderPasses)
{
shader = filter.__initShader(childRenderer, i, filter.__preserveObject ? bitmap3 : null);
childRenderer.__setBlendMode(filter.__shaderBlendMode);
childRenderer.__setRenderTarget(bitmap2);
childRenderer.__renderFilterPass(bitmap, shader, filter.__smooth);
cacheBitmap = bitmap;
bitmap = bitmap2;
bitmap2 = cacheBitmap;
}
filter.__renderDirty = false;
}
displayObject.__cacheBitmap.__bitmapData = bitmap;
}
parentRenderer.__blendMode = NORMAL;
parentRenderer.__setBlendMode(cacheBlendMode);
parentRenderer.__copyShader(childRenderer);
if (cacheRTT != null)
{
context.setRenderToTexture(cacheRTT, cacheRTTDepthStencil, cacheRTTAntiAlias, cacheRTTSurfaceSelector);
}
else
{
context.setRenderToBackBuffer();
}
// context.__bindGLFramebuffer (cacheFramebuffer);
// parentRenderer.__restoreState (childRenderer);
parentRenderer.__resumeClipAndMask(childRenderer);
parentRenderer.setViewport();
displayObject.__cacheBitmapColorTransform.__copyFrom(colorTransform);
}
else
{
#if (js && html5)
displayObject.__cacheBitmapData.__drawCanvas(displayObject, cast displayObject.__cacheBitmapRenderer);
#else
displayObject.__cacheBitmapData.__drawCairo(displayObject, cast displayObject.__cacheBitmapRenderer);
#end
if (hasFilters)
{
var needSecondBitmapData = false;
var needCopyOfOriginal = false;
for (filter in displayObject.__filters)
{
if (filter.__needSecondBitmapData)
{
needSecondBitmapData = true;
}
if (filter.__preserveObject)
{
needCopyOfOriginal = true;
}
}
var bitmap = displayObject.__cacheBitmapData;
var bitmap2 = null;
var bitmap3 = null;
if (needSecondBitmapData)
{
if (displayObject.__cacheBitmapData2 == null
|| displayObject.__cacheBitmapData2.image == null
|| bitmapWidth > displayObject.__cacheBitmapData2.width
|| bitmapHeight > displayObject.__cacheBitmapData2.height)
{
displayObject.__cacheBitmapData2 = new BitmapData(bitmapWidth, bitmapHeight, true, 0);
}
else
{
displayObject.__cacheBitmapData2.fillRect(displayObject.__cacheBitmapData2.rect, 0);
}
bitmap2 = displayObject.__cacheBitmapData2;
}
else
{
bitmap2 = bitmap;
}
if (needCopyOfOriginal)
{
if (displayObject.__cacheBitmapData3 == null
|| displayObject.__cacheBitmapData3.image == null
|| bitmapWidth > displayObject.__cacheBitmapData3.width
|| bitmapHeight > displayObject.__cacheBitmapData3.height)
{
displayObject.__cacheBitmapData3 = new BitmapData(bitmapWidth, bitmapHeight, true, 0);
}
else
{
displayObject.__cacheBitmapData3.fillRect(displayObject.__cacheBitmapData3.rect, 0);
}
bitmap3 = displayObject.__cacheBitmapData3;
}
if (displayObject.__tempPoint == null) displayObject.__tempPoint = new Point();
var destPoint = displayObject.__tempPoint;
var cacheBitmap, lastBitmap;
for (filter in displayObject.__filters)
{
if (filter.__preserveObject)
{
bitmap3.copyPixels(bitmap, bitmap.rect, destPoint);
}
lastBitmap = filter.__applyFilter(bitmap2, bitmap, bitmap.rect, destPoint);
if (filter.__preserveObject)
{
lastBitmap.draw(bitmap3, null,
displayObject.__objectTransform != null ? displayObject.__objectTransform.__colorTransform : null);
}
filter.__renderDirty = false;
if (needSecondBitmapData && lastBitmap == bitmap2)
{
cacheBitmap = bitmap;
bitmap = bitmap2;
bitmap2 = cacheBitmap;
}
}
if (displayObject.__cacheBitmapData != bitmap)
{
// TODO: Fix issue with swapping __cacheBitmap.__bitmapData
// __cacheBitmapData.copyPixels (bitmap, bitmap.rect, destPoint);
// Adding __cacheBitmapRenderer = null; makes this work
cacheBitmap = displayObject.__cacheBitmapData;
displayObject.__cacheBitmapData = bitmap;
displayObject.__cacheBitmapData2 = cacheBitmap;
displayObject.__cacheBitmap.__bitmapData = displayObject.__cacheBitmapData;
displayObject.__cacheBitmapRenderer = null;
}
displayObject.__cacheBitmap.__imageVersion = displayObject.__cacheBitmapData.__textureVersion;
}
displayObject.__cacheBitmapColorTransform.__copyFrom(colorTransform);
if (!displayObject.__cacheBitmapColorTransform.__isDefault(true))
{
displayObject.__cacheBitmapColorTransform.alphaMultiplier = 1;
displayObject.__cacheBitmapData.colorTransform(displayObject.__cacheBitmapData.rect, displayObject.__cacheBitmapColorTransform);
}
}
displayObject.__isCacheBitmapRender = false;
}
if (updateTransform || needRender)
{
Rectangle.__pool.release(rect);
}
updated = updateTransform;
}
else if (displayObject.__cacheBitmap != null)
{
if (renderer.__type == DOM)
{
var domRenderer:DOMRenderer = cast renderer;
domRenderer.__renderDrawableClear(displayObject.__cacheBitmap);
}
displayObject.__cacheBitmap = null;
displayObject.__cacheBitmapData = null;
displayObject.__cacheBitmapData2 = null;
displayObject.__cacheBitmapData3 = null;
displayObject.__cacheBitmapColorTransform = null;
displayObject.__cacheBitmapRenderer = null;
updated = true;
}
ColorTransform.__pool.release(colorTransform);
if (updated && displayObject.__drawableType == TEXT_FIELD)
{
var textField:TextField = cast displayObject;
if (textField.__cacheBitmap != null)
{
textField.__cacheBitmap.__renderTransform.tx -= textField.__offsetX;
textField.__cacheBitmap.__renderTransform.ty -= textField.__offsetY;
}
}
return updated;
#else
return false;
#end
}
}
#else
typedef DisplayObjectRenderer = Dynamic;
#end
+9
View File
@@ -64,6 +64,7 @@ import lime.media.AudioSource;
@:noCompletion private var __soundTransform:SoundTransform;
#if lime
@:noCompletion private var __source:AudioSource;
@:noCompletion private var __audioSource(get, set):AudioSource;
#end
#if openfljs
@@ -232,6 +233,14 @@ import lime.media.AudioSource;
__dispose();
dispatchEvent(new Event(Event.SOUND_COMPLETE));
}
function set___audioSource(value:AudioSource):AudioSource {
return __source = value;
}
function get___audioSource():AudioSource {
return __source;
}
}
#else
typedef SoundChannel = flash.media.SoundChannel;