Skip to content

Commit

Permalink
PEAK!!!!!
Browse files Browse the repository at this point in the history
Fixed the rating sprites in the Note Offset menu being HaxeFlixel logos (closes #690)
Added the Hold Note Splashes from Base 0.3.X and up (special thanks to Psych Online  (more specifically, NotMagniill and Snirozu) for the code)
  • Loading branch information
JordanSantiagoYT committed Oct 25, 2024
1 parent d6ae5f0 commit 08699d1
Show file tree
Hide file tree
Showing 9 changed files with 224 additions and 6 deletions.
Binary file added assets/preload/images/credits/magniill.png
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.
16 changes: 16 additions & 0 deletions assets/shared/images/noteSplashes/holdSplashes/holdSplash.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<TextureAtlas imagePath="holdSplash.png" width="599" height="591">
<SubTexture name="start0000" x="413" y="96" width="93" height="93" frameX="-111" frameY="-107" frameWidth="300" frameHeight="400" />
<SubTexture name="hold0000" x="407" y="243" width="108" height="139" rotated="true" frameX="-93" frameY="-94" frameWidth="300" frameHeight="400" />
<SubTexture name="hold0001" x="413" y="0" width="120" height="96" frameX="-100" frameY="-104" frameWidth="300" frameHeight="400" />
<SubTexture name="hold0002" x="506" y="96" width="93" height="80" frameX="-115" frameY="-107" frameWidth="300" frameHeight="400" />
<SubTexture name="hold0003" x="146" y="423" width="36" height="78" rotated="true" frameX="-122" frameY="-133" frameWidth="300" frameHeight="400" />
<SubTexture name="end0000" x="146" y="423" width="36" height="78" rotated="true" frameX="-122" frameY="-133" frameWidth="300" frameHeight="400" />
<SubTexture name="end0001" x="0" y="423" width="146" height="168" rotated="true" frameX="-72" frameY="-59" frameWidth="300" frameHeight="400" />
<SubTexture name="end0002" x="192" y="243" width="215" height="185" frameX="-47" frameY="-55" frameWidth="300" frameHeight="400" />
<SubTexture name="end0003" x="192" y="243" width="215" height="185" frameX="-47" frameY="-55" frameWidth="300" frameHeight="400" />
<SubTexture name="end0004" x="0" y="193" width="192" height="230" rotated="true" frameX="-44" frameY="-62" frameWidth="300" frameHeight="400" />
<SubTexture name="end0005" x="0" y="0" width="246" height="193" frameX="-43" frameY="-78" frameWidth="300" frameHeight="400" />
<SubTexture name="end0006" x="246" y="0" width="167" height="243" rotated="true" frameX="-52" frameY="-113" frameWidth="300" frameHeight="400" />
<SubTexture name="end0007" x="246" y="0" width="167" height="243" rotated="true" frameX="-52" frameY="-113" frameWidth="300" frameHeight="400" />
</TextureAtlas>
1 change: 1 addition & 0 deletions source/CreditsState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class CreditsState extends MusicBeatState
['SomeGuyWhoLovesCoding', 'sgwlc', 'Rewrote the chart loading system and ported the new Rendering Mode to source', 'https://www.youtube.com/channel/UCMSusVA3DY-4EtiGP4zKAJA', 'FFBD40'],
['Betopia', 'nothing', 'Freeplay Search bar creator', 'https://www.youtube.com/channel/UCfjyz9xRhZiRbLMteQloVeg', 'FFFFFF'],
['CDEV Engine', 'cdev', 'Update Screen Creator', 'https://github.com/Core5570RYT/FNF-CDEV-Engine', '00427B'],
['NotMagniill', 'magniill', 'Code for the Sustain Note Splashes', 'https://github.com/notmagniill', 'FFBD40'],
[''],
['Psych Engine Team'],
['Shadow Mario', 'shadowmario', 'Main Programmer of Psych Engine', 'https://twitter.com/Shadow_Mario_', '444444'],
Expand Down
12 changes: 11 additions & 1 deletion source/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import flixel.util.FlxColor;
import shaders.RGBPalette;
import shaders.RGBPalette.RGBShaderReference;

import objects.SustainSplash;

using StringTools;

typedef EventNote = {
Expand All @@ -32,6 +34,7 @@ typedef PreloadedChartNote = {
sustainLength:Float,
sustainScale:Float,
parentST:Float,
parentSL:Float,
hitHealth:Float,
missHealth:Float,
hitCausesMiss:Null<Bool>,
Expand Down Expand Up @@ -66,6 +69,7 @@ class Note extends FlxSprite
public var extraData:Map<String, Dynamic> = new Map<String, Dynamic>();

public var parentST:Float = 0;
public var parentSL:Float = 0;
public var strumTime:Float = 0;
public var mustPress:Bool = false;
public var doOppStuff:Bool = false;
Expand All @@ -82,6 +86,7 @@ class Note extends FlxSprite

public var sustainLength:Float = 0;
public var isSustainNote:Bool = false;
public var isSustainEnd:Bool = false;
public var noteType(default, set):String = null;

public var eventName:String = '';
Expand Down Expand Up @@ -115,6 +120,7 @@ class Note extends FlxSprite
b: -1,
a: 1
};
public var noteHoldSplash:SustainSplash;

// Lua shit
public var noteSplashDisabled:Bool = false;
Expand Down Expand Up @@ -603,9 +609,13 @@ class Note extends FlxSprite
doOppStuff = chartNoteData.oppNote;
gfNote = chartNoteData.gfNote;
isSustainNote = chartNoteData.isSustainNote;
isSustainEnd = chartNoteData.isSustainEnd;
sustainScale = chartNoteData.sustainScale;
lowPriority = chartNoteData.lowPriority;
if (isSustainNote) parentST = chartNoteData.parentST;
if (isSustainNote) {
parentST = chartNoteData.parentST;
parentSL = chartNoteData.parentSL;
}

hitHealth = chartNoteData.hitHealth;
missHealth = chartNoteData.missHealth;
Expand Down
49 changes: 46 additions & 3 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import vlc.MP4Handler;
#end

import Note;
import objects.SustainSplash;

using StringTools;

Expand Down Expand Up @@ -132,7 +133,7 @@ class PlayState extends MusicBeatState
public var healthDrainFloor:Float = 0.1;

var strumsHit:Array<Bool> = [false, false, false, false, false, false, false, false];
public var splashesPerFrame:Array<Int> = [0, 0];
public var splashesPerFrame:Array<Int> = [0, 0, 0, 0];

public var vocals:FlxSound;
public var opponentVocals:FlxSound;
Expand Down Expand Up @@ -169,6 +170,7 @@ class PlayState extends MusicBeatState
public var strumLineNotes:FlxTypedGroup<StrumNote>;
public var opponentStrums:FlxTypedGroup<StrumNote>;
public var playerStrums:FlxTypedGroup<StrumNote>;
public var grpHoldSplashes:FlxTypedGroup<SustainSplash>;
public var grpNoteSplashes:FlxTypedGroup<NoteSplash>;
public var laneunderlay:FlxSprite;
public var laneunderlayOpponent:FlxSprite;
Expand Down Expand Up @@ -590,6 +592,7 @@ class PlayState extends MusicBeatState
FlxG.cameras.reset(camGame);
FlxG.cameras.add(camHUD, false);
FlxG.cameras.add(camOther, false);
grpHoldSplashes = new FlxTypedGroup<SustainSplash>((ClientPrefs.maxSplashLimit != 0 ? ClientPrefs.maxSplashLimit : 10000));
grpNoteSplashes = new FlxTypedGroup<NoteSplash>((ClientPrefs.maxSplashLimit != 0 ? ClientPrefs.maxSplashLimit : 10000));

FlxG.cameras.setDefaultDrawTarget(camGame, true);
Expand Down Expand Up @@ -1172,6 +1175,7 @@ class PlayState extends MusicBeatState
notes.visible = sustainNotes.visible = ClientPrefs.showNotes; //that was easier than expected

add(grpNoteSplashes);
add(grpHoldSplashes);


if(ClientPrefs.timeBarType == 'Song Name' && ClientPrefs.timeBarStyle == 'VS Impostor')
Expand All @@ -1181,7 +1185,14 @@ class PlayState extends MusicBeatState

var splash:NoteSplash = new NoteSplash(100, 100, 0);
grpNoteSplashes.add(splash);
splash.alpha = 0.0;
splash.alpha = 0.0001;

SustainSplash.startCrochet = Conductor.stepCrochet;
SustainSplash.frameRate = Math.floor(24 / 100 * SONG.bpm);
var splash:SustainSplash = new SustainSplash();
grpHoldSplashes.add(splash);
splash.visible = true;
splash.alpha = 0.0001;

playerStrums = new FlxTypedGroup<StrumNote>();
opponentStrums = new FlxTypedGroup<StrumNote>();
Expand Down Expand Up @@ -1620,6 +1631,7 @@ class PlayState extends MusicBeatState
laneunderlay.cameras = [camHUD];
strumLineNotes.cameras = [camHUD];
grpNoteSplashes.cameras = [camHUD];
grpHoldSplashes.cameras = [camHUD];
sustainNotes.cameras = [camHUD];
notes.cameras = [camHUD];
healthBar.cameras = [camHUD];
Expand Down Expand Up @@ -3047,6 +3059,7 @@ class PlayState extends MusicBeatState
isSustainEnd: susNote == floorSus,
sustainScale: 1 / ratio,
parentST: swagNote.strumTime,
parentSL: swagNote.sustainLength,
hitHealth: 0.023,
missHealth: songNotes[3] != 'Hurt Note' ? 0.0475 : 0.1,
wasHit: false,
Expand Down Expand Up @@ -3620,7 +3633,8 @@ class PlayState extends MusicBeatState
if (charAnimsFrame > 0) charAnimsFrame = 0;
if (oppAnimsFrame > 0) oppAnimsFrame = 0;
strumsHit = [false, false, false, false, false, false, false, false];
if (splashesPerFrame[0] > 0 || splashesPerFrame[1] > 0) splashesPerFrame = [0, 0];
for (i in 0...splashesPerFrame.length)
if (splashesPerFrame[i] > 0) splashesPerFrame[i] = 0;

if (hitImagesFrame > 0) hitImagesFrame = 0;

Expand Down Expand Up @@ -5637,6 +5651,10 @@ class PlayState extends MusicBeatState
}
}

if (daNote.noteHoldSplash != null) {
daNote.noteHoldSplash.kill();
}

callOnLuas('noteMiss', [notes.members.indexOf(daNote), daNote.noteData, daNote.noteType, daNote.isSustainNote]);
if (ClientPrefs.missRating) popUpScore(daNote, true);
}
Expand Down Expand Up @@ -5961,6 +5979,7 @@ class PlayState extends MusicBeatState
camHUD.shake(playerChar.shakeIntensity / 2, playerChar.shakeDuration / playbackRate);
}
note.wasGoodHit = true;
if (ClientPrefs.noteSplashes && note.isSustainNote && splashesPerFrame[3] <= 4) spawnHoldSplashOnNote(note);
if (SONG.needsVoices && ClientPrefs.songLoading && !ffmpegMode)
if (opponentChart && opponentVocals != null && opponentVocals.volume != 1) opponentVocals.volume = 1;
else if (!opponentChart && vocals.volume != 1 || vocals.volume != 1) vocals.volume = 1;
Expand Down Expand Up @@ -6109,6 +6128,7 @@ class PlayState extends MusicBeatState
}
daNote.hitByOpponent = true;

if (ClientPrefs.oppNoteSplashes && daNote.isSustainNote && splashesPerFrame[2] <= 4) spawnHoldSplashOnNote(daNote, true);

if (!ClientPrefs.noHitFuncs) callOnLuas(!opponentChart ? 'opponentNoteHit' : 'goodNoteHit', [notes.members.indexOf(daNote), Math.abs(daNote.noteData), daNote.noteType, daNote.isSustainNote]);

Expand Down Expand Up @@ -6203,6 +6223,29 @@ class PlayState extends MusicBeatState
if (ClientPrefs.fastNoteSpawn) (note.isSustainNote ? sustainNotes : notes).pushToPool(note);
}

public function spawnHoldSplashOnNote(note:Note, ?isDad:Bool = false) {
if (!ClientPrefs.noteSplashes || note == null)
return;

splashesPerFrame[(isDad ? 2 : 3)] += 1;

if (note != null) {
var strum:StrumNote = (isDad ? playerStrums : opponentStrums).members[note.noteData];
final susLength:Float = (!note.isSustainNote ? note.sustainLength : note.parentSL);
final tailLength:Int = Math.floor(susLength / Conductor.stepCrochet);

if(strum != null && tailLength != 0)
spawnHoldSplash(note);
}
}

public function spawnHoldSplash(note:Note) {
var end:Note = note;
var splash:SustainSplash = grpHoldSplashes.recycle(SustainSplash);
splash.setupSusSplash((note.mustPress ? playerStrums : opponentStrums).members[note.noteData], note, playbackRate);
grpHoldSplashes.add(end.noteHoldSplash = splash);
}

public function spawnNoteSplashOnNote(isDad:Bool, note:Note, ?isGf:Bool = false) {
if(ClientPrefs.noteSplashes && note != null) {
splashesPerFrame[(isDad ? 0 : 1)] += 1;
Expand Down
35 changes: 35 additions & 0 deletions source/editors/EditorPlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import flixel.util.FlxTimer;
import flixel.input.keyboard.FlxKey;
import openfl.events.KeyboardEvent;
import Note.PreloadedChartNote;
import objects.SustainSplash;

import Character.CharacterFile;

Expand All @@ -33,6 +34,7 @@ class EditorPlayState extends MusicBeatState
public var strumLineNotes:FlxTypedGroup<StrumNote>;
public var opponentStrums:FlxTypedGroup<StrumNote>;
public var playerStrums:FlxTypedGroup<StrumNote>;
public var grpHoldSplashes:FlxTypedGroup<SustainSplash>;
public var grpNoteSplashes:FlxTypedGroup<NoteSplash>;

public var sustainNotes:NoteGroup;
Expand Down Expand Up @@ -110,6 +112,9 @@ class EditorPlayState extends MusicBeatState

notes = new NoteGroup();
add(notes);

grpHoldSplashes = new FlxTypedGroup<SustainSplash>((ClientPrefs.maxSplashLimit != 0 ? ClientPrefs.maxSplashLimit : 10000));
add(grpHoldSplashes);

grpNoteSplashes = new FlxTypedGroup<NoteSplash>();
add(grpNoteSplashes);
Expand All @@ -118,6 +123,13 @@ class EditorPlayState extends MusicBeatState
grpNoteSplashes.add(splash);
splash.alpha = 0.0;

SustainSplash.startCrochet = Conductor.stepCrochet;
SustainSplash.frameRate = Math.floor(24 / 100 * PlayState.SONG.bpm);
var splash:SustainSplash = new SustainSplash();
grpHoldSplashes.add(splash);
splash.visible = true;
splash.alpha = 0.0001;

Paths.initDefaultSkin(PlayState.SONG.arrowSkin);

generateSong(PlayState.SONG.song, startPos);
Expand Down Expand Up @@ -278,6 +290,7 @@ class EditorPlayState extends MusicBeatState
sustainLength: 0,
sustainScale: 1 / ratio,
parentST: swagNote.strumTime,
parentSL: swagNote.sustainLength,
hitHealth: 0.023,
missHealth: 0.0475,
wasHit: false,
Expand Down Expand Up @@ -754,6 +767,8 @@ class EditorPlayState extends MusicBeatState
}
}

if (ClientPrefs.noteSplashes && note.isSustainNote) spawnHoldSplashOnNote(note);

if (!note.isSustainNote) invalidateNote(note);

note.wasGoodHit = true;
Expand Down Expand Up @@ -981,6 +996,26 @@ class EditorPlayState extends MusicBeatState
}
}

public function spawnHoldSplashOnNote(note:Note, ?isDad:Bool = false) {
if (!ClientPrefs.noteSplashes || note == null)
return;

if (note != null) {
var strum:StrumNote = (isDad ? playerStrums : opponentStrums).members[note.noteData];
final susLength:Float = (!note.isSustainNote ? note.sustainLength : note.parentSL);
final tailLength:Int = Math.floor(susLength / Conductor.stepCrochet);

if(strum != null && tailLength != 0)
spawnHoldSplash(note);
}
}

public function spawnHoldSplash(note:Note) {
var end:Note = note;
var splash:SustainSplash = grpHoldSplashes.recycle(SustainSplash);
splash.setupSusSplash((note.mustPress ? playerStrums : opponentStrums).members[note.noteData], note, 1);
grpHoldSplashes.add(end.noteHoldSplash = splash);
}

// Note splash shit, duh
function spawnNoteSplashOnNote(note:Note) {
Expand Down
Loading

0 comments on commit 08699d1

Please sign in to comment.