mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-08-20 07:25:59 +00:00
Merge branch 'rewrite/master' into rewrite/feature/remember-difficulty
This commit is contained in:
commit
fbcce75ea4
2
assets
2
assets
|
@ -1 +1 @@
|
|||
Subproject commit 61ddda8bd98fac65b21b4c35d24ee78129b48f29
|
||||
Subproject commit ef79a6cf1ae3dcbd86a5b798f8117a6c692c0156
|
|
@ -102,6 +102,9 @@ class GameOverSubState extends MusicBeatSubState
|
|||
cameraFollowPoint = new FlxObject(PlayState.instance.cameraFollowPoint.x, PlayState.instance.cameraFollowPoint.y, 1, 1);
|
||||
cameraFollowPoint.x = boyfriend.getGraphicMidpoint().x;
|
||||
cameraFollowPoint.y = boyfriend.getGraphicMidpoint().y;
|
||||
var offsets:Array<Float> = boyfriend.getDeathCameraOffsets();
|
||||
cameraFollowPoint.x += offsets[0];
|
||||
cameraFollowPoint.y += offsets[1];
|
||||
add(cameraFollowPoint);
|
||||
|
||||
FlxG.camera.target = null;
|
||||
|
|
|
@ -1641,7 +1641,7 @@ class PlayState extends MusicBeatSubState
|
|||
*/
|
||||
function onConversationComplete():Void
|
||||
{
|
||||
isInCutscene = true;
|
||||
isInCutscene = false;
|
||||
remove(currentConversation);
|
||||
currentConversation = null;
|
||||
|
||||
|
|
|
@ -188,6 +188,11 @@ class BaseCharacter extends Bopper
|
|||
shouldBop = false;
|
||||
}
|
||||
|
||||
public function getDeathCameraOffsets():Array<Float>
|
||||
{
|
||||
return _data.death?.cameraOffsets ?? [0.0, 0.0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of flipX from the character data.
|
||||
* `!getFlipX()` is the direction Boyfriend should face.
|
||||
|
@ -580,8 +585,7 @@ class BaseCharacter extends Bopper
|
|||
|
||||
public override function playAnimation(name:String, restart:Bool = false, ignoreOther:Bool = false, reversed:Bool = false):Void
|
||||
{
|
||||
FlxG.watch.addQuick('playAnim(${characterName})', name);
|
||||
// trace('playAnim(${characterName}): ${name}');
|
||||
// FlxG.watch.addQuick('playAnim(${characterName})', name);
|
||||
super.playAnimation(name, restart, ignoreOther, reversed);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,10 @@ class CharacterDataParser
|
|||
* The current version string for the stage data format.
|
||||
* Handle breaking changes by incrementing this value
|
||||
* and adding migration to the `migrateStageData()` function.
|
||||
*
|
||||
* - Version 1.0.1 adds `death.cameraOffsets`
|
||||
*/
|
||||
public static final CHARACTER_DATA_VERSION:String = '1.0.0';
|
||||
public static final CHARACTER_DATA_VERSION:String = '1.0.1';
|
||||
|
||||
/**
|
||||
* The current version rule check for the stage data format.
|
||||
|
@ -603,6 +605,8 @@ typedef CharacterData =
|
|||
*/
|
||||
var healthIcon:Null<HealthIconData>;
|
||||
|
||||
var death:Null<DeathData>;
|
||||
|
||||
/**
|
||||
* The global offset to the character's position, in pixels.
|
||||
* @default [0, 0]
|
||||
|
@ -695,3 +699,13 @@ typedef HealthIconData =
|
|||
*/
|
||||
var offsets:Null<Array<Float>>;
|
||||
}
|
||||
|
||||
typedef DeathData =
|
||||
{
|
||||
/**
|
||||
* The amount to offset the camera by while focusing on this character as they die.
|
||||
* Default value focuses on the character's graphic midpoint.
|
||||
* @default [0, 0]
|
||||
*/
|
||||
var ?cameraOffsets:Array<Float>;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package funkin.play.song;
|
||||
|
||||
import funkin.util.SortUtil;
|
||||
import flixel.sound.FlxSound;
|
||||
import openfl.utils.Assets;
|
||||
import funkin.modding.events.ScriptEvent;
|
||||
|
@ -252,32 +253,7 @@ class Song implements IPlayStateScriptedClass implements IRegistryEntry<SongMeta
|
|||
return difficulty.variation == variationId;
|
||||
});
|
||||
|
||||
// sort the difficulties, since they may be out of order in the chart JSON
|
||||
// maybe be careful of lowercase/uppercase?
|
||||
// also used in Level.listDifficulties()!!
|
||||
var diffMap:Map<String, Int> = new Map<String, Int>();
|
||||
for (difficulty in diffFiltered)
|
||||
{
|
||||
var num:Int = 0;
|
||||
switch (difficulty)
|
||||
{
|
||||
case 'easy':
|
||||
num = 0;
|
||||
case 'normal':
|
||||
num = 1;
|
||||
case 'hard':
|
||||
num = 2;
|
||||
case 'erect':
|
||||
num = 3;
|
||||
case 'nightmare':
|
||||
num = 4;
|
||||
}
|
||||
diffMap.set(difficulty, num);
|
||||
}
|
||||
|
||||
diffFiltered.sort(function(a:String, b:String) {
|
||||
return (diffMap.get(a) ?? 0) - (diffMap.get(b) ?? 0);
|
||||
});
|
||||
diffFiltered.sort(SortUtil.defaultsThenAlphabetically.bind(Constants.DEFAULT_DIFFICULTY_LIST));
|
||||
|
||||
return diffFiltered;
|
||||
}
|
||||
|
|
|
@ -667,8 +667,6 @@ class ChartEditorDialogHandler
|
|||
timeChanges[0].bpm = event.value;
|
||||
}
|
||||
|
||||
Conductor.forceBPM(event.value);
|
||||
|
||||
newSongMetadata.timeChanges = timeChanges;
|
||||
};
|
||||
|
||||
|
@ -677,6 +675,8 @@ class ChartEditorDialogHandler
|
|||
dialogContinue.onClick = (_event) -> {
|
||||
state.songMetadata.set(targetVariation, newSongMetadata);
|
||||
|
||||
Conductor.mapTimeChanges(state.currentSongMetadata.timeChanges);
|
||||
|
||||
dialog.hideDialog(DialogButton.APPLY);
|
||||
}
|
||||
|
||||
|
@ -696,6 +696,8 @@ class ChartEditorDialogHandler
|
|||
|
||||
var charData:SongCharacterData = state.currentSongMetadata.playData.characters;
|
||||
|
||||
var hasClearedVocals:Bool = false;
|
||||
|
||||
charIdsForVocals.push(charData.player);
|
||||
charIdsForVocals.push(charData.opponent);
|
||||
|
||||
|
@ -715,6 +717,7 @@ class ChartEditorDialogHandler
|
|||
if (dialogNoVocals == null) throw 'Could not locate dialogNoVocals button in Upload Vocals dialog';
|
||||
dialogNoVocals.onClick = function(_event) {
|
||||
// Dismiss
|
||||
ChartEditorAudioHandler.stopExistingVocals(state);
|
||||
dialog.hideDialog(DialogButton.APPLY);
|
||||
};
|
||||
|
||||
|
@ -738,6 +741,12 @@ class ChartEditorDialogHandler
|
|||
trace('Selected file: $pathStr');
|
||||
var path:Path = new Path(pathStr);
|
||||
|
||||
if (!hasClearedVocals)
|
||||
{
|
||||
hasClearedVocals = true;
|
||||
ChartEditorAudioHandler.stopExistingVocals(state);
|
||||
}
|
||||
|
||||
if (ChartEditorAudioHandler.loadVocalsFromPath(state, path, charKey, instId))
|
||||
{
|
||||
// Tell the user the load was successful.
|
||||
|
@ -788,6 +797,11 @@ class ChartEditorDialogHandler
|
|||
if (selectedFile != null && selectedFile.bytes != null)
|
||||
{
|
||||
trace('Selected file: ' + selectedFile.name);
|
||||
if (!hasClearedVocals)
|
||||
{
|
||||
hasClearedVocals = true;
|
||||
ChartEditorAudioHandler.stopExistingVocals(state);
|
||||
}
|
||||
if (ChartEditorAudioHandler.loadVocalsFromBytes(state, selectedFile.bytes, charKey, instId))
|
||||
{
|
||||
// Tell the user the load was successful.
|
||||
|
|
|
@ -1897,6 +1897,16 @@ class ChartEditorState extends HaxeUIState
|
|||
handleViewKeybinds();
|
||||
handleTestKeybinds();
|
||||
handleHelpKeybinds();
|
||||
|
||||
#if debug
|
||||
handleQuickWatch();
|
||||
#end
|
||||
}
|
||||
|
||||
function handleQuickWatch():Void
|
||||
{
|
||||
FlxG.watch.addQuick('scrollPosInPixels', scrollPositionInPixels);
|
||||
FlxG.watch.addQuick('playheadPosInPixels', playheadPositionInPixels);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3119,6 +3129,7 @@ class ChartEditorState extends HaxeUIState
|
|||
function quitChartEditor():Void
|
||||
{
|
||||
autoSave();
|
||||
stopWelcomeMusic();
|
||||
FlxG.switchState(new MainMenuState());
|
||||
}
|
||||
|
||||
|
@ -3342,6 +3353,7 @@ class ChartEditorState extends HaxeUIState
|
|||
if (!isHaxeUIDialogOpen && !isCursorOverHaxeUI && FlxG.keys.justPressed.ENTER)
|
||||
{
|
||||
var minimal = FlxG.keys.pressed.SHIFT;
|
||||
ChartEditorToolboxHandler.hideAllToolboxes(this);
|
||||
testSongInPlayState(minimal);
|
||||
}
|
||||
}
|
||||
|
@ -4153,14 +4165,13 @@ class ChartEditorState extends HaxeUIState
|
|||
*/
|
||||
function moveSongToScrollPosition():Void
|
||||
{
|
||||
// Update the songPosition in the Conductor.
|
||||
var targetPos = scrollPositionInMs;
|
||||
Conductor.update(targetPos);
|
||||
|
||||
// Update the songPosition in the audio tracks.
|
||||
if (audioInstTrack != null) audioInstTrack.time = scrollPositionInMs + playheadPositionInMs;
|
||||
if (audioVocalTrackGroup != null) audioVocalTrackGroup.time = scrollPositionInMs + playheadPositionInMs;
|
||||
|
||||
// Update the songPosition in the Conductor.
|
||||
Conductor.update(audioInstTrack.time);
|
||||
|
||||
// We need to update the note sprites because we changed the scroll position.
|
||||
noteDisplayDirty = true;
|
||||
}
|
||||
|
|
|
@ -136,6 +136,18 @@ class ChartEditorToolboxHandler
|
|||
}
|
||||
}
|
||||
|
||||
public static function rememberOpenToolboxes(state:ChartEditorState):Void {}
|
||||
|
||||
public static function openRememberedToolboxes(state:ChartEditorState):Void {}
|
||||
|
||||
public static function hideAllToolboxes(state:ChartEditorState):Void
|
||||
{
|
||||
for (toolbox in state.activeToolboxes.values())
|
||||
{
|
||||
toolbox.hideDialog(DialogButton.CANCEL);
|
||||
}
|
||||
}
|
||||
|
||||
public static function minimizeToolbox(state:ChartEditorState, id:String):Void
|
||||
{
|
||||
var toolbox:Null<CollapsibleDialog> = state.activeToolboxes.get(id);
|
||||
|
@ -634,9 +646,9 @@ class ChartEditorToolboxHandler
|
|||
timeChanges[0].bpm = event.value;
|
||||
}
|
||||
|
||||
Conductor.forceBPM(event.value);
|
||||
|
||||
state.currentSongMetadata.timeChanges = timeChanges;
|
||||
|
||||
Conductor.mapTimeChanges(state.currentSongMetadata.timeChanges);
|
||||
};
|
||||
inputBPM.value = state.currentSongMetadata.timeChanges[0].bpm;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package funkin.ui.story;
|
||||
|
||||
import funkin.util.SortUtil;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.util.FlxColor;
|
||||
import funkin.play.song.Song;
|
||||
|
@ -155,31 +156,7 @@ class Level implements IRegistryEntry<LevelData>
|
|||
}
|
||||
}
|
||||
|
||||
// sort the difficulties, since they may be out of order in the chart JSON
|
||||
// also copy/pasted to Song.listDifficulties()!
|
||||
var diffMap:Map<String, Int> = new Map<String, Int>();
|
||||
for (difficulty in difficulties)
|
||||
{
|
||||
var num:Int = 0;
|
||||
switch (difficulty)
|
||||
{
|
||||
case 'easy':
|
||||
num = 0;
|
||||
case 'normal':
|
||||
num = 1;
|
||||
case 'hard':
|
||||
num = 2;
|
||||
case 'erect':
|
||||
num = 3;
|
||||
case 'nightmare':
|
||||
num = 4;
|
||||
}
|
||||
diffMap.set(difficulty, num);
|
||||
}
|
||||
|
||||
difficulties.sort(function(a:String, b:String) {
|
||||
return diffMap.get(a) - diffMap.get(b);
|
||||
});
|
||||
difficulties.sort(SortUtil.defaultsThenAlphabetically.bind(Constants.DEFAULT_DIFFICULTY_LIST));
|
||||
|
||||
// Filter to only include difficulties that are present in all songs
|
||||
for (songIndex in 1...songList.length)
|
||||
|
|
|
@ -121,6 +121,11 @@ class Constants
|
|||
*/
|
||||
public static final DEFAULT_DIFFICULTY:String = 'normal';
|
||||
|
||||
/**
|
||||
* Default list of difficulties for charts.
|
||||
*/
|
||||
public static final DEFAULT_DIFFICULTY_LIST:Array<String> = ['easy', 'normal', 'hard'];
|
||||
|
||||
/**
|
||||
* Default player character for charts.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue