Merge pull request #1717 from Spel0/fix-fixin-fixes

Week 6 static arrows fix + alt anims for BF and Opponent
This commit is contained in:
Kade M 2021-08-13 18:44:20 -07:00 committed by GitHub
commit 04247e9d58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 68 additions and 37 deletions

View File

@ -452,7 +452,7 @@ class Character extends FlxSprite
/** /**
* FOR GF DANCING SHIT * FOR GF DANCING SHIT
*/ */
public function dance(forced:Bool = false) public function dance(forced:Bool = false, altAnim:Bool = false)
{ {
if (!debugMode) if (!debugMode)
{ {
@ -476,6 +476,9 @@ class Character extends FlxSprite
else else
playAnim('danceLeft'); playAnim('danceLeft');
default: default:
if (altAnim && animation.getByName('idle-alt') != null)
playAnim('idle-alt', forced);
else
playAnim('idle', forced); playAnim('idle', forced);
} }
} }
@ -483,6 +486,15 @@ class Character extends FlxSprite
public function playAnim(AnimName:String, Force:Bool = false, Reversed:Bool = false, Frame:Int = 0):Void 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); animation.play(AnimName, Force, Reversed, Frame);
var daOffset = animOffsets.get(AnimName); var daOffset = animOffsets.get(AnimName);

View File

@ -301,7 +301,7 @@ class ChartingState extends MusicBeatState
{ {
var renderer = new SectionRender(0,640 * awfgaw,GRID_SIZE); var renderer = new SectionRender(0,640 * awfgaw,GRID_SIZE);
if (_song.notes[awfgaw] == null) if (_song.notes[awfgaw] == null)
_song.notes.push(newSection(16,true,false)); _song.notes.push(newSection(16,true,false,false));
renderer.section = _song.notes[awfgaw]; renderer.section = _song.notes[awfgaw];
sectionRenderes.add(renderer); sectionRenderes.add(renderer);
@ -1183,7 +1183,8 @@ class ChartingState extends MusicBeatState
var check_mustHitSection:FlxUICheckBox; var check_mustHitSection:FlxUICheckBox;
var check_changeBPM:FlxUICheckBox; var check_changeBPM:FlxUICheckBox;
var stepperSectionBPM:FlxUINumericStepper; var stepperSectionBPM:FlxUINumericStepper;
var check_altAnim:FlxUICheckBox; var check_p1AltAnim:FlxUICheckBox;
var check_p2AltAnim:FlxUICheckBox;
function addSectionUI():Void function addSectionUI():Void
{ {
@ -1267,8 +1268,11 @@ class ChartingState extends MusicBeatState
check_mustHitSection.checked = true; check_mustHitSection.checked = true;
// _song.needsVoices = check_mustHit.checked; // _song.needsVoices = check_mustHit.checked;
check_altAnim = new FlxUICheckBox(10, 340, null, null, "Alternate Animation", 100); check_p1AltAnim = new FlxUICheckBox(10, 340, null, null, "P1 Alternate Animation", 100);
check_altAnim.name = 'check_altAnim'; check_p1AltAnim.name = 'check_p1AltAnim';
check_p2AltAnim = new FlxUICheckBox(200, 340, null, null, "P2 Alternate Animation", 100);
check_p2AltAnim.name = 'check_p2AltAnim';
var refresh = new FlxButton(10, 60, 'Refresh Section', function() { var refresh = new FlxButton(10, 60, 'Refresh Section', function() {
var section = getSectionByTime(Conductor.songPosition); var section = getSectionByTime(Conductor.songPosition);
@ -1277,7 +1281,8 @@ class ChartingState extends MusicBeatState
return; return;
check_mustHitSection.checked = section.mustHitSection; check_mustHitSection.checked = section.mustHitSection;
check_altAnim.checked = section.altAnim; check_p1AltAnim.checked = section.p1AltAnim;
check_p2AltAnim.checked = section.p2AltAnim;
}); });
var startSection:FlxButton = new FlxButton(10, 85, "Play Here", function() { var startSection:FlxButton = new FlxButton(10, 85, "Play Here", function() {
@ -1294,7 +1299,8 @@ class ChartingState extends MusicBeatState
//tab_group_section.add(stepperCopy); //tab_group_section.add(stepperCopy);
//tab_group_section.add(stepperCopyLabel); //tab_group_section.add(stepperCopyLabel);
tab_group_section.add(check_mustHitSection); tab_group_section.add(check_mustHitSection);
tab_group_section.add(check_altAnim); tab_group_section.add(check_p1AltAnim);
tab_group_section.add(check_p2AltAnim);
//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);
@ -1511,8 +1517,10 @@ class ChartingState extends MusicBeatState
var label = check.getLabel().text; var label = check.getLabel().text;
switch (label) switch (label)
{ {
case "Alternate Animation": case "P1 Alternate Animation":
getSectionByTime(Conductor.songPosition).altAnim = check.checked; getSectionByTime(Conductor.songPosition).p1AltAnim = check.checked;
case "P2 Alternate Animation":
getSectionByTime(Conductor.songPosition).p2AltAnim = check.checked;
} }
} }
else if (id == FlxUINumericStepper.CHANGE_EVENT && (sender is FlxUINumericStepper)) else if (id == FlxUINumericStepper.CHANGE_EVENT && (sender is FlxUINumericStepper))
@ -2073,7 +2081,8 @@ class ChartingState extends MusicBeatState
{ {
lastUpdatedSection = weird; lastUpdatedSection = weird;
check_mustHitSection.checked = weird.mustHitSection; check_mustHitSection.checked = weird.mustHitSection;
check_altAnim.checked = weird.altAnim; check_p1AltAnim.checked = weird.p1AltAnim;
check_p2AltAnim.checked = weird.p2AltAnim;
} }
} }
@ -2547,13 +2556,14 @@ class ChartingState extends MusicBeatState
if (sec == null) if (sec == null)
{ {
check_mustHitSection.checked = true; check_mustHitSection.checked = true;
check_altAnim.checked = false; check_p1AltAnim.checked = false;
check_p2AltAnim.checked = false;
} }
else else
{ {
check_mustHitSection.checked = sec.mustHitSection; check_mustHitSection.checked = sec.mustHitSection;
check_altAnim.checked = sec.altAnim; check_p1AltAnim.checked = sec.p1AltAnim;
check_changeBPM.checked = sec.changeBPM; check_p2AltAnim.checked = sec.p2AltAnim;
} }
} }
@ -2681,7 +2691,9 @@ class ChartingState extends MusicBeatState
mustHitSection: true, mustHitSection: true,
sectionNotes: [], sectionNotes: [],
typeOfSection: 0, typeOfSection: 0,
altAnim: false altAnim: false,
p1AltAnim: false,
p2AltAnim: false
}; };
_song.notes.push(sec); _song.notes.push(sec);
@ -2792,7 +2804,7 @@ class ChartingState extends MusicBeatState
updateGrid(); updateGrid();
} }
private function newSection(lengthInSteps:Int = 16,mustHitSection:Bool = false,altAnim:Bool = true):SwagSection private function newSection(lengthInSteps:Int = 16,mustHitSection:Bool = false,p1AltAnim:Bool = true, p2AltAnim:Bool = true):SwagSection
{ {
var daPos:Float = 0; var daPos:Float = 0;
@ -2820,7 +2832,9 @@ class ChartingState extends MusicBeatState
mustHitSection: mustHitSection, mustHitSection: mustHitSection,
sectionNotes: [], sectionNotes: [],
typeOfSection: 0, typeOfSection: 0,
altAnim: altAnim altAnim: false,
p1AltAnim: p1AltAnim,
p2AltAnim: p2AltAnim
}; };
@ -2894,7 +2908,7 @@ class ChartingState extends MusicBeatState
} }
for (daSection1 in 0..._song.notes.length) for (daSection1 in 0..._song.notes.length)
{ {
newSong.push(newSection(16,_song.notes[daSection1].mustHitSection,_song.notes[daSection1].altAnim)); newSong.push(newSection(16,_song.notes[daSection1].mustHitSection,_song.notes[daSection1].p1AltAnim,_song.notes[daSection1].p2AltAnim));
} }
for (daSection in 0...(_song.notes.length)) for (daSection in 0...(_song.notes.length))
@ -2902,7 +2916,8 @@ class ChartingState extends MusicBeatState
var aimtosetsection = daSection+Std.int((totaladdsection)); var aimtosetsection = daSection+Std.int((totaladdsection));
if(aimtosetsection<0) aimtosetsection = 0; if(aimtosetsection<0) aimtosetsection = 0;
newSong[aimtosetsection].mustHitSection = _song.notes[daSection].mustHitSection; newSong[aimtosetsection].mustHitSection = _song.notes[daSection].mustHitSection;
newSong[aimtosetsection].altAnim = _song.notes[daSection].altAnim; newSong[aimtosetsection].p1AltAnim = _song.notes[daSection].p1AltAnim;
newSong[aimtosetsection].p2AltAnim = _song.notes[daSection].p2AltAnim;
//trace("section "+daSection); //trace("section "+daSection);
for(daNote in 0...(_song.notes[daSection].sectionNotes.length)) for(daNote in 0...(_song.notes[daSection].sectionNotes.length))
{ {
@ -3021,7 +3036,7 @@ class ChartingState extends MusicBeatState
} }
else 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.rawNoteData = n.noteData;
note.sustainLength = noteSus; note.sustainLength = noteSus;
note.setGraphicSize(Math.floor(GRID_SIZE), Math.floor(GRID_SIZE)); note.setGraphicSize(Math.floor(GRID_SIZE), Math.floor(GRID_SIZE));

View File

@ -147,7 +147,9 @@ class Note extends FlxSprite
animation.add(dataColor[i] + 'holdend', [i + 4]); // Tails animation.add(dataColor[i] + 'holdend', [i + 4]); // Tails
} }
setGraphicSize(Std.int(width * PlayState.daPixelZoom)); var widthSize = Std.int(PlayState.curStage.startsWith('school') ? (width * PlayState.daPixelZoom) : (isSustainNote ? (width * (PlayState.daPixelZoom - 1.5)) : (width * PlayState.daPixelZoom)));
setGraphicSize(widthSize);
updateHitbox(); updateHitbox();
default: default:
frames = Paths.getSparrowAtlas('NOTE_assets'); frames = Paths.getSparrowAtlas('NOTE_assets');

View File

@ -3060,7 +3060,7 @@ class PlayState extends MusicBeatState
if (SONG.notes[Math.floor(curStep / 16)] != null) if (SONG.notes[Math.floor(curStep / 16)] != null)
{ {
if (SONG.notes[Math.floor(curStep / 16)].altAnim) if (SONG.notes[Math.floor(curStep / 16)].p1AltAnim)
altAnim = '-alt'; altAnim = '-alt';
} }
@ -4382,18 +4382,15 @@ class PlayState extends MusicBeatState
else else
totalNotesHit += 1; totalNotesHit += 1;
switch (note.noteData) var altAnim:String = "";
if (note.isAlt)
{ {
case 2: altAnim = '-alt';
boyfriend.playAnim('singUP', true); trace("Alt note on BF");
case 3:
boyfriend.playAnim('singRIGHT', true);
case 1:
boyfriend.playAnim('singDOWN', true);
case 0:
boyfriend.playAnim('singLEFT', true);
} }
boyfriend.playAnim('sing' + dataSuffix[note.noteData] + altAnim, true);
#if windows #if windows
if (luaModchart != null) if (luaModchart != null)
luaModchart.executeState('playerOneSing', [note.noteData, Conductor.songPosition]); luaModchart.executeState('playerOneSing', [note.noteData, Conductor.songPosition]);
@ -4621,7 +4618,7 @@ class PlayState extends MusicBeatState
// Dad doesnt interupt his own notes // Dad doesnt interupt his own notes
if ((!dad.animation.curAnim.name.startsWith("sing")) && dad.curCharacter != 'gf') if ((!dad.animation.curAnim.name.startsWith("sing")) && dad.curCharacter != 'gf')
if ((curBeat % idleBeat == 0 || !idleToBeat) || dad.curCharacter == "spooky") if ((curBeat % idleBeat == 0 || !idleToBeat) || dad.curCharacter == "spooky")
dad.dance(idleToBeat); dad.dance(idleToBeat, SONG.notes[Math.floor(curStep / 16)].p1AltAnim);
} }
// 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); wiggleShit.update(Conductor.crochet);
@ -4655,7 +4652,7 @@ class PlayState extends MusicBeatState
if (!boyfriend.animation.curAnim.name.startsWith("sing") && (curBeat % idleBeat == 0 || !idleToBeat)) if (!boyfriend.animation.curAnim.name.startsWith("sing") && (curBeat % idleBeat == 0 || !idleToBeat))
{ {
boyfriend.playAnim('idle', idleToBeat); boyfriend.playAnim('idle' + ((SONG.notes[Math.floor(curStep / 16)].p2AltAnim && boyfriend.animation.getByName('idle-alt') != null) ? '-alt' : ''), idleToBeat);
} }
/*if (!dad.animation.curAnim.name.startsWith("sing")) /*if (!dad.animation.curAnim.name.startsWith("sing"))

View File

@ -11,6 +11,8 @@ typedef SwagSection =
var bpm:Float; var bpm:Float;
var changeBPM:Bool; var changeBPM:Bool;
var altAnim:Bool; var altAnim:Bool;
var p1AltAnim:Bool;
var p2AltAnim:Bool;
} }
class Section class Section

View File

@ -125,7 +125,6 @@ class Song
if (song.eventObjects == null) if (song.eventObjects == null)
song.eventObjects = []; song.eventObjects = [];
for(i in song.eventObjects) for(i in song.eventObjects)
{ {
var name = Reflect.field(i,"name"); var name = Reflect.field(i,"name");
@ -176,7 +175,11 @@ class Song
// conversion stuff // conversion stuff
for (section in swagShit.notes)
{
if (section.altAnim)
section.p1AltAnim = section.altAnim;
}
return swagShit; return swagShit;
} }