Merge branch 'master' into master

This commit is contained in:
CuckyDev 2021-07-11 18:38:20 -04:00 committed by GitHub
commit 6876a48875
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3118 additions and 118 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,7 @@
package;
import flixel.FlxCamera;
import flixel.FlxObject;
import flixel.addons.ui.FlxUIText;
import haxe.zip.Writer;
import Conductor.BPMChangeEvent;
@ -48,6 +49,7 @@ class ChartingState extends MusicBeatState
public var snap:Int = 1;
var UI_box:FlxUITabMenu;
var UI_options:FlxUITabMenu;
/**
* Array of notes showing when each section STARTS in STEPS
@ -68,6 +70,9 @@ class ChartingState extends MusicBeatState
var GRID_SIZE:Int = 40;
var subDivisions:Float = 1;
var defaultSnap:Bool = true;
var dummyArrow:FlxSprite;
var curRenderedNotes:FlxTypedGroup<Note>;
@ -98,6 +103,8 @@ class ChartingState extends MusicBeatState
public var snapText:FlxText;
var camFollow:FlxObject;
override function create()
{
curSection = lastSection;
@ -121,16 +128,17 @@ class ChartingState extends MusicBeatState
};
}
gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * 16);
add(gridBG);
addGrid(1);
var blackBorder:FlxSprite = new FlxSprite(60,10).makeGraphic(120,100,FlxColor.BLACK);
blackBorder.scrollFactor.set();
blackBorder.alpha = 0.3;
/*
snapText = new FlxText(60,10,0,"Snap: 1/" + snap + " (Press SHIFT to unsnap the cursor)\nAdd Notes: 1-8 (or click)\nDiff: 0", 14);
snapText.scrollFactor.set();
*/
gridBlackLine = new FlxSprite(gridBG.x + gridBG.width / 2).makeGraphic(2, Std.int(gridBG.height), FlxColor.BLACK);
add(gridBlackLine);
@ -171,7 +179,7 @@ class ChartingState extends MusicBeatState
bpmTxt.scrollFactor.set();
add(bpmTxt);
strumLine = new FlxSprite(0, 50).makeGraphic(Std.int(FlxG.width / 2), 4);
strumLine = new FlxSprite(0, 50).makeGraphic(Std.int(GRID_SIZE * 8), 4);
add(strumLine);
dummyArrow = new FlxSprite().makeGraphic(GRID_SIZE, GRID_SIZE);
@ -185,27 +193,102 @@ class ChartingState extends MusicBeatState
];
UI_box = new FlxUITabMenu(null, tabs, true);
UI_box.scrollFactor.set();
UI_box.resize(300, 400);
UI_box.x = FlxG.width / 2;
UI_box.x = FlxG.width / 2 + 40;
UI_box.y = 20;
add(UI_box);
var opt_tabs = [{name: "Options", label:'Editor Options'}];
UI_options = new FlxUITabMenu(null, opt_tabs, true);
UI_options.scrollFactor.set();
UI_options.selected_tab = 0;
UI_options.resize(300, 200);
UI_options.x = UI_box.x;
UI_options.y = FlxG.height - 300;
add(UI_options);
addSongUI();
addSectionUI();
addNoteUI();
addOptionsUI();
add(curRenderedNotes);
add(curRenderedSustains);
add(blackBorder);
add(snapText);
//add(snapText);
super.create();
}
function addGrid(?divisions:Float = 1)
{
// This here is because non-integer numbers aren't supported as grid sizes, making the grid slowly 'drift' as it goes on
var h = GRID_SIZE / divisions;
if (Math.floor(h) != h)
h = GRID_SIZE;
remove(gridBG);
gridBG = FlxGridOverlay.create(GRID_SIZE, Std.int(h), GRID_SIZE * 8, GRID_SIZE * 16);
add(gridBG);
}
var stepperDiv:FlxUINumericStepper;
var check_snap:FlxUICheckBox;
function addOptionsUI()
{
stepperDiv = new FlxUINumericStepper(10, 26, 1, subDivisions, 1, 4);
stepperDiv.value = 0;
stepperDiv.name = 'divisions';
var stepperDivLabel = new FlxText(8, 10, 'Grid sub-divisions');
var hitsounds = new FlxUICheckBox(10, 60, null, null, "Play hitsounds", 100);
hitsounds.checked = false;
hitsounds.callback = function()
{
playClaps = hitsounds.checked;
};
var check_mute_inst = new FlxUICheckBox(10, 90, null, null, "Mute Instrumental", 100);
check_mute_inst.checked = false;
check_mute_inst.callback = function()
{
var vol:Float = 1;
if (check_mute_inst.checked)
vol = 0;
FlxG.sound.music.volume = vol;
};
check_snap = new FlxUICheckBox(80, 25, null, null, "Snap to grid", 100);
check_snap.checked = defaultSnap;
// _song.needsVoices = check_voices.checked;
check_snap.callback = function()
{
defaultSnap = check_snap.checked;
trace('CHECKED!');
};
var tab_options = new FlxUI(null, UI_options);
tab_options.name = "Options";
tab_options.add(stepperDiv);
tab_options.add(stepperDivLabel);
tab_options.add(check_snap);
tab_options.add(hitsounds);
tab_options.add(check_mute_inst);
UI_options.addGroup(tab_options);
}
function addSongUI():Void
{
var UI_songTitle = new FlxUIInputText(10, 10, 70, _song.song, 8);
@ -220,18 +303,6 @@ class ChartingState extends MusicBeatState
trace('CHECKED!');
};
var check_mute_inst = new FlxUICheckBox(10, 200, null, null, "Mute Instrumental (in editor)", 100);
check_mute_inst.checked = false;
check_mute_inst.callback = function()
{
var vol:Float = 1;
if (check_mute_inst.checked)
vol = 0;
FlxG.sound.music.volume = vol;
};
var saveButton:FlxButton = new FlxButton(110, 8, "Save", function()
{
saveLevel();
@ -283,14 +354,6 @@ class ChartingState extends MusicBeatState
stepperSongVol.value = FlxG.sound.music.volume;
stepperSongVol.name = 'song_instvol';
var hitsounds = new FlxUICheckBox(10, stepperSongVol.y + 60, null, null, "Play hitsounds", 100);
hitsounds.checked = false;
hitsounds.callback = function()
{
playClaps = hitsounds.checked;
};
var stepperSongVolLabel = new FlxText(74, 110, 'Instrumental Volume');
@ -359,7 +422,7 @@ class ChartingState extends MusicBeatState
tab_group_song.add(UI_songTitle);
tab_group_song.add(restart);
tab_group_song.add(check_voices);
tab_group_song.add(check_mute_inst);
//tab_group_song.add(check_mute_inst);
tab_group_song.add(saveButton);
tab_group_song.add(reloadSong);
tab_group_song.add(reloadSongJson);
@ -379,7 +442,7 @@ class ChartingState extends MusicBeatState
tab_group_song.add(shiftNoteDialLabel3);
tab_group_song.add(stepperShiftNoteDialms);
tab_group_song.add(shiftNoteButton);
tab_group_song.add(hitsounds);
//tab_group_song.add(hitsounds);
var tab_group_assets = new FlxUI(null, UI_box);
tab_group_assets.name = "Assets";
@ -396,9 +459,11 @@ class ChartingState extends MusicBeatState
UI_box.addGroup(tab_group_song);
UI_box.addGroup(tab_group_assets);
UI_box.scrollFactor.set();
camFollow = new FlxObject(280, 0, 1, 1);
add(camFollow);
FlxG.camera.follow(strumLine);
FlxG.camera.follow(camFollow);
}
var stepperLength:FlxUINumericStepper;
@ -447,7 +512,7 @@ class ChartingState extends MusicBeatState
check_mustHitSection.checked = true;
// _song.needsVoices = check_mustHit.checked;
check_altAnim = new FlxUICheckBox(10, 400, null, null, "Alternate Animation", 100);
check_altAnim = new FlxUICheckBox(10, 340, null, null, "Alternate Animation", 100);
check_altAnim.name = 'check_altAnim';
check_changeBPM = new FlxUICheckBox(10, 60, null, null, 'Change BPM', 100);
@ -575,53 +640,55 @@ class ChartingState extends MusicBeatState
var nums:FlxUINumericStepper = cast sender;
var wname = nums.name;
FlxG.log.add(wname);
if (wname == 'section_length')
{
if (nums.value <= 4)
nums.value = 4;
_song.notes[curSection].lengthInSteps = Std.int(nums.value);
updateGrid();
}
else if (wname == 'song_speed')
{
if (nums.value <= 0)
nums.value = 0;
_song.speed = nums.value;
}
else if (wname == 'song_bpm')
{
if (nums.value <= 0)
nums.value = 1;
tempBpm = Std.int(nums.value);
Conductor.mapBPMChanges(_song);
Conductor.changeBPM(Std.int(nums.value));
}
else if (wname == 'note_susLength')
{
if (curSelectedNote == null)
return;
if (nums.value <= 0)
nums.value = 0;
curSelectedNote[2] = nums.value;
updateGrid();
}
else if (wname == 'section_bpm')
switch (wname)
{
if (nums.value <= 0.1)
nums.value = 0.1;
_song.notes[curSection].bpm = Std.int(nums.value);
updateGrid();
}else if (wname == 'song_vocalvol')
{
if (nums.value <= 0.1)
nums.value = 0.1;
vocals.volume = nums.value;
}else if (wname == 'song_instvol')
{
if (nums.value <= 0.1)
nums.value = 0.1;
FlxG.sound.music.volume = nums.value;
case 'section_length':
if (nums.value <= 4)
nums.value = 4;
_song.notes[curSection].lengthInSteps = Std.int(nums.value);
updateGrid();
case 'song_speed':
if (nums.value <= 0)
nums.value = 0;
_song.speed = nums.value;
case 'song_bpm':
if (nums.value <= 0)
nums.value = 1;
tempBpm = Std.int(nums.value);
Conductor.mapBPMChanges(_song);
Conductor.changeBPM(Std.int(nums.value));
case 'note_susLength':
if (curSelectedNote == null)
return;
if (nums.value <= 0)
nums.value = 0;
curSelectedNote[2] = nums.value;
updateGrid();
case 'section_bpm':
if (nums.value <= 0.1)
nums.value = 0.1;
_song.notes[curSection].bpm = Std.int(nums.value);
updateGrid();
case 'song_vocalvol':
if (nums.value <= 0.1)
nums.value = 0.1;
vocals.volume = nums.value;
case 'song_instvol':
if (nums.value <= 0.1)
nums.value = 0.1;
FlxG.sound.music.volume = nums.value;
case 'divisions':
subDivisions = nums.value;
updateGrid();
}
}
@ -668,7 +735,7 @@ class ChartingState extends MusicBeatState
{
updateHeads();
snapText.text = "Snap: 1/" + snap + " (" + (doSnapShit ? "Shift to disable" : "Snap Disabled, Shift to renable. It's a bit buggy") + ")\nAdd Notes: 1-8 (or click)";
//snapText.text = "Snap: 1/" + snap + " (" + (doSnapShit ? "Shift to disable" : "Snap Disabled, Shift to renable. It's a bit buggy") + ")\nAdd Notes: 1-8 (or click)";
curStep = recalculateSteps();
@ -680,9 +747,18 @@ class ChartingState extends MusicBeatState
snap = 192;
if (snap <= 1)
snap = 1;*/
/*
if (FlxG.keys.justPressed.SHIFT)
doSnapShit = !doSnapShit;
*/
doSnapShit = defaultSnap;
if (FlxG.keys.pressed.SHIFT)
{
doSnapShit = !defaultSnap;
}
check_snap.checked = doSnapShit;
Conductor.songPosition = FlxG.sound.music.time;
_song.song = typingShit.text;
@ -717,7 +793,7 @@ class ChartingState extends MusicBeatState
}
strumLine.y = getYfromStrum((Conductor.songPosition - sectionStartTime()) % (Conductor.stepCrochet * _song.notes[curSection].lengthInSteps));
camFollow.y = strumLine.y;
if (playClaps)
@ -861,11 +937,20 @@ class ChartingState extends MusicBeatState
&& FlxG.mouse.y > gridBG.y
&& FlxG.mouse.y < gridBG.y + (GRID_SIZE * _song.notes[curSection].lengthInSteps))
{
dummyArrow.visible = true;
dummyArrow.x = Math.floor(FlxG.mouse.x / GRID_SIZE) * GRID_SIZE;
if (FlxG.keys.pressed.SHIFT)
dummyArrow.y = FlxG.mouse.y;
var div_by:Float = GRID_SIZE / subDivisions;
if (doSnapShit)
dummyArrow.y = Math.floor(FlxG.mouse.y / div_by) * div_by;
else
dummyArrow.y = Math.floor(FlxG.mouse.y / GRID_SIZE) * GRID_SIZE;
dummyArrow.y = FlxG.mouse.y;
}
else
{
dummyArrow.visible = false;
}
if (FlxG.keys.justPressed.ENTER)
@ -977,11 +1062,12 @@ class ChartingState extends MusicBeatState
trace(increase + " - " + curStep + " - " + (curStep + increase));
curStep += increase;
// *Maybe a pre-snap goes here but I don't really know, I don't chart with number keys
FlxG.sound.music.time += (increase * Conductor.stepCrochet) / subDivisions;
var stepMs = curStep * Conductor.stepCrochet;
var msStep = FlxG.sound.music.time / Conductor.stepCrochet;
FlxG.sound.music.time = stepMs;
curStep = Std.int(msStep);
}
else
FlxG.sound.music.time -= (amount * Conductor.stepCrochet * 0.4);
@ -1199,9 +1285,7 @@ class ChartingState extends MusicBeatState
function updateGrid():Void
{
remove(gridBG);
gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * 16);
add(gridBG);
addGrid(subDivisions);
remove(gridBlackLine);
gridBlackLine = new FlxSprite(gridBG.x + gridBG.width / 2).makeGraphic(2, Std.int(gridBG.height), FlxColor.BLACK);

View File

@ -112,6 +112,10 @@ class Note extends FlxSprite
}
else
{
if (PlayState.SONG.noteStyle == null) {
switch(PlayState.storyWeek) {case 6: noteTypeCheck = 'pixel';}
} else {noteTypeCheck = PlayState.SONG.noteStyle;}
switch (noteTypeCheck)
{
case 'pixel':

View File

@ -2794,16 +2794,20 @@ class PlayState extends MusicBeatState
daNote.visible = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].visible;
daNote.x = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].x;
if (!daNote.isSustainNote)
daNote.modAngle = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].angle;
daNote.alpha = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].alpha;
daNote.angle = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].angle;
if (daNote.sustainActive)
daNote.alpha = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].alpha;
daNote.modAngle = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].angle;
}
else if (!daNote.wasGoodHit && !daNote.modifiedByLua)
{
daNote.visible = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].visible;
daNote.x = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].x;
if (!daNote.isSustainNote)
daNote.modAngle = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].angle;
daNote.alpha = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].alpha;
daNote.angle = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].angle;
if (daNote.sustainActive)
daNote.alpha = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].alpha;
daNote.modAngle = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].angle;
}
if (daNote.isSustainNote)
@ -2825,11 +2829,6 @@ class PlayState extends MusicBeatState
{
daNote.kill();
notes.remove(daNote, true);
if (!daNote.isParent)
{
for(i in daNote.parent.children)
i.sustainActive = false;
}
}
else
{
@ -2840,29 +2839,33 @@ class PlayState extends MusicBeatState
totalNotesHit += 1;
else
{
if (daNote.isSustainNote)
{
daNote.kill();
notes.remove(daNote, true);
}
else
{
if (!daNote.isSustainNote)
health -= 0.075;
vocals.volume = 0;
if (theFunne)
noteMiss(daNote.noteData, daNote);
}
vocals.volume = 0;
if (theFunne && daNote.sustainActive)
noteMiss(daNote.noteData, daNote);
}
}
else
{
health -= 0.075;
if (!daNote.isSustainNote)
health -= 0.075;
vocals.volume = 0;
if (theFunne)
if (theFunne && daNote.sustainActive)
noteMiss(daNote.noteData, daNote);
}
}
if (!daNote.wasGoodHit && daNote.isSustainNote && daNote.sustainActive && daNote.spotInLine != daNote.parent.children.length)
{
health -= 0.2; // give a health punishment for failing a LN
trace("hold fell over at " + daNote.spotInLine);
for(i in daNote.parent.children)
{
i.sustainActive = false;
}
}
daNote.visible = false;
daNote.kill();
notes.remove(daNote, true);
@ -3092,7 +3095,7 @@ class PlayState extends MusicBeatState
score = -300;
combo = 0;
misses++;
health -= 0.2;
health -= 0.35;
ss = false;
shits++;
if (FlxG.save.data.accuracyMod == 0)
@ -3100,7 +3103,7 @@ class PlayState extends MusicBeatState
case 'bad':
daRating = 'bad';
score = 0;
health -= 0.06;
health -= 0.1;
ss = false;
bads++;
if (FlxG.save.data.accuracyMod == 0)
@ -3111,12 +3114,12 @@ class PlayState extends MusicBeatState
ss = false;
goods++;
if (health < 2)
health += 0.04;
health += 0.02;
if (FlxG.save.data.accuracyMod == 0)
totalNotesHit += 0.75;
case 'sick':
if (health < 2)
health += 0.1;
health += 0.15;
if (FlxG.save.data.accuracyMod == 0)
totalNotesHit += 1;
sicks++;
@ -3680,7 +3683,7 @@ class PlayState extends MusicBeatState
{
if (!boyfriend.stunned)
{
health -= 0.04;
//health -= 0.2;
if (combo > 5 && gf.animOffsets.exists('sad'))
{
gf.playAnim('sad');
@ -3718,8 +3721,14 @@ class PlayState extends MusicBeatState
if (FlxG.save.data.accuracyMod == 1)
totalNotesHit -= 1;
songScore -= 10;
if (daNote != null)
{
if (!daNote.isSustainNote)
songScore -= 10;
}
else
songScore -= 10;
FlxG.sound.play(Paths.soundRandom('missnote', 1, 3), FlxG.random.float(0.1, 0.2));
// FlxG.sound.play(Paths.sound('missnote1'), 1, false);
// FlxG.log.add('played imss note');