Merge branch 'master' into resyncvocals

This commit is contained in:
M&M 2021-02-12 23:21:51 -08:00 committed by GitHub
commit 93b0fe153d
16 changed files with 215 additions and 235 deletions

View file

@ -4,29 +4,18 @@ about: Report a bug or critical performance issue
title: 'Bug Report: ' title: 'Bug Report: '
labels: bug labels: bug
--- ---
#### Please check for duplicates or similar issues, as well performing simple troubleshooting steps (such as clearing cookies, clearing AppData, trying another browser) before submitting an issue.
### If you are playing the game in a browser, what site are you playing it from?
[Newgrounds](https://www.newgrounds.com/portal/view/770371) or [Itch.io](https://ninja-muffin24.itch.io/funkin)? Specify below.
# Please check for duplicates or similar issues, as well performing simple troubleshooting steps (such as clearing cookies, clearing AppData, trying another browser) before submitting an issue. ### If you are playing the game in a browser, what browser are you using?
Chrome (or a Chromium based browser, i.e. Edge, Opera, etc.), Firefox, or Safari? Specify blow.
## Where are you playing the game? ### If you are playing a downloaded version of the game, what operating system are you using?
Windows (`x86`), Windows (`x86_64`), Linux, or macOS? Specify below.
### Web
- [ ] [Newgrounds](https://www.newgrounds.com/portal/view/770371)
- [ ] [Itch.io](https://ninja-muffin24.itch.io/funkin)
#### If you are using a web build, what browser are you using?
- [ ] Chrome, or a Chromium based broswer (Edge, Opera, etc.)
- [ ] Firefox, or a Gecko based broswer
- [ ] Safari
- [ ] Other, please specify:
### Local
- [ ] Windows x86
- [ ] Windows x86_64
- [ ] Linux
- [ ] macOS
## What version of the game are you using? Look in the bottom left corner of the main menu. ## What version of the game are you using? Look in the bottom left corner of the main menu.
## Have you identified any steps to reproduce the bug? If so, please describe them below. Use images if possible. ## Have you identified any steps to reproduce the bug? If so, please describe them below. Use images if possible.
## Please describe your issue. Provide extensive detail and images if possibe. ## Please describe your issue. Provide extensive detail and images if possible.

View file

@ -4,7 +4,5 @@ about: Suggest a new feature
title: 'Enhancement: ' title: 'Enhancement: '
labels: enhancement labels: enhancement
--- ---
#### Please check for duplicates or similar issues before creating this issue.
# Please check for duplicates or similar issues before creating this issue.
## What is your suggestion, and why should it be implemented? ## What is your suggestion, and why should it be implemented?

View file

@ -4,7 +4,5 @@ about: Ask a general question
title: 'Question: ' title: 'Question: '
labels: question labels: question
--- ---
#### Please check for duplicates or similar issues before asking your question.
# Please check for duplicates or similar issues before asking your question.
## What is your question? ## What is your question?

View file

@ -4,9 +4,7 @@ about: Fix a bug or critical performance issue
title: 'Bug Fix: ' title: 'Bug Fix: '
labels: bug labels: bug
--- ---
#### Please check for duplicates or similar PRs before creating this issue.
# Please check for duplicates or similar PRs before creating this issue.
## Does this PR close any issue(s)? If so, link them below. ## Does this PR close any issue(s)? If so, link them below.
## Breifly describe the issue(s) fixed. ## Briefly describe the issue(s) fixed.

View file

@ -4,9 +4,7 @@ about: Add a new feature
title: 'Enhancement: ' title: 'Enhancement: '
labels: enhancement labels: enhancement
--- ---
#### Please check for duplicates or similar PRs before creating this issue.
# Please check for duplicates or similar PRs before creating this issue.
## Does this PR close any issue(s)? If so, link them below. ## Does this PR close any issue(s)? If so, link them below.
## What do your change(s) add, and why should they be implemented? ## What do your change(s) add, and why should they be implemented?

View file

@ -4,6 +4,13 @@ All notable changes will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [unreleased]
### Changed
- Made the transitions between the story mode levels more seamless.
### Fixed
- Chart's and chart editor now support changeBPM, GOD BLESS MTH FOR THIS ONE I BEEN STRUGGLIN WIT THAT SINCE OCTOBER LMAO ([GOD BLESS MTH](https://github.com/ninjamuffin99/Funkin/pull/382))
- Antialiasing on the skyscraper lights
## [0.2.7] - 2021-02-02 ## [0.2.7] - 2021-02-02
### Added ### Added
- PIXEL DAY UPDATE LOL 1 WEEK LATER - PIXEL DAY UPDATE LOL 1 WEEK LATER

View file

@ -2,6 +2,7 @@ package;
import Section.SwagSection; import Section.SwagSection;
import Song.SwagSong; import Song.SwagSong;
import Conductor.BPMChangeEvent;
import flixel.FlxG; import flixel.FlxG;
import flixel.FlxSprite; import flixel.FlxSprite;
import flixel.addons.display.FlxGridOverlay; import flixel.addons.display.FlxGridOverlay;
@ -117,11 +118,9 @@ class ChartingState extends MusicBeatState
song: 'Test', song: 'Test',
notes: [], notes: [],
bpm: 150, bpm: 150,
sections: 0,
needsVoices: true, needsVoices: true,
player1: 'bf', player1: 'bf',
player2: 'dad', player2: 'dad',
sectionLengths: [],
speed: 1, speed: 1,
validScore: false validScore: false
}; };
@ -140,6 +139,7 @@ class ChartingState extends MusicBeatState
loadSong(_song.song); loadSong(_song.song);
Conductor.changeBPM(_song.bpm); Conductor.changeBPM(_song.bpm);
Conductor.mapBPMChanges(_song);
bpmTxt = new FlxText(1000, 50, 0, "", 16); bpmTxt = new FlxText(1000, 50, 0, "", 16);
bpmTxt.scrollFactor.set(); bpmTxt.scrollFactor.set();
@ -366,6 +366,7 @@ class ChartingState extends MusicBeatState
vocals.time = 0; vocals.time = 0;
FlxG.sound.music.pause(); FlxG.sound.music.pause();
FlxG.sound.music.time = 0; FlxG.sound.music.time = 0;
changeSection();
}; };
} }
@ -425,6 +426,7 @@ class ChartingState extends MusicBeatState
else if (wname == 'song_bpm') else if (wname == 'song_bpm')
{ {
tempBpm = Std.int(nums.value); tempBpm = Std.int(nums.value);
Conductor.mapBPMChanges(_song);
Conductor.changeBPM(Std.int(nums.value)); Conductor.changeBPM(Std.int(nums.value));
} }
else if (wname == 'note_susLength') else if (wname == 'note_susLength')
@ -444,12 +446,27 @@ class ChartingState extends MusicBeatState
var updatedSection:Bool = false; var updatedSection:Bool = false;
/* this function got owned LOL
function lengthBpmBullshit():Float function lengthBpmBullshit():Float
{ {
if (_song.notes[curSection].changeBPM) if (_song.notes[curSection].changeBPM)
return _song.notes[curSection].lengthInSteps * (_song.notes[curSection].bpm / _song.bpm); return _song.notes[curSection].lengthInSteps * (_song.notes[curSection].bpm / _song.bpm);
else else
return _song.notes[curSection].lengthInSteps; return _song.notes[curSection].lengthInSteps;
}*/
function sectionStartTime():Float
{
var daBPM:Int = _song.bpm;
var daPos:Float = 0;
for (i in 0...curSection)
{
if (_song.notes[i].changeBPM) {
daBPM = _song.notes[i].bpm;
}
daPos += 4 * (1000 * 60 / daBPM);
}
return daPos;
} }
override function update(elapsed:Float) override function update(elapsed:Float)
@ -459,11 +476,9 @@ class ChartingState extends MusicBeatState
Conductor.songPosition = FlxG.sound.music.time; Conductor.songPosition = FlxG.sound.music.time;
_song.song = typingShit.text; _song.song = typingShit.text;
strumLine.y = getYfromStrum(Conductor.songPosition % (Conductor.stepCrochet * lengthBpmBullshit())); strumLine.y = getYfromStrum((Conductor.songPosition - sectionStartTime()) % (Conductor.stepCrochet * _song.notes[curSection].lengthInSteps));
if (curBeat % 4 == 0) if (curBeat % 4 == 0 && curStep >= 16 * (curSection + 1))
{
if (curStep > 16 * (curSection + 1))
{ {
trace(curStep); trace(curStep);
trace((_song.notes[curSection].lengthInSteps) * (curSection + 1)); trace((_song.notes[curSection].lengthInSteps) * (curSection + 1));
@ -476,7 +491,6 @@ class ChartingState extends MusicBeatState
changeSection(curSection + 1, false); changeSection(curSection + 1, false);
} }
}
FlxG.watch.addQuick('daBeat', curBeat); FlxG.watch.addQuick('daBeat', curBeat);
FlxG.watch.addQuick('daStep', curStep); FlxG.watch.addQuick('daStep', curStep);
@ -674,21 +688,18 @@ class ChartingState extends MusicBeatState
function recalculateSteps():Int function recalculateSteps():Int
{ {
var steps:Int = 0; var lastChange:BPMChangeEvent = {
var timeShit:Float = 0; stepTime: 0,
songTime: 0,
for (i in 0...curSection) bpm: 0
}
for (i in 0...Conductor.bpmChangeMap.length)
{ {
steps += 16; if (FlxG.sound.music.time > Conductor.bpmChangeMap[i].songTime)
lastChange = Conductor.bpmChangeMap[i];
if (_song.notes[i].changeBPM)
timeShit += (((60 / _song.notes[i].bpm) * 1000) / 4) * 16;
else
timeShit += (((60 / _song.bpm) * 1000) / 4) * 16;
} }
steps += Math.floor((FlxG.sound.music.time - timeShit) / Conductor.stepCrochet); curStep = lastChange.stepTime + Math.floor((FlxG.sound.music.time - lastChange.songTime) / Conductor.stepCrochet);
curStep = steps;
updateBeat(); updateBeat();
return curStep; return curStep;
@ -702,7 +713,7 @@ class ChartingState extends MusicBeatState
vocals.pause(); vocals.pause();
// Basically old shit from changeSection??? // Basically old shit from changeSection???
FlxG.sound.music.time = lengthBpmBullshit() * Conductor.stepCrochet * curSection; FlxG.sound.music.time = sectionStartTime();
if (songBeginning) if (songBeginning)
{ {
@ -732,15 +743,15 @@ class ChartingState extends MusicBeatState
FlxG.sound.music.pause(); FlxG.sound.music.pause();
vocals.pause(); vocals.pause();
var daNum:Int = 0; /*var daNum:Int = 0;
var daLength:Float = 0; var daLength:Float = 0;
while (daNum <= sec) while (daNum <= sec)
{ {
daLength += lengthBpmBullshit(); daLength += lengthBpmBullshit();
daNum++; daNum++;
} }*/
FlxG.sound.music.time = (daLength - lengthBpmBullshit()) * Conductor.stepCrochet; FlxG.sound.music.time = sectionStartTime();
vocals.time = FlxG.sound.music.time; vocals.time = FlxG.sound.music.time;
updateCurStep(); updateCurStep();
} }
@ -815,10 +826,16 @@ class ChartingState extends MusicBeatState
if (_song.notes[curSection].changeBPM && _song.notes[curSection].bpm > 0) if (_song.notes[curSection].changeBPM && _song.notes[curSection].bpm > 0)
{ {
Conductor.changeBPM(_song.notes[curSection].bpm); Conductor.changeBPM(_song.notes[curSection].bpm);
FlxG.log.add('CHANGED BPM!');
} }
else else
{ {
Conductor.changeBPM(tempBpm); //get last bpm
var daBPM:Int = _song.bpm;
for (i in 0...curSection)
if (_song.notes[i].changeBPM)
daBPM = _song.notes[i].bpm;
Conductor.changeBPM(daBPM);
} }
/* // PORT BULLSHIT, INCASE THERE'S NO SUSTAIN DATA FOR A NOTE /* // PORT BULLSHIT, INCASE THERE'S NO SUSTAIN DATA FOR A NOTE
@ -846,7 +863,7 @@ class ChartingState extends MusicBeatState
note.setGraphicSize(GRID_SIZE, GRID_SIZE); note.setGraphicSize(GRID_SIZE, GRID_SIZE);
note.updateHitbox(); note.updateHitbox();
note.x = Math.floor(daNoteInfo * GRID_SIZE); note.x = Math.floor(daNoteInfo * GRID_SIZE);
note.y = Math.floor(getYfromStrum(daStrumTime)) % gridBG.height; note.y = Math.floor(getYfromStrum((daStrumTime - sectionStartTime()) % (Conductor.stepCrochet * _song.notes[curSection].lengthInSteps)));
curRenderedNotes.add(note); curRenderedNotes.add(note);
@ -925,7 +942,7 @@ class ChartingState extends MusicBeatState
private function addNote():Void private function addNote():Void
{ {
var noteStrum = getStrumTime(dummyArrow.y) + (curSection * (Conductor.stepCrochet * 16)); var noteStrum = getStrumTime(dummyArrow.y) + sectionStartTime();
var noteData = Math.floor(FlxG.mouse.x / GRID_SIZE); var noteData = Math.floor(FlxG.mouse.x / GRID_SIZE);
var noteSus = 0; var noteSus = 0;
@ -938,7 +955,7 @@ class ChartingState extends MusicBeatState
_song.notes[curSection].sectionNotes.push([noteStrum, (noteData + 4) % 8, noteSus]); _song.notes[curSection].sectionNotes.push([noteStrum, (noteData + 4) % 8, noteSus]);
} }
trace(getStrumTime(dummyArrow.y) + (curSection * (Conductor.stepCrochet * lengthBpmBullshit()))); trace(noteStrum);
trace(curSection); trace(curSection);
updateGrid(); updateGrid();
@ -957,6 +974,7 @@ class ChartingState extends MusicBeatState
return FlxMath.remapToRange(strumTime, 0, 16 * Conductor.stepCrochet, gridBG.y, gridBG.y + gridBG.height); return FlxMath.remapToRange(strumTime, 0, 16 * Conductor.stepCrochet, gridBG.y, gridBG.y + gridBG.height);
} }
/*
function calculateSectionLengths(?sec:SwagSection):Int function calculateSectionLengths(?sec:SwagSection):Int
{ {
var daLength:Int = 0; var daLength:Int = 0;
@ -978,7 +996,7 @@ class ChartingState extends MusicBeatState
} }
return daLength; return daLength;
} }*/
private var daSpacing:Float = 0.3; private var daSpacing:Float = 0.3;
@ -1014,10 +1032,7 @@ class ChartingState extends MusicBeatState
function autosaveSong():Void function autosaveSong():Void
{ {
FlxG.save.data.autosave = Json.stringify({ FlxG.save.data.autosave = Json.stringify({
"song": _song, "song": _song
"bpm": Conductor.bpm,
"sections": _song.notes.length,
'notes': _song.notes
}); });
FlxG.save.flush(); FlxG.save.flush();
} }
@ -1025,10 +1040,7 @@ class ChartingState extends MusicBeatState
private function saveLevel() private function saveLevel()
{ {
var json = { var json = {
"song": _song, "song": _song
"bpm": Conductor.bpm,
"sections": _song.notes.length,
'notes': _song.notes
}; };
var data:String = Json.stringify(json); var data:String = Json.stringify(json);

View file

@ -1,9 +1,19 @@
package; package;
import Song.SwagSong;
/** /**
* ... * ...
* @author * @author
*/ */
typedef BPMChangeEvent =
{
var stepTime:Int;
var songTime:Float;
var bpm:Int;
}
class Conductor class Conductor
{ {
public static var bpm:Int = 100; public static var bpm:Int = 100;
@ -16,10 +26,39 @@ class Conductor
public static var safeFrames:Int = 10; public static var safeFrames:Int = 10;
public static var safeZoneOffset:Float = (safeFrames / 60) * 1000; // is calculated in create(), is safeFrames in milliseconds public static var safeZoneOffset:Float = (safeFrames / 60) * 1000; // is calculated in create(), is safeFrames in milliseconds
public static var bpmChangeMap:Array<BPMChangeEvent> = [];
public function new() public function new()
{ {
} }
public static function mapBPMChanges(song:SwagSong)
{
bpmChangeMap = [];
var curBPM:Int = song.bpm;
var totalSteps:Int = 0;
var totalPos:Float = 0;
for (i in 0...song.notes.length)
{
if(song.notes[i].changeBPM && song.notes[i].bpm != curBPM)
{
curBPM = song.notes[i].bpm;
var event:BPMChangeEvent = {
stepTime: totalSteps,
songTime: totalPos,
bpm: curBPM
};
bpmChangeMap.push(event);
}
var deltaSteps:Int = song.notes[i].lengthInSteps;
totalSteps += deltaSteps;
totalPos += ((60 / curBPM) * 1000 / 4) * deltaSteps;
}
trace("new BPM map BUDDY " + bpmChangeMap);
}
public static function changeBPM(newBpm:Int) public static function changeBPM(newBpm:Int)
{ {
bpm = newBpm; bpm = newBpm;

View file

@ -3,6 +3,7 @@ package;
import flixel.FlxG; import flixel.FlxG;
import flixel.FlxObject; import flixel.FlxObject;
import flixel.FlxSprite; import flixel.FlxSprite;
import flixel.addons.transition.FlxTransitionableState;
import flixel.effects.FlxFlicker; import flixel.effects.FlxFlicker;
import flixel.graphics.frames.FlxAtlasFrames; import flixel.graphics.frames.FlxAtlasFrames;
import flixel.group.FlxGroup.FlxTypedGroup; import flixel.group.FlxGroup.FlxTypedGroup;
@ -32,6 +33,9 @@ class MainMenuState extends MusicBeatState
override function create() override function create()
{ {
transIn = FlxTransitionableState.defaultTransIn;
transOut = FlxTransitionableState.defaultTransOut;
if (!FlxG.sound.music.playing) if (!FlxG.sound.music.playing)
{ {
FlxG.sound.playMusic('assets/music/freakyMenu' + TitleState.soundExt); FlxG.sound.playMusic('assets/music/freakyMenu' + TitleState.soundExt);

View file

@ -1,5 +1,6 @@
package; package;
import Conductor.BPMChangeEvent;
import flixel.FlxG; import flixel.FlxG;
import flixel.addons.transition.FlxTransitionableState; import flixel.addons.transition.FlxTransitionableState;
import flixel.addons.ui.FlxUIState; import flixel.addons.ui.FlxUIState;
@ -11,9 +12,6 @@ class MusicBeatState extends FlxUIState
private var lastBeat:Float = 0; private var lastBeat:Float = 0;
private var lastStep:Float = 0; private var lastStep:Float = 0;
private var totalBeats:Int = 0;
private var totalSteps:Int = 0;
private var curStep:Int = 0; private var curStep:Int = 0;
private var curBeat:Int = 0; private var curBeat:Int = 0;
private var controls(get, never):Controls; private var controls(get, never):Controls;
@ -35,59 +33,47 @@ class MusicBeatState extends FlxUIState
override function update(elapsed:Float) override function update(elapsed:Float)
{ {
everyStep(); //everyStep();
var oldStep:Int = curStep;
updateCurStep(); updateCurStep();
// Needs to be ROUNED, rather than ceil or floor
updateBeat(); updateBeat();
if (oldStep != curStep && curStep > 0)
stepHit();
super.update(elapsed); super.update(elapsed);
} }
private function updateBeat():Void private function updateBeat():Void
{ {
curBeat = Math.round(curStep / 4); curBeat = Math.floor(curStep / 4);
}
/**
* CHECKS EVERY FRAME
*/
private function everyStep():Void
{
if (Conductor.songPosition > lastStep + Conductor.stepCrochet - Conductor.safeZoneOffset
|| Conductor.songPosition < lastStep + Conductor.safeZoneOffset)
{
if (Conductor.songPosition > lastStep + Conductor.stepCrochet)
{
stepHit();
}
}
} }
private function updateCurStep():Void private function updateCurStep():Void
{ {
curStep = Math.floor(Conductor.songPosition / Conductor.stepCrochet); var lastChange:BPMChangeEvent = {
stepTime: 0,
songTime: 0,
bpm: 0
}
for (i in 0...Conductor.bpmChangeMap.length)
{
if (Conductor.songPosition >= Conductor.bpmChangeMap[i].songTime)
lastChange = Conductor.bpmChangeMap[i];
}
curStep = lastChange.stepTime + Math.floor((Conductor.songPosition - lastChange.songTime) / Conductor.stepCrochet);
} }
public function stepHit():Void public function stepHit():Void
{ {
totalSteps += 1; if (curStep % 4 == 0)
lastStep += Conductor.stepCrochet;
// If the song is at least 3 steps behind
if (Conductor.songPosition > lastStep + (Conductor.stepCrochet * 3))
{
lastStep = Conductor.songPosition;
totalSteps = Math.ceil(lastStep / Conductor.stepCrochet);
}
if (totalSteps % 4 == 0)
beatHit(); beatHit();
} }
public function beatHit():Void public function beatHit():Void
{ {
lastBeat += Conductor.crochet; //do literally nothing dumbass
totalBeats += 1;
} }
} }

View file

@ -1,5 +1,6 @@
package; package;
import Conductor.BPMChangeEvent;
import flixel.FlxG; import flixel.FlxG;
import flixel.FlxSubState; import flixel.FlxSubState;
@ -13,9 +14,6 @@ class MusicBeatSubstate extends FlxSubState
private var lastBeat:Float = 0; private var lastBeat:Float = 0;
private var lastStep:Float = 0; private var lastStep:Float = 0;
private var totalBeats:Int = 0;
private var totalSteps:Int = 0;
private var curStep:Int = 0; private var curStep:Int = 0;
private var curBeat:Int = 0; private var curBeat:Int = 0;
private var controls(get, never):Controls; private var controls(get, never):Controls;
@ -34,46 +32,43 @@ class MusicBeatSubstate extends FlxSubState
override function update(elapsed:Float) override function update(elapsed:Float)
{ {
everyStep(); //everyStep();
var oldStep:Int = curStep;
updateCurStep(); updateCurStep();
curBeat = Math.round(curStep / 4); curBeat = Math.floor(curStep / 4);
if (oldStep != curStep && curStep > 0)
stepHit();
super.update(elapsed); super.update(elapsed);
} }
/**
* CHECKS EVERY FRAME
*/
private function everyStep():Void
{
if (Conductor.songPosition > lastStep + Conductor.stepCrochet - Conductor.safeZoneOffset
|| Conductor.songPosition < lastStep + Conductor.safeZoneOffset)
{
if (Conductor.songPosition > lastStep + Conductor.stepCrochet)
{
stepHit();
}
}
}
private function updateCurStep():Void private function updateCurStep():Void
{ {
curStep = Math.floor(Conductor.songPosition / Conductor.stepCrochet); var lastChange:BPMChangeEvent = {
stepTime: 0,
songTime: 0,
bpm: 0
}
for (i in 0...Conductor.bpmChangeMap.length)
{
if (Conductor.songPosition > Conductor.bpmChangeMap[i].songTime)
lastChange = Conductor.bpmChangeMap[i];
}
curStep = lastChange.stepTime + Math.floor((Conductor.songPosition - lastChange.songTime) / Conductor.stepCrochet);
} }
public function stepHit():Void public function stepHit():Void
{ {
totalSteps += 1; if (curStep % 4 == 0)
lastStep += Conductor.stepCrochet;
if (totalSteps % 4 == 0)
beatHit(); beatHit();
} }
public function beatHit():Void public function beatHit():Void
{ {
lastBeat += Conductor.crochet; //do literally nothing dumbass
totalBeats += 1;
} }
} }

View file

@ -35,6 +35,8 @@ class NGio
trace('INIT NOLOGIN'); trace('INIT NOLOGIN');
GAME_VER = "v" + Application.current.meta.get('version'); GAME_VER = "v" + Application.current.meta.get('version');
if (api.length != 0)
{
NG.create(api); NG.create(api);
new FlxTimer().start(2, function(tmr:FlxTimer) new FlxTimer().start(2, function(tmr:FlxTimer)
@ -49,6 +51,7 @@ class NGio
call.send(); call.send();
}); });
} }
}
public function new(api:String, encKey:String, ?sessionId:String) public function new(api:String, encKey:String, ?sessionId:String)
{ {

View file

@ -4,6 +4,7 @@ import Controls.Control;
import flixel.FlxG; import flixel.FlxG;
import flixel.FlxSprite; import flixel.FlxSprite;
import flixel.FlxSubState; import flixel.FlxSubState;
import flixel.addons.transition.FlxTransitionableState;
import flixel.group.FlxGroup.FlxTypedGroup; import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.input.keyboard.FlxKey; import flixel.input.keyboard.FlxKey;
import flixel.system.FlxSound; import flixel.system.FlxSound;

View file

@ -140,6 +140,7 @@ class PlayState extends MusicBeatState
if (SONG == null) if (SONG == null)
SONG = Song.loadFromJson('tutorial'); SONG = Song.loadFromJson('tutorial');
Conductor.mapBPMChanges(SONG);
Conductor.changeBPM(SONG.bpm); Conductor.changeBPM(SONG.bpm);
switch (SONG.song.toLowerCase()) switch (SONG.song.toLowerCase())
@ -210,6 +211,7 @@ class PlayState extends MusicBeatState
light.visible = false; light.visible = false;
light.setGraphicSize(Std.int(light.width * 0.85)); light.setGraphicSize(Std.int(light.width * 0.85));
light.updateHitbox(); light.updateHitbox();
light.antialiasing = true;
phillyCityLights.add(light); phillyCityLights.add(light);
} }
@ -484,8 +486,6 @@ class PlayState extends MusicBeatState
defaultCamZoom = 0.9; defaultCamZoom = 0.9;
curStage = 'stage'; curStage = 'stage';
var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic('assets/images/stageback.png'); var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic('assets/images/stageback.png');
// bg.setGraphicSize(Std.int(bg.width * 2.5));
// bg.updateHitbox();
bg.antialiasing = true; bg.antialiasing = true;
bg.scrollFactor.set(0.9, 0.9); bg.scrollFactor.set(0.9, 0.9);
bg.active = false; bg.active = false;
@ -515,9 +515,7 @@ class PlayState extends MusicBeatState
{ {
case 'limo': case 'limo':
gfVersion = 'gf-car'; gfVersion = 'gf-car';
case 'mall': case 'mall' | 'mallEvil':
gfVersion = 'gf-christmas';
case 'mallEvil':
gfVersion = 'gf-christmas'; gfVersion = 'gf-christmas';
case 'school': case 'school':
gfVersion = 'gf-pixel'; gfVersion = 'gf-pixel';
@ -771,6 +769,7 @@ class PlayState extends MusicBeatState
senpaiEvil.frames = FlxAtlasFrames.fromSparrow('assets/images/weeb/senpaiCrazy.png', 'assets/images/weeb/senpaiCrazy.xml'); senpaiEvil.frames = FlxAtlasFrames.fromSparrow('assets/images/weeb/senpaiCrazy.png', 'assets/images/weeb/senpaiCrazy.xml');
senpaiEvil.animation.addByPrefix('idle', 'Senpai Pre Explosion', 24, false); senpaiEvil.animation.addByPrefix('idle', 'Senpai Pre Explosion', 24, false);
senpaiEvil.setGraphicSize(Std.int(senpaiEvil.width * 6)); senpaiEvil.setGraphicSize(Std.int(senpaiEvil.width * 6));
senpaiEvil.scrollFactor.set();
senpaiEvil.updateHitbox(); senpaiEvil.updateHitbox();
senpaiEvil.screenCenter(); senpaiEvil.screenCenter();
@ -1084,44 +1083,7 @@ class PlayState extends MusicBeatState
switch (curStage) switch (curStage)
{ {
case 'school': case 'school' | 'schoolEvil':
babyArrow.loadGraphic('assets/images/weeb/pixelUI/arrows-pixels.png', true, 17, 17);
babyArrow.animation.add('green', [6]);
babyArrow.animation.add('red', [7]);
babyArrow.animation.add('blue', [5]);
babyArrow.animation.add('purplel', [4]);
babyArrow.setGraphicSize(Std.int(babyArrow.width * daPixelZoom));
babyArrow.updateHitbox();
babyArrow.antialiasing = false;
switch (Math.abs(i))
{
case 2:
babyArrow.x += Note.swagWidth * 2;
babyArrow.animation.add('static', [2]);
babyArrow.animation.add('pressed', [6, 10], 12, false);
babyArrow.animation.add('confirm', [14, 18], 12, false);
case 3:
babyArrow.x += Note.swagWidth * 3;
babyArrow.animation.add('static', [3]);
babyArrow.animation.add('pressed', [7, 11], 12, false);
babyArrow.animation.add('confirm', [15, 19], 24, false);
case 1:
babyArrow.x += Note.swagWidth * 1;
babyArrow.animation.add('static', [1]);
babyArrow.animation.add('pressed', [5, 9], 12, false);
babyArrow.animation.add('confirm', [13, 17], 24, false);
case 0:
babyArrow.x += Note.swagWidth * 0;
babyArrow.animation.add('static', [0]);
babyArrow.animation.add('pressed', [4, 8], 12, false);
babyArrow.animation.add('confirm', [12, 16], 24, false);
}
case 'schoolEvil':
// ALL THIS IS COPY PASTED CUZ IM LAZY
babyArrow.loadGraphic('assets/images/weeb/pixelUI/arrows-pixels.png', true, 17, 17); babyArrow.loadGraphic('assets/images/weeb/pixelUI/arrows-pixels.png', true, 17, 17);
babyArrow.animation.add('green', [6]); babyArrow.animation.add('green', [6]);
babyArrow.animation.add('red', [7]); babyArrow.animation.add('red', [7]);
@ -1194,9 +1156,12 @@ class PlayState extends MusicBeatState
babyArrow.updateHitbox(); babyArrow.updateHitbox();
babyArrow.scrollFactor.set(); babyArrow.scrollFactor.set();
if (!isStoryMode)
{
babyArrow.y -= 10; babyArrow.y -= 10;
babyArrow.alpha = 0; babyArrow.alpha = 0;
FlxTween.tween(babyArrow, {y: babyArrow.y + 10, alpha: 1}, 1, {ease: FlxEase.circOut, startDelay: 0.5 + (0.2 * i)}); FlxTween.tween(babyArrow, {y: babyArrow.y + 10, alpha: 1}, 1, {ease: FlxEase.circOut, startDelay: 0.5 + (0.2 * i)});
}
babyArrow.ID = i; babyArrow.ID = i;
@ -1445,11 +1410,12 @@ class PlayState extends MusicBeatState
camHUD.zoom = FlxMath.lerp(1, camHUD.zoom, 0.95); camHUD.zoom = FlxMath.lerp(1, camHUD.zoom, 0.95);
} }
FlxG.watch.addQuick("beatShit", totalBeats); FlxG.watch.addQuick("beatShit", curBeat);
FlxG.watch.addQuick("stepShit", curStep);
if (curSong == 'Fresh') if (curSong == 'Fresh')
{ {
switch (totalBeats) switch (curBeat)
{ {
case 16: case 16:
camZooming = true; camZooming = true;
@ -1468,7 +1434,7 @@ class PlayState extends MusicBeatState
if (curSong == 'Bopeebo') if (curSong == 'Bopeebo')
{ {
switch (totalBeats) switch (curBeat)
{ {
case 128, 129, 130: case 128, 129, 130:
vocals.volume = 0; vocals.volume = 0;
@ -1548,8 +1514,6 @@ class PlayState extends MusicBeatState
altAnim = '-alt'; altAnim = '-alt';
} }
trace("DA ALT THO?: " + SONG.notes[Math.floor(curStep / 16)].altAnim);
switch (Math.abs(daNote.noteData)) switch (Math.abs(daNote.noteData))
{ {
case 2: case 2:
@ -1626,6 +1590,9 @@ class PlayState extends MusicBeatState
{ {
FlxG.sound.playMusic('assets/music/freakyMenu' + TitleState.soundExt); FlxG.sound.playMusic('assets/music/freakyMenu' + TitleState.soundExt);
transIn = FlxTransitionableState.defaultTransIn;
transOut = FlxTransitionableState.defaultTransOut;
FlxG.switchState(new StoryMenuState()); FlxG.switchState(new StoryMenuState());
// if () // if ()
@ -1664,20 +1631,14 @@ class PlayState extends MusicBeatState
FlxG.sound.play('assets/sounds/Lights_Shut_off' + TitleState.soundExt); FlxG.sound.play('assets/sounds/Lights_Shut_off' + TitleState.soundExt);
} }
if (SONG.song.toLowerCase() == 'senpai') FlxTransitionableState.skipNextTransIn = true;
{ FlxTransitionableState.skipNextTransOut = true;
transIn = null;
transOut = null;
prevCamFollow = camFollow; prevCamFollow = camFollow;
}
PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase() + difficulty, PlayState.storyPlaylist[0]); PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase() + difficulty, PlayState.storyPlaylist[0]);
FlxG.sound.music.stop(); FlxG.sound.music.stop();
FlxG.switchState(new PlayState()); FlxG.switchState(new PlayState());
transIn = FlxTransitionableState.defaultTransIn;
transOut = FlxTransitionableState.defaultTransOut;
} }
} }
else else
@ -2237,17 +2198,16 @@ class PlayState extends MusicBeatState
override function stepHit() override function stepHit()
{ {
super.stepHit();
if (FlxG.sound.music.time > Conductor.songPosition + 20 || FlxG.sound.music.time < Conductor.songPosition - 20) if (FlxG.sound.music.time > Conductor.songPosition + 20 || FlxG.sound.music.time < Conductor.songPosition - 20)
{ {
resyncVocals(); resyncVocals();
} }
if (dad.curCharacter == 'spooky' && totalSteps % 4 == 2) if (dad.curCharacter == 'spooky' && curStep % 4 == 2)
{ {
// dad.dance(); // dad.dance();
} }
super.stepHit();
} }
var lightningStrikeBeat:Int = 0; var lightningStrikeBeat:Int = 0;
@ -2255,7 +2215,6 @@ class PlayState extends MusicBeatState
override function beatHit() override function beatHit()
{ {
wiggleShit.update(Conductor.crochet);
super.beatHit(); super.beatHit();
if (generatedMusic) if (generatedMusic)
@ -2270,23 +2229,24 @@ class PlayState extends MusicBeatState
Conductor.changeBPM(SONG.notes[Math.floor(curStep / 16)].bpm); Conductor.changeBPM(SONG.notes[Math.floor(curStep / 16)].bpm);
FlxG.log.add('CHANGED BPM!'); FlxG.log.add('CHANGED BPM!');
} }
else // else
Conductor.changeBPM(SONG.bpm); // Conductor.changeBPM(SONG.bpm);
// Dad doesnt interupt his own notes // Dad doesnt interupt his own notes
if (SONG.notes[Math.floor(curStep / 16)].mustHitSection) if (SONG.notes[Math.floor(curStep / 16)].mustHitSection)
dad.dance(); dad.dance();
} }
// FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM); // FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM);
wiggleShit.update(Conductor.crochet);
// HARDCODING FOR MILF ZOOMS! // HARDCODING FOR MILF ZOOMS!
if (curSong.toLowerCase() == 'milf' && curBeat >= 168 && curBeat <= 200 && camZooming && FlxG.camera.zoom < 1.35) if (curSong.toLowerCase() == 'milf' && curBeat >= 168 && curBeat < 200 && camZooming && FlxG.camera.zoom < 1.35)
{ {
FlxG.camera.zoom += 0.015; FlxG.camera.zoom += 0.015;
camHUD.zoom += 0.03; camHUD.zoom += 0.03;
} }
if (camZooming && FlxG.camera.zoom < 1.35 && totalBeats % 4 == 0) if (camZooming && FlxG.camera.zoom < 1.35 && curBeat % 4 == 0)
{ {
FlxG.camera.zoom += 0.015; FlxG.camera.zoom += 0.015;
camHUD.zoom += 0.03; camHUD.zoom += 0.03;
@ -2298,7 +2258,7 @@ class PlayState extends MusicBeatState
iconP1.updateHitbox(); iconP1.updateHitbox();
iconP2.updateHitbox(); iconP2.updateHitbox();
if (totalBeats % gfSpeed == 0) if (curBeat % gfSpeed == 0)
{ {
gf.dance(); gf.dance();
} }
@ -2308,7 +2268,7 @@ class PlayState extends MusicBeatState
boyfriend.playAnim('idle'); boyfriend.playAnim('idle');
} }
if (totalBeats % 8 == 7 && curSong == 'Bopeebo') if (curBeat % 8 == 7 && curSong == 'Bopeebo')
{ {
boyfriend.playAnim('hey', true); boyfriend.playAnim('hey', true);
@ -2340,7 +2300,7 @@ class PlayState extends MusicBeatState
if (!trainMoving) if (!trainMoving)
trainCooldown += 1; trainCooldown += 1;
if (totalBeats % 4 == 0) if (curBeat % 4 == 0)
{ {
phillyCityLights.forEach(function(light:FlxSprite) phillyCityLights.forEach(function(light:FlxSprite)
{ {
@ -2353,7 +2313,7 @@ class PlayState extends MusicBeatState
// phillyCityLights.members[curLight].alpha = 1; // phillyCityLights.members[curLight].alpha = 1;
} }
if (totalBeats % 8 == 4 && FlxG.random.bool(30) && !trainMoving && trainCooldown > 8) if (curBeat % 8 == 4 && FlxG.random.bool(30) && !trainMoving && trainCooldown > 8)
{ {
trainCooldown = FlxG.random.int(-4, 0); trainCooldown = FlxG.random.int(-4, 0);
trainStart(); trainStart();

View file

@ -12,8 +12,6 @@ typedef SwagSong =
var song:String; var song:String;
var notes:Array<SwagSection>; var notes:Array<SwagSection>;
var bpm:Int; var bpm:Int;
var sections:Int;
var sectionLengths:Array<Dynamic>;
var needsVoices:Bool; var needsVoices:Bool;
var speed:Float; var speed:Float;
@ -27,25 +25,17 @@ class Song
public var song:String; public var song:String;
public var notes:Array<SwagSection>; public var notes:Array<SwagSection>;
public var bpm:Int; public var bpm:Int;
public var sections:Int;
public var sectionLengths:Array<Dynamic> = [];
public var needsVoices:Bool = true; public var needsVoices:Bool = true;
public var speed:Float = 1; public var speed:Float = 1;
public var player1:String = 'bf'; public var player1:String = 'bf';
public var player2:String = 'dad'; public var player2:String = 'dad';
public function new(song, notes, bpm, sections) public function new(song, notes, bpm)
{ {
this.song = song; this.song = song;
this.notes = notes; this.notes = notes;
this.bpm = bpm; this.bpm = bpm;
this.sections = sections;
for (i in 0...notes.length)
{
this.sectionLengths.push(notes[i]);
}
} }
public static function loadFromJson(jsonInput:String, ?folder:String):SwagSong public static function loadFromJson(jsonInput:String, ?folder:String):SwagSong
@ -72,9 +62,7 @@ class Song
daNotes = songData.notes; daNotes = songData.notes;
daSong = songData.song; daSong = songData.song;
daSections = songData.sections; daBpm = songData.bpm; */
daBpm = songData.bpm;
daSectionLengths = songData.sectionLengths; */
return parseJSONshit(rawJson); return parseJSONshit(rawJson);
} }

View file

@ -2,6 +2,7 @@ package;
import flixel.FlxG; import flixel.FlxG;
import flixel.FlxSprite; import flixel.FlxSprite;
import flixel.addons.transition.FlxTransitionableState;
import flixel.graphics.frames.FlxAtlasFrames; import flixel.graphics.frames.FlxAtlasFrames;
import flixel.group.FlxGroup.FlxTypedGroup; import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.group.FlxGroup; import flixel.group.FlxGroup;
@ -69,6 +70,9 @@ class StoryMenuState extends MusicBeatState
override function create() override function create()
{ {
transIn = FlxTransitionableState.defaultTransIn;
transOut = FlxTransitionableState.defaultTransOut;
if (FlxG.sound.music != null) if (FlxG.sound.music != null)
{ {
if (!FlxG.sound.music.playing) if (!FlxG.sound.music.playing)