Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Commit

Permalink
ghost tapping moment
Browse files Browse the repository at this point in the history
  • Loading branch information
yophlox committed Aug 2, 2024
1 parent fd8c636 commit c4e4b29
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 178 deletions.
10 changes: 1 addition & 9 deletions Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,12 @@
<set name="BUILD_DIR" value="export/32bit" if="32bit" />

<classpath name="source" />

<assets path="assets/images" />
<assets path="assets/charts" />

<assets path="assets" />
<assets path="assets/music" include="*.mp3" if="web"/>
<assets path="assets/music" include="*.ogg" unless="web"/>
<assets path="assets/sounds" include="*.mp3" if="web" />
<assets path="assets/sounds" include="*.ogg" unless="web" />

<assets path="assets/characterList.txt" rename='assets/characterList.txt'/>
<assets path="assets/freeplaySonglist.txt" rename='assets/freeplaySonglist.txt'/>
<assets path="assets/introText.txt" rename='assets/introText.txt'/>


<!-- NOTE FOR FUTURE SELF SINCE FONTS ARE ALWAYS FUCKY
TO FIX ONE OF THEM, I CONVERTED IT TO OTF. DUNNO IF YOU NEED TO
THEN UHHH I USED THE NAME OF THE FONT WITH SETFORMAT() ON THE TEXT!!!
Expand Down
9 changes: 0 additions & 9 deletions assets/chars/bf.json

This file was deleted.

271 changes: 111 additions & 160 deletions source/funkin/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1581,6 +1581,7 @@ class PlayState extends MusicBeatState
{
health -= 0.0475;
vocals.volume = 0;
noteMiss(daNote.noteData, daNote);
}

daNote.active = false;
Expand Down Expand Up @@ -1861,9 +1862,10 @@ class PlayState extends MusicBeatState
curSection += 1;
}

private function keyShit():Void
private function keyShit():Void // KADE ENGINE, INPUT LOL!
{
// HOLDING
/*
var up = controls.UP;
var right = controls.RIGHT;
var down = controls.DOWN;
Expand All @@ -1878,137 +1880,123 @@ class PlayState extends MusicBeatState
var rightR = controls.RIGHT_R;
var downR = controls.DOWN_R;
var leftR = controls.LEFT_R;

var controlArray:Array<Bool> = [leftP, downP, upP, rightP];
*/

var holdArray:Array<Bool> = [controls.LEFT, controls.DOWN, controls.UP, controls.RIGHT];
var pressArray:Array<Bool> = [
controls.LEFT_P,
controls.DOWN_P,
controls.UP_P,
controls.RIGHT_P
];
var releaseArray:Array<Bool> = [
controls.LEFT_R,
controls.DOWN_R,
controls.UP_R,
controls.RIGHT_R
];

//var controlArray:Array<Bool> = [leftP, downP, upP, rightP];

if (holdArray.contains(true) && /*!boyfriend.stunned && */ generatedMusic)
{
notes.forEachAlive(function(daNote:Note)
{
if (daNote.isSustainNote && daNote.canBeHit && daNote.mustPress && holdArray[daNote.noteData])
goodNoteHit(daNote);
});
}

// FlxG.watch.addQuick('asdfa', upP);
if ((upP || rightP || downP || leftP) && !boyfriend.stunned && generatedMusic)
if (pressArray.contains(true) && /*!boyfriend.stunned &&*/ generatedMusic)
{
boyfriend.holdTimer = 0;

var possibleNotes:Array<Note> = [];

var ignoreList:Array<Int> = [];
var possibleNotes:Array<Note> = []; // notes that can be hit
var directionList:Array<Int> = []; // directions that can be hit
var dumbNotes:Array<Note> = []; // notes to kill later
var directionsAccounted:Array<Bool> = [false,false,false,false]; // we don't want to do judgments for more than one presses

notes.forEachAlive(function(daNote:Note)
{
if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate)
{
// the sorting probably doesn't need to be in here? who cares lol
possibleNotes.push(daNote);
possibleNotes.sort((a, b) -> Std.int(a.strumTime - b.strumTime));

ignoreList.push(daNote.noteData);
}
});

if (possibleNotes.length > 0)
{
var daNote = possibleNotes[0];

if (perfectMode)
noteCheck(true, daNote);

// Jump notes
if (possibleNotes.length >= 2)
if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate && !daNote.wasGoodHit)
{
if (possibleNotes[0].strumTime == possibleNotes[1].strumTime)
if (!directionsAccounted[daNote.noteData])
{
for (coolNote in possibleNotes)
if (directionList.contains(daNote.noteData))
{
if (controlArray[coolNote.noteData])
goodNoteHit(coolNote);
else
directionsAccounted[daNote.noteData] = true;
for (coolNote in possibleNotes)
{
var inIgnoreList:Bool = false;
for (shit in 0...ignoreList.length)
{
if (controlArray[ignoreList[shit]])
inIgnoreList = true;
if (coolNote.noteData == daNote.noteData && Math.abs(daNote.strumTime - coolNote.strumTime) < 10)
{ // if it's the same note twice at < 10ms distance, just delete it
// EXCEPT u cant delete it in this loop cuz it fucks with the collection lol
dumbNotes.push(daNote);
break;
}
else if (coolNote.noteData == daNote.noteData && daNote.strumTime < coolNote.strumTime)
{ // if daNote is earlier than existing note (coolNote), replace
possibleNotes.remove(coolNote);
possibleNotes.push(daNote);
break;
}
if (!inIgnoreList)
badNoteCheck();
}
}
}
else if (possibleNotes[0].noteData == possibleNotes[1].noteData)
{
noteCheck(controlArray[daNote.noteData], daNote);
}
else
{
for (coolNote in possibleNotes)
else
{
noteCheck(controlArray[coolNote.noteData], coolNote);
possibleNotes.push(daNote);
directionList.push(daNote.noteData);
}
}
}
else // regular notes?
{
noteCheck(controlArray[daNote.noteData], daNote);
}
/*
if (controlArray[daNote.noteData])
goodNoteHit(daNote);
*/
// trace(daNote.noteData);
/*
switch (daNote.noteData)
{
case 2: // NOTES YOU JUST PRESSED
if (upP || rightP || downP || leftP)
noteCheck(upP, daNote);
case 3:
if (upP || rightP || downP || leftP)
noteCheck(rightP, daNote);
case 1:
if (upP || rightP || downP || leftP)
noteCheck(downP, daNote);
case 0:
if (upP || rightP || downP || leftP)
noteCheck(leftP, daNote);
}
*/
if (daNote.wasGoodHit)
{
daNote.kill();
notes.remove(daNote, true);
daNote.destroy();
}
});

for (note in dumbNotes)
{
FlxG.log.add("killing dumb ass note at " + note.strumTime);
note.kill();
notes.remove(note, true);
note.destroy();
}
else

possibleNotes.sort((a, b) -> Std.int(a.strumTime - b.strumTime));
var dontCheck = false;

for (i in 0...pressArray.length)
{
badNoteCheck();
if (pressArray[i] && !directionList.contains(i))
dontCheck = true;
}
}

if ((up || right || down || left) && !boyfriend.stunned && generatedMusic)
{
notes.forEachAlive(function(daNote:Note)
if (perfectMode)
goodNoteHit(possibleNotes[0]);
else if (possibleNotes.length > 0 && !dontCheck)
{
if (daNote.canBeHit && daNote.mustPress && daNote.isSustainNote)
for (shit in 0...pressArray.length)
{ // if a direction is hit that shouldn't be
if (pressArray[shit] && !directionList.contains(shit))
noteMiss(shit, null);
}

for (coolNote in possibleNotes)
{
switch (daNote.noteData)
if (pressArray[coolNote.noteData])
{
// NOTES YOU ARE HOLDING
case 0:
if (left)
goodNoteHit(daNote);
case 1:
if (down)
goodNoteHit(daNote);
case 2:
if (up)
goodNoteHit(daNote);
case 3:
if (right)
goodNoteHit(daNote);
scoreTxt.color = FlxColor.WHITE;
goodNoteHit(coolNote);
}
}
});
}
}

if (boyfriend.holdTimer > Conductor.stepCrochet * 4 * 0.001 && !up && !down && !right && !left)
notes.forEachAlive(function(daNote:Note)
{
if(daNote.y < strumLine.y)
{
}
});

if (boyfriend.holdTimer > Conductor.stepCrochet * 4 * 0.001 && (!holdArray.contains(true)))
{
if (boyfriend.animation.curAnim.name.startsWith('sing') && !boyfriend.animation.curAnim.name.endsWith('miss'))
{
Expand All @@ -2018,30 +2006,11 @@ class PlayState extends MusicBeatState

playerStrums.forEach(function(spr:FlxSprite)
{
switch (spr.ID)
{
case 0:
if (leftP && spr.animation.curAnim.name != 'confirm')
spr.animation.play('pressed');
if (leftR)
spr.animation.play('static');
case 1:
if (downP && spr.animation.curAnim.name != 'confirm')
spr.animation.play('pressed');
if (downR)
spr.animation.play('static');
case 2:
if (upP && spr.animation.curAnim.name != 'confirm')
spr.animation.play('pressed');
if (upR)
spr.animation.play('static');
case 3:
if (rightP && spr.animation.curAnim.name != 'confirm')
spr.animation.play('pressed');
if (rightR)
spr.animation.play('static');
}

if (pressArray[spr.ID] && spr.animation.curAnim.name != 'confirm')
spr.animation.play('pressed');
if (!holdArray[spr.ID])
spr.animation.play('static');

if (spr.animation.curAnim.name == 'confirm' && !curStage.startsWith('school'))
{
spr.centerOffsets();
Expand All @@ -2053,26 +2022,28 @@ class PlayState extends MusicBeatState
});
}

function noteMiss(direction:Int = 1):Void
{
if (isStoryMode)
{
storyScore += Math.round(songScore);
storyMisses += misses;
}
function noteMiss(direction:Int = 1, daNote:Note):Void
{
if (!boyfriend.stunned)
{
misses++;
health -= 0.04;
if (combo > 5)

if (health < 0)
health = 0;

if (health > 0)
health -= 0.04;

if (combo > 5 && gf.animOffsets.exists('sad'))
{
gf.playAnim('sad');
}
combo = 0;

songScore -= 10;

FlxG.sound.play('assets/sounds/missnote' + FlxG.random.int(1, 3) + TitleState.soundExt, FlxG.random.float(0.1, 0.2));
// FlxG.sound.play('assets/sounds/missnote1' + TitleState.soundExt, 1, false);
FlxG.sound.play(Paths.soundRandom('missnote', 1, 3), FlxG.random.float(0.1, 0.2));
// FlxG.sound.play(Paths.sound('missnote1'), 1, false);
// FlxG.log.add('played imss note');

boyfriend.stunned = true;
Expand All @@ -2096,33 +2067,13 @@ class PlayState extends MusicBeatState
}
}
}

function badNoteCheck()
{
// just double pasting this shit cuz fuk u
// REDO THIS SYSTEM!
var upP = controls.UP_P;
var rightP = controls.RIGHT_P;
var downP = controls.DOWN_P;
var leftP = controls.LEFT_P;

if (leftP)
noteMiss(0);
if (downP)
noteMiss(1);
if (upP)
noteMiss(2);
if (rightP)
noteMiss(3);
}

function noteCheck(keyP:Bool, note:Note):Void
function noteCheck(controlArray:Array<Bool>, note:Note):Void
{
if (keyP)
if (controlArray[note.noteData])
goodNoteHit(note);
else
{
badNoteCheck();
noteMiss(note.noteData, note);
}
}

Expand Down

0 comments on commit c4e4b29

Please sign in to comment.