Ability for BF to have idle and notes alt anims + failsafe

This commit is contained in:
Spel0 2021-08-13 19:36:56 +03:00
parent c2db786457
commit 91a6b772ff
3 changed files with 19 additions and 13 deletions

View File

@ -483,6 +483,15 @@ class Character extends FlxSprite
public function playAnim(AnimName:String, Force:Bool = false, Reversed:Bool = false, Frame:Int = 0):Void
{
if (AnimName.endsWith('alt') && animation.getByName(AnimName) == null)
{
#if debug
FlxG.log.warn(['Such alt animation doesnt exist: ' + AnimName]);
#end
AnimName = AnimName.split('-')[0];
}
animation.play(AnimName, Force, Reversed, Frame);
var daOffset = animOffsets.get(AnimName);

View File

@ -3027,7 +3027,7 @@ class ChartingState extends MusicBeatState
}
else
{
var note:Note = new Note(n.strumTime, n.noteData % 4,null,false,true);
var note:Note = new Note(n.strumTime, n.noteData % 4,null,false,true, n.isAlt);
note.rawNoteData = n.noteData;
note.sustainLength = noteSus;
note.setGraphicSize(Math.floor(GRID_SIZE), Math.floor(GRID_SIZE));

View File

@ -4358,17 +4358,14 @@ class PlayState extends MusicBeatState
else
totalNotesHit += 1;
switch (note.noteData)
{
case 2:
boyfriend.playAnim('singUP', true);
case 3:
boyfriend.playAnim('singRIGHT', true);
case 1:
boyfriend.playAnim('singDOWN', true);
case 0:
boyfriend.playAnim('singLEFT', true);
}
var altAnim:String = "";
if (note.isAlt)
{
altAnim = '-alt';
trace("Alt note on BF");
}
boyfriend.playAnim('sing' + dataSuffix[note.noteData] + altAnim, true);
#if windows
if (luaModchart != null)
@ -4631,7 +4628,7 @@ class PlayState extends MusicBeatState
if (!boyfriend.animation.curAnim.name.startsWith("sing") && (curBeat % idleBeat == 0 || !idleToBeat))
{
boyfriend.playAnim('idle', idleToBeat);
boyfriend.playAnim('idle' + ((SONG.notes[Math.floor(curStep / 16)].altAnim && boyfriend.animation.getByName('idle-alt') != null) ? '-alt' : ''), idleToBeat);
}
/*if (!dad.animation.curAnim.name.startsWith("sing"))