mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-12-02 11:44:23 +00:00
Merge pull request #280 from FunkinCrew/bugfix/song-data-offset-fix
Fix a freeplay crash and a Week 5 script error.
This commit is contained in:
commit
5dbed6d4dd
2
hmm.json
2
hmm.json
|
@ -149,7 +149,7 @@
|
|||
"name": "polymod",
|
||||
"type": "git",
|
||||
"dir": null,
|
||||
"ref": "80d1d309803c1b111866524f9769325e3b8b0b1b",
|
||||
"ref": "cb11a95d0159271eb3587428cf4b9602e46dc469",
|
||||
"url": "https://github.com/larsiusprime/polymod"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -38,10 +38,11 @@ class SongMetadata implements ICloneable<SongMetadata>
|
|||
public var looped:Bool;
|
||||
|
||||
/**
|
||||
* Instrumental and vocal offsets. Optional, defaults to 0.
|
||||
* Instrumental and vocal offsets.
|
||||
* Defaults to an empty SongOffsets object.
|
||||
*/
|
||||
@:optional
|
||||
public var offsets:SongOffsets;
|
||||
public var offsets:Null<SongOffsets>;
|
||||
|
||||
/**
|
||||
* Data relating to the song's gameplay.
|
||||
|
|
|
@ -12,6 +12,7 @@ import funkin.util.VersionUtil;
|
|||
|
||||
using funkin.data.song.migrator.SongDataMigrator;
|
||||
|
||||
@:nullSafety
|
||||
class SongRegistry extends BaseRegistry<Song, SongMetadata>
|
||||
{
|
||||
/**
|
||||
|
@ -31,7 +32,7 @@ class SongRegistry extends BaseRegistry<Song, SongMetadata>
|
|||
|
||||
public static final SONG_MUSIC_DATA_VERSION_RULE:thx.semver.VersionRule = "2.0.x";
|
||||
|
||||
public static var DEFAULT_GENERATEDBY(get, null):String;
|
||||
public static var DEFAULT_GENERATEDBY(get, never):String;
|
||||
|
||||
static function get_DEFAULT_GENERATEDBY():String
|
||||
{
|
||||
|
@ -88,7 +89,7 @@ class SongRegistry extends BaseRegistry<Song, SongMetadata>
|
|||
{
|
||||
try
|
||||
{
|
||||
var entry:Song = createEntry(entryId);
|
||||
var entry:Null<Song> = createEntry(entryId);
|
||||
if (entry != null)
|
||||
{
|
||||
trace(' Loaded entry data: ${entry}');
|
||||
|
@ -455,7 +456,7 @@ class SongRegistry extends BaseRegistry<Song, SongMetadata>
|
|||
{
|
||||
variation = variation == null ? Constants.DEFAULT_VARIATION : variation;
|
||||
var entryStr:Null<String> = loadEntryMetadataFile(id, variation)?.contents;
|
||||
var entryVersion:thx.semver.Version = VersionUtil.getVersionFromJSON(entryStr);
|
||||
var entryVersion:Null<thx.semver.Version> = VersionUtil.getVersionFromJSON(entryStr);
|
||||
return entryVersion;
|
||||
}
|
||||
|
||||
|
@ -463,7 +464,7 @@ class SongRegistry extends BaseRegistry<Song, SongMetadata>
|
|||
{
|
||||
variation = variation == null ? Constants.DEFAULT_VARIATION : variation;
|
||||
var entryStr:Null<String> = loadEntryChartFile(id, variation)?.contents;
|
||||
var entryVersion:thx.semver.Version = VersionUtil.getVersionFromJSON(entryStr);
|
||||
var entryVersion:Null<thx.semver.Version> = VersionUtil.getVersionFromJSON(entryStr);
|
||||
return entryVersion;
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ class Song implements IPlayStateScriptedClass implements IRegistryEntry<SongMeta
|
|||
difficulty.timeChanges = metadata.timeChanges;
|
||||
difficulty.looped = metadata.looped;
|
||||
difficulty.generatedBy = metadata.generatedBy;
|
||||
difficulty.offsets = metadata.offsets;
|
||||
difficulty.offsets = metadata?.offsets ?? new SongOffsets();
|
||||
|
||||
difficulty.difficultyRating = metadata.playData.ratings.get(diffId) ?? 0;
|
||||
difficulty.album = metadata.playData.album;
|
||||
|
|
Loading…
Reference in a new issue