diff --git a/source/ChartingState.hx b/source/ChartingState.hx index afdc65c..4f99b73 100644 --- a/source/ChartingState.hx +++ b/source/ChartingState.hx @@ -674,14 +674,14 @@ class ChartingState extends MusicBeatState writingNotes = !writingNotes; } - /*if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.RIGHT) + if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.RIGHT) snap = snap * 2; if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.LEFT) snap = Math.round(snap / 2); if (snap >= 192) snap = 192; if (snap <= 1) - snap = 1;*/ + snap = 1; Conductor.songPosition = FlxG.sound.music.time; _song.song = typingShit.text; @@ -944,7 +944,16 @@ class ChartingState extends MusicBeatState FlxG.sound.music.pause(); vocals.pause(); - FlxG.sound.music.time = curStep * Conductor.stepCrochet - (FlxG.mouse.wheel * Conductor.stepCrochet / snap); + var stepMs = curStep * Conductor.stepCrochet; + + if (FlxG.sound.music.time < 0) + FlxG.sound.music.time = 0; + + + trace(Conductor.stepCrochet / snap); + + FlxG.sound.music.time = (stepMs + (Conductor.stepCrochet / snap)) * FlxG.mouse.wheel; + trace(stepMs + " + " + Conductor.stepCrochet / snap + " -> " + FlxG.sound.music.time); vocals.time = FlxG.sound.music.time; } diff --git a/source/ModchartState.hx b/source/ModchartState.hx index f781cf9..8362853 100644 --- a/source/ModchartState.hx +++ b/source/ModchartState.hx @@ -1,6 +1,8 @@ // this file is for modchart things, this is to declutter playstate.hx // Lua +import flixel.graphics.FlxGraphic; +import flixel.graphics.frames.FlxAtlasFrames; #if windows import flixel.tweens.FlxEase; import openfl.filters.ShaderFilter; @@ -249,6 +251,33 @@ class ModchartState PlayState.instance.addObject(PlayState.boyfriend); PlayState.instance.iconP2.animation.play(id); } + + function makeAnimatedLuaSprite(spritePath:String,names:Array,prefixes:Array,startAnim:String, id:String) + { + #if sys + var data:BitmapData = BitmapData.fromFile(Sys.getCwd() + "assets/data/" + PlayState.SONG.song.toLowerCase() + '/' + spritePath + ".png"); + + var sprite:FlxSprite = new FlxSprite(0,0); + + sprite.frames = FlxAtlasFrames.fromSparrow(FlxGraphic.fromBitmapData(data), Sys.getCwd() + "assets/data/" + PlayState.SONG.song.toLowerCase() + "/" + spritePath + ".xml"); + + trace(sprite.frames.frames.length); + + for (p in 0...names.length) + { + var i = names[p]; + var ii = prefixes[p]; + sprite.animation.addByPrefix(i,ii,24,false); + } + + luaSprites.set(id,sprite); + + PlayState.instance.addObject(sprite); + + sprite.animation.play(startAnim); + return id; + #end + } function makeLuaSprite(spritePath:String,toBeCalled:String, drawBehind:Bool) { @@ -373,6 +402,8 @@ class ModchartState Lua_helper.add_callback(lua,"changeBoyfriendCharacter", changeBoyfriendCharacter); Lua_helper.add_callback(lua,"getProperty", getPropertyByName); + + Lua_helper.add_callback(lua,"makeAnimatedSprite", makeAnimatedLuaSprite); Lua_helper.add_callback(lua,"destroySprite", function(id:String) { var sprite = luaSprites.get(id); @@ -381,6 +412,8 @@ class ModchartState PlayState.instance.removeObject(sprite); return true; }); + + // hud/camera @@ -752,7 +785,8 @@ class ModchartState Lua_helper.add_callback(lua,"tweenFadeOut", function(id:String, toAlpha:Float, time:Float, onComplete:String) { FlxTween.tween(getActorByName(id), {alpha: toAlpha}, time, {ease: FlxEase.circOut, onComplete: function(flxTween:FlxTween) { if (onComplete != '' && onComplete != null) {callLua(onComplete,[id]);}}}); }); -//forgot and accidentally commit to master branch + + //forgot and accidentally commit to master branch // shader /*Lua_helper.add_callback(lua,"createShader", function(frag:String,vert:String) { diff --git a/source/Note.hx b/source/Note.hx index 544fe3a..657010b 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -190,12 +190,23 @@ class Note extends FlxSprite if (mustPress) { - // The * 0.5 is so that it's easier to hit them too late, instead of too early - if (strumTime > Conductor.songPosition - (Conductor.safeZoneOffset * 1.5) - && strumTime < Conductor.songPosition + (Conductor.safeZoneOffset * 0.5)) - canBeHit = true; + // ass + if (isSustainNote) + { + if (strumTime > Conductor.songPosition - (Conductor.safeZoneOffset * 1.5) + && strumTime < Conductor.songPosition + (Conductor.safeZoneOffset * 0.5)) + canBeHit = true; + else + canBeHit = false; + } else - canBeHit = false; + { + if (strumTime > Conductor.songPosition - Conductor.safeZoneOffset + && strumTime < Conductor.songPosition + Conductor.safeZoneOffset) + canBeHit = true; + else + canBeHit = false; + } if (strumTime < Conductor.songPosition - Conductor.safeZoneOffset * Conductor.timeScale && !wasGoodHit) tooLate = true;