Skip to content
This repository has been archived by the owner on Apr 2, 2023. It is now read-only.

Commit

Permalink
v4.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SpunBlue committed Aug 30, 2022
1 parent f0d3b84 commit d98ae1b
Show file tree
Hide file tree
Showing 13 changed files with 299 additions and 293 deletions.
2 changes: 1 addition & 1 deletion Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project>
<!-- _________________________ Application Settings _________________________ -->

<app title="Friday Night Funkin' Sublime Engine" file="FNFSL" packageName="com.spunblue.fnfsl" package="com.spunblue.fnfsl" main="Main" company="spunblue" version="4.0.0"/>
<app title="Friday Night Funkin' Sublime Engine" file="FNFSL" packageName="com.spunblue.fnfsl" package="com.spunblue.fnfsl" main="Main" company="spunblue" version="4.1.0"/>

<!--The flixel preloader is not accurate in Chrome. You can use it regularly if you embed the swf into a html file
or you can set the actual size of your file manually at "FlxPreloaderBase-onUpdate-bytesTotal"-->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CRT
Empty file.
2 changes: 1 addition & 1 deletion include/mods/Template Mod/mod.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name":"Template Mod",
"name":"Tutorial Mod",
"description":"Small Template Mod designed for Mod Developers to use as a starting point for their own mods. IT IS NOT A MOD OF ANY KIND. Only Madlads are allowed to play this.",
"author":"SpunBlue",
"version":"1.0"
Expand Down
9 changes: 1 addition & 8 deletions source/ChartingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -299,17 +299,13 @@ class ChartingState extends MusicBeatState
var bfCharacters:Array<String>;
var gfCharacters:Array<String>;

var stagelist:Array<String>;
var stagelist:Array<String> = [];
var noteskins:Array<String>;

if (SLModding.curLoaded != '' || SLModding.curLoaded != null){
var tempChararcters = File.getContent(Paths.txt('dadList')) + File.getContent(Paths.txt('bfList')) + File.getContent(Paths.txt('gfList'));

// untested
if (FileSystem.readDirectory("mods/" + SLModding.curLoaded + "/images/characters/") != null){
for (character in FileSystem.readDirectory("mods/" + SLModding.curLoaded + "/images/characters/")){
tempChararcters += character + "\n";
}
tempChararcters = tempChararcters.substring(0, tempChararcters.length - 1);

var allCharacters:Array<String> = tempChararcters.split('\n');
Expand All @@ -328,9 +324,6 @@ class ChartingState extends MusicBeatState
var tempStageList = File.getContent(Paths.txt('stageList'));

if (FileSystem.readDirectory("mods/" + SLModding.curLoaded + "/images/stages/") != null){
for (stage in FileSystem.readDirectory("mods/" + SLModding.curLoaded + "/images/stages/")){
tempStageList += stage + "\n";
}
tempStageList = tempStageList.substring(0, tempStageList.length - 1);

stagelist = tempStageList.split('\n');
Expand Down
24 changes: 4 additions & 20 deletions source/Controls.hx
Original file line number Diff line number Diff line change
Expand Up @@ -572,32 +572,16 @@ class Controls extends FlxActionSet

public function addDefaultGamepad(id):Void
{
#if !switch
addGamepadLiteral(id, [
Control.ACCEPT => [A],
Control.BACK => [B],
Control.UP => [DPAD_UP, LEFT_STICK_DIGITAL_UP],
Control.DOWN => [DPAD_DOWN, LEFT_STICK_DIGITAL_DOWN],
Control.LEFT => [DPAD_LEFT, LEFT_STICK_DIGITAL_LEFT],
Control.RIGHT => [DPAD_RIGHT, LEFT_STICK_DIGITAL_RIGHT],
Control.UP => [DPAD_UP, LEFT_STICK_DIGITAL_UP, RIGHT_SHOULDER],
Control.DOWN => [DPAD_DOWN, LEFT_STICK_DIGITAL_DOWN, LEFT_SHOULDER],
Control.LEFT => [DPAD_LEFT, LEFT_STICK_DIGITAL_LEFT, LEFT_TRIGGER],
Control.RIGHT => [DPAD_RIGHT, LEFT_STICK_DIGITAL_RIGHT, RIGHT_TRIGGER],
Control.PAUSE => [START],
Control.RESET => [Y]
]);
#else
addGamepadLiteral(id, [
//Swap A and B for switch
Control.ACCEPT => [B],
Control.BACK => [A],
Control.UP => [DPAD_UP, LEFT_STICK_DIGITAL_UP, RIGHT_STICK_DIGITAL_UP],
Control.DOWN => [DPAD_DOWN, LEFT_STICK_DIGITAL_DOWN, RIGHT_STICK_DIGITAL_DOWN],
Control.LEFT => [DPAD_LEFT, LEFT_STICK_DIGITAL_LEFT, RIGHT_STICK_DIGITAL_LEFT],
Control.RIGHT => [DPAD_RIGHT, LEFT_STICK_DIGITAL_RIGHT, RIGHT_STICK_DIGITAL_RIGHT],
Control.PAUSE => [START],
//Swap Y and X for switch
Control.RESET => [Y],
Control.CHEAT => [X]
]);
#end
}

/**
Expand Down
1 change: 1 addition & 0 deletions source/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Note extends FlxSprite

public var sustainLength:Float = 0;
public var isSustainNote:Bool = false;
public var isIgnored:Bool = false;

public var noteScore:Float = 1;

Expand Down
101 changes: 93 additions & 8 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ import lime.utils.Assets;
import openfl.display.BlendMode;
import openfl.filters.ShaderFilter;

// shaders
import shaders.CRT;

using StringTools;

class PlayState extends MusicBeatState
Expand Down Expand Up @@ -66,6 +69,7 @@ class PlayState extends MusicBeatState

private var strumLineNotes:FlxTypedGroup<FlxSprite>;
private var playerStrums:FlxTypedGroup<FlxSprite>;
private var cpuStrums:FlxTypedGroup<FlxSprite>;

var specialNoteXOffset:Int = 0;

Expand Down Expand Up @@ -147,6 +151,11 @@ class PlayState extends MusicBeatState

var hasDialogue:Bool = false;

// shaders
var curShader:String = '';

var crt:CRT = new CRT();

override public function create()
{
if (FlxG.sound.music != null)
Expand All @@ -168,6 +177,17 @@ class PlayState extends MusicBeatState
persistentUpdate = true;
persistentDraw = true;

if (Paths.txt(SONG.song + "/shader") != null)
curShader = Paths.txt(SONG.song + "/shader");

if (FileSystem.exists(SLModding.generatePath(SLModding.curLoaded, "data/" + SONG.song) + "shader.txt"))
curShader = File.getContent(SLModding.generatePath(SLModding.curLoaded, "data/" + SONG.song) + "shader.txt");

switch(curShader.toLowerCase()){
case 'crt':
camGame.setFilters([new ShaderFilter(crt.shader)]);
}

if (FlxG.save.data.downScroll == null)
FlxG.save.data.downScroll = false;

Expand Down Expand Up @@ -821,6 +841,9 @@ class PlayState extends MusicBeatState
strumLineNotes = new FlxTypedGroup<FlxSprite>();
add(strumLineNotes);

cpuStrums = new FlxTypedGroup<FlxSprite>();
add(cpuStrums);

add(noteSplashes);

playerStrums = new FlxTypedGroup<FlxSprite>();
Expand Down Expand Up @@ -983,6 +1006,7 @@ class PlayState extends MusicBeatState
add(rankTxt);

noteSplashes.cameras = [camHUD];
cpuStrums.cameras = [camHUD];
strumLineNotes.cameras = [camHUD];
notes.cameras = [camHUD];
underlay.cameras = [camHUD];
Expand Down Expand Up @@ -1517,6 +1541,19 @@ class PlayState extends MusicBeatState

babyArrow.ID = i;

switch (player)
{
case 0:
cpuStrums.add(babyArrow);
case 1:
playerStrums.add(babyArrow);
}

cpuStrums.forEach(function(spr:FlxSprite)
{
spr.centerOffsets();
});

if (player == 1)
{
playerStrums.add(babyArrow);
Expand Down Expand Up @@ -1662,6 +1699,9 @@ class PlayState extends MusicBeatState

super.update(elapsed);

if (curShader.toLowerCase() == 'crt')
crt.shader.uTime.value = [elapsed];

scoreTxt.text = 'Score: $songScore • Misses: $misses • Accuracy: ${calculateRating()} • Combo: $combo';
rankTxt.text = 'Sicks • $sicks\nGoods • $goods\nBads • $bads\nShits • $shits';

Expand Down Expand Up @@ -1961,6 +2001,13 @@ class PlayState extends MusicBeatState
}
}

if (generatedMusic){
// interpolation
notes.forEachAlive(function(daNote:Note){
daNote.y = (strumLine.y - (songTime - daNote.strumTime) * (0.45 * songScrollSpeed));
});
}

if (generatedMusic && !paused)
{
notes.forEachAlive(function(daNote:Note)
Expand Down Expand Up @@ -1998,7 +2045,7 @@ class PlayState extends MusicBeatState
daNote.clipRect = swagRect;
}

if (!daNote.mustPress && daNote.wasGoodHit)
if (FlxG.save.data.downScroll == false ? !daNote.mustPress && daNote.y <= strumLine.y : !daNote.mustPress && daNote.y >= strumLine.y)
{
if (SONG.song != 'Tutorial')
camZooming = true;
Expand Down Expand Up @@ -2057,14 +2104,42 @@ class PlayState extends MusicBeatState
if (SONG.needsVoices)
vocals.volume = 1;

//CPUSTRUM CONFIRM ANIMATION
cpuStrums.forEach(function(spr:FlxSprite)
{

if (Math.abs(daNote.noteData) == spr.ID)
{
spr.animation.play('confirm', true);

if (!daNote.isSustainNote)
noteSplash(daNote.x, daNote.y, daNote.noteData, true);
}

//CPUSTRUM NoteSkin Confirm Offsets
if (spr.animation.curAnim.name == 'confirm')
{
switch (SONG.noteskin){
default:
spr.centerOffsets();
spr.offset.x -= 13;
spr.offset.y -= 13;
case 'pixel':
// not needed
case 'circle':
spr.centerOffsets();
}
}
else{
spr.centerOffsets();
}
});

daNote.kill();
notes.remove(daNote, true);
daNote.destroy();
}

// cool funkin' interpolation, but it's not working correctly ):
//daNote.y = (strumLine.y - (songTime - daNote.strumTime) * (0.45 * songScrollSpeed));

// if the player is late, miss.
if ((FlxG.save.data.downScroll == false) ? daNote.y < -daNote.height : daNote.y > FlxG.height + daNote.height)
{
Expand Down Expand Up @@ -2101,6 +2176,16 @@ class PlayState extends MusicBeatState
});
}

cpuStrums.forEach(function(spr:FlxSprite)
{
if (spr.animation.finished && spr.animation.curAnim.name == 'confirm')
{
spr.animation.play('static');
spr.centerOffsets();
// trace('confirm animation finished');
}
});

if (!inCutscene)
keyShit();

Expand Down Expand Up @@ -2412,7 +2497,7 @@ class PlayState extends MusicBeatState
{
notes.forEachAlive(function(daNote:Note)
{
if (daNote.canBeHit && daNote.mustPress && daNote.isSustainNote)
if (daNote.canBeHit && daNote.mustPress && daNote.isSustainNote && !daNote.isIgnored)
{
switch (daNote.noteData)
{
Expand Down Expand Up @@ -2643,9 +2728,9 @@ class PlayState extends MusicBeatState
var recycledNote = noteSplashes.recycle(NoteSplash);
if (!isDad)
recycledNote.makeSplash(playerStrums.members[nData].x, playerStrums.members[nData].y, nData);
//else
//recycledNote.makeSplash(cpuStrums.members[nData].x, cpuStrums.members[nData].y, nData);
//noteSplashes.add(recycledNote);
else
recycledNote.makeSplash(cpuStrums.members[nData].x, cpuStrums.members[nData].y, nData);
noteSplashes.add(recycledNote);
}

function playCutscene(name:String, isPath:Bool = false)
Expand Down
24 changes: 19 additions & 5 deletions source/optionsmenu/ModsMenu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ class ModsMenu extends MusicBeatState

var selectedMod:Int = 0;

var modIcon:FlxSprite;
var modTitle:FlxText;
var modDescription:FlxText;
var modAuthor:FlxText;
var modVersion:FlxText;

override public function create()
{
FlxG.mouse.visible = true;
Expand Down Expand Up @@ -84,33 +90,41 @@ class ModsMenu extends MusicBeatState
}
}

var modIcon:FlxSprite = new FlxSprite().loadGraphic(openfl.display.BitmapData.fromFile(SLModding.generatePath(mod) + 'icon.png'));
modIcon = new FlxSprite().loadGraphic(openfl.display.BitmapData.fromFile(SLModding.generatePath(mod) + 'icon.png'));
modIcon.setGraphicSize(256, 256);
modIcon.updateHitbox();
modIcon.antialiasing = true;
modIcon.setPosition(modBG.x + 24, modBG.y + 24);
modIcon.antialiasing = true;
modStuff.add(modIcon);

var modTitle:FlxText = new FlxText((modBG.x + 256) + 48, modBG.y + 24, SLModding.parseModValue('name', mod));
modTitle = new FlxText((modBG.x + 256) + 48, modBG.y + 24, SLModding.parseModValue('name', mod));
modTitle.setFormat("PhantomMuff 1.5", 64, FlxColor.WHITE, "center");
modTitle.antialiasing = true;
modStuff.add(modTitle);

var modDescription:FlxText = new FlxText((modBG.x + 256) + 48, modTitle.y + modTitle.height + 24, modBG.width * 0.7, SLModding.parseModValue('description', mod));
modDescription = new FlxText((modBG.x + 256) + 48, modTitle.y + modTitle.height + 24, modBG.width * 0.7, SLModding.parseModValue('description', mod));
modDescription.setFormat("PhantomMuff 1.5", 32, FlxColor.WHITE, "left");
modDescription.antialiasing = true;
modStuff.add(modDescription);

var modAuthor:FlxText = new FlxText(modIcon.x, (modIcon.y + modIcon.height) + 72, 256, SLModding.parseModValue('author', mod));
modAuthor = new FlxText(modIcon.x, (modIcon.y + modIcon.height) + 72, 256, SLModding.parseModValue('author', mod));
modAuthor.setFormat("PhantomMuff 1.5", 32, FlxColor.WHITE, "center");
modAuthor.antialiasing = true;
modStuff.add(modAuthor);

var modVersion:FlxText = new FlxText(modIcon.x, (modAuthor.y + modAuthor.height) + 24, 256, SLModding.parseModValue('version', mod));
modVersion = new FlxText(modIcon.x, (modAuthor.y + modAuthor.height) + 24, 256, SLModding.parseModValue('version', mod));
modVersion.setFormat("PhantomMuff 1.5", 32, FlxColor.WHITE, "center");
modVersion.antialiasing = true;
modStuff.add(modVersion);

if (modTitle.text.length > 16){
modTitle.setFormat("PhantomMuff 1.5", 24, FlxColor.WHITE, "center");
}

if (modVersion.text.length > 8){
modVersion.setFormat("PhantomMuff 1.5", 24, FlxColor.WHITE, "center");
}
}

override public function update(elapsed:Float)
Expand Down
Loading

0 comments on commit d98ae1b

Please sign in to comment.