Skip to content

Commit

Permalink
Whenever life gets you down Keeps you wearing a frown And the gravy t…
Browse files Browse the repository at this point in the history
…rain has left you behind And when you're all out of hope Down at the end of your rope And nobody's there to throw you a line If you ever get so low that you don't know which way to go Come on and take a walk in my shoes Never worry 'bout a thing, got the world on a string 'Cause I've got the cure for all of my blues (all of his blues) I take a look at my enormous penis And my troubles start a-meltin' away (ba-doo-bop-bop) I take a look at my enormous penis And the happy times are coming to stay I gotta sing, and I dance when I glance in my pants And the feeling's like a sunshiney day I take a look at my enormous pe-e-e-nis And everything is goin' my way (ba-doo-bop-bop) Voo-voo-vi-sov-va-va-vava-div-ee-vu-jah-va-sovoyay Foji-vas-va-vajuba-do-ah Subbo-ze-va-daa-dun-da Pe-ee-ee-nis Za-un-duh-ba-de-un-doi-bu-doula Everybody! I take a look at my enormous penis And my troubles start a-meltin' away (ba-doo-bop-bop) I take a look at my enormous penis And the happy times are coming to stay Yeah, I got great big amounts in the place where it counts And the feeling's like a sunshiney day I take a look at my enormous pe-e-e-nis And everything is goin' my way (my trouser monster) Everything is goin' my way (my meat is murder) Everything is goin' my way (size doesn't matter) Everything is goin' my way Yumm
  • Loading branch information
MaybeMaru committed Apr 8, 2024
1 parent 05e84f3 commit 3f03029
Show file tree
Hide file tree
Showing 10 changed files with 143 additions and 74 deletions.
3 changes: 2 additions & 1 deletion source/funkin/objects/Character.hx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ typedef CharacterJson = {
var isGF:Bool;
} & SpriteJson;

class Character extends FlxSpriteExt {
class Character extends FlxSpriteExt
{
public static final DEFAULT_CHARACTER:CharacterJson = {
anims: [],
imagePath: "week1/BOYFRIEND",
Expand Down
53 changes: 30 additions & 23 deletions source/funkin/objects/NotesGroup.hx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import funkin.objects.note.StrumLineGroup;

class NotesGroup extends Group
{
public static var instance:NotesGroup = null;
public static var instance:NotesGroup;
public var SONG:SwagSong;
var game:PlayState = null;
var game:PlayState;
var boyfriend:Character;
var dad:Character;

public static var songSpeed:Float = 1.0;
public var curSong:String = 'test';
Expand Down Expand Up @@ -44,24 +46,24 @@ class NotesGroup extends Group
public var isPlayState:Bool = true;

public function set_inBotplay(value:Bool) {
if (isPlayState) game.boyfriend.botMode = value;
if (boyfriend != null) boyfriend.botMode = value;
return inBotplay = value;
}

public function set_dadBotplay(value:Bool) {
if (isPlayState) game.dad.botMode = value;
if (dad != null) dad.botMode = value;
return dadBotplay = value;
}

public function spawnSplash(note:Note) {
grpNoteSplashes.spawnSplash(note);
}

inline function hitNote(note:Note, ?character:Character, botplayCheck:Bool = false, prefBot:Bool = false) {
inline function hitNote(note:Note, character:Character, botplayCheck:Bool = false, prefBot:Bool = false) {
note.wasGoodHit = true;
if (note.child != null) note.child.startedPress = true;

if (isPlayState) {
if (character != null) {
character.sing(note.noteData, note.altAnim);
Conductor.vocals.volume = 1;
}
Expand All @@ -77,11 +79,11 @@ class NotesGroup extends Group
note.targetStrum.playStrumAnim('confirm', true);
}

function pressSustain(sustain:Sustain, ?character:Character, botplayCheck:Bool = false, prefBot:Bool = false) {
function pressSustain(sustain:Sustain, character:Character, botplayCheck:Bool = false, prefBot:Bool = false) {
if (!sustain.exists)
return;

if (isPlayState) {
if (character != null) {
character.sing(sustain.noteData, sustain.altAnim, false);
Conductor.vocals.volume = 1;
}
Expand All @@ -105,6 +107,11 @@ class NotesGroup extends Group
this.isPlayState = isPlayState;
SONG = Song.checkSong(_SONG, null, false); //Double check null values
curSong = SONG.song;

if (isPlayState) {
boyfriend = game.boyfriend;
dad = game.dad;
}

Conductor.mapBPMChanges(SONG);
Conductor.bpm = SONG.bpm;
Expand All @@ -127,28 +134,28 @@ class NotesGroup extends Group
// Setup functions
goodNoteHit.add((note:Note) -> {
if (note.wasGoodHit) return;
hitNote(note, isPlayState ? game.boyfriend : null, inBotplay, getPref("botplay"));
hitNote(note, boyfriend, inBotplay, getPref("botplay"));
ModdingUtil.addCall('goodNoteHit', [note]);
ModdingUtil.addCall('noteHit', [note, true]);
note.removeNote();
});

goodSustainPress.add((sustain:Sustain) -> {
pressSustain(sustain, isPlayState ? game.boyfriend : null, inBotplay, getPref("botplay"));
pressSustain(sustain, boyfriend, inBotplay, getPref("botplay"));
ModdingUtil.addCall('goodSustainPress', [sustain]);
ModdingUtil.addCall('sustainPress', [sustain, true]);
});

opponentNoteHit.add((note:Note) -> {
if (note.wasGoodHit) return;
hitNote(note, isPlayState ? game.dad : null, dadBotplay);
hitNote(note, dad, dadBotplay);
ModdingUtil.addCall('opponentNoteHit', [note]);
ModdingUtil.addCall('noteHit', [note, false]);
note.removeNote();
});

opponentSustainPress.add((sustain:Sustain) -> {
pressSustain(sustain, isPlayState ? game.dad : null, dadBotplay);
pressSustain(sustain, dad, dadBotplay);
ModdingUtil.addCall('opponentSustainPress', [sustain]);
ModdingUtil.addCall('sustainPress', [sustain, false]);
});
Expand Down Expand Up @@ -176,8 +183,7 @@ class NotesGroup extends Group

ModdingUtil.addCall('noteMiss', [note]);

var char:Character = note.mustPress ? game.boyfriend : game.dad;
char.sing(note.noteData, 'miss');
(note.mustPress ? boyfriend : game.dad).sing(note.noteData, "miss");

game.updateScore();
});
Expand All @@ -189,10 +195,10 @@ class NotesGroup extends Group
ModdingUtil.addCall('badNoteHit', [data]);

if (!inBotplay)
game.boyfriend.sing(data, 'miss');
boyfriend.sing(data, 'miss');

if (!dadBotplay)
game.dad.sing(data, 'miss');
dad.sing(data, 'miss');

game.updateScore();
});
Expand Down Expand Up @@ -604,16 +610,17 @@ class NotesGroup extends Group
if (!inBotplay) checkStrums(playerStrums.members);
if (!dadBotplay) checkStrums(opponentStrums.members);

// Check for sing animations in PlayState characters
if (isPlayState) {
if (!inBotplay) checkOverSinging(game.boyfriend, playerStrums);
if (!dadBotplay) checkOverSinging(game.dad, opponentStrums);
}
// Check for sing animations in characters
if (!inBotplay) checkOverSinging(boyfriend, playerStrums);
if (!dadBotplay) checkOverSinging(dad, opponentStrums);
}

function checkOverSinging(char:Character, strums:StrumLineGroup):Void {
function checkOverSinging(char:Character, strums:StrumLineGroup):Void
{
if (char == null) return;
if (char.animation.curAnim == null) return;

var anim = char.animation.curAnim;
if (anim == null) return;
var name:String = anim.name;

var overSinging:Bool =
Expand Down
3 changes: 2 additions & 1 deletion source/funkin/objects/note/BasicNote.hx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ interface INoteData {
public var noteData:Int;
}

class BasicNote extends SmartSprite implements INoteData {
class BasicNote extends SmartSprite implements INoteData
{
public var strumTime:Float = 0.0;
public var noteData:Int = 0;
public var mustPress:Bool = false;
Expand Down
6 changes: 5 additions & 1 deletion source/funkin/objects/note/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ class Note extends BasicNote

override function updateSprites() {
super.updateSprites();
playAnim('scroll' + CoolUtil.directionArray[noteData]);
updateAnim();
}

public function updateAnim() {
playAnim('scroll' + CoolUtil.directionArray[noteData]);
}

override function applyCurOffset(forced:Bool = false) {
if (animation.curAnim != null) {
if(existsOffsets(animation.curAnim.name)) {
Expand Down
19 changes: 13 additions & 6 deletions source/funkin/objects/note/Sustain.hx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,23 @@ import flixel.graphics.frames.FlxFrame;

class Sustain extends BasicNote
{
public function new(noteData:Int = 0, strumTime:Float = 0.0, susLength:Float = 0.0, skin:String = "default", ?parent:Note):Void {
clipRect = FlxRect.get();
public function new(noteData:Int = 0, strumTime:Float = 0.0, susLength:Float = 0.0, skin:String = "default", ?parent:Note):Void
{
var initSus:Bool = (susLength > 0);
if (initSus) clipRect = FlxRect.get();

super(noteData, strumTime, skin); // Load skin

this.parent = parent;
isSustainNote = true;
drawStyle = BOTTOM_TOP;
alpha = 0.6;

yDisplace = NoteUtil.noteHeight * 0.5;
this.susLength = susLength;
setSusLength(susLength);
if (initSus) {
yDisplace = NoteUtil.noteHeight * 0.5;
this.susLength = susLength;
setSusLength(susLength);
}
}

override function set_noteSpeed(value:Float):Float {
Expand Down Expand Up @@ -126,7 +131,9 @@ class Sustain extends BasicNote
setTiles(1, 1);
calcHeight = frameHeight;
repeatHeight = lastHeight;
clipRect.width = repeatWidth;

if (clipRect != null)
clipRect.width = repeatWidth;
}

override function setupTile(tileX:Int, tileY:Int, baseFrame:FlxFrame):FlxPoint {
Expand Down
1 change: 0 additions & 1 deletion source/funkin/states/editors/chart/ChartGridBase.hx
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ class ChartSustain extends Sustain {
}

repeatHeight = FlxMath.remapToRange(chartData[2], 0, Conductor.stepCrochet, 0, GRID_SIZE) + GRID_SIZE * .5;
clipRect.height = repeatHeight;
}
}

Expand Down
1 change: 1 addition & 0 deletions source/funkin/states/newchart/ChartEditor.hx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class ChartEditor extends MusicBeatState
public static function setupSong(song:String, diff:String, ?input:SwagSong):SwagSong
{
SONG = input ?? Song.loadFromFile(diff, song);
Conductor.loadSong(SONG.song);
Conductor.bpm = SONG.bpm;
Conductor.songPosition = 0.0;
return SONG;
Expand Down
69 changes: 32 additions & 37 deletions source/funkin/states/newchart/ChartGrid.hx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class ChartGrid extends Group

var notesGrid:FlxBackdrop;
var eventsGrid:FlxBackdrop;
var content:ChartGridContent;

var beats:FlxBackdrop;

Expand Down Expand Up @@ -60,6 +61,9 @@ class ChartGrid extends Group
strumline = new ChartStrumLine(notesGrid.x);
add(strumline);

content = new ChartGridContent();
add(content);

prepareBpmChanges();
prepareObjects();

Expand Down Expand Up @@ -87,14 +91,17 @@ class ChartGrid extends Group
}
}

function move(elapsed:Float):Void {
Conductor.songPosition += elapsed * 1000;

if (Conductor.songPosition < 0)
Conductor.songPosition = 0;
function move(elapsed:Float):Void
{
Conductor.songPosition = boundTime(Conductor.songPosition + elapsed * 1000);

if (Conductor.songPosition >= sectionTimes[curSection + 1]) curSection++;
if (Conductor.songPosition < sectionTimes[curSection]) {
if (Conductor.songPosition >= sectionTimes[curSection + 1])
{
if ((curSection + 1) != (sectionTimes.length - 1))
curSection++;
}
else if (Conductor.songPosition < sectionTimes[curSection])
{
curSection--;
Conductor.songPosition = sectionTimes[curSection + 1] - 1; // Adjust time
}
Expand Down Expand Up @@ -131,27 +138,30 @@ class ChartGrid extends Group

// Get the conductor songPosition time Y
inline function getCurrentTimeY():Float {
return getTimeY(Math.max(0, getTime()));
return getTimeY(boundTime(getTime()));
}

// Bound a time value to the inst length
inline function boundTime(time:Float) {
return FlxMath.bound(time, 0, Conductor.inst.length - Conductor.offset[0] - Conductor.latency);
}

// TODO:
// Merge prepareObjects and prepareBPM since the notes gotta change position depending on the bpm
// Maybe generate notes first and make another function to position them at runtime?
// Make a beats seperator class to accomodate for that too

public var sectionObjects:Array<Array<FlxObject>> = [];

function prepareObjects() {
ChartEditor.SONG.notes.fastForEach((section, i) ->
{
var array:Array<FlxObject> = [];
var array:Array<FlxBasic> = [];

section.sectionNotes.fastForEach((note, i) -> {
var note = makeNote(note[0], note[1]);
var note = makeNote(note[0], note[1], note[2]);
array.push(note);
});

sectionObjects.push(array);
content.sectionNotes.push(array);
});
}

Expand All @@ -171,14 +181,16 @@ class ChartGrid extends Group

time += 4 * (60000 / bpm);
});

sectionTimes.push(time);
}

function makeNote(strumTime:Float, noteData:Int) {
var note = new Note(noteData, strumTime);
note.x = notesGrid.x + (TILE * noteData);
note.y = getTimeY(strumTime);
note.setGraphicSize(TILE, TILE);
note.updateHitbox();
function makeNote(strumTime:Float, noteData:Int, ?susLength:Float) {
var note = new ChartNote(noteData, susLength ?? 0, downscroll);
note.setPos(
notesGrid.x + (TILE * noteData),
getTimeY(strumTime)
);
return note;
}

Expand All @@ -190,24 +202,7 @@ class ChartGrid extends Group
Conductor.songPosition = sectionTimes[value] ?? sectionTimes[sectionTimes.length - 1];
updatePosition();

return curSection = value;
}

override function draw() {
super.draw();

// Render the 3 current visible sections, maybe make this higher depending on the snap?
// TODO: replace with ChartGridContent
for (i in 0...3)
{
if (sectionObjects[curSection - 1 + i] != null)
{
sectionObjects[curSection - 1 + i].fastForEach((object, i) -> {
if (object != null) if (object.exists) if (object.visible)
object.draw();
});
}
}
return content.renderSection = curSection = value;
}

override function destroy() {
Expand Down
7 changes: 3 additions & 4 deletions source/funkin/states/newchart/ChartGridContent.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ package funkin.states.newchart;

class ChartGridContent extends FlxBasic
{
public var sectionSustains:Array<Array<FlxObject>> = [];
public var sectionNotes:Array<Array<FlxObject>> = [];
public var sectionEvents:Array<Array<FlxObject>> = [];
public var sectionTexts:Array<Array<FlxObject>> = [];
public var sectionNotes:Array<Array<FlxBasic>> = [];
public var sectionEvents:Array<Array<FlxBasic>> = [];
public var sectionTexts:Array<Array<FlxBasic>> = [];

public var renderSection:Int = 0;
public var renderRange:Int = 3;
Expand Down
Loading

0 comments on commit 3f03029

Please sign in to comment.