Merge branch 'master' into master

This commit is contained in:
Kade M
2021-04-25 22:59:14 -07:00
committed by GitHub
6 changed files with 82 additions and 191 deletions

View File

@ -12,7 +12,7 @@ import flixel.system.FlxAssets;
// Lua
#if cpp
#if windows
import llua.Convert;
import llua.Lua;
import llua.State;
@ -65,7 +65,7 @@ import openfl.filters.ShaderFilter;
#if windows
import Discord.DiscordClient;
#end
#if cpp
#if windows
import Sys;
import sys.FileSystem;
#end
@ -74,7 +74,6 @@ using StringTools;
class PlayState extends MusicBeatState
{
public static var curStage:String = '';
public static var SONG:SwagSong;
public static var isStoryMode:Bool = false;
@ -214,7 +213,7 @@ class PlayState extends MusicBeatState
// LUA SHIT
#if cpp
#if windows
public static var lua:State = null;
@ -1028,29 +1027,28 @@ class PlayState extends MusicBeatState
FlxG.fixedTimestep = false;
if (FlxG.save.data.songPosition) // I dont wanna talk about this code :(
{
songPosBG = new FlxSprite(0, 10).loadGraphic(Paths.image('healthBar'));
if (FlxG.save.data.downscroll)
songPosBG.y = FlxG.height * 0.9 + 45;
songPosBG.screenCenter(X);
songPosBG.scrollFactor.set();
add(songPosBG);
songPosBar = new FlxBar(songPosBG.x + 4, songPosBG.y + 4, LEFT_TO_RIGHT, Std.int(songPosBG.width - 8), Std.int(songPosBG.height - 8), this,
'songPositionBar', 0, 90000);
songPosBar.scrollFactor.set();
songPosBar.createFilledBar(FlxColor.GRAY, FlxColor.LIME);
add(songPosBar);
var songName = new FlxText(songPosBG.x + (songPosBG.width / 2) - 20,songPosBG.y,0,SONG.song, 16);
if (FlxG.save.data.downscroll)
songName.y -= 3;
songName.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
songName.scrollFactor.set();
add(songName);
songName.cameras = [camHUD];
}
{
songPosBG = new FlxSprite(0, 10).loadGraphic(Paths.image('healthBar'));
if (FlxG.save.data.downscroll)
songPosBG.y = FlxG.height * 0.9 + 45;
songPosBG.screenCenter(X);
songPosBG.scrollFactor.set();
add(songPosBG);
songPosBar = new FlxBar(songPosBG.x + 4, songPosBG.y + 4, LEFT_TO_RIGHT, Std.int(songPosBG.width - 8), Std.int(songPosBG.height - 8), this,
'songPositionBar', 0, 90000);
songPosBar.scrollFactor.set();
songPosBar.createFilledBar(FlxColor.GRAY, FlxColor.LIME);
add(songPosBar);
var songName = new FlxText(songPosBG.x + (songPosBG.width / 2) - 20,songPosBG.y,0,SONG.song, 16);
if (FlxG.save.data.downscroll)
songName.y -= 3;
songName.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
songName.scrollFactor.set();
add(songName);
songName.cameras = [camHUD];
}
healthBarBG = new FlxSprite(0, FlxG.height * 0.9).loadGraphic(Paths.image('healthBar'));
if (FlxG.save.data.downscroll)
@ -1066,9 +1064,6 @@ class PlayState extends MusicBeatState
// healthBar
add(healthBar);
// Add Kade Engine watermark
kadeEngineWatermark = new FlxText(4,healthBarBG.y + 50,0,SONG.song + " " + (storyDifficulty == 2 ? "Hard" : storyDifficulty == 1 ? "Normal" : "Easy") + (Main.watermarks ? " - KE " + MainMenuState.kadeEngineVer : ""), 16);
kadeEngineWatermark.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
@ -1282,7 +1277,7 @@ class PlayState extends MusicBeatState
generateStaticArrows(1);
#if cpp
#if windows
if (executeModchart) // dude I hate lua (jkjkjkjk)
{
trace('opening a lua state (because we are cool :))');
@ -1483,7 +1478,7 @@ class PlayState extends MusicBeatState
getActorByName(id).x = x;
}));
trace(Lua_helper.add_callback(lua,"setActorAlpha", function(alpha:Int,id:String) {
trace(Lua_helper.add_callback(lua,"setActorAlpha", function(alpha:Float,id:String) {
getActorByName(id).alpha = alpha;
}));
@ -1846,7 +1841,7 @@ class PlayState extends MusicBeatState
var playerCounter:Int = 0;
// Per song offset check
#if cpp
#if windows
var songPath = 'assets/data/' + PlayState.SONG.song.toLowerCase() + '/';
for(file in sys.FileSystem.readDirectory(songPath))
{
@ -2125,7 +2120,7 @@ class PlayState extends MusicBeatState
perfectMode = false;
#end
#if cpp
#if windows
if (executeModchart && lua != null && songStarted)
{
setVar('songPos',Conductor.songPosition);
@ -2245,7 +2240,7 @@ class PlayState extends MusicBeatState
DiscordClient.changePresence("Chart Editor", null, null, true);
#end
FlxG.switchState(new ChartingState());
#if cpp
#if windows
if (lua != null)
{
Lua.close(lua);
@ -2432,7 +2427,7 @@ class PlayState extends MusicBeatState
}
}
#if cpp
#if windows
if (lua != null)
setVar("mustHit",PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection);
#end
@ -2441,7 +2436,7 @@ class PlayState extends MusicBeatState
{
var offsetX = 0;
var offsetY = 0;
#if cpp
#if windows
if (lua != null)
{
offsetX = getVar("followXOffset", "float");
@ -2449,7 +2444,7 @@ class PlayState extends MusicBeatState
}
#end
camFollow.setPosition(dad.getMidpoint().x + 150 + offsetX, dad.getMidpoint().y - 100 + offsetY);
#if cpp
#if windows
if (lua != null)
callLua('playerTwoTurn', []);
#end
@ -2475,7 +2470,7 @@ class PlayState extends MusicBeatState
{
var offsetX = 0;
var offsetY = 0;
#if cpp
#if windows
if (lua != null)
{
offsetX = getVar("followXOffset", "float");
@ -2484,7 +2479,7 @@ class PlayState extends MusicBeatState
#end
camFollow.setPosition(boyfriend.getMidpoint().x - 100 + offsetX, boyfriend.getMidpoint().y - 100 + offsetY);
#if cpp
#if windows
if (lua != null)
callLua('playerOneTurn', []);
#end
@ -2624,10 +2619,9 @@ class PlayState extends MusicBeatState
dad.playAnim('singDOWN' + altAnim, true);
case 0:
dad.playAnim('singLEFT' + altAnim, true);
}
}
#if cpp
#if windows
if (lua != null)
callLua('playerTwoSing', [Math.abs(daNote.noteData), Conductor.songPosition]);
#end
@ -2721,7 +2715,7 @@ class PlayState extends MusicBeatState
if (!loadRep)
rep.SaveReplay();
#if cpp
#if windows
if (executeModchart)
{
Lua.close(lua);
@ -2763,7 +2757,7 @@ class PlayState extends MusicBeatState
FlxG.switchState(new StoryMenuState());
#if cpp
#if windows
if (lua != null)
{
Lua.close(lua);
@ -3557,7 +3551,7 @@ class PlayState extends MusicBeatState
boyfriend.playAnim('singRIGHTmiss', true);
}
#if cpp
#if windows
if (lua != null)
callLua('playerOneMiss', [direction, Conductor.songPosition]);
#end
@ -3706,7 +3700,7 @@ class PlayState extends MusicBeatState
boyfriend.playAnim('singLEFT', true);
}
#if cpp
#if windows
if (lua != null)
callLua('playerOneSing', [note.noteData, Conductor.songPosition]);
#end
@ -3829,7 +3823,7 @@ class PlayState extends MusicBeatState
resyncVocals();
}
#if cpp
#if windows
if (executeModchart && lua != null)
{
setVar('curStep',curStep);
@ -3868,7 +3862,7 @@ class PlayState extends MusicBeatState
notes.sort(FlxSort.byY, FlxSort.DESCENDING);
}
#if cpp
#if windows
if (executeModchart && lua != null)
{
setVar('curBeat',curBeat);
@ -3887,18 +3881,16 @@ class PlayState extends MusicBeatState
// Conductor.changeBPM(SONG.bpm);
// Dad doesnt interupt his own notes
if (dad.animation.curAnim.name.startsWith('sing'))
{
if (dad.animation.finished)
{
// Commented out until a reason to bring this back arises in the future
/* if (SONG.notes[Math.floor(curStep / 16)].mustHitSection)
dad.dance(); */
if(dad.animation.curAnim.name.startsWith('sing'))
if(dad.animation.finished)
dad.dance();
}
}
else
{
dad.dance();
}
}
// FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM);
wiggleShit.update(Conductor.crochet);