Skip to content

Commit

Permalink
added parallax support
Browse files Browse the repository at this point in the history
will do noteskins next
  • Loading branch information
Joalor64GH authored Jun 18, 2024
1 parent 0793ded commit 7632562
Show file tree
Hide file tree
Showing 13 changed files with 177 additions and 4 deletions.
1 change: 1 addition & 0 deletions Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
<haxelib name="fnf-modcharting-tools" />
<haxelib name="linc_luajit" if="LUA_ALLOWED" />
<haxelib name="SScript-Latest" if="SCRIPT_EXTENSION" />
<haxelib name="parallaxlt" />

<haxelib name="extension-webm" if="WEBM_ALLOWED" />
<haxelib name="hxCodec" if="VIDEOS_ALLOWED" />
Expand Down
Binary file added assets/images/noteskins/NOTE_assets-chip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 53 additions & 0 deletions assets/images/noteskins/NOTE_assets-chip.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="NOTE_assets-chip.png">
<!-- Created with Adobe Animate version 21.0.6.41649 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="arrowDOWN0000" x="1" y="226" width="152" height="152"/>
<SubTexture name="arrowLEFT0000" x="1" y="226" width="152" height="152"/>
<SubTexture name="arrowRIGHT0000" x="1" y="226" width="152" height="152"/>
<SubTexture name="arrowUP0000" x="1" y="226" width="152" height="152"/>
<SubTexture name="blue0000" x="441" y="1" width="152" height="152"/>
<SubTexture name="blue hold end0000" x="116" y="435" width="114" height="50"/>
<SubTexture name="blue hold piece0000" x="1" y="379" width="114" height="77"/>
<SubTexture name="down confirm0000" x="224" y="1" width="216" height="216" frameX="-2" frameY="-4" frameWidth="222" frameHeight="224"/>
<SubTexture name="down confirm0001" x="224" y="218" width="216" height="216" frameX="-2" frameY="-4" frameWidth="222" frameHeight="224"/>
<SubTexture name="down confirm0002" x="1" y="1" width="222" height="224"/>
<SubTexture name="down confirm0003" x="1" y="1" width="222" height="224"/>
<SubTexture name="down press0000" x="441" y="304" width="142" height="142" frameX="-4" frameY="-3" frameWidth="150" frameHeight="149"/>
<SubTexture name="down press0001" x="441" y="304" width="142" height="142" frameX="-4" frameY="-3" frameWidth="150" frameHeight="149"/>
<SubTexture name="down press0002" x="441" y="154" width="150" height="149"/>
<SubTexture name="down press0003" x="441" y="154" width="150" height="149"/>
<SubTexture name="green0000" x="441" y="1" width="152" height="152"/>
<SubTexture name="green hold end0000" x="116" y="435" width="114" height="50"/>
<SubTexture name="green hold piece0000" x="1" y="379" width="114" height="77"/>
<SubTexture name="left confirm0000" x="224" y="1" width="216" height="216" frameX="-2" frameY="-4" frameWidth="222" frameHeight="224"/>
<SubTexture name="left confirm0001" x="224" y="218" width="216" height="216" frameX="-2" frameY="-4" frameWidth="222" frameHeight="224"/>
<SubTexture name="left confirm0002" x="1" y="1" width="222" height="224"/>
<SubTexture name="left confirm0003" x="1" y="1" width="222" height="224"/>
<SubTexture name="left press0000" x="441" y="304" width="142" height="142" frameX="-4" frameY="-3" frameWidth="150" frameHeight="149"/>
<SubTexture name="left press0001" x="441" y="304" width="142" height="142" frameX="-4" frameY="-3" frameWidth="150" frameHeight="149"/>
<SubTexture name="left press0002" x="441" y="154" width="150" height="149"/>
<SubTexture name="left press0003" x="441" y="154" width="150" height="149"/>
<SubTexture name="purple0000" x="441" y="1" width="152" height="152"/>
<SubTexture name="purple hold end0000" x="116" y="435" width="114" height="50"/>
<SubTexture name="purple hold piece0000" x="1" y="379" width="114" height="77"/>
<SubTexture name="red0000" x="441" y="1" width="152" height="152"/>
<SubTexture name="red hold end0000" x="116" y="435" width="114" height="50"/>
<SubTexture name="red hold piece0000" x="1" y="379" width="114" height="77"/>
<SubTexture name="right confirm0000" x="224" y="1" width="216" height="216" frameX="-2" frameY="-4" frameWidth="222" frameHeight="224"/>
<SubTexture name="right confirm0001" x="224" y="218" width="216" height="216" frameX="-2" frameY="-4" frameWidth="222" frameHeight="224"/>
<SubTexture name="right confirm0002" x="1" y="1" width="222" height="224"/>
<SubTexture name="right confirm0003" x="1" y="1" width="222" height="224"/>
<SubTexture name="right press0000" x="441" y="304" width="142" height="142" frameX="-4" frameY="-3" frameWidth="150" frameHeight="149"/>
<SubTexture name="right press0001" x="441" y="304" width="142" height="142" frameX="-4" frameY="-3" frameWidth="150" frameHeight="149"/>
<SubTexture name="right press0002" x="441" y="154" width="150" height="149"/>
<SubTexture name="right press0003" x="441" y="154" width="150" height="149"/>
<SubTexture name="up confirm0000" x="224" y="1" width="216" height="216" frameX="-2" frameY="-4" frameWidth="222" frameHeight="224"/>
<SubTexture name="up confirm0001" x="224" y="218" width="216" height="216" frameX="-2" frameY="-4" frameWidth="222" frameHeight="224"/>
<SubTexture name="up confirm0002" x="1" y="1" width="222" height="224"/>
<SubTexture name="up confirm0003" x="1" y="1" width="222" height="224"/>
<SubTexture name="up press0000" x="441" y="304" width="142" height="142" frameX="-4" frameY="-3" frameWidth="150" frameHeight="149"/>
<SubTexture name="up press0001" x="441" y="304" width="142" height="142" frameX="-4" frameY="-3" frameWidth="150" frameHeight="149"/>
<SubTexture name="up press0002" x="441" y="154" width="150" height="149"/>
<SubTexture name="up press0003" x="441" y="154" width="150" height="149"/>
</TextureAtlas>
Binary file added assets/images/noteskins/NOTE_assets-future.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 53 additions & 0 deletions assets/images/noteskins/NOTE_assets-future.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="NOTE_assets-future.png">
<!-- Created with Adobe Animate version 21.0.6.41649 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="arrowDOWN0000" x="1826" y="227" width="147" height="162"/>
<SubTexture name="arrowLEFT0000" x="903" y="221" width="163" height="147"/>
<SubTexture name="arrowRIGHT0000" x="898" y="369" width="161" height="146"/>
<SubTexture name="arrowUP0000" x="751" y="243" width="146" height="162"/>
<SubTexture name="blue0000" x="455" y="243" width="147" height="161"/>
<SubTexture name="blue hold end0000" x="1625" y="426" width="146" height="75"/>
<SubTexture name="blue hold piece0000" x="1478" y="426" width="146" height="77"/>
<SubTexture name="down confirm0000" x="1" y="1" width="226" height="243"/>
<SubTexture name="down confirm0001" x="228" y="1" width="226" height="243"/>
<SubTexture name="down confirm0002" x="1838" y="1" width="209" height="225" frameX="-8" frameY="-10" frameWidth="226" frameHeight="243"/>
<SubTexture name="down confirm0003" x="1838" y="1" width="209" height="225" frameX="-8" frameY="-10" frameWidth="226" frameHeight="243"/>
<SubTexture name="down press0000" x="730" y="406" width="133" height="146" frameX="-2" frameY="-3" frameWidth="138" frameHeight="152"/>
<SubTexture name="down press0001" x="730" y="406" width="133" height="146" frameX="-2" frameY="-3" frameWidth="138" frameHeight="152"/>
<SubTexture name="down press0002" x="155" y="392" width="138" height="152"/>
<SubTexture name="down press0003" x="155" y="392" width="138" height="152"/>
<SubTexture name="green0000" x="603" y="243" width="147" height="161"/>
<SubTexture name="green hold end0000" x="1625" y="426" width="146" height="75"/>
<SubTexture name="green hold piece0000" x="1478" y="426" width="146" height="77"/>
<SubTexture name="left confirm0000" x="1372" y="216" width="226" height="209" frameX="-3" frameY="-5" frameWidth="232" frameHeight="218"/>
<SubTexture name="left confirm0001" x="1599" y="216" width="226" height="209" frameX="-3" frameY="-5" frameWidth="232" frameHeight="218"/>
<SubTexture name="left confirm0002" x="1139" y="1" width="232" height="218"/>
<SubTexture name="left confirm0003" x="1139" y="1" width="232" height="218"/>
<SubTexture name="left press0000" x="433" y="405" width="148" height="133" frameX="-2" frameY="-3" frameWidth="153" frameHeight="139"/>
<SubTexture name="left press0001" x="433" y="405" width="148" height="133" frameX="-2" frameY="-3" frameWidth="153" frameHeight="139"/>
<SubTexture name="left press0002" x="1826" y="390" width="153" height="139"/>
<SubTexture name="left press0003" x="1826" y="390" width="153" height="139"/>
<SubTexture name="purple0000" x="1" y="245" width="162" height="146"/>
<SubTexture name="purple hold end0000" x="1625" y="426" width="146" height="75"/>
<SubTexture name="purple hold piece0000" x="1478" y="426" width="146" height="77"/>
<SubTexture name="red0000" x="164" y="245" width="162" height="146"/>
<SubTexture name="red hold end0000" x="1625" y="426" width="146" height="75"/>
<SubTexture name="red hold piece0000" x="1478" y="426" width="146" height="77"/>
<SubTexture name="right confirm0000" x="1372" y="1" width="232" height="214" frameX="-1" frameY="-4" frameWidth="235" frameHeight="219"/>
<SubTexture name="right confirm0001" x="1605" y="1" width="232" height="214" frameX="-1" frameY="-4" frameWidth="235" frameHeight="219"/>
<SubTexture name="right confirm0002" x="903" y="1" width="235" height="219"/>
<SubTexture name="right confirm0003" x="903" y="1" width="235" height="219"/>
<SubTexture name="right press0000" x="582" y="405" width="147" height="133" frameX="-2" frameY="-3" frameWidth="153" frameHeight="139"/>
<SubTexture name="right press0001" x="582" y="405" width="147" height="133" frameX="-2" frameY="-3" frameWidth="153" frameHeight="139"/>
<SubTexture name="right press0002" x="1" y="392" width="153" height="139"/>
<SubTexture name="right press0003" x="1" y="392" width="153" height="139"/>
<SubTexture name="up confirm0000" x="455" y="1" width="223" height="241"/>
<SubTexture name="up confirm0001" x="679" y="1" width="223" height="241"/>
<SubTexture name="up confirm0002" x="1139" y="220" width="204" height="219" frameX="-10" frameY="-11" frameWidth="223" frameHeight="241"/>
<SubTexture name="up confirm0003" x="1139" y="220" width="204" height="219" frameX="-10" frameY="-11" frameWidth="223" frameHeight="241"/>
<SubTexture name="up press0000" x="1344" y="426" width="133" height="146" frameX="-2" frameY="-3" frameWidth="138" frameHeight="152"/>
<SubTexture name="up press0001" x="1344" y="426" width="133" height="146" frameX="-2" frameY="-3" frameWidth="138" frameHeight="152"/>
<SubTexture name="up press0002" x="294" y="392" width="138" height="152"/>
<SubTexture name="up press0003" x="294" y="392" width="138" height="152"/>
</TextureAtlas>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion compileData/haxelibs.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
{"name": "fnf-modcharting-tools", "type": "git", "dir": null, "ref": "main", "url": "https://github.com/TheZoroForce240/FNF-Modcharting-Tools"},
{"name": "linc_luajit", "type": "git", "dir": null, "ref": "master", "url": "https://github.com/nebulazorua/linc_luajit"},
{"name": "SScript-Latest", "type": "git", "dir": null, "ref": "testing", "url": "https://github.com/Joalor64GH/SScript-Latest"},
{"name": "linc_discord-rpc", "type": "git", "dir": null, "ref": "master", "url": "https://github.com/Aidan63/linc_discord-rpc"}
{"name": "linc_discord-rpc", "type": "git", "dir": null, "ref": "master", "url": "https://github.com/Aidan63/linc_discord-rpc"},
{"name": "parallaxlt", "type": "haxelib", "version": "0.0.0"}
]
}
65 changes: 63 additions & 2 deletions source/meta/data/scripts/FunkinLua.hx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import hscript.Expr;
import haxe.Json;
#end

import flixel_5_3_1.ParallaxSprite; // flixel 5 render pipeline

class FunkinLua {
public static var Function_Stop:Dynamic = 1;
public static var Function_Continue:Dynamic = 0;
Expand Down Expand Up @@ -1712,6 +1714,19 @@ class FunkinLua {
// PlayState.instance.modchartSprites.set(tag, leSprite);
// });

Lua_helper.add_callback(lua, "makeParallaxSprite", function(tag:String, ?image:String = null, ?x:Float = 0, ?y:Float = 0) {
tag = tag.replace('.', '');
resetSpriteTag(tag, true);
var leSprite:ParallaxSprite = new ParallaxSprite(x, y, Paths.image(image));
PlayState.instance.modchartParallax.set(tag, leSprite);
leSprite.active = true;
});
Lua_helper.add_callback(lua, "fixateParallaxSprite", function(obj:String, anchorX:Int = 0, anchorY:Int = 0, scrollOneX:Float = 1, scrollOneY:Float = 1, scrollTwoX:Float = 1.1, scrollTwoY:Float = 1.1,
direct:String = 'horizontal') {
var spr:ParallaxSprite = getObjectDirectly(obj, false);
if(spr != null) spr.fixate(anchorX, anchorY, scrollOneX, scrollOneY, scrollTwoX, scrollTwoY, direct);
});

Lua_helper.add_callback(lua, "makeGraphic", function(obj:String, width:Int, height:Int, color:String) {
var colorNum:Int = Std.parseInt(color);
if(!color.startsWith('0x')) colorNum = Std.parseInt('0xff' + color);
Expand Down Expand Up @@ -1839,6 +1854,22 @@ class FunkinLua {
object.scrollFactor.set(scrollX, scrollY);
}
});

Lua_helper.add_callback(lua, "addParallaxSprite", function(tag:String, front:Bool = false) {
if(PlayState.instance.modchartParallax.exists(tag)) {
var spr:ParallaxSprite = PlayState.instance.modchartParallax.get(tag);
if(front)
getInstance().add(spr);
else
{
if(!PlayState.instance.isDead)
PlayState.instance.insert(PlayState.instance.members.indexOf(getLowestCharacterGroup()), spr);
else
GameOverSubstate.instance.insert(GameOverSubstate.instance.members.indexOf(GameOverSubstate.instance.boyfriend), spr);
}
}
});

Lua_helper.add_callback(lua, "addLuaSprite", function(tag:String, front:Bool = false) {
if(PlayState.instance.modchartSprites.exists(tag)) {
var shit:ModchartSprite = PlayState.instance.modchartSprites.get(tag);
Expand Down Expand Up @@ -3195,8 +3226,17 @@ class FunkinLua {
PlayState.instance.modchartTexts.remove(tag);
}

function resetSpriteTag(tag:String) {
if(!PlayState.instance.modchartSprites.exists(tag)) {
function resetSpriteTag(tag:String, isParallax:Bool = false) {
if(!PlayState.instance.modchartSprites.exists(tag) || !PlayState.instance.modchartParallax.exists(tag)) {
return;
}
if (isParallax)
{
var target:ParallaxSprite = PlayState.instance.modchartParallax.get(tag);
target.kill();
PlayState.instance.remove(target, true);
target.destroy();
PlayState.instance.modchartParallax.remove(tag);
return;
}

Expand Down Expand Up @@ -3489,6 +3529,27 @@ class FunkinLua {
{
return PlayState.instance.isDead ? GameOverSubstate.instance : PlayState.instance;
}

public static inline function getLowestCharacterGroup():FlxSpriteGroup
{
var group:FlxSpriteGroup = PlayState.instance.gfGroup;
var pos:Int = PlayState.instance.members.indexOf(group);

var newPos:Int = PlayState.instance.members.indexOf(PlayState.instance.boyfriendGroup);
if(newPos < pos)
{
group = PlayState.instance.boyfriendGroup;
pos = newPos;
}

newPos = PlayState.instance.members.indexOf(PlayState.instance.dadGroup);
if(newPos < pos)
{
group = PlayState.instance.dadGroup;
pos = newPos;
}
return group;
}
}

class ModchartSprite extends FlxSprite
Expand Down
2 changes: 1 addition & 1 deletion source/meta/state/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class FreeplayState extends MusicBeatState
});
buttonTop.setGraphicSize(Std.int(songSearchText.width), 50);
buttonTop.updateHitbox();
buttonTop.label.setFormat(Paths.font("vcr.ttf"), 24, FlxColor.BLACK, RIGHT);
buttonTop.label.setFormat(Paths.font("vcr.ttf"), 24, FlxColor.BLACK, CENTER);
buttonTop.x = FlxG.width - buttonTop.width;
add(buttonTop);

Expand Down
4 changes: 4 additions & 0 deletions source/meta/state/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ import objects.userinterface.note.*;
import objects.userinterface.note.Note;
import objects.userinterface.DialogueBoxPsych;

import flixel_5_3_1.ParallaxSprite;

class PlayState extends MusicBeatState
{
public static var STRUM_X = 48.5;
Expand All @@ -76,6 +78,7 @@ class PlayState extends MusicBeatState
public var variables:Map<String, Dynamic> = new Map();
public var modchartTweens:Map<String, FlxTween> = new Map<String, FlxTween>();
public var modchartSprites:Map<String, ModchartSprite> = new Map<String, ModchartSprite>();
public var modchartParallax:Map<String, ParallaxSprite> = new Map<String, ParallaxSprite>();
public var modchartTimers:Map<String, FlxTimer> = new Map<String, FlxTimer>();
public var modchartSounds:Map<String, FlxSound> = new Map<String, FlxSound>();
public var modchartTexts:Map<String, ModchartText> = new Map<String, ModchartText>();
Expand Down Expand Up @@ -2167,6 +2170,7 @@ class PlayState extends MusicBeatState

public function getLuaObject(tag:String, text:Bool=true):FlxSprite {
if(modchartSprites.exists(tag)) return modchartSprites.get(tag);
if(modchartParallax.exists(tag)) return modchartParallax.get(tag);
if(text && modchartTexts.exists(tag)) return modchartTexts.get(tag);
if(variables.exists(tag)) return variables.get(tag);
return null;
Expand Down

0 comments on commit 7632562

Please sign in to comment.