Merge pull request #1550 from KadeDev/master

Master
This commit is contained in:
Kade M 2021-08-02 18:09:51 -07:00 committed by GitHub
commit e7e9f3647c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
44 changed files with 503 additions and 128 deletions

View File

@ -7,6 +7,8 @@
<!--Switch Export with Unique ApplicationID and Icon--> <!--Switch Export with Unique ApplicationID and Icon-->
<set name="APP_ID" value="0x0100f6c013bbc000" /> <set name="APP_ID" value="0x0100f6c013bbc000" />
<haxedef name="LINC_LUA_RELATIVE_DYNAMIC_LIB"/>
<!--The flixel preloader is not accurate in Chrome. You can use it regularly if you embed the swf into a html file <!--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"--> or you can set the actual size of your file manually at "FlxPreloaderBase-onUpdate-bytesTotal"-->
<!-- <app preloader="Preloader" resizable="true" /> --> <!-- <app preloader="Preloader" resizable="true" /> -->

View File

@ -13,10 +13,10 @@
<SubTexture name="Week 4 press0001" x="365" y="275" width="355" height="89"/> <SubTexture name="Week 4 press0001" x="365" y="275" width="355" height="89"/>
<SubTexture name="Week 60000" x="0" y="374" width="359" height="92"/> <SubTexture name="Week 60000" x="0" y="374" width="359" height="92"/>
<SubTexture name="Week 60001" x="369" y="374" width="359" height="92"/> <SubTexture name="Week 60001" x="369" y="374" width="359" height="92"/>
<SubTexture name="arrow left0000" x="738" y="374" width="48" height="85"/> <SubTexture name="arrow push left0000" x="738" y="374" width="48" height="85"/>
<SubTexture name="arrow push left0000" x="796" y="374" width="42" height="75"/> <SubTexture name="arrow left0000" x="796" y="374" width="42" height="75"/>
<SubTexture name="arrow push right0000" x="848" y="374" width="41" height="74"/> <SubTexture name="arrow right0000" x="848" y="374" width="41" height="74"/>
<SubTexture name="arrow right0000" x="899" y="374" width="47" height="85"/> <SubTexture name="arrow push right0000" x="899" y="374" width="47" height="85"/>
<SubTexture name="lock0000" x="956" y="374" width="67" height="93"/> <SubTexture name="lock0000" x="956" y="374" width="67" height="93"/>
<SubTexture name="tutorial selected0000" x="0" y="477" width="443" height="82"/> <SubTexture name="tutorial selected0000" x="0" y="477" width="443" height="82"/>
<SubTexture name="tutorial selected0001" x="453" y="477" width="443" height="82"/> <SubTexture name="tutorial selected0001" x="453" y="477" width="443" height="82"/>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

View File

@ -0,0 +1,20 @@
# Latest (master) changelog/Changelog for 1.0.0
Changes marked with 💖 will be listed in the short version of the changelog in `version.downloadMe`.
### Additions
- The ability to hide the grid in the editor (for faster load times)
- 💖 Wiggle Shader for Lua Modcharts
### Changes
- Sort replays by the newest one
- Cleaned up code
- SM Files can now have modcharts
- 💖 Optimized the editor
- 💖 Fixed HTML5 Delta Timings
### Bugfixes
- 💖 Steps actually exist now
- Fixed Decimal BPM Changes
- Fixes some hard locks
- It's a lot harder to crash in freeplay now

View File

@ -1,6 +1,9 @@
# Changelogs # Changelogs
- [Latest](latest) (Contains changes that are not in a release yet) - [Latest](latest) (Contains changes that are not in a release yet)
- [1.6.1](changelog-1.6.1)
- [1.6](changelog-1.6)
- [1.5.4](changelog-1.5.4)
- [1.5.3](changelog-1.5.3) - [1.5.3](changelog-1.5.3)
- [1.5.2](changelog-1.5.2) - [1.5.2](changelog-1.5.2)
- [1.5.1](changelog-1.5.1) - [1.5.1](changelog-1.5.1)

View File

@ -348,7 +348,7 @@ class Character extends FlxSprite
antialiasing = false; antialiasing = false;
case 'spirit': case 'spirit':
frames = Paths.getPackerAtlas('spirit','shared',true); frames = Paths.getPackerAtlas('spirit','shared',false);
animation.addByPrefix('idle', "idle spirit_", 24, false); animation.addByPrefix('idle', "idle spirit_", 24, false);
animation.addByPrefix('singUP', "up_", 24, false); animation.addByPrefix('singUP', "up_", 24, false);
animation.addByPrefix('singRIGHT', "right_", 24, false); animation.addByPrefix('singRIGHT', "right_", 24, false);
@ -408,9 +408,9 @@ class Character extends FlxSprite
} }
} }
public function loadOffsetFile(character:String) public function loadOffsetFile(character:String, library:String = 'shared')
{ {
var offset:Array<String> = CoolUtil.coolTextFile(Paths.txt('images/characters/' + character + "Offsets", 'shared')); var offset:Array<String> = CoolUtil.coolTextFile(Paths.txt('images/characters/' + character + "Offsets", library));
for (i in 0...offset.length) for (i in 0...offset.length)
{ {

View File

@ -243,6 +243,8 @@ class ChartingState extends MusicBeatState
var data = TimingStruct.AllTimings[currentIndex - 1]; var data = TimingStruct.AllTimings[currentIndex - 1];
data.endBeat = beat; data.endBeat = beat;
data.length = (data.endBeat - data.startBeat) / (data.bpm / 60); data.length = (data.endBeat - data.startBeat) / (data.bpm / 60);
var step = ((60 / data.bpm) * 1000) / 4;
TimingStruct.AllTimings[currentIndex].startStep = Math.floor(((data.endBeat / (data.bpm / 60)) * 1000) / step);
TimingStruct.AllTimings[currentIndex].startTime = data.startTime + data.length; TimingStruct.AllTimings[currentIndex].startTime = data.startTime + data.length;
} }
@ -418,6 +420,8 @@ class ChartingState extends MusicBeatState
var data = TimingStruct.AllTimings[currentIndex - 1]; var data = TimingStruct.AllTimings[currentIndex - 1];
data.endBeat = beat; data.endBeat = beat;
data.length = (data.endBeat - data.startBeat) / (data.bpm / 60); data.length = (data.endBeat - data.startBeat) / (data.bpm / 60);
var step = ((60 / data.bpm) * 1000) / 4;
TimingStruct.AllTimings[currentIndex].startStep = Math.floor(((data.endBeat / (data.bpm / 60)) * 1000) / step);
TimingStruct.AllTimings[currentIndex].startTime = data.startTime + data.length; TimingStruct.AllTimings[currentIndex].startTime = data.startTime + data.length;
} }
@ -611,6 +615,8 @@ class ChartingState extends MusicBeatState
var data = TimingStruct.AllTimings[currentIndex - 1]; var data = TimingStruct.AllTimings[currentIndex - 1];
data.endBeat = beat; data.endBeat = beat;
data.length = (data.endBeat - data.startBeat) / (data.bpm / 60); data.length = (data.endBeat - data.startBeat) / (data.bpm / 60);
var step = ((60 / data.bpm) * 1000) / 4;
TimingStruct.AllTimings[currentIndex].startStep = Math.floor(((data.endBeat / (data.bpm / 60)) * 1000) / step);
TimingStruct.AllTimings[currentIndex].startTime = data.startTime + data.length; TimingStruct.AllTimings[currentIndex].startTime = data.startTime + data.length;
} }
@ -639,7 +645,7 @@ class ChartingState extends MusicBeatState
var eventPos = new FlxUIInputText(150,100,80,""); var eventPos = new FlxUIInputText(150,100,80,"");
var eventAdd = new FlxButton(95,155,"Add Event", function() { var eventAdd = new FlxButton(95,155,"Add Event", function() {
var pog:Song.Event = new Song.Event("New Event " + HelperFunctions.truncateFloat(curDecimalBeat, 3),HelperFunctions.truncateFloat(curDecimalBeat, 3),_song.bpm + "","BPM Change"); var pog:Song.Event = new Song.Event("New Event " + HelperFunctions.truncateFloat(curDecimalBeat, 3),HelperFunctions.truncateFloat(curDecimalBeat, 3),_song.bpm,"BPM Change");
trace("adding " + pog.name); trace("adding " + pog.name);
@ -654,13 +660,13 @@ class ChartingState extends MusicBeatState
eventName.text = pog.name; eventName.text = pog.name;
eventType.selectedLabel = pog.type; eventType.selectedLabel = pog.type;
eventValue.text = pog.value; eventValue.text = pog.value + "";
eventPos.text = pog.position + ""; eventPos.text = pog.position + "";
currentSelectedEventName = pog.name; currentSelectedEventName = pog.name;
currentEventPosition = pog.position; currentEventPosition = pog.position;
savedType = pog.type; savedType = pog.type;
savedValue = pog.value; savedValue = pog.value + "";
var listofnames = []; var listofnames = [];
@ -696,6 +702,8 @@ class ChartingState extends MusicBeatState
var data = TimingStruct.AllTimings[currentIndex - 1]; var data = TimingStruct.AllTimings[currentIndex - 1];
data.endBeat = beat; data.endBeat = beat;
data.length = (data.endBeat - data.startBeat) / (data.bpm / 60); data.length = (data.endBeat - data.startBeat) / (data.bpm / 60);
var step = ((60 / data.bpm) * 1000) / 4;
TimingStruct.AllTimings[currentIndex].startStep = Math.floor(((data.endBeat / (data.bpm / 60)) * 1000) / step);
TimingStruct.AllTimings[currentIndex].startTime = data.startTime + data.length; TimingStruct.AllTimings[currentIndex].startTime = data.startTime + data.length;
} }
@ -738,13 +746,13 @@ class ChartingState extends MusicBeatState
eventName.text = firstEvent.name; eventName.text = firstEvent.name;
eventType.selectedLabel = firstEvent.type; eventType.selectedLabel = firstEvent.type;
eventValue.text = firstEvent.value; eventValue.text = firstEvent.value + "";
eventPos.text = firstEvent.position + ""; eventPos.text = firstEvent.position + "";
currentSelectedEventName = firstEvent.name; currentSelectedEventName = firstEvent.name;
currentEventPosition = firstEvent.position; currentEventPosition = firstEvent.position;
savedType = firstEvent.type; savedType = firstEvent.type;
savedValue = firstEvent.value; savedValue = firstEvent.value + '';
var listofnames = []; var listofnames = [];
@ -780,6 +788,8 @@ class ChartingState extends MusicBeatState
var data = TimingStruct.AllTimings[currentIndex - 1]; var data = TimingStruct.AllTimings[currentIndex - 1];
data.endBeat = beat; data.endBeat = beat;
data.length = (data.endBeat - data.startBeat) / (data.bpm / 60); data.length = (data.endBeat - data.startBeat) / (data.bpm / 60);
var step = ((60 / data.bpm) * 1000) / 4;
TimingStruct.AllTimings[currentIndex].startStep = Math.floor(((data.endBeat / (data.bpm / 60)) * 1000) / step);
TimingStruct.AllTimings[currentIndex].startTime = data.startTime + data.length; TimingStruct.AllTimings[currentIndex].startTime = data.startTime + data.length;
} }
@ -839,7 +849,7 @@ class ChartingState extends MusicBeatState
trace("bruh"); trace("bruh");
eventType.selectedLabel = firstEventObject.type; eventType.selectedLabel = firstEventObject.type;
trace("bruh"); trace("bruh");
eventValue.text = firstEventObject.value; eventValue.text = firstEventObject.value + "";
trace("bruh"); trace("bruh");
currentSelectedEventName = firstEventObject.name; currentSelectedEventName = firstEventObject.name;
trace("bruh"); trace("bruh");
@ -859,7 +869,7 @@ class ChartingState extends MusicBeatState
trace('selecting ' + name + ' found: ' + event); trace('selecting ' + name + ' found: ' + event);
eventName.text = event.name; eventName.text = event.name;
eventValue.text = event.value; eventValue.text = event.value + "";
eventPos.text = event.position + ""; eventPos.text = event.position + "";
eventType.selectedLabel = event.type; eventType.selectedLabel = event.type;
currentSelectedEventName = event.name; currentSelectedEventName = event.name;
@ -1162,14 +1172,6 @@ class ChartingState extends MusicBeatState
}); });
var clearSectionButton:FlxButton = new FlxButton(10, 150, "Clear Section", clearSection); var clearSectionButton:FlxButton = new FlxButton(10, 150, "Clear Section", clearSection);
var startSection:FlxButton = new FlxButton(10, 85, "Play Here", function() {
PlayState.SONG = _song;
FlxG.sound.music.stop();
if (!PlayState.isSM)
vocals.stop();
PlayState.startTime = lastUpdatedSection.startTime;
LoadingState.loadAndSwitchState(new PlayState());
});
var swapSection:FlxButton = new FlxButton(10, 170, "Swap Section", function() var swapSection:FlxButton = new FlxButton(10, 170, "Swap Section", function()
{ {
@ -1242,7 +1244,6 @@ class ChartingState extends MusicBeatState
tab_group_section.add(copyButton); tab_group_section.add(copyButton);
tab_group_section.add(clearSectionButton); tab_group_section.add(clearSectionButton);
tab_group_section.add(swapSection); tab_group_section.add(swapSection);
tab_group_section.add(startSection);
UI_box.addGroup(tab_group_section); UI_box.addGroup(tab_group_section);
} }
@ -1491,6 +1492,36 @@ class ChartingState extends MusicBeatState
{ {
updateHeads(); updateHeads();
for(i in sectionRenderes)
{
var diff = i.y - strumLine.y;
if (diff < 4000 && diff >= -4000)
{
i.active = true;
i.visible = true;
}
else
{
i.active = false;
i.visible = false;
}
}
for(i in curRenderedNotes)
{
var diff = i.y - strumLine.y;
if (diff < 4000 && diff >= -4000)
{
i.active = true;
i.visible = true;
}
else
{
i.active = false;
i.visible = false;
}
}
var doInput = true; var doInput = true;
for (i in Typeables) for (i in Typeables)
@ -1599,6 +1630,8 @@ class ChartingState extends MusicBeatState
var data = TimingStruct.AllTimings[currentIndex - 1]; var data = TimingStruct.AllTimings[currentIndex - 1];
data.endBeat = beat; data.endBeat = beat;
data.length = (data.endBeat - data.startBeat) / (data.bpm / 60); data.length = (data.endBeat - data.startBeat) / (data.bpm / 60);
var step = ((60 / data.bpm) * 1000) / 4;
TimingStruct.AllTimings[currentIndex].startStep = Math.floor(((data.endBeat / (data.bpm / 60)) * 1000) / step);
TimingStruct.AllTimings[currentIndex].startTime = data.startTime + data.length; TimingStruct.AllTimings[currentIndex].startTime = data.startTime + data.length;
} }
@ -1692,6 +1725,8 @@ class ChartingState extends MusicBeatState
+ currentBPM + currentBPM
+ "\nCurBeat: " + "\nCurBeat: "
+ HelperFunctions.truncateFloat(curDecimalBeat,3) + HelperFunctions.truncateFloat(curDecimalBeat,3)
+ "\nCurStep: "
+ curStep
+ "\nZoom: " + "\nZoom: "
+ zoomFactor; + zoomFactor;

View File

@ -23,7 +23,6 @@ class DiffCalc
public static function CalculateDiff(song:SwagSong, ?accuracy:Float = .93) public static function CalculateDiff(song:SwagSong, ?accuracy:Float = .93)
{ {
trace('calcuilafjwaf');
// cleaned notes // cleaned notes
var cleanedNotes:Array<SmallNote> = []; var cleanedNotes:Array<SmallNote> = [];
@ -38,14 +37,16 @@ class DiffCalc
{ {
for (ii in i.sectionNotes) // notes for (ii in i.sectionNotes) // notes
{ {
if (ii[1] > 3 && !i.mustHitSection) var gottaHitNote:Bool = i.mustHitSection;
if (ii[1] >= 3 && gottaHitNote)
cleanedNotes.push(new SmallNote(ii[0],Math.floor(Math.abs(ii[1])))); cleanedNotes.push(new SmallNote(ii[0],Math.floor(Math.abs(ii[1]))));
else if (ii[1] < 4 && i.mustHitSection) if (ii[1] <= 4 && !gottaHitNote)
cleanedNotes.push(new SmallNote(ii[0],Math.floor(Math.abs(ii[1])))); cleanedNotes.push(new SmallNote(ii[0],Math.floor(Math.abs(ii[1]))));
} }
} }
trace(cleanedNotes.length + " - playable notes"); trace('calcuilafjwaf ' + cleanedNotes.length);
var handOne:Array<SmallNote> = []; var handOne:Array<SmallNote> = [];
var handTwo:Array<SmallNote> = []; var handTwo:Array<SmallNote> = [];

View File

@ -1,4 +1,5 @@
package; package;
import lime.app.Application;
import openfl.utils.Future; import openfl.utils.Future;
import openfl.media.Sound; import openfl.media.Sound;
import flixel.system.FlxSound; import flixel.system.FlxSound;
@ -77,7 +78,6 @@ class FreeplayState extends MusicBeatState
{ {
var data:Array<String> = initSonglist[i].split(':'); var data:Array<String> = initSonglist[i].split(':');
var meta = new SongMetadata(data[0], Std.parseInt(data[2]), data[1]); var meta = new SongMetadata(data[0], Std.parseInt(data[2]), data[1]);
songs.push(meta);
var format = StringTools.replace(meta.songName, " ", "-"); var format = StringTools.replace(meta.songName, " ", "-");
switch (format) { switch (format) {
case 'Dad-Battle': format = 'Dadbattle'; case 'Dad-Battle': format = 'Dadbattle';
@ -85,11 +85,40 @@ class FreeplayState extends MusicBeatState
} }
var diffs = []; var diffs = [];
var diffsThatExist = [];
#if sys
if (FileSystem.exists('assets/data/${format}/${format}-hard.json'))
diffsThatExist.push("Hard");
if (FileSystem.exists('assets/data/${format}/${format}-easy.json'))
diffsThatExist.push("Easy");
if (FileSystem.exists('assets/data/${format}/${format}.json'))
diffsThatExist.push("Normal");
if (diffsThatExist.length == 0)
{
Application.current.window.alert("No difficulties found for chart, skipping.",meta.songName + " Chart");
continue;
}
#else
diffsThatExist = ["Easy","Normal","Hard"];
#end
if (diffsThatExist.contains("Easy"))
FreeplayState.loadDiff(0,format,meta.songName,diffs); FreeplayState.loadDiff(0,format,meta.songName,diffs);
if (diffsThatExist.contains("Normal"))
FreeplayState.loadDiff(1,format,meta.songName,diffs); FreeplayState.loadDiff(1,format,meta.songName,diffs);
if (diffsThatExist.contains("Hard"))
FreeplayState.loadDiff(2,format,meta.songName,diffs); FreeplayState.loadDiff(2,format,meta.songName,diffs);
meta.diffs = diffsThatExist;
if (diffsThatExist.length != 3)
trace("I ONLY FOUND " + diffsThatExist);
FreeplayState.songData.set(meta.songName,diffs); FreeplayState.songData.set(meta.songName,diffs);
trace('loaded diffs for ' + meta.songName); trace('loaded diffs for ' + meta.songName);
songs.push(meta);
} }
@ -376,6 +405,9 @@ class FreeplayState extends MusicBeatState
function changeDiff(change:Int = 0) function changeDiff(change:Int = 0)
{ {
if (!songs[curSelected].diffs.contains(CoolUtil.difficultyFromInt(curDifficulty + change)))
return;
curDifficulty += change; curDifficulty += change;
if (curDifficulty < 0) if (curDifficulty < 0)
@ -417,6 +449,19 @@ class FreeplayState extends MusicBeatState
if (curSelected >= songs.length) if (curSelected >= songs.length)
curSelected = 0; curSelected = 0;
if (songs[curSelected].diffs.length != 3)
{
switch(songs[curSelected].diffs[0])
{
case "Easy":
curDifficulty = 0;
case "Normal":
curDifficulty = 1;
case "Hard":
curDifficulty = 2;
}
}
// selector.y = (70 * curSelected) + 30; // selector.y = (70 * curSelected) + 30;
// adjusting the highscore song name to be compatible (changeSelection) // adjusting the highscore song name to be compatible (changeSelection)
@ -501,6 +546,8 @@ class SongMetadata
#end #end
public var songCharacter:String = ""; public var songCharacter:String = "";
public var diffs = [];
#if sys #if sys
public function new(song:String, week:Int, songCharacter:String, ?sm:SMFile = null, ?path:String = "") public function new(song:String, week:Int, songCharacter:String, ?sm:SMFile = null, ?path:String = "")
{ {

View File

@ -3,59 +3,58 @@ package;
import flixel.FlxG; import flixel.FlxG;
import flixel.FlxSprite; import flixel.FlxSprite;
using StringTools;
class HealthIcon extends FlxSprite class HealthIcon extends FlxSprite
{ {
public var char:String = 'bf';
public var isPlayer:Bool = false;
public var isOldIcon:Bool = false;
/** /**
* Used for FreeplayState! If you use it elsewhere, prob gonna annoying * Used for FreeplayState! If you use it elsewhere, prob gonna annoying
*/ */
public var sprTracker:FlxSprite; public var sprTracker:FlxSprite;
public function new(char:String = 'bf', isPlayer:Bool = false) public function new(?char:String = "bf", ?isPlayer:Bool = false)
{ {
super(); super();
if(FlxG.save.data.antialiasing) this.char = char;
{ this.isPlayer = isPlayer;
antialiasing = true;
}
if (char == 'sm')
{
loadGraphic(Paths.image("stepmania-icon"));
return;
}
loadGraphic(Paths.image('iconGrid'), true, 150, 150);
animation.add('bf', [0, 1], 0, false, isPlayer);
animation.add('bf-car', [0, 1], 0, false, isPlayer);
animation.add('bf-christmas', [0, 1], 0, false, isPlayer);
animation.add('bf-pixel', [21, 21], 0, false, isPlayer);
animation.add('spooky', [2, 3], 0, false, isPlayer);
animation.add('pico', [4, 5], 0, false, isPlayer);
animation.add('mom', [6, 7], 0, false, isPlayer);
animation.add('mom-car', [6, 7], 0, false, isPlayer);
animation.add('tankman', [8, 9], 0, false, isPlayer);
animation.add('face', [10, 11], 0, false, isPlayer);
animation.add('dad', [12, 13], 0, false, isPlayer);
animation.add('senpai', [22, 22], 0, false, isPlayer);
animation.add('senpai-angry', [22, 22], 0, false, isPlayer);
animation.add('spirit', [23, 23], 0, false, isPlayer);
animation.add('bf-old', [14, 15], 0, false, isPlayer);
animation.add('gf', [16], 0, false, isPlayer);
animation.add('gf-christmas', [16], 0, false, isPlayer);
animation.add('gf-pixel', [16], 0, false, isPlayer);
animation.add('parents-christmas', [17, 18], 0, false, isPlayer);
animation.add('monster', [19, 20], 0, false, isPlayer);
animation.add('monster-christmas', [19, 20], 0, false, isPlayer);
animation.play(char);
isPlayer = isOldIcon = false;
if (FlxG.save.data.antialiasing)
{
switch(char) switch(char)
{ {
case 'bf-pixel' | 'senpai' | 'senpai-angry' | 'spirit' | 'gf-pixel': case 'bf-pixel' | 'senpai' | 'senpai-angry' | 'spirit' | 'gf-pixel':
antialiasing = false; antialiasing = false;
default:
antialiasing = true;
}
} }
changeIcon(char);
scrollFactor.set(); scrollFactor.set();
} }
public function swapOldIcon()
{
(isOldIcon = !isOldIcon) ? changeIcon("bf-old") : changeIcon(char);
}
public function changeIcon(char:String)
{
if (char != 'bf-pixel' && char != 'bf-old')
char = char.split("-")[0];
loadGraphic(Paths.image('icons/icon-' + char), true, 150, 150);
animation.add(char, [0, 1], 0, false, isPlayer);
animation.play(char);
}
override function update(elapsed:Float) override function update(elapsed:Float)
{ {
super.update(elapsed); super.update(elapsed);

View File

@ -109,6 +109,9 @@ class KadeEngineData
if (FlxG.save.data.cacheImages == null) if (FlxG.save.data.cacheImages == null)
FlxG.save.data.cacheImages = false; FlxG.save.data.cacheImages = false;
if (FlxG.save.data.editor == null)
FlxG.save.data.editor = true;
var gamepad:FlxGamepad = FlxG.gamepads.lastActive; var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
KeyBinds.gamepad = gamepad != null; KeyBinds.gamepad = gamepad != null;

View File

@ -44,7 +44,7 @@ class LoadReplayState extends MusicBeatState
#end #end
trace(controlsStrings); trace(controlsStrings);
controlsStrings.sort(Reflect.compare); controlsStrings.sort(sortByDate);
addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 1, ['dad']); addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 1, ['dad']);
addWeek(['Spookeez', 'South', 'Monster'], 2, ['spooky']); addWeek(['Spookeez', 'South', 'Monster'], 2, ['spooky']);
@ -106,6 +106,13 @@ class LoadReplayState extends MusicBeatState
super.create(); super.create();
} }
function sortByDate(a:String, b:String) {
var aTime = Std.parseFloat(a.split("time")[1])/1000;
var bTime = Std.parseFloat(b.split("time")[1])/1000;
return Std.int(bTime - aTime); // Newest first
}
public function getWeekNumbFromSong(songName:String):Int public function getWeekNumbFromSong(songName:String):Int
{ {
var week:Int = 0; var week:Int = 0;

View File

@ -78,6 +78,10 @@ class Main extends Sprite
gameHeight = Math.ceil(stageHeight / zoom); gameHeight = Math.ceil(stageHeight / zoom);
} }
#if !cpp
framerate = 60;
#end
#if cpp #if cpp
initialState = Caching; initialState = Caching;
game = new FlxGame(gameWidth, gameHeight, initialState, zoom, framerate, framerate, skipSplash, startFullscreen); game = new FlxGame(gameWidth, gameHeight, initialState, zoom, framerate, framerate, skipSplash, startFullscreen);

View File

@ -40,7 +40,7 @@ class MainMenuState extends MusicBeatState
public static var nightly:String = ""; public static var nightly:String = "";
public static var kadeEngineVer:String = "1.6" + nightly; public static var kadeEngineVer:String = "1.6.1" + nightly;
public static var gameVer:String = "0.2.7.1"; public static var gameVer:String = "0.2.7.1";
var magenta:FlxSprite; var magenta:FlxSprite;

74
source/ModchartShader.hx Normal file
View File

@ -0,0 +1,74 @@
import flixel.system.FlxAssets.FlxShader;
class ModchartShader extends FlxShader
{
public var vertexHeader = "attribute float openfl_Alpha;
attribute vec4 openfl_ColorMultiplier;
attribute vec4 openfl_ColorOffset;
attribute vec4 openfl_Position;
attribute vec2 openfl_TextureCoord;
varying float openfl_Alphav;
varying vec4 openfl_ColorMultiplierv;
varying vec4 openfl_ColorOffsetv;
varying vec2 openfl_TextureCoordv;
uniform mat4 openfl_Matrix;
uniform bool openfl_HasColorTransform;
uniform vec2 openfl_TextureSize;";
public var vertexBody = "openfl_Alphav = openfl_Alpha;
openfl_TextureCoordv = openfl_TextureCoord;
if (openfl_HasColorTransform) {
openfl_ColorMultiplierv = openfl_ColorMultiplier;
openfl_ColorOffsetv = openfl_ColorOffset / 255.0;
}
gl_Position = openfl_Matrix * openfl_Position;";
public var vertexSource = "#pragma header
void main(void) {
#pragma body
}";
public var fragmentHeader = "varying float openfl_Alphav;
varying vec4 openfl_ColorMultiplierv;
varying vec4 openfl_ColorOffsetv;
varying vec2 openfl_TextureCoordv;
uniform bool openfl_HasColorTransform;
uniform sampler2D openfl_Texture;
uniform vec2 openfl_TextureSize;";
public var fragmentBody = "vec4 color = texture2D (openfl_Texture, openfl_TextureCoordv);
if (color.a == 0.0) {
gl_FragColor = vec4 (0.0, 0.0, 0.0, 0.0);
} else if (openfl_HasColorTransform) {
color = vec4 (color.rgb / color.a, color.a);
mat4 colorMultiplier = mat4 (0);
colorMultiplier[0][0] = openfl_ColorMultiplierv.x;
colorMultiplier[1][1] = openfl_ColorMultiplierv.y;
colorMultiplier[2][2] = openfl_ColorMultiplierv.z;
colorMultiplier[3][3] = 1.0; // openfl_ColorMultiplierv.w;
color = clamp (openfl_ColorOffsetv + (color * colorMultiplier), 0.0, 1.0);
if (color.a > 0.0) {
gl_FragColor = vec4 (color.rgb * color.a * openfl_Alphav, color.a * openfl_Alphav);
} else {
gl_FragColor = vec4 (0.0, 0.0, 0.0, 0.0);
}
} else {
gl_FragColor = color * openfl_Alphav;
}";
public function new(frag:String,?vert:String = "")
{
if (vert != "")
glVertexSource = vert;
glFragmentSource = frag;
if (glVertexSource != null)
{
glVertexSource = StringTools.replace(glVertexSource, "#pragma header", vertexHeader);
glVertexSource = StringTools.replace(glVertexSource, "#pragma body", vertexBody);
}
if (glVertexSource != null)
{
glFragmentSource = StringTools.replace(glFragmentSource, "#pragma header", fragmentHeader);
glFragmentSource = StringTools.replace(glFragmentSource, "#pragma body", fragmentBody);
}
super();
}
}

View File

@ -241,7 +241,7 @@ class ModchartState
PlayState.instance.removeObject(PlayState.dad); PlayState.instance.removeObject(PlayState.dad);
PlayState.dad = new Character(olddadx, olddady, id); PlayState.dad = new Character(olddadx, olddady, id);
PlayState.instance.addObject(PlayState.dad); PlayState.instance.addObject(PlayState.dad);
PlayState.instance.iconP2.animation.play(id); PlayState.instance.iconP2.changeIcon(id);
} }
function changeBoyfriendCharacter(id:String) function changeBoyfriendCharacter(id:String)
@ -250,7 +250,7 @@ class ModchartState
PlayState.instance.removeObject(PlayState.boyfriend); PlayState.instance.removeObject(PlayState.boyfriend);
PlayState.boyfriend = new Boyfriend(oldboyfriendx, oldboyfriendy, id); PlayState.boyfriend = new Boyfriend(oldboyfriendx, oldboyfriendy, id);
PlayState.instance.addObject(PlayState.boyfriend); PlayState.instance.addObject(PlayState.boyfriend);
PlayState.instance.iconP1.animation.play(id); PlayState.instance.iconP1.changeIcon(id);
} }
function makeAnimatedLuaSprite(spritePath:String,names:Array<String>,prefixes:Array<String>,startAnim:String, id:String) function makeAnimatedLuaSprite(spritePath:String,names:Array<String>,prefixes:Array<String>,startAnim:String, id:String)
@ -297,7 +297,12 @@ class ModchartState
case 'philly-nice': songLowercase = 'philly'; case 'philly-nice': songLowercase = 'philly';
} }
var data:BitmapData = BitmapData.fromFile(Sys.getCwd() + "assets/data/" + songLowercase + '/' + spritePath + ".png"); var path = Sys.getCwd() + "assets/data/" + songLowercase + '/';
if (PlayState.isSM)
path = PlayState.pathToSm + "/";
var data:BitmapData = BitmapData.fromFile(path + spritePath + ".png");
var sprite:FlxSprite = new FlxSprite(0,0); var sprite:FlxSprite = new FlxSprite(0,0);
var imgWidth:Float = FlxG.width / data.width; var imgWidth:Float = FlxG.width / data.width;
@ -347,6 +352,8 @@ class ModchartState
lua = null; lua = null;
} }
public var luaWiggles:Map<String,WiggleEffect> = new Map<String,WiggleEffect>();
// LUA SHIT // LUA SHIT
function new() function new()
@ -367,7 +374,11 @@ class ModchartState
case 'philly-nice': songLowercase = 'philly'; case 'philly-nice': songLowercase = 'philly';
} }
var result = LuaL.dofile(lua, Paths.lua(songLowercase + "/modchart")); // execute le file var path = Paths.lua(songLowercase + "/modchart");
if (PlayState.isSM)
path = PlayState.pathToSm + "/modchart.lua";
var result = LuaL.dofile(lua, path); // execute le file
if (result != 0) if (result != 0)
{ {
@ -427,6 +438,41 @@ class ModchartState
Lua_helper.add_callback(lua,"getProperty", getPropertyByName); Lua_helper.add_callback(lua,"getProperty", getPropertyByName);
Lua_helper.add_callback(lua,"setNoteWiggle", function(wiggleId) {
PlayState.instance.camNotes.setFilters([new ShaderFilter(luaWiggles.get(wiggleId).shader)]);
});
Lua_helper.add_callback(lua,"setSustainWiggle", function(wiggleId) {
PlayState.instance.camSustains.setFilters([new ShaderFilter(luaWiggles.get(wiggleId).shader)]);
});
Lua_helper.add_callback(lua,"createWiggle", function(freq:Float,amplitude:Float,speed:Float) {
var wiggle = new WiggleEffect();
wiggle.waveAmplitude = amplitude;
wiggle.waveSpeed = speed;
wiggle.waveFrequency = freq;
var id = Lambda.count(luaWiggles) + 1 + "";
luaWiggles.set(id,wiggle);
return id;
});
Lua_helper.add_callback(lua,"setWiggleTime", function(wiggleId:String,time:Float) {
var wiggle = luaWiggles.get(wiggleId);
wiggle.shader.uTime.value = [time];
});
Lua_helper.add_callback(lua,"setWiggleAmplitude", function(wiggleId:String,amp:Float) {
var wiggle = luaWiggles.get(wiggleId);
wiggle.waveAmplitude = amp;
});
// Lua_helper.add_callback(lua,"makeAnimatedSprite", makeAnimatedLuaSprite); // Lua_helper.add_callback(lua,"makeAnimatedSprite", makeAnimatedLuaSprite);
// this one is still in development // this one is still in development

View File

@ -49,7 +49,7 @@ class MusicBeatState extends FlxUIState
override function update(elapsed:Float) override function update(elapsed:Float)
{ {
//everyStep(); //everyStep();
var nextStep:Int = updateCurStep(); /*var nextStep:Int = updateCurStep();
if (nextStep >= 0) if (nextStep >= 0)
{ {
@ -69,7 +69,7 @@ class MusicBeatState extends FlxUIState
updateBeat(); updateBeat();
stepHit(); stepHit();
} }
} }*/
if (Conductor.songPosition < 0) if (Conductor.songPosition < 0)
curDecimalBeat = 0; curDecimalBeat = 0;
@ -83,17 +83,62 @@ class MusicBeatState extends FlxUIState
Conductor.crochet = ((60 / data.bpm) * 1000); Conductor.crochet = ((60 / data.bpm) * 1000);
var percent = (Conductor.songPosition - (data.startTime * 1000)) / (data.length * 1000); var step = ((60 / data.bpm) * 1000) / 4;
var startInMS = (data.startTime * 1000);
var percent = (Conductor.songPosition - startInMS) / (data.length * 1000);
curDecimalBeat = data.startBeat + (((Conductor.songPosition/1000) - data.startTime) * (data.bpm / 60)); curDecimalBeat = data.startBeat + (((Conductor.songPosition/1000) - data.startTime) * (data.bpm / 60));
var ste:Int = Math.floor(data.startStep + ((Conductor.songPosition - startInMS) / step));
if (ste >= 0)
{
if (ste > curStep)
{
for (i in curStep...ste)
{
curStep++;
updateBeat();
stepHit();
}
}
else if (ste < curStep)
{
//Song reset?
curStep = ste;
updateBeat();
stepHit();
}
}
} }
else else
{ {
curDecimalBeat = (Conductor.songPosition / 1000) * (Conductor.bpm/60); curDecimalBeat = (Conductor.songPosition / 1000) * (Conductor.bpm/60);
var nextStep:Int = Math.floor(Conductor.songPosition / Conductor.stepCrochet);
if (nextStep >= 0)
{
if (nextStep > curStep)
{
for (i in curStep...nextStep)
{
curStep++;
updateBeat();
stepHit();
}
}
else if (nextStep < curStep)
{
//Song reset?
curStep = nextStep;
updateBeat();
stepHit();
}
}
Conductor.crochet = ((60 / Conductor.bpm) * 1000); Conductor.crochet = ((60 / Conductor.bpm) * 1000);
} }
} }
if (FlxG.save.data.fpsRain && skippedFrames >= 6) if (FlxG.save.data.fpsRain && skippedFrames >= 6)
{ {
if (currentColor >= array.length) if (currentColor >= array.length)

View File

@ -142,6 +142,29 @@ class GraphicLoading extends Option
} }
class EditorRes extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.editor = !FlxG.save.data.editor;
display = updateDisplay();
return true;
}
private override function updateDisplay():String
{
return FlxG.save.data.editor ? "Show Editor Grid" : "Do not Show Editor Grid";
}
}
class DownscrollOption extends Option class DownscrollOption extends Option
{ {
public function new(desc:String) public function new(desc:String)
@ -801,6 +824,7 @@ class LockWeeksOption extends Option
} }
FlxG.save.data.weekUnlocked = 1; FlxG.save.data.weekUnlocked = 1;
StoryMenuState.weekUnlocked = [true, true]; StoryMenuState.weekUnlocked = [true, true];
confirm = false;
trace('Weeks Locked'); trace('Weeks Locked');
display = updateDisplay(); display = updateDisplay();
return true; return true;
@ -871,6 +895,8 @@ class ResetSettings extends Option
FlxG.save.data.weekUnlocked = null; FlxG.save.data.weekUnlocked = null;
FlxG.save.data.newInput = null; FlxG.save.data.newInput = null;
FlxG.save.data.downscroll = null; FlxG.save.data.downscroll = null;
FlxG.save.data.antialiasing = null;
FlxG.save.data.missSounds = null;
FlxG.save.data.dfjk = null; FlxG.save.data.dfjk = null;
FlxG.save.data.accuracyDisplay = null; FlxG.save.data.accuracyDisplay = null;
FlxG.save.data.offset = null; FlxG.save.data.offset = null;
@ -886,6 +912,7 @@ class ResetSettings extends Option
FlxG.save.data.watermark = null; FlxG.save.data.watermark = null;
FlxG.save.data.ghost = null; FlxG.save.data.ghost = null;
FlxG.save.data.distractions = null; FlxG.save.data.distractions = null;
FlxG.save.data.stepMania = null;
FlxG.save.data.flashing = null; FlxG.save.data.flashing = null;
FlxG.save.data.resetButton = null; FlxG.save.data.resetButton = null;
FlxG.save.data.botplay = null; FlxG.save.data.botplay = null;
@ -893,7 +920,12 @@ class ResetSettings extends Option
FlxG.save.data.strumline = null; FlxG.save.data.strumline = null;
FlxG.save.data.customStrumLine = null; FlxG.save.data.customStrumLine = null;
FlxG.save.data.camzoom = null; FlxG.save.data.camzoom = null;
FlxG.save.data.stepMania = null; FlxG.save.data.scoreScreen = null;
FlxG.save.data.inputShow = null;
FlxG.save.data.optimize = null;
FlxG.save.data.cacheImages = null;
FlxG.save.data.editor = null;
KadeEngineData.initSave(); KadeEngineData.initSave();
confirm = false; confirm = false;
trace('All settings have been reset'); trace('All settings have been reset');

View File

@ -40,6 +40,7 @@ class OptionsMenu extends MusicBeatState
new CustomizeGameplay("Drag and drop gameplay modules to your prefered positions!") new CustomizeGameplay("Drag and drop gameplay modules to your prefered positions!")
]), ]),
new OptionCategory("Appearance", [ new OptionCategory("Appearance", [
new EditorRes("Not showing the editor grid will greatly increase editor performance"),
new DistractionsAndEffectsOption("Toggle stage distractions that can hinder your gameplay."), new DistractionsAndEffectsOption("Toggle stage distractions that can hinder your gameplay."),
new CamZoomOption("Toggle the camera zoom in-game."), new CamZoomOption("Toggle the camera zoom in-game."),
new StepManiaOption("Sets the colors of the arrows depending on quantization instead of direction."), new StepManiaOption("Sets the colors of the arrows depending on quantization instead of direction."),
@ -125,6 +126,8 @@ class OptionsMenu extends MusicBeatState
FlxTween.tween(versionShit,{y: FlxG.height - 18},2,{ease: FlxEase.elasticInOut}); FlxTween.tween(versionShit,{y: FlxG.height - 18},2,{ease: FlxEase.elasticInOut});
FlxTween.tween(blackBorder,{y: FlxG.height - 18},2, {ease: FlxEase.elasticInOut}); FlxTween.tween(blackBorder,{y: FlxG.height - 18},2, {ease: FlxEase.elasticInOut});
changeSelection();
super.create(); super.create();
} }

View File

@ -164,7 +164,7 @@ class Paths
if (isCharacter) if (isCharacter)
if (usecahce) if (usecahce)
#if cpp #if cpp
return FlxAtlasFrames.fromSpriteSheetPacker(imageCached(key), file('images/$key.txt', library)); return FlxAtlasFrames.fromSpriteSheetPacker(imageCached(key), file('images/characters/$key.txt', library));
#else #else
return null; return null;
#end #end

View File

@ -205,7 +205,7 @@ class PauseSubState extends MusicBeatSubstate
} }
#end #end
if (controls.ACCEPT) if (controls.ACCEPT && !FlxG.keys.pressed.ALT)
{ {
var daSelected:String = menuItems[curSelected]; var daSelected:String = menuItems[curSelected];

View File

@ -1,5 +1,6 @@
package; package;
import Song.Event; import Song.Event;
import openfl.media.Sound; import openfl.media.Sound;
#if sys #if sys
@ -178,6 +179,8 @@ class PlayState extends MusicBeatState
public var iconP1:HealthIcon; // making these public again because i may be stupid public var iconP1:HealthIcon; // making these public again because i may be stupid
public var iconP2:HealthIcon; // what could go wrong? public var iconP2:HealthIcon; // what could go wrong?
public var camHUD:FlxCamera; public var camHUD:FlxCamera;
public var camSustains:FlxCamera;
public var camNotes:FlxCamera;
private var camGame:FlxCamera; private var camGame:FlxCamera;
public var cannotDie = false; public var cannotDie = false;
@ -323,6 +326,8 @@ class PlayState extends MusicBeatState
#if windows #if windows
executeModchart = FileSystem.exists(Paths.lua(songLowercase + "/modchart")); executeModchart = FileSystem.exists(Paths.lua(songLowercase + "/modchart"));
if (isSM)
executeModchart = FileSystem.exists(pathToSm + "/modchart.lua");
if (executeModchart) if (executeModchart)
PlayStateChangeables.Optimize = false; PlayStateChangeables.Optimize = false;
#end #end
@ -382,9 +387,15 @@ class PlayState extends MusicBeatState
camGame = new FlxCamera(); camGame = new FlxCamera();
camHUD = new FlxCamera(); camHUD = new FlxCamera();
camHUD.bgColor.alpha = 0; camHUD.bgColor.alpha = 0;
camSustains = new FlxCamera();
camSustains.bgColor.alpha = 0;
camNotes = new FlxCamera();
camNotes.bgColor.alpha = 0;
FlxG.cameras.reset(camGame); FlxG.cameras.reset(camGame);
FlxG.cameras.add(camHUD); FlxG.cameras.add(camHUD);
FlxG.cameras.add(camSustains);
FlxG.cameras.add(camNotes);
FlxCamera.defaultCameras = [camGame]; FlxCamera.defaultCameras = [camGame];
@ -2324,13 +2335,14 @@ class PlayState extends MusicBeatState
{ {
luaModchart.setVar('songPos', Conductor.songPosition); luaModchart.setVar('songPos', Conductor.songPosition);
luaModchart.setVar('hudZoom', camHUD.zoom); luaModchart.setVar('hudZoom', camHUD.zoom);
luaModchart.setVar('curBeat', HelperFunctions.truncateFloat(curDecimalBeat,3));
luaModchart.setVar('cameraZoom', FlxG.camera.zoom); luaModchart.setVar('cameraZoom', FlxG.camera.zoom);
luaModchart.executeState('update', [elapsed]); luaModchart.executeState('update', [elapsed]);
for (i in luaWiggles) for (key => value in luaModchart.luaWiggles)
{ {
trace('wiggle le gaming'); trace('wiggle le gaming');
i.update(elapsed); value.update(elapsed);
} }
/*for (i in 0...strumLineNotes.length) { /*for (i in 0...strumLineNotes.length) {
@ -2394,12 +2406,7 @@ class PlayState extends MusicBeatState
} }
if (FlxG.keys.justPressed.NINE) if (FlxG.keys.justPressed.NINE)
{ iconP1.swapOldIcon();
if (iconP1.animation.curAnim.name == 'bf-old')
iconP1.animation.play(SONG.player1);
else
iconP1.animation.play('bf-old');
}
switch (curStage) switch (curStage)
{ {
@ -2425,7 +2432,7 @@ class PlayState extends MusicBeatState
scoreTxt.x = (originalX - (lengthInPx / 2)) + 335; scoreTxt.x = (originalX - (lengthInPx / 2)) + 335;
if (controls.PAUSE && startedCountdown && canPause) if (controls.PAUSE && startedCountdown && canPause && !cannotDie)
{ {
persistentUpdate = false; persistentUpdate = false;
persistentDraw = true; persistentDraw = true;
@ -2909,6 +2916,10 @@ class PlayState extends MusicBeatState
{ {
var dunceNote:Note = unspawnNotes[0]; var dunceNote:Note = unspawnNotes[0];
notes.add(dunceNote); notes.add(dunceNote);
if (!dunceNote.isSustainNote)
dunceNote.cameras = [camNotes];
else
dunceNote.cameras = [camSustains];
var index:Int = unspawnNotes.indexOf(dunceNote); var index:Int = unspawnNotes.indexOf(dunceNote);
unspawnNotes.splice(index, 1); unspawnNotes.splice(index, 1);
@ -3726,25 +3737,22 @@ class PlayState extends MusicBeatState
var holdArray:Array<Bool> = [controls.LEFT, controls.DOWN, controls.UP, controls.RIGHT]; 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 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 releaseArray:Array<Bool> = [controls.LEFT_R, controls.DOWN_R, controls.UP_R, controls.RIGHT_R];
var keynameArray:Array<String> = ['left', 'down', 'up', 'right'];
#if windows #if windows
if (luaModchart != null) if (luaModchart != null)
{ {
if (controls.LEFT_P) for (i in 0...pressArray.length) {
{ if (pressArray[i] == true) {
luaModchart.executeState('keyPressed', ["left"]); luaModchart.executeState('keyPressed', [keynameArray[i]]);
}
}; };
if (controls.DOWN_P)
{ for (i in 0...releaseArray.length) {
luaModchart.executeState('keyPressed', ["down"]); if (releaseArray[i] == true) {
}; luaModchart.executeState('keyReleased', [keynameArray[i]]);
if (controls.UP_P) }
{
luaModchart.executeState('keyPressed', ["up"]);
};
if (controls.RIGHT_P)
{
luaModchart.executeState('keyPressed', ["right"]);
}; };
}; };
#end #end
@ -3914,9 +3922,9 @@ class PlayState extends MusicBeatState
playerStrums.forEach(function(spr:FlxSprite) playerStrums.forEach(function(spr:FlxSprite)
{ {
if (keys[spr.ID] && spr.animation.curAnim.name != 'confirm') if (keys[spr.ID] && spr.animation.curAnim.name != 'confirm')
spr.animation.play('pressed'); spr.animation.play('pressed', false);
if (!keys[spr.ID]) if (!keys[spr.ID])
spr.animation.play('static'); spr.animation.play('static', false);
if (spr.animation.curAnim.name == 'confirm' && !curStage.startsWith('school')) if (spr.animation.curAnim.name == 'confirm' && !curStage.startsWith('school'))
{ {
@ -3991,7 +3999,7 @@ class PlayState extends MusicBeatState
FlxG.stage.window.onFocusIn.add(focusIn); FlxG.stage.window.onFocusIn.add(focusIn);
var ourSource:String = "assets/videos/daWeirdVid/dontDelete.webm"; var ourSource:String = "assets/videos/daWeirdVid/dontDelete.webm";
WebmPlayer.SKIP_STEP_LIMIT = 90; //WebmPlayer.SKIP_STEP_LIMIT = 90;
var str1:String = "WEBM SHIT"; var str1:String = "WEBM SHIT";
webmHandler = new WebmHandler(); webmHandler = new WebmHandler();
webmHandler.source(ourSource); webmHandler.source(ourSource);
@ -4447,17 +4455,21 @@ class PlayState extends MusicBeatState
#if windows #if windows
if (executeModchart && luaModchart != null) if (executeModchart && luaModchart != null)
{ {
luaModchart.setVar('curBeat', curBeat);
luaModchart.executeState('beatHit', [curBeat]); luaModchart.executeState('beatHit', [curBeat]);
} }
#end #end
if (curSong == 'Tutorial' && dad.curCharacter == 'gf') if (curSong == 'Tutorial' && dad.curCharacter == 'gf')
{ {
if (curBeat % 2 == 1 && dad.animOffsets.exists('danceLeft')) if (SONG.notes[Math.floor(curStep / 16)].mustHitSection)
dad.playAnim('danceLeft'); dad.dance();
if (curBeat % 2 == 0 && dad.animOffsets.exists('danceRight')) else
dad.playAnim('danceRight'); {
if (curBeat == 73 || curBeat % 4 == 0 || curBeat % 4 == 1)
dad.playAnim('danceLeft', true);
else
dad.playAnim('danceRight', true);
}
} }
if (SONG.notes[Math.floor(curStep / 16)] != null) if (SONG.notes[Math.floor(curStep / 16)] != null)
@ -4467,7 +4479,7 @@ class PlayState extends MusicBeatState
// Dad doesnt interupt his own notes // Dad doesnt interupt his own notes
if ((SONG.notes[Math.floor(curStep / 16)].mustHitSection || !dad.animation.curAnim.name.startsWith("sing")) && dad.curCharacter != 'gf') if ((SONG.notes[Math.floor(curStep / 16)].mustHitSection || !dad.animation.curAnim.name.startsWith("sing")) && dad.curCharacter != 'gf')
if (curBeat % idleBeat == 0 || dad.curCharacter == "spooky") if ((curBeat % idleBeat == 0 || !idleToBeat) || dad.curCharacter == "spooky")
dad.dance(idleToBeat); dad.dance(idleToBeat);
} }
// FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM); // FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM);
@ -4500,7 +4512,7 @@ class PlayState extends MusicBeatState
gf.dance(); gf.dance();
} }
if (!boyfriend.animation.curAnim.name.startsWith("sing") && curBeat % idleBeat == 0) if (!boyfriend.animation.curAnim.name.startsWith("sing") && (curBeat % idleBeat == 0 || !idleToBeat))
{ {
boyfriend.playAnim('idle', idleToBeat); boyfriend.playAnim('idle', idleToBeat);
} }

View File

@ -15,12 +15,13 @@ class SectionRender extends FlxSprite
{ {
super(x,y); super(x,y);
makeGraphic(GRID_SIZE * 8, GRID_SIZE * Height,FlxColor.BLACK); makeGraphic(GRID_SIZE * 8, GRID_SIZE * Height,0xffe7e6e6);
var h = GRID_SIZE; var h = GRID_SIZE;
if (Math.floor(h) != h) if (Math.floor(h) != h)
h = GRID_SIZE; h = GRID_SIZE;
if (FlxG.save.data.editor)
FlxGridOverlay.overlay(this,GRID_SIZE, Std.int(h), GRID_SIZE * 8,GRID_SIZE * Height); FlxGridOverlay.overlay(this,GRID_SIZE, Std.int(h), GRID_SIZE * 8,GRID_SIZE * Height);
} }

41
source/ShaderShader.hx Normal file
View File

@ -0,0 +1,41 @@
import flixel.system.FlxAssets;
class ShaderShader extends FlxShader
{
@:glFragmentSource('
#pragma header
uniform float fade;
varying vec4 color;
varying vec2 textureCoord;
varying vec2 textureSize;
uniform sampler2D sampler0;
float luma(vec3 color) {
return dot(color, vec3(0.299, 0.587, 0.114));
}
vec3 rgb(float r, float g, float b) {
return vec3(r/255.0,g/255.0,b/255.0);
}
void main()
{
vec2 uv = textureCoord;
vec3 col = texture2D( sampler0, uv ).rgb;
float bright=floor(luma(col+0.4)*4.0)/4.0;
vec3 newcol;
if (bright<0.3) newcol = rgb(54.0,87.0,53.0);
else if (bright<0.6) newcol = rgb(128.0,128.0,0.0);
else newcol = rgb(157.0,187.0,97.0);
gl_FragColor = vec4( newcol*(fade)+col*(1.0-fade), 1.0 ) * color;
}
')
public function new()
{
super();
}
}

View File

@ -11,10 +11,10 @@ class Event
{ {
public var name:String; public var name:String;
public var position:Float; public var position:Float;
public var value:Dynamic; public var value:Float;
public var type:String; public var type:String;
public function new(name:String,pos:Float,value:Dynamic,type:String) public function new(name:String,pos:Float,value:Float,type:String)
{ {
this.name = name; this.name = name;
this.position = pos; this.position = pos;

View File

@ -7,6 +7,7 @@ class TimingStruct
public var bpm:Float = 0; public var bpm:Float = 0;
public var startBeat:Float = 0; public var startBeat:Float = 0;
public var startStep:Int = 0;
public var endBeat:Float = Math.POSITIVE_INFINITY; public var endBeat:Float = Math.POSITIVE_INFINITY;
public var startTime:Float = 0; public var startTime:Float = 0;
@ -23,7 +24,7 @@ class TimingStruct
AllTimings.push(pog); AllTimings.push(pog);
} }
public function new(startBeat,bpm,endBeat:Float, offset:Float) public function new(startBeat:Float,bpm:Float,endBeat:Float, offset:Float)
{ {
this.bpm = bpm; this.bpm = bpm;
this.startBeat = startBeat; this.startBeat = startBeat;

View File

@ -70,6 +70,8 @@ class SMHeader
var data = TimingStruct.AllTimings[currentIndex - 1]; var data = TimingStruct.AllTimings[currentIndex - 1];
data.endBeat = beat; data.endBeat = beat;
data.length = (data.endBeat - data.startBeat) / (data.bpm / 60); data.length = (data.endBeat - data.startBeat) / (data.bpm / 60);
var step = ((60 / data.bpm) * 1000) / 4;
TimingStruct.AllTimings[currentIndex].startStep = Math.floor(((data.endBeat / (data.bpm / 60)) * 1000) / step);
TimingStruct.AllTimings[currentIndex].startTime = data.startTime + data.length; TimingStruct.AllTimings[currentIndex].startTime = data.startTime + data.length;
} }

View File

@ -1,8 +1,5 @@
1.6; 1.6.1;
- Full reworked charter - Wiggle Shader for Lua Modcharts
- BPM Changes & Scroll Speed Change Support - Optimized the editor
- StepMania File Format support - Fixed HTML5 Delta Timings
- Pre-loading for characters option - Steps actually exist now
- New Main Menu Remix
- Difficulty Calculator
- Held note rework