What? Constants is evolving into Flags!
Co-Authored-By: Ne_Eo <NeeEoo@users.noreply.github.com>
This commit is contained in:
@@ -1,139 +0,0 @@
|
||||
package funkin;
|
||||
|
||||
import lime.app.Application;
|
||||
import funkin.backend.system.macros.GitCommitMacro;
|
||||
import flixel.util.FlxColor;
|
||||
|
||||
using StringTools;
|
||||
|
||||
@:build(funkin.backend.system.macros.ConstantsMacro.build())
|
||||
class Constants {
|
||||
// these arent good since someone could easily change through meta.set() - Nex
|
||||
// @:lazy public static var WINDOW_TITLE:String = Application.current.meta.get('name');
|
||||
// @:lazy public static var BUILD_FILENAME:String = Application.current.meta.get('file');
|
||||
// @:lazy public static var VERSION:String = Application.current.meta.get('version');
|
||||
|
||||
public static var COMMIT_NUMBER = GitCommitMacro.commitNumber;
|
||||
public static var COMMIT_HASH = GitCommitMacro.commitHash;
|
||||
public static var COMMIT_MESSAGE = 'Commit $COMMIT_NUMBER ($COMMIT_HASH)';
|
||||
@:lazy public static var VERSION_MESSAGE:String = 'Codename Engine v${Application.current.meta.get('version')}';
|
||||
|
||||
public static var REPO_NAME = "CodenameEngine";
|
||||
public static var REPO_OWNER = "FNF-CNE-Devs";
|
||||
|
||||
public static var REPO_URL:String = 'https://github.com/$REPO_OWNER/$REPO_NAME';
|
||||
|
||||
// make this empty once you guys are done with the project.
|
||||
// good luck /gen <3 @crowplexus
|
||||
public static var RELEASE_CYCLE:String = "Beta";
|
||||
|
||||
/**
|
||||
* Preferred sound extension for the game's audio files.
|
||||
* Currently is set to `mp3` for web targets, and `ogg` for other targets.
|
||||
*/
|
||||
public static var SOUND_EXT = #if web "mp3" #else "ogg" #end;
|
||||
public static var VIDEO_EXT = "mp4";
|
||||
public static var IMAGE_EXT = "png";
|
||||
|
||||
public static var DISCORD_LOGO_KEY = "icon";
|
||||
public static var DISCORD_CLIENT_ID = "1027994136193810442";
|
||||
public static var DISCORD_LOGO_TEXT = "Codename Engine";
|
||||
|
||||
public static var DEFAULT_CHARACTER = "bf";
|
||||
public static var DEFAULT_GIRLFRIEND = "gf";
|
||||
public static var DEFAULT_OPPONENT = "dad";
|
||||
|
||||
public static var DEFAULT_DIFFICULTY = "normal";
|
||||
public static var DEFAULT_STAGE = "stage";
|
||||
public static var DEFAULT_SCROLL_SPEED = 2.0;
|
||||
//public static var DEFAULT_NOTE_TYPE:String = null;
|
||||
public static var DEFAULT_HEALTH_ICON = "face";
|
||||
|
||||
public static var DEFAULT_BPM = 100.0;
|
||||
public static var DEFAULT_BEATS_PER_MEASURE = 4;
|
||||
public static var DEFAULT_STEPS_PER_BEAT = 4;
|
||||
|
||||
public static var SUPPORTED_CHART_RUNTIME_FORMATS = ["Legacy", "Psych Engine"];
|
||||
public static var SUPPORTED_CHART_FORMATS = ["BaseGame"];
|
||||
|
||||
public static var BASEGAME_SONG_METADATA_VERSION = "2.2.2";
|
||||
public static var BASEGAME_SONG_CHART_DATA_VERSION = "2.0.0";
|
||||
public static var BASEGAME_DEFAULT_NOTE_STYLE = 'funkin';
|
||||
public static var BASEGAME_DEFAULT_ALBUM_ID = 'volume1';
|
||||
public static var BASEGAME_DEFAULT_PREVIEW_START = 0;
|
||||
public static var BASEGAME_DEFAULT_PREVIEW_END = 15000;
|
||||
|
||||
public static var DEFAULT_COOP_ALLOWED = false;
|
||||
public static var DEFAULT_OPPONENT_MODE_ALLOWED = false;
|
||||
public static var DEFAULT_COOP_MODE = false; // used in playstate if it doesnt find it
|
||||
public static var DEFAULT_OPPONENT_MODE = false;
|
||||
|
||||
public static var DEFAULT_NOTE_MS_LIMIT:Float = 1500;
|
||||
|
||||
public static var DEFAULT_NOTE_SCALE = 0.7;
|
||||
|
||||
/**
|
||||
* Default background colors for songs without bg color
|
||||
*/
|
||||
public static var DEFAULT_COLOR:FlxColor = 0xFF9271FD;
|
||||
|
||||
public static var JSON_PRETTY_PRINT = "\t";
|
||||
|
||||
public static var UNDO_PREFIX = "* ";
|
||||
|
||||
// -- PlayState --
|
||||
|
||||
public static var DEFAULT_GAMEOVER_CHARACTER = "bf-dead";
|
||||
public static var DEFAULT_GAMEOVER_SONG = "gameOver";
|
||||
public static var DEFAULT_GAMEOVER_LOSS_SFX = "gameOverSFX";
|
||||
public static var DEFAULT_GAMEOVER_RETRY_SFX = "gameOverEnd";
|
||||
|
||||
public static var DEFAULT_CAM_ZOOM_INTERVAL = 4;
|
||||
public static var DEFAULT_CAM_ZOOM_STRENGTH = 1;
|
||||
public static var DEFAULT_CAM_ZOOM = 1.05; // what zoom level it defaults to
|
||||
public static var DEFAULT_HUD_ZOOM = 1.0;
|
||||
public static var MAX_CAMERA_ZOOM = 1.35;
|
||||
|
||||
public static var DEFAULT_PAUSE_ITEMS = ['Resume', 'Restart Song', 'Change Controls', 'Change Options', 'Exit to menu', "Exit to charter"];
|
||||
public static var DEFAULT_CUTSCENE_PAUSE_ITEMS = ['Resume Cutscene', 'Skip Cutscene', 'Restart Cutscene', 'Exit to menu'];
|
||||
public static var DEFAULT_GITAROO = true;
|
||||
public static var GITAROO_CHANCE = 0.1;
|
||||
public static var DEFAULT_CAN_ACCESS_DEBUG_MENUS = true;
|
||||
public static var DEFAULT_MUTE_VOCALS_ON_MISS = true;
|
||||
|
||||
public static var DEFAULT_MAX_HEALTH = 2.0;
|
||||
public static var DEFAULT_HEALTH = DEFAULT_MAX_HEALTH / 2.0;
|
||||
|
||||
|
||||
public static var PIXEL_ART_SCALE = 6.0;
|
||||
|
||||
public static var DEFAULT_COMBO_GROUP_MAX_SIZE = 25;
|
||||
|
||||
public static var DEFAULT_STRUM_AMOUNT = 4;
|
||||
public static var DEFAULT_CAMERA_FOLLOW_SPEED = 0.04;
|
||||
|
||||
public static var ICON_OFFSET = 26;
|
||||
public static var ICON_LERP = 0.33;
|
||||
|
||||
public static var VOCAL_OFFSET_VIOLATION_THRESHOLD = 25;
|
||||
|
||||
public static var DEFAULT_CAM_ZOOM_LERP = 0.05;
|
||||
public static var DEFAULT_HUD_ZOOM_LERP = 0.05;
|
||||
|
||||
public static var BOP_ICON_SCALE = 1.2;
|
||||
|
||||
public static var CAM_BOP_STRENGTH = 0.015;
|
||||
public static var HUD_BOP_STRENGTH = 0.03;
|
||||
|
||||
|
||||
public static var MAX_SPLASHES = 8;
|
||||
|
||||
public static var STUNNED_TIME = 5 / 60;
|
||||
|
||||
// Usage: Codename Credits
|
||||
public static var MAIN_DEVS_COLOR:FlxColor = 0xFF9C35D5;
|
||||
public static var MIN_CONTRIBUTIONS_COLOR:FlxColor = 0xFFB4A7DA;
|
||||
|
||||
|
||||
public static var DEFAULT_NOTE_FIELDS:Array<String> = ["time", "id", "type", "sLen"];
|
||||
}
|
||||
@@ -27,7 +27,7 @@ class Paths
|
||||
return library != null ? '$library:assets/$library/$file' : 'assets/$file';
|
||||
|
||||
public static inline function video(key:String, ?ext:String)
|
||||
return getPath('videos/$key.${ext != null ? ext : Constants.VIDEO_EXT}');
|
||||
return getPath('videos/$key.${ext != null ? ext : Flags.VIDEO_EXT}');
|
||||
|
||||
public static inline function ndll(key:String)
|
||||
return getPath('ndlls/$key.ndll');
|
||||
@@ -60,32 +60,32 @@ class Paths
|
||||
return getPath('data/$key.ps1', library);
|
||||
|
||||
static public function sound(key:String, ?library:String, ?ext:String)
|
||||
return getPath('sounds/$key.${ext != null ? ext : Constants.SOUND_EXT}', library);
|
||||
return getPath('sounds/$key.${ext != null ? ext : Flags.SOUND_EXT}', library);
|
||||
|
||||
inline static public function soundRandom(key:String, min:Int, max:Int, ?library:String)
|
||||
return sound(key + FlxG.random.int(min, max), library);
|
||||
|
||||
inline static public function music(key:String, ?library:String, ?ext:String)
|
||||
return getPath('music/$key.${ext != null ? ext : Constants.SOUND_EXT}', library);
|
||||
return getPath('music/$key.${ext != null ? ext : Flags.SOUND_EXT}', library);
|
||||
|
||||
inline static public function voices(song:String, ?difficulty:String, ?prefix:String = "", ?ext:String) {
|
||||
if (difficulty == null) difficulty = Constants.DEFAULT_DIFFICULTY;
|
||||
if (ext == null) ext = Constants.SOUND_EXT;
|
||||
if (difficulty == null) difficulty = Flags.DEFAULT_DIFFICULTY;
|
||||
if (ext == null) ext = Flags.SOUND_EXT;
|
||||
song = song.toLowerCase();
|
||||
var diff = getPath('songs/$song/song/Voices$prefix-${difficulty.toLowerCase()}.${ext}', null);
|
||||
return OpenFlAssets.exists(diff) ? diff : getPath('songs/$song/song/Voices$prefix.${ext}', null);
|
||||
}
|
||||
|
||||
inline static public function inst(song:String, ?difficulty:String, ?prefix:String = "", ?ext:String) {
|
||||
if (difficulty == null) difficulty = Constants.DEFAULT_DIFFICULTY;
|
||||
if (ext == null) ext = Constants.SOUND_EXT;
|
||||
if (difficulty == null) difficulty = Flags.DEFAULT_DIFFICULTY;
|
||||
if (ext == null) ext = Flags.SOUND_EXT;
|
||||
song = song.toLowerCase();
|
||||
var diff = getPath('songs/$song/song/Inst$prefix-${difficulty.toLowerCase()}.${ext}', null);
|
||||
return OpenFlAssets.exists(diff) ? diff : getPath('songs/$song/song/Inst$prefix.${ext}', null);
|
||||
}
|
||||
|
||||
static public function image(key:String, ?library:String, checkForAtlas:Bool = false, ?ext:String) {
|
||||
if (ext == null) ext = Constants.IMAGE_EXT;
|
||||
if (ext == null) ext = Flags.IMAGE_EXT;
|
||||
if (checkForAtlas) {
|
||||
var atlasPath = getPath('images/$key/spritemap.$ext', library);
|
||||
var multiplePath = getPath('images/$key/1.$ext', library);
|
||||
@@ -112,7 +112,7 @@ class Paths
|
||||
|
||||
static public function chart(song:String, ?difficulty:String):String
|
||||
{
|
||||
difficulty = (difficulty != null ? difficulty : Constants.DEFAULT_DIFFICULTY).toLowerCase();
|
||||
difficulty = (difficulty != null ? difficulty : Flags.DEFAULT_DIFFICULTY).toLowerCase();
|
||||
song = song.toLowerCase();
|
||||
|
||||
return getPath('songs/$song/charts/$difficulty.json', null);
|
||||
@@ -161,19 +161,19 @@ class Paths
|
||||
return FlxAtlasFrames.fromSparrow(image(key, library, ext), file('images/$key.xml', library));
|
||||
|
||||
inline static public function getSparrowAtlasAlt(key:String, ?ext:String)
|
||||
return FlxAtlasFrames.fromSparrow('$key.${ext != null ? ext : Constants.IMAGE_EXT}', '$key.xml');
|
||||
return FlxAtlasFrames.fromSparrow('$key.${ext != null ? ext : Flags.IMAGE_EXT}', '$key.xml');
|
||||
|
||||
inline static public function getPackerAtlas(key:String, ?library:String, ?ext:String)
|
||||
return FlxAtlasFrames.fromSpriteSheetPacker(image(key, library, ext), file('images/$key.txt', library));
|
||||
|
||||
inline static public function getPackerAtlasAlt(key:String, ?ext:String)
|
||||
return FlxAtlasFrames.fromSpriteSheetPacker('$key.${ext != null ? ext : Constants.IMAGE_EXT}', '$key.txt');
|
||||
return FlxAtlasFrames.fromSpriteSheetPacker('$key.${ext != null ? ext : Flags.IMAGE_EXT}', '$key.txt');
|
||||
|
||||
inline static public function getAsepriteAtlas(key:String, ?library:String, ?ext:String)
|
||||
return FlxAtlasFrames.fromAseprite(image(key, library, ext), file('images/$key.json', library));
|
||||
|
||||
inline static public function getAsepriteAtlasAlt(key:String, ?ext:String)
|
||||
return FlxAtlasFrames.fromAseprite('$key.${ext != null ? ext : Constants.IMAGE_EXT}', '$key.json');
|
||||
return FlxAtlasFrames.fromAseprite('$key.${ext != null ? ext : Flags.IMAGE_EXT}', '$key.json');
|
||||
|
||||
inline static public function getAssetsRoot():String
|
||||
return ModsFolder.currentModFolder != null ? '${ModsFolder.modsPath}${ModsFolder.currentModFolder}' : './assets';
|
||||
@@ -205,7 +205,7 @@ class Paths
|
||||
*/
|
||||
static function loadFrames(path:String, Unique:Bool = false, Key:String = null, SkipAtlasCheck:Bool = false, ?Ext:String = null):FlxFramesCollection {
|
||||
var noExt = Path.withoutExtension(path);
|
||||
var ext = Ext != null ? Ext : Constants.IMAGE_EXT;
|
||||
var ext = Ext != null ? Ext : Flags.IMAGE_EXT;
|
||||
|
||||
if (Assets.exists('$noExt/1.${ext}')) {
|
||||
// MULTIPLE SPRITESHEETS!!
|
||||
|
||||
@@ -17,7 +17,7 @@ class BaseGameParser {
|
||||
result.customValues.timeChanges = data.timeChanges;
|
||||
var firstTimeChng:SwagTimeChange = data.timeChanges[0];
|
||||
result.bpm = firstTimeChng.bpm;
|
||||
result.beatsPerMeasure = firstTimeChng.b != null ? firstTimeChng.b : Constants.DEFAULT_BEATS_PER_MEASURE;
|
||||
result.beatsPerMeasure = firstTimeChng.b != null ? firstTimeChng.b : Flags.DEFAULT_BEATS_PER_MEASURE;
|
||||
|
||||
result.difficulties = data.playData.difficulties.concat(data.playData.songVariations);
|
||||
Reflect.deleteField(data.playData, "difficulties");
|
||||
@@ -28,8 +28,8 @@ class BaseGameParser {
|
||||
|
||||
public static function encodeMeta(meta:ChartMetaData, ?chart:ChartData):SwagMetadata {
|
||||
var addVars:Dynamic = meta.customValues;
|
||||
var defStage:String = addVars.stage != null ? addVars.stage : Constants.DEFAULT_STAGE;
|
||||
var defChars:SwagCharactersList = addVars.characters != null ? addVars.characters : {player: Constants.DEFAULT_CHARACTER, girlfriend: Constants.DEFAULT_GIRLFRIEND, opponent: Constants.DEFAULT_OPPONENT};
|
||||
var defStage:String = addVars.stage != null ? addVars.stage : Flags.DEFAULT_STAGE;
|
||||
var defChars:SwagCharactersList = addVars.characters != null ? addVars.characters : {player: Flags.DEFAULT_CHARACTER, girlfriend: Flags.DEFAULT_GIRLFRIEND, opponent: Flags.DEFAULT_OPPONENT};
|
||||
var defTimeCh:Array<SwagTimeChange>;
|
||||
|
||||
if (addVars.timeChanges != null && addVars.timeChanges.length > 0) {
|
||||
@@ -68,16 +68,16 @@ class BaseGameParser {
|
||||
timeChanges: defTimeCh,
|
||||
looped: false,
|
||||
generatedBy: 'Basegame Chart Importer (Codename Engine)',
|
||||
version: Constants.BASEGAME_SONG_METADATA_VERSION,
|
||||
version: Flags.BASEGAME_SONG_METADATA_VERSION,
|
||||
playData: {
|
||||
stage: defStage,
|
||||
characters: defChars,
|
||||
songVariations: addVars.songVariations != null ? [for (i in 0...addVars.songVariations.length) {meta.difficulties.remove(addVars.songVariations[i]); addVars.songVariations[i];}] : [],
|
||||
difficulties: meta.difficulties,
|
||||
noteStyle: addVars.noteStyle != null ? addVars.noteStyle : Constants.BASEGAME_DEFAULT_NOTE_STYLE,
|
||||
album: addVars.album != null ? addVars.album : Constants.BASEGAME_DEFAULT_ALBUM_ID,
|
||||
previewStart: addVars.previewStart != null ? addVars.previewStart : Constants.BASEGAME_DEFAULT_PREVIEW_START,
|
||||
previewEnd: addVars.previewEnd != null ? addVars.previewEnd : Constants.BASEGAME_DEFAULT_PREVIEW_END
|
||||
noteStyle: addVars.noteStyle != null ? addVars.noteStyle : Flags.BASEGAME_DEFAULT_NOTE_STYLE,
|
||||
album: addVars.album != null ? addVars.album : Flags.BASEGAME_DEFAULT_ALBUM_ID,
|
||||
previewStart: addVars.previewStart != null ? addVars.previewStart : Flags.BASEGAME_DEFAULT_PREVIEW_START,
|
||||
previewEnd: addVars.previewEnd != null ? addVars.previewEnd : Flags.BASEGAME_DEFAULT_PREVIEW_END
|
||||
},
|
||||
};
|
||||
|
||||
@@ -127,8 +127,8 @@ typedef SwagTimeChange =
|
||||
typedef SwagPlayData =
|
||||
{
|
||||
var album:String;
|
||||
var previewStart:Int;
|
||||
var previewEnd:Int;
|
||||
var previewStart:Float;
|
||||
var previewEnd:Float;
|
||||
var stage:String;
|
||||
var characters:SwagCharactersList;
|
||||
var songVariations:Array<String>;
|
||||
|
||||
@@ -26,7 +26,7 @@ class Chart {
|
||||
}
|
||||
|
||||
public static function loadChartMeta(songName:String, ?difficulty:String, fromMods:Bool = true) {
|
||||
if (difficulty == null) difficulty = Constants.DEFAULT_DIFFICULTY;
|
||||
if (difficulty == null) difficulty = Flags.DEFAULT_DIFFICULTY;
|
||||
|
||||
var metaPath = Paths.file('songs/${songName.toLowerCase()}/meta.json');
|
||||
var metaDiffPath = Paths.file('songs/${songName.toLowerCase()}/meta-${difficulty.toLowerCase()}.json');
|
||||
@@ -47,19 +47,19 @@ class Chart {
|
||||
|
||||
if (data == null)
|
||||
data = {
|
||||
name: songName,
|
||||
bpm: Constants.DEFAULT_BPM
|
||||
name: songName
|
||||
};
|
||||
data.setFieldDefault("name", songName);
|
||||
data.setFieldDefault("beatsPerMeasure", Constants.DEFAULT_BEATS_PER_MEASURE);
|
||||
data.setFieldDefault("stepsPerBeat", Constants.DEFAULT_STEPS_PER_BEAT);
|
||||
data.setFieldDefault("bpm", Flags.DEFAULT_BPM);
|
||||
data.setFieldDefault("beatsPerMeasure", Flags.DEFAULT_BEATS_PER_MEASURE);
|
||||
data.setFieldDefault("stepsPerBeat", Flags.DEFAULT_STEPS_PER_BEAT);
|
||||
data.setFieldDefault("needsVoices", true);
|
||||
data.setFieldDefault("icon", Constants.DEFAULT_HEALTH_ICON);
|
||||
data.setFieldDefault("icon", Flags.DEFAULT_HEALTH_ICON);
|
||||
data.setFieldDefault("difficulties", []);
|
||||
data.setFieldDefault("coopAllowed", Constants.DEFAULT_COOP_ALLOWED);
|
||||
data.setFieldDefault("opponentModeAllowed", Constants.DEFAULT_OPPONENT_MODE_ALLOWED);
|
||||
data.setFieldDefault("coopAllowed", Flags.DEFAULT_COOP_ALLOWED);
|
||||
data.setFieldDefault("opponentModeAllowed", Flags.DEFAULT_OPPONENT_MODE_ALLOWED);
|
||||
data.setFieldDefault("displayName", data.name);
|
||||
data.setFieldDefault("parsedColor", data.color.getColorFromDynamic().getDefault(Constants.DEFAULT_COLOR));
|
||||
data.setFieldDefault("parsedColor", data.color.getColorFromDynamic().getDefault(Flags.DEFAULT_COLOR));
|
||||
|
||||
if (data.difficulties.length <= 0) {
|
||||
data.difficulties = [for(f in Paths.getFolderContent('songs/${songName.toLowerCase()}/charts/', false, fromMods ? MODS : SOURCE)) if (Path.extension(f = f.toUpperCase()) == "JSON") Path.withoutExtension(f)];
|
||||
@@ -84,7 +84,7 @@ class Chart {
|
||||
}
|
||||
|
||||
public static function parse(songName:String, ?difficulty:String):ChartData {
|
||||
if (difficulty == null) difficulty = Constants.DEFAULT_DIFFICULTY;
|
||||
if (difficulty == null) difficulty = Flags.DEFAULT_DIFFICULTY;
|
||||
|
||||
var chartPath = Paths.chart(songName, difficulty);
|
||||
var base:ChartData = {
|
||||
@@ -94,8 +94,8 @@ class Chart {
|
||||
meta: {
|
||||
name: null
|
||||
},
|
||||
scrollSpeed: Constants.DEFAULT_SCROLL_SPEED ,
|
||||
stage: Constants.DEFAULT_STAGE,
|
||||
scrollSpeed: Flags.DEFAULT_SCROLL_SPEED,
|
||||
stage: Flags.DEFAULT_STAGE,
|
||||
codenameChart: true,
|
||||
fromMods: Paths.assetsTree.existsSpecific(chartPath, "TEXT", MODS)
|
||||
};
|
||||
@@ -192,7 +192,7 @@ class Chart {
|
||||
* @return Filtered chart used for saving.
|
||||
*/
|
||||
public static function save(songFolderPath:String, chart:ChartData, ?difficulty:String, ?saveSettings:ChartSaveSettings):ChartData {
|
||||
if (difficulty == null) difficulty = Constants.DEFAULT_DIFFICULTY;
|
||||
if (difficulty == null) difficulty = Flags.DEFAULT_DIFFICULTY;
|
||||
if (saveSettings == null) saveSettings = {};
|
||||
|
||||
if (saveSettings.saveMetaInChart == null) saveSettings.saveMetaInChart = true;
|
||||
@@ -210,11 +210,11 @@ class Chart {
|
||||
var chartPath = '${songFolderPath}/$saveFolder/${difficulty.trim()}.json';
|
||||
var metaPath = '${songFolderPath}/meta.json';
|
||||
|
||||
CoolUtil.safeSaveFile(chartPath, Json.stringify(filteredChart, null, saveSettings.prettyPrint == true ? Constants.JSON_PRETTY_PRINT : null));
|
||||
CoolUtil.safeSaveFile(chartPath, Json.stringify(filteredChart, null, saveSettings.prettyPrint == true ? Flags.JSON_PRETTY_PRINT : null));
|
||||
|
||||
// idk how null reacts to it so better be sure
|
||||
if (saveSettings.overrideExistingMeta == true || !FileSystem.exists(metaPath))
|
||||
CoolUtil.safeSaveFile(metaPath, Json.stringify(meta, null, saveSettings.prettyPrint == true ? Constants.JSON_PRETTY_PRINT : null));
|
||||
CoolUtil.safeSaveFile(metaPath, Json.stringify(meta, null, saveSettings.prettyPrint == true ? Flags.JSON_PRETTY_PRINT : null));
|
||||
#end
|
||||
return filteredChart;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class FNFLegacyParser {
|
||||
|
||||
var camFocusedBF:Bool = false;
|
||||
var altAnims:Bool = false;
|
||||
var beatsPerMeasure:Float = data.beatsPerMeasure.getDefault(Constants.DEFAULT_BEATS_PER_MEASURE);
|
||||
var beatsPerMeasure:Float = data.beatsPerMeasure.getDefault(Flags.DEFAULT_BEATS_PER_MEASURE);
|
||||
var curBPM:Float = data.bpm;
|
||||
var curTime:Float = 0;
|
||||
var curCrochet:Float = ((60 / curBPM) * 1000);
|
||||
@@ -132,10 +132,10 @@ class FNFLegacyParser {
|
||||
if ((swagSection.mustHitSection && strumLine.type == OPPONENT) ||
|
||||
(!swagSection.mustHitSection && strumLine.type == PLAYER))
|
||||
sectionNote[1] += 4;
|
||||
swagSection.sectionNotes.push(sectionNote);
|
||||
swagSection.sectionNotes.push(sectionNote);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return {song: base};
|
||||
}
|
||||
|
||||
@@ -156,9 +156,9 @@ class FNFLegacyParser {
|
||||
for (strumLine in chart.strumLines)
|
||||
switch (strumLine.type) {
|
||||
case OPPONENT:
|
||||
if (base.player2 == null) base.player2 = strumLine.characters.getDefault([Constants.DEFAULT_OPPONENT])[0];
|
||||
if (base.player2 == null) base.player2 = strumLine.characters.getDefault([Flags.DEFAULT_OPPONENT])[0];
|
||||
case PLAYER:
|
||||
if (base.player1 == null) base.player1 = strumLine.characters.getDefault([Constants.DEFAULT_CHARACTER])[0];
|
||||
if (base.player1 == null) base.player1 = strumLine.characters.getDefault([Flags.DEFAULT_CHARACTER])[0];
|
||||
case ADDITIONAL: // do nothing
|
||||
}
|
||||
|
||||
|
||||
@@ -54,8 +54,8 @@ class Script extends FlxBasic implements IFlxDestroyable {
|
||||
|
||||
// Engine related stuff
|
||||
"engine" => {
|
||||
commit: Constants.COMMIT_NUMBER,
|
||||
hash: Constants.COMMIT_HASH,
|
||||
commit: Flags.COMMIT_NUMBER,
|
||||
hash: Flags.COMMIT_HASH,
|
||||
build: 2675, // 2675 being the last build num before it was removed
|
||||
name: "Codename Engine"
|
||||
},
|
||||
@@ -101,7 +101,7 @@ class Script extends FlxBasic implements IFlxDestroyable {
|
||||
defines.set("CODENAME_ENGINE", true);
|
||||
defines.set("CODENAME_VER", Application.current.meta.get('version'));
|
||||
defines.set("CODENAME_BUILD", 2675); // 2675 being the last build num before it was removed
|
||||
defines.set("CODENAME_COMMIT", Constants.COMMIT_NUMBER);
|
||||
defines.set("CODENAME_COMMIT", Flags.COMMIT_NUMBER);
|
||||
return defines;
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,7 @@ class Conductor
|
||||
/**
|
||||
* Current BPM
|
||||
*/
|
||||
public static var bpm:Float = Constants.DEFAULT_BPM;
|
||||
public static var bpm:Float = 100;
|
||||
|
||||
/**
|
||||
* Current Crochet (time per beat), in milliseconds.
|
||||
|
||||
@@ -2,7 +2,10 @@ package funkin.backend.system;
|
||||
|
||||
import lime.utils.AssetLibrary;
|
||||
import lime.utils.AssetType;
|
||||
import flixel.util.FlxColor;
|
||||
|
||||
import lime.app.Application;
|
||||
import funkin.backend.system.macros.GitCommitMacro;
|
||||
import funkin.backend.assets.IModsAssetLibrary;
|
||||
import funkin.backend.assets.ScriptedAssetLibrary;
|
||||
|
||||
@@ -11,11 +14,129 @@ import funkin.backend.assets.ScriptedAssetLibrary;
|
||||
*/
|
||||
@:build(funkin.backend.system.macros.FlagMacro.build())
|
||||
class Flags {
|
||||
// -- Codename's Default Flags --
|
||||
public static var COMMIT_NUMBER:Int = GitCommitMacro.commitNumber;
|
||||
public static var COMMIT_HASH:String = GitCommitMacro.commitHash;
|
||||
public static var COMMIT_MESSAGE:String = 'Commit $COMMIT_NUMBER ($COMMIT_HASH)';
|
||||
@:lazy public static var VERSION_MESSAGE:String = 'Codename Engine v${Application.current.meta.get('version')}';
|
||||
|
||||
public static var REPO_NAME:String = "CodenameEngine";
|
||||
public static var REPO_OWNER:String = "FNF-CNE-Devs";
|
||||
public static var REPO_URL:String = 'https://github.com/$REPO_OWNER/$REPO_NAME';
|
||||
|
||||
// make this empty once you guys are done with the project.
|
||||
// good luck /gen <3 @crowplexus
|
||||
public static var RELEASE_CYCLE:String = "Beta";
|
||||
|
||||
/**
|
||||
* Preferred sound extension for the game's audio files.
|
||||
* Currently is set to `mp3` for web targets, and `ogg` for other targets.
|
||||
*/
|
||||
public static var SOUND_EXT:String = #if web "mp3" #else "ogg" #end; // we also support wav
|
||||
public static var VIDEO_EXT:String = "mp4";
|
||||
public static var IMAGE_EXT:String = "png"; // we also support jpg
|
||||
|
||||
public static var DEFAULT_DISCORD_LOGO_KEY:String = "icon";
|
||||
public static var DEFAULT_DISCORD_CLIENT_ID:String = "1027994136193810442";
|
||||
public static var DEFAULT_DISCORD_LOGO_TEXT:String = "Codename Engine";
|
||||
|
||||
@:also(funkin.game.Character.FALLBACK_CHARACTER)
|
||||
public static var DEFAULT_CHARACTER:String = "bf";
|
||||
public static var DEFAULT_GIRLFRIEND:String = "gf";
|
||||
public static var DEFAULT_OPPONENT:String = "dad";
|
||||
|
||||
@:also(funkin.game.PlayState.difficulty)
|
||||
public static var DEFAULT_DIFFICULTY:String = "normal";
|
||||
public static var DEFAULT_STAGE:String = "stage";
|
||||
public static var DEFAULT_SCROLL_SPEED:Float = 2.0;
|
||||
public static var DEFAULT_HEALTH_ICON:String = "face";
|
||||
|
||||
public static var SONGS_LIST_MOD_MODE:Allow<"prepend", "override", "append"> = "override";
|
||||
public static var WEEKS_LIST_MOD_MODE:Allow<"prepend", "override", "append"> = "override";
|
||||
|
||||
// Internal stuff
|
||||
public static var DEFAULT_BPM:Float = 100.0;
|
||||
public static var DEFAULT_BEATS_PER_MEASURE:Int = 4;
|
||||
public static var DEFAULT_STEPS_PER_BEAT:Int = 4;
|
||||
|
||||
public static var SUPPORTED_CHART_RUNTIME_FORMATS:Array<String> = ["Legacy", "Psych Engine"];
|
||||
public static var SUPPORTED_CHART_FORMATS:Array<String> = ["BaseGame"];
|
||||
|
||||
public static var BASEGAME_SONG_METADATA_VERSION:String = "2.2.2";
|
||||
public static var BASEGAME_SONG_CHART_DATA_VERSION:String = "2.0.0";
|
||||
public static var BASEGAME_DEFAULT_NOTE_STYLE:String = 'funkin';
|
||||
public static var BASEGAME_DEFAULT_ALBUM_ID:String = 'volume1';
|
||||
public static var BASEGAME_DEFAULT_PREVIEW_START:Float = 0;
|
||||
public static var BASEGAME_DEFAULT_PREVIEW_END:Float = 15000;
|
||||
|
||||
/**
|
||||
* Default background colors for songs without bg color
|
||||
*/
|
||||
public static var DEFAULT_COLOR:FlxColor = 0xFF9271FD;
|
||||
public static var DEFAULT_COOP_ALLOWED:Bool = false;
|
||||
public static var DEFAULT_OPPONENT_MODE_ALLOWED:Bool = false;
|
||||
|
||||
@:also(funkin.game.PlayState.coopMode)
|
||||
public static var DEFAULT_COOP_MODE:Bool = false; // used in playstate if it doesnt find it
|
||||
@:also(funkin.game.PlayState.opponentMode)
|
||||
public static var DEFAULT_OPPONENT_MODE:Bool = false;
|
||||
|
||||
public static var DEFAULT_NOTE_MS_LIMIT:Float = 1500;
|
||||
public static var DEFAULT_NOTE_SCALE:Float = 0.7;
|
||||
|
||||
@:also(funkin.game.Character.FALLBACK_DEAD_CHARACTER)
|
||||
public static var DEFAULT_GAMEOVER_CHARACTER:String = "bf-dead";
|
||||
public static var DEFAULT_GAMEOVER_SONG:String = "gameOver";
|
||||
public static var DEFAULT_GAMEOVER_LOSS_SFX:String = "gameOverSFX";
|
||||
public static var DEFAULT_GAMEOVER_RETRY_SFX:String = "gameOverEnd";
|
||||
|
||||
public static var DEFAULT_CAM_ZOOM_INTERVAL:Int = 4;
|
||||
public static var DEFAULT_CAM_ZOOM_STRENGTH:Int = 1;
|
||||
public static var DEFAULT_CAM_ZOOM:Float = 1.05; // what zoom level it defaults to
|
||||
public static var DEFAULT_HUD_ZOOM:Float = 1.0;
|
||||
public static var MAX_CAMERA_ZOOM:Float = 1.35;
|
||||
|
||||
public static var DEFAULT_PAUSE_ITEMS:Array<String> = ['Resume', 'Restart Song', 'Change Controls', 'Change Options', 'Exit to menu', "Exit to charter"];
|
||||
public static var DEFAULT_CUTSCENE_PAUSE_ITEMS:Array<String> = ['Resume Cutscene', 'Skip Cutscene', 'Restart Cutscene', 'Exit to menu'];
|
||||
public static var DEFAULT_GITAROO:Bool = true;
|
||||
public static var GITAROO_CHANCE:Float = 0.1;
|
||||
public static var DEFAULT_CAN_ACCESS_DEBUG_MENUS:Bool = true;
|
||||
public static var DEFAULT_MUTE_VOCALS_ON_MISS:Bool = true;
|
||||
|
||||
public static var DEFAULT_MAX_HEALTH:Float = 2.0;
|
||||
public static var DEFAULT_HEALTH:Null<Float> = null;//DEFAULT_MAX_HEALTH / 2.0;
|
||||
public static var BOP_ICON_SCALE:Float = 1.2;
|
||||
public static var ICON_OFFSET:Float = 26;
|
||||
public static var ICON_LERP:Float = 0.33;
|
||||
|
||||
public static var CAM_BOP_STRENGTH:Float = 0.015;
|
||||
public static var HUD_BOP_STRENGTH:Float = 0.03;
|
||||
public static var DEFAULT_CAM_ZOOM_LERP:Float = 0.05;
|
||||
public static var DEFAULT_HUD_ZOOM_LERP:Float = 0.05;
|
||||
|
||||
public static var MAX_SPLASHES:Int = 8;
|
||||
public static var STUNNED_TIME:Float = 5 / 60;
|
||||
|
||||
@:also(funkin.game.PlayState.daPixelZoom)
|
||||
public static var PIXEL_ART_SCALE:Float = 6.0;
|
||||
|
||||
public static var DEFAULT_COMBO_GROUP_MAX_SIZE:Int = 25;
|
||||
|
||||
public static var DEFAULT_STRUM_AMOUNT:Int = 4;
|
||||
public static var DEFAULT_CAMERA_FOLLOW_SPEED:Float = 0.04;
|
||||
|
||||
public static var VOCAL_OFFSET_VIOLATION_THRESHOLD:Float = 25;
|
||||
|
||||
// Usage: Codename Credits
|
||||
public static var MAIN_DEVS_COLOR:FlxColor = 0xFF9C35D5;
|
||||
public static var MIN_CONTRIBUTIONS_COLOR:FlxColor = 0xFFB4A7DA;
|
||||
|
||||
public static var UNDO_PREFIX:String = "* ";
|
||||
public static var JSON_PRETTY_PRINT:String = "\t";
|
||||
// -- End of Codename's Default Flags --
|
||||
|
||||
/**
|
||||
* Flags that Codename couldn't recognize as it's own defaults (they can only be `string`!).
|
||||
*/
|
||||
@:bypass public static var customFlags:Map<String, String> = [];
|
||||
|
||||
public static function load() {
|
||||
|
||||
@@ -165,7 +165,8 @@ class Main extends Sprite
|
||||
public static function refreshAssets() @:privateAccess {
|
||||
WindowUtils.resetTitle();
|
||||
|
||||
var game = FlxG.game; var daSndTray = Type.createInstance(game._customSoundTray = funkin.menus.ui.FunkinSoundTray, []);
|
||||
var game = FlxG.game;
|
||||
var daSndTray = Type.createInstance(game._customSoundTray = funkin.menus.ui.FunkinSoundTray, []);
|
||||
var index:Int = game.numChildren - 1;
|
||||
|
||||
if(game.soundTray != null)
|
||||
|
||||
@@ -19,12 +19,10 @@ class MainState extends FlxState {
|
||||
public override function create() {
|
||||
super.create();
|
||||
if (!initiated) {
|
||||
Constants.init();
|
||||
Main.loadGameSettings();
|
||||
}
|
||||
|
||||
initiated = true;
|
||||
Constants.reset();
|
||||
|
||||
#if sys
|
||||
CoolUtil.deleteFolder('./.temp/'); // delete temp folder
|
||||
@@ -58,9 +56,9 @@ class MainState extends FlxState {
|
||||
}
|
||||
#end
|
||||
|
||||
Main.refreshAssets();
|
||||
ModsFolder.onModSwitch.dispatch(ModsFolder.currentModFolder);
|
||||
Flags.load();
|
||||
ModsFolder.onModSwitch.dispatch(ModsFolder.currentModFolder); // Loads global.hx
|
||||
Main.refreshAssets();
|
||||
DiscordUtil.init();
|
||||
EventsData.reloadEvents();
|
||||
TitleState.initialized = false;
|
||||
@@ -75,6 +73,8 @@ class MainState extends FlxState {
|
||||
betaWarningShown = true;
|
||||
}
|
||||
|
||||
#if sys
|
||||
CoolUtil.safeAddAttributes('./.temp/', NativeAPI.FileAttribute.HIDDEN);
|
||||
#end
|
||||
}
|
||||
}
|
||||
@@ -13,5 +13,5 @@ class CodenameBuildField extends TextField {
|
||||
}
|
||||
|
||||
public function reload()
|
||||
text = 'Codename Engine ${Constants.RELEASE_CYCLE}\n${Constants.COMMIT_MESSAGE}';
|
||||
text = 'Codename Engine ${Flags.RELEASE_CYCLE}\n${Flags.COMMIT_MESSAGE}';
|
||||
}
|
||||
|
||||
@@ -6,13 +6,21 @@ using StringTools;
|
||||
class BuildInfo {
|
||||
public static function printBuildInfo() {
|
||||
if(haxe.macro.Context.defined("display")) return;
|
||||
var haxeVersion = haxe.macro.Context.definedValue("haxe");
|
||||
var haxeVersion = haxe.macro.Context.definedValue("haxe").trim();
|
||||
Sys.println('[ BUILD INFO ]');
|
||||
Sys.println('Haxe Version: ${haxeVersion}');
|
||||
try {
|
||||
var lastBuiltWith:Null<String> = null;
|
||||
var compiling = #if final "final" #elseif debug "debug" #else "release" #end;
|
||||
var target = #if windows "windows" #elseif mac "macos" #elseif linux "linux" #elseif android "android" #elseif ios "ios" #elseif html5 "html5" #else "" #end;
|
||||
var compiling = #if final "release" #elseif debug "debug" #else "release" #end;
|
||||
var target = #if hl "hl"
|
||||
#elseif html5 "html5"
|
||||
#elseif ios "ios"
|
||||
#elseif android "android"
|
||||
#elseif windows "windows"
|
||||
#elseif (mac || macos) "macos"
|
||||
#elseif linux "linux"
|
||||
#else ""
|
||||
#end;
|
||||
if(target == "") throw "Unknown target";
|
||||
var exportPath = Sys.getCwd() + "/export/" + compiling + "/" + target + "/";
|
||||
exportPath += "obj/Options.txt";
|
||||
@@ -20,23 +28,27 @@ class BuildInfo {
|
||||
var options = sys.io.File.getContent(exportPath);
|
||||
for(option in options.split("\n")) {
|
||||
if(option.startsWith("haxe=")) {
|
||||
lastBuiltWith = option.substr(5);
|
||||
lastBuiltWith = option.substr(5).trim();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(lastBuiltWith != null && lastBuiltWith != haxeVersion)
|
||||
if(lastBuiltWith != null && lastBuiltWith.length > 0 && lastBuiltWith != haxeVersion)
|
||||
Sys.println('Last Built With Haxe: ${lastBuiltWith} [!!!! MAKE SURE IF YOU SWITCHED VERSIONS YOU DELETE EXPORT FOLDERS !!!!]');
|
||||
} catch(e) {}
|
||||
Sys.println('Target Platform: ${
|
||||
#if windows "Windows"
|
||||
#elseif mac "Mac"
|
||||
#elseif linux "Linux"
|
||||
#elseif android "Android"
|
||||
var targetPlatform = #if html5 "Web (HTML5)"
|
||||
#elseif ios "iOS"
|
||||
#elseif android "Android"
|
||||
#elseif windows "Windows"
|
||||
#elseif (mac || macos) "Mac"
|
||||
#elseif linux "Linux"
|
||||
#else "Unknown"
|
||||
#end
|
||||
}');
|
||||
#end;
|
||||
|
||||
if(haxe.macro.Context.defined("hl")) {
|
||||
targetPlatform = "Hashlink (" + targetPlatform + ")";
|
||||
}
|
||||
Sys.println('Target Platform: ' + targetPlatform);
|
||||
Sys.println('Build Date: ${Date.now().toString()}');
|
||||
Sys.println('');
|
||||
}
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
package funkin.backend.system.macros;
|
||||
|
||||
#if macro
|
||||
import haxe.macro.Context;
|
||||
import haxe.macro.Expr;
|
||||
#end
|
||||
|
||||
class ConstantsMacro {
|
||||
#if macro
|
||||
static function build() {
|
||||
var fields = Context.getBuildFields();
|
||||
|
||||
var resetFields:Array<Expr> = [];
|
||||
var lazyFields:Array<Expr> = [];
|
||||
for(field in fields) {
|
||||
switch(field.kind) {
|
||||
case FVar(t, e):
|
||||
resetFields.push(macro $i{field.name} = ${e});
|
||||
|
||||
var hasLazy = false;
|
||||
for(meta in field.meta) {
|
||||
if(meta.name == ":lazy") {
|
||||
hasLazy = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(hasLazy) {
|
||||
lazyFields.push(macro $i{field.name} = ${e});
|
||||
field.kind = FVar(t, null);
|
||||
}
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
fields.push({
|
||||
name: "reset",
|
||||
pos: Context.currentPos(),
|
||||
access: [APublic, AStatic],
|
||||
kind: FFun({
|
||||
args: [],
|
||||
ret: null,
|
||||
expr: macro {
|
||||
$b{resetFields}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
fields.push({
|
||||
name: "init",
|
||||
pos: Context.currentPos(),
|
||||
access: [APublic, AStatic],
|
||||
kind: FFun({
|
||||
args: [],
|
||||
ret: null,
|
||||
expr: macro {
|
||||
$b{lazyFields}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
return fields;
|
||||
}
|
||||
#end
|
||||
}
|
||||
@@ -7,7 +7,18 @@ using StringTools;
|
||||
|
||||
using haxe.macro.Tools;
|
||||
|
||||
using funkin.backend.system.macros.FlagMacro;
|
||||
|
||||
class FlagMacro {
|
||||
private static function hasMeta(meta:Array<MetadataEntry>, name:String):Bool {
|
||||
for(m in meta) {
|
||||
if(m.name == name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function build():Array<Field> {
|
||||
var fields = Context.getBuildFields();
|
||||
|
||||
@@ -21,26 +32,50 @@ class FlagMacro {
|
||||
var parserExprs:Array<Expr> = [];
|
||||
|
||||
for (field in fields) {
|
||||
var skip = false;
|
||||
for(meta in field.meta) {
|
||||
if(meta.name == ":bypass") {
|
||||
skip = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var skip = field.meta.hasMeta(":bypass");
|
||||
var hasLazy = field.meta.hasMeta(":lazy");
|
||||
|
||||
if(skip) continue;
|
||||
|
||||
switch (field.kind) {
|
||||
case FVar(type, expr):
|
||||
var isNullable = false;
|
||||
switch(type) {
|
||||
case TPath({name: "Null", pack: [], params: [TPType(p)]}):
|
||||
type = p;
|
||||
isNullable = true;
|
||||
default:
|
||||
}
|
||||
|
||||
var alsos:Array<Expr> = [];
|
||||
for(meta in field.meta) {
|
||||
if(meta.name == ":also") {
|
||||
for(param in meta.params) {
|
||||
switch(param.expr) {
|
||||
case EField(_, _):
|
||||
alsos.push(param);
|
||||
default:
|
||||
Context.error("Invalid :also parameter", param.pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(expr == null)
|
||||
Context.error('Flag ' + field.name + ' must have a default value', field.pos);
|
||||
switch(expr.expr) {
|
||||
case EConst(CIdent("true")) | EConst(CIdent("false")):
|
||||
type = macro: Bool;
|
||||
default:
|
||||
if(type == null)
|
||||
if(type == null) {
|
||||
switch(expr.expr) {
|
||||
case EConst(CIdent("true")) | EConst(CIdent("false")):
|
||||
type = macro: Bool;
|
||||
case EConst(CInt(_)):
|
||||
type = macro: Int;
|
||||
case EConst(CFloat(_)):
|
||||
type = macro: Float;
|
||||
case EConst(CString(_)):
|
||||
type = macro: String;
|
||||
default:
|
||||
Context.error('Flag ' + field.name + ' must have a type', field.pos);
|
||||
}
|
||||
}
|
||||
|
||||
var parser:Expr = null;
|
||||
@@ -52,7 +87,7 @@ class FlagMacro {
|
||||
parser = macro value.split(",").map((e) -> e.trim());
|
||||
case macro: Array<String>:
|
||||
parser = macro value.split(",");
|
||||
case macro: Array<Int>:
|
||||
case (macro: Array<Int>) | (macro: Array<FlxColor>):
|
||||
parser = macro value.split(",").map((e) -> Std.parseInt(e));
|
||||
case macro: Array<Float>:
|
||||
parser = macro value.split(",").map((e) -> Std.parseFloat(e));
|
||||
@@ -61,12 +96,15 @@ class FlagMacro {
|
||||
e = e.trim();
|
||||
e == "true" || e == "t" || e == "1";
|
||||
});
|
||||
case macro: Int:
|
||||
case macro: TrimmedString:
|
||||
field.kind = FVar(macro: String, expr);
|
||||
parser = macro value.trim();
|
||||
case macro: String:
|
||||
parser = macro value;
|
||||
case (macro: Int) | (macro: FlxColor):
|
||||
parser = macro Std.parseInt(value);
|
||||
case macro: Float:
|
||||
parser = macro Std.parseFloat(value);
|
||||
case macro: String:
|
||||
parser = macro value;
|
||||
case macro: Bool:
|
||||
parser = macro value == "true" || value == "t" || value == "1";
|
||||
case TPath({name: "Allow", pack: [], params: params}):
|
||||
@@ -128,8 +166,7 @@ class FlagMacro {
|
||||
if(chosenType == STRING) {
|
||||
parser = macro value;
|
||||
field.kind = FVar(macro: String, expr);
|
||||
}
|
||||
else if(chosenType == INT) {
|
||||
} else if(chosenType == INT) {
|
||||
parser = macro Std.parseInt(value);
|
||||
field.kind = FVar(macro: Int, expr);
|
||||
} else {
|
||||
@@ -147,7 +184,7 @@ class FlagMacro {
|
||||
}
|
||||
|
||||
case TPath({name: "Array", pack: []}):
|
||||
Context.error("Flag " + field.name + " cannot be an Array that isnt a String or Bool or TrimmedString", field.pos);
|
||||
Context.error("Flag " + field.name + " cannot be an Array that isnt a String or Bool or TrimmedString or Int or Float", field.pos);
|
||||
case TPath({name: "Map", pack: []}):
|
||||
Context.error("Flag " + field.name + " cannot be a Map<K, V>", field.pos);
|
||||
default:
|
||||
@@ -159,6 +196,14 @@ class FlagMacro {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(isNullable) {
|
||||
switch(field.kind) {
|
||||
case FVar(t, e):
|
||||
field.kind = FVar(TPath({name: "Null", pack: [], params: [TPType(t)]}), e);
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
resetExprs.push(macro $i{field.name} = ${expr});
|
||||
|
||||
// parse(name: String, value: String)
|
||||
@@ -166,16 +211,39 @@ class FlagMacro {
|
||||
if(customCheck != null) {
|
||||
parserExprs.push(customCheck);
|
||||
} else {
|
||||
parserExprs.push(macro @:mergeBlock {
|
||||
if(name == $v{field.name}) {
|
||||
$i{field.name} = $parser;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
var alsoExpr = alsos.length > 0 ? macro @:mergeBlock $b{alsos.map((e) -> return macro $e = val)} : macro {};
|
||||
|
||||
if(isNullable) {
|
||||
parserExprs.push(macro @:mergeBlock {
|
||||
if(name == $v{field.name}) {
|
||||
var val = value == "NULL" ? null : $parser;
|
||||
$i{field.name} = val;
|
||||
$alsoExpr;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
parserExprs.push(macro @:mergeBlock {
|
||||
if(name == $v{field.name}) {
|
||||
var val = $parser;
|
||||
$i{field.name} = val;
|
||||
$alsoExpr;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
default:
|
||||
// nothing
|
||||
}
|
||||
|
||||
if(hasLazy) {
|
||||
switch(field.kind) {
|
||||
case FVar(t, expr):
|
||||
field.kind = FVar(t, null);
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fields.push({
|
||||
@@ -209,6 +277,9 @@ class FlagMacro {
|
||||
});
|
||||
|
||||
//var printer = new haxe.macro.Printer();
|
||||
//for(field in fields) {
|
||||
// trace(printer.printField(field));
|
||||
//}
|
||||
//trace(printer.printField(fields[fields.length - 2]));
|
||||
//trace(printer.printField(fields[fields.length - 1]));
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class UpdateScreen extends MusicBeatState {
|
||||
generalProgress.alignment = CENTER;
|
||||
add(generalProgress);
|
||||
|
||||
overSound = FlxG.sound.load(Paths.sound(Constants.DEFAULT_GAMEOVER_RETRY_SFX));
|
||||
overSound = FlxG.sound.load(Paths.sound(Flags.DEFAULT_GAMEOVER_RETRY_SFX));
|
||||
|
||||
updater.execute();
|
||||
|
||||
|
||||
@@ -121,11 +121,15 @@ class CoolUtil
|
||||
* @return The attributes through the `FileAttributeWrapper`
|
||||
*/
|
||||
@:noUsing public static inline function safeGetAttributes(path:String, useAbsol:Bool = true):FileAttributeWrapper {
|
||||
#if sys
|
||||
addMissingFolders(Path.directory(path));
|
||||
|
||||
var result = NativeAPI.getFileAttributes(path, useAbsol);
|
||||
if(result.isNothing) Logs.trace('The file where it has been tried to get the attributes from, might be corrupted or inexistent (code: ${result.getValue()})', WARNING);
|
||||
return result;
|
||||
#else
|
||||
return 0;
|
||||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,11 +142,15 @@ class CoolUtil
|
||||
*/
|
||||
@:noUsing public static inline function safeSetAttributes(path:String, attrib:OneOfThree<NativeAPI.FileAttribute, FileAttributeWrapper, Int>, useAbsol:Bool = true):Int {
|
||||
// yes, i'm aware that FileAttribute is also an Int so need to include it too, but at least like this we don't have to make cast sometimes while passing the arguments - Nex
|
||||
#if sys
|
||||
addMissingFolders(Path.directory(path));
|
||||
|
||||
var result = NativeAPI.setFileAttributes(path, attrib, useAbsol);
|
||||
if(result == 0) Logs.trace('Failed to set attributes to $path with a code of: $result', WARNING);
|
||||
return result;
|
||||
#else
|
||||
return 0;
|
||||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,11 +162,15 @@ class CoolUtil
|
||||
* @return The result code: `0` means that it failed setting
|
||||
*/
|
||||
@:noUsing public static inline function safeAddAttributes(path:String, attrib:OneOfTwo<NativeAPI.FileAttribute, Int>, useAbsol:Bool = true):Int {
|
||||
#if sys
|
||||
addMissingFolders(Path.directory(path));
|
||||
|
||||
var result = NativeAPI.addFileAttributes(path, attrib, useAbsol);
|
||||
if(result == 0) Logs.trace('Failed to add attributes to $path with a code of: $result', WARNING);
|
||||
return result;
|
||||
#else
|
||||
return 0;
|
||||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,11 +182,15 @@ class CoolUtil
|
||||
* @return The result code: `0` means that it failed setting
|
||||
*/
|
||||
@:noUsing public static inline function safeRemoveAttributes(path:String, attrib:OneOfTwo<NativeAPI.FileAttribute, Int>, useAbsol:Bool = true):Int {
|
||||
#if sys
|
||||
addMissingFolders(Path.directory(path));
|
||||
|
||||
var result = NativeAPI.removeFileAttributes(path, attrib, useAbsol);
|
||||
if(result == 0) Logs.trace('Failed to remove attributes to $path with a code of: $result', WARNING);
|
||||
return result;
|
||||
#else
|
||||
return 0;
|
||||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -403,17 +419,17 @@ class CoolUtil
|
||||
if (Assets.exists(infoPath)) {
|
||||
var musicInfo = IniUtil.parseAsset(infoPath, [
|
||||
"BPM" => null,
|
||||
"TimeSignature" => Constants.DEFAULT_BEATS_PER_MEASURE + "/" + Constants.DEFAULT_STEPS_PER_BEAT
|
||||
"TimeSignature" => Flags.DEFAULT_BEATS_PER_MEASURE + "/" + Flags.DEFAULT_STEPS_PER_BEAT
|
||||
]);
|
||||
|
||||
var timeSignParsed:Array<Null<Float>> = musicInfo["TimeSignature"] == null ? [] : [for(s in musicInfo["TimeSignature"].split("/")) Std.parseFloat(s)];
|
||||
var beatsPerMeasure:Float = Constants.DEFAULT_BEATS_PER_MEASURE;
|
||||
var stepsPerBeat:Float = Constants.DEFAULT_STEPS_PER_BEAT;
|
||||
var beatsPerMeasure:Float = Flags.DEFAULT_BEATS_PER_MEASURE;
|
||||
var stepsPerBeat:Float = Flags.DEFAULT_STEPS_PER_BEAT;
|
||||
|
||||
// Check later, i dont think timeSignParsed can contain null, only nan
|
||||
if (timeSignParsed.length == 2 && !timeSignParsed.contains(null)) {
|
||||
beatsPerMeasure = timeSignParsed[0] == null || timeSignParsed[0] <= 0 ? Constants.DEFAULT_BEATS_PER_MEASURE : cast timeSignParsed[0];
|
||||
stepsPerBeat = timeSignParsed[1] == null || timeSignParsed[1] <= 0 ? Constants.DEFAULT_STEPS_PER_BEAT : cast timeSignParsed[1];
|
||||
beatsPerMeasure = timeSignParsed[0] == null || timeSignParsed[0] <= 0 ? Flags.DEFAULT_BEATS_PER_MEASURE : cast timeSignParsed[0];
|
||||
stepsPerBeat = timeSignParsed[1] == null || timeSignParsed[1] <= 0 ? Flags.DEFAULT_STEPS_PER_BEAT : cast timeSignParsed[1];
|
||||
}
|
||||
|
||||
var bpm:Null<Float> = Std.parseFloat(musicInfo["BPM"]).getDefault(DefaultBPM);
|
||||
|
||||
@@ -86,9 +86,9 @@ class DiscordUtil
|
||||
if (config == null)
|
||||
config = {};
|
||||
|
||||
config.logoKey = config.logoKey.getDefault(Constants.DISCORD_LOGO_KEY);
|
||||
config.logoText = config.logoText.getDefault(Constants.DISCORD_LOGO_TEXT);
|
||||
config.clientID = config.clientID.getDefault(Constants.DISCORD_CLIENT_ID);
|
||||
config.logoKey = config.logoKey.getDefault(Flags.DEFAULT_DISCORD_LOGO_KEY);
|
||||
config.logoText = config.logoText.getDefault(Flags.DEFAULT_DISCORD_LOGO_TEXT);
|
||||
config.clientID = config.clientID.getDefault(Flags.DEFAULT_DISCORD_CLIENT_ID);
|
||||
currentID = config.clientID;
|
||||
#end
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ class CharacterEditor extends UIState {
|
||||
characterBG.scale.set(FlxG.width/characterBG.width, FlxG.height/characterBG.height);
|
||||
characterBG.scale.set(characterBG.scale.x / charCamera.zoom, characterBG.scale.y / charCamera.zoom);
|
||||
|
||||
WindowUtils.prefix = undos.unsaved ? Constants.UNDO_PREFIX : "";
|
||||
WindowUtils.prefix = undos.unsaved ? Flags.UNDO_PREFIX : "";
|
||||
SaveWarning.showWarning = undos.unsaved;
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ class CharacterEditor extends UIState {
|
||||
]);
|
||||
|
||||
// clean
|
||||
if (charXML.exists("gameOverChar") && character.gameOverCharacter == Constants.DEFAULT_GAMEOVER_CHARACTER) charXML.remove("gameOverChar");
|
||||
if (charXML.exists("gameOverChar") && character.gameOverCharacter == Flags.DEFAULT_GAMEOVER_CHARACTER) charXML.remove("gameOverChar");
|
||||
if (charXML.exists("camx") && character.cameraOffset.x == 0) charXML.remove("camx");
|
||||
if (charXML.exists("camy") && character.cameraOffset.y == 0) charXML.remove("camy");
|
||||
if (charXML.exists("holdTime") && character.holdTime == 4) charXML.remove("holdTime");
|
||||
|
||||
@@ -150,7 +150,7 @@ class CharacterInfoScreen extends UISubstateWindow {
|
||||
@:privateAccess iconSprite.animation.clearAnimations();
|
||||
|
||||
var path:String = Paths.image('icons/$icon');
|
||||
if (!Assets.exists(path)) path = Paths.image('icons/' + Constants.DEFAULT_HEALTH_ICON);
|
||||
if (!Assets.exists(path)) path = Paths.image('icons/' + Flags.DEFAULT_HEALTH_ICON);
|
||||
|
||||
iconSprite.loadGraphic(path, true, 150, 150);
|
||||
iconSprite.animation.add(icon, [0], 0, false);
|
||||
|
||||
@@ -73,7 +73,7 @@ class ChartCreationScreen extends UISubstateWindow {
|
||||
|
||||
strumLineList.addButton.callback = function() {
|
||||
strumLineList.add(new StrumLineButton(strumLineList.buttons.length, {
|
||||
characters: [Constants.DEFAULT_OPPONENT],
|
||||
characters: [Flags.DEFAULT_OPPONENT],
|
||||
type: 0,
|
||||
notes: null,
|
||||
position: "DAD",
|
||||
@@ -84,7 +84,7 @@ class ChartCreationScreen extends UISubstateWindow {
|
||||
|
||||
// DEFAULTS
|
||||
strumLineList.add(new StrumLineButton(0, {
|
||||
characters: [Constants.DEFAULT_OPPONENT],
|
||||
characters: [Flags.DEFAULT_OPPONENT],
|
||||
type: 0,
|
||||
notes: null,
|
||||
position: "DAD",
|
||||
@@ -93,7 +93,7 @@ class ChartCreationScreen extends UISubstateWindow {
|
||||
scrollSpeed: 1,
|
||||
}, strumLineList));
|
||||
strumLineList.add(new StrumLineButton(1, {
|
||||
characters: [Constants.DEFAULT_CHARACTER],
|
||||
characters: [Flags.DEFAULT_CHARACTER],
|
||||
type: 1,
|
||||
notes: null,
|
||||
position: "BOYFRIEND",
|
||||
@@ -102,7 +102,7 @@ class ChartCreationScreen extends UISubstateWindow {
|
||||
scrollSpeed: 1,
|
||||
}, strumLineList));
|
||||
strumLineList.add(new StrumLineButton(2, {
|
||||
characters: [Constants.DEFAULT_GIRLFRIEND],
|
||||
characters: [Flags.DEFAULT_GIRLFRIEND],
|
||||
type: 2,
|
||||
notes: null,
|
||||
position: "GIRLFRIEND",
|
||||
@@ -333,7 +333,7 @@ class CompactCharacterButton extends UIButton {
|
||||
char = funkin.game.Character.getIconFromCharName(char);
|
||||
var image = Paths.image("icons/" + char);
|
||||
if(!Assets.exists(image))
|
||||
image = Paths.image("icons/" + Constants.DEFAULT_HEALTH_ICON);
|
||||
image = Paths.image("icons/" + Flags.DEFAULT_HEALTH_ICON);
|
||||
charIcon.loadGraphic(image, true, 150, 150);
|
||||
charIcon.updateHitbox();
|
||||
}
|
||||
|
||||
@@ -1246,7 +1246,7 @@ class Charter extends UIState {
|
||||
if (strumLines != null)
|
||||
strumlineLockButton.button.animation.play(strumLines.draggable ? "1" : "0", true);
|
||||
|
||||
WindowUtils.prefix = undos.unsaved ? Constants.UNDO_PREFIX : "";
|
||||
WindowUtils.prefix = undos.unsaved ? Flags.UNDO_PREFIX : "";
|
||||
SaveWarning.showWarning = undos.unsaved;
|
||||
|
||||
__firstFrame = false;
|
||||
@@ -1298,7 +1298,7 @@ class Charter extends UIState {
|
||||
}
|
||||
|
||||
function _file_saveas(_) {
|
||||
openSubState(new SaveSubstate(Json.stringify(Chart.filterChartForSaving(PlayState.SONG, false), null, Options.editorPrettyPrint ? Constants.JSON_PRETTY_PRINT : null), {
|
||||
openSubState(new SaveSubstate(Json.stringify(Chart.filterChartForSaving(PlayState.SONG, false), null, Options.editorPrettyPrint ? Flags.JSON_PRETTY_PRINT : null), {
|
||||
defaultSaveFile: '${__diff.toLowerCase()}.json'
|
||||
}));
|
||||
undos.save();
|
||||
@@ -1314,7 +1314,7 @@ class Charter extends UIState {
|
||||
}
|
||||
|
||||
function _file_saveas_no_events(_) {
|
||||
openSubState(new SaveSubstate(Json.stringify(Chart.filterChartForSaving(PlayState.SONG, false, false), null, Options.editorPrettyPrint ? Constants.JSON_PRETTY_PRINT : null), {
|
||||
openSubState(new SaveSubstate(Json.stringify(Chart.filterChartForSaving(PlayState.SONG, false, false), null, Options.editorPrettyPrint ? Flags.JSON_PRETTY_PRINT : null), {
|
||||
defaultSaveFile: '${__diff.toLowerCase()}.json'
|
||||
}));
|
||||
undos.save();
|
||||
@@ -1324,7 +1324,7 @@ class Charter extends UIState {
|
||||
#if sys
|
||||
CoolUtil.safeSaveFile(
|
||||
'${Paths.getAssetsRoot()}/songs/${__song.toLowerCase()}/meta.json',
|
||||
Json.stringify(PlayState.SONG.meta == null ? {} : PlayState.SONG.meta, null, Constants.JSON_PRETTY_PRINT)
|
||||
Json.stringify(PlayState.SONG.meta == null ? {} : PlayState.SONG.meta, null, Flags.JSON_PRETTY_PRINT)
|
||||
);
|
||||
#else
|
||||
_file_meta_saveas(_);
|
||||
@@ -1332,20 +1332,20 @@ class Charter extends UIState {
|
||||
}
|
||||
|
||||
function _file_meta_saveas(_) {
|
||||
openSubState(new SaveSubstate(Json.stringify(PlayState.SONG.meta == null ? {} : PlayState.SONG.meta, null, Constants.JSON_PRETTY_PRINT), { // always pretty print meta
|
||||
openSubState(new SaveSubstate(Json.stringify(PlayState.SONG.meta == null ? {} : PlayState.SONG.meta, null, Flags.JSON_PRETTY_PRINT), { // always pretty print meta
|
||||
defaultSaveFile: 'meta.json'
|
||||
}));
|
||||
}
|
||||
|
||||
function _file_saveas_fnflegacy(_) {
|
||||
openSubState(new SaveSubstate(Json.stringify(FNFLegacyParser.encode(PlayState.SONG), null, Options.editorPrettyPrint ? Constants.JSON_PRETTY_PRINT : null), {
|
||||
defaultSaveFile: '${__song.toLowerCase().replace(" ", "-")}${__diff.toLowerCase() == Constants.DEFAULT_DIFFICULTY ? "" : '-${__diff.toLowerCase()}'}.json',
|
||||
openSubState(new SaveSubstate(Json.stringify(FNFLegacyParser.encode(PlayState.SONG), null, Options.editorPrettyPrint ? Flags.JSON_PRETTY_PRINT : null), {
|
||||
defaultSaveFile: '${__song.toLowerCase().replace(" ", "-")}${__diff.toLowerCase() == Flags.DEFAULT_DIFFICULTY ? "" : '-${__diff.toLowerCase()}'}.json',
|
||||
}));
|
||||
}
|
||||
|
||||
function _file_saveas_psych(_) {
|
||||
openSubState(new SaveSubstate(Json.stringify(PsychParser.encode(PlayState.SONG), null, Options.editorPrettyPrint ? Constants.JSON_PRETTY_PRINT : null), {
|
||||
defaultSaveFile: '${__song.toLowerCase().replace(" ", "-")}${__diff.toLowerCase() == Constants.DEFAULT_DIFFICULTY ? "" : '-${__diff.toLowerCase()}'}.json',
|
||||
openSubState(new SaveSubstate(Json.stringify(PsychParser.encode(PlayState.SONG), null, Options.editorPrettyPrint ? Flags.JSON_PRETTY_PRINT : null), {
|
||||
defaultSaveFile: '${__song.toLowerCase().replace(" ", "-")}${__diff.toLowerCase() == Flags.DEFAULT_DIFFICULTY ? "" : '-${__diff.toLowerCase()}'}.json',
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -1353,7 +1353,7 @@ class Charter extends UIState {
|
||||
#if sys
|
||||
CoolUtil.safeSaveFile(
|
||||
'${Paths.getAssetsRoot()}/songs/${__song.toLowerCase()}/events.json',
|
||||
Json.stringify({events: PlayState.SONG.events == null ? [] : PlayState.SONG.events}, null, Options.editorPrettyPrint ? Constants.JSON_PRETTY_PRINT : null)
|
||||
Json.stringify({events: PlayState.SONG.events == null ? [] : PlayState.SONG.events}, null, Options.editorPrettyPrint ? Flags.JSON_PRETTY_PRINT : null)
|
||||
);
|
||||
#else
|
||||
_file_events_saveas(_);
|
||||
@@ -1362,7 +1362,7 @@ class Charter extends UIState {
|
||||
|
||||
function _file_events_saveas(_) {
|
||||
#if sys
|
||||
openSubState(new SaveSubstate(Json.stringify({events: PlayState.SONG.events == null ? [] : PlayState.SONG.events}, null, Options.editorPrettyPrint ? Constants.JSON_PRETTY_PRINT : null), {
|
||||
openSubState(new SaveSubstate(Json.stringify({events: PlayState.SONG.events == null ? [] : PlayState.SONG.events}, null, Options.editorPrettyPrint ? Flags.JSON_PRETTY_PRINT : null), {
|
||||
defaultSaveFile: 'events.json'
|
||||
}));
|
||||
#end
|
||||
|
||||
@@ -129,7 +129,7 @@ class CharterMetaDataScreen extends UISubstateWindow {
|
||||
@:privateAccess iconSprite.animation.clearAnimations();
|
||||
|
||||
var path:String = Paths.image('icons/$icon');
|
||||
if (!Assets.exists(path)) path = Paths.image('icons/' + Constants.DEFAULT_HEALTH_ICON);
|
||||
if (!Assets.exists(path)) path = Paths.image('icons/' + Flags.DEFAULT_HEALTH_ICON);
|
||||
|
||||
iconSprite.loadGraphic(path, true, 150, 150);
|
||||
iconSprite.animation.add(icon, [0], 0, false);
|
||||
|
||||
@@ -109,9 +109,9 @@ class CharterSelection extends EditorTreeMenu {
|
||||
sys.FileSystem.createDirectory('$songFolder/charts');
|
||||
|
||||
// Save Files
|
||||
CoolUtil.safeSaveFile('$songFolder/meta.json', Json.stringify(creation.meta, Constants.JSON_PRETTY_PRINT));
|
||||
if (creation.instBytes != null) sys.io.File.saveBytes('$songFolder/song/Inst.${Constants.SOUND_EXT}', creation.instBytes);
|
||||
if (creation.voicesBytes != null) sys.io.File.saveBytes('$songFolder/song/Voices.${Constants.SOUND_EXT}', creation.voicesBytes);
|
||||
CoolUtil.safeSaveFile('$songFolder/meta.json', Json.stringify(creation.meta, Flags.JSON_PRETTY_PRINT));
|
||||
if (creation.instBytes != null) sys.io.File.saveBytes('$songFolder/song/Inst.${Flags.SOUND_EXT}', creation.instBytes);
|
||||
if (creation.voicesBytes != null) sys.io.File.saveBytes('$songFolder/song/Voices.${Flags.SOUND_EXT}', creation.voicesBytes);
|
||||
#end
|
||||
|
||||
var option = new EditorIconOption(creation.meta.name, "Press ACCEPT to choose a difficulty to edit.", creation.meta.icon, function() {
|
||||
@@ -147,7 +147,7 @@ class CharterSelection extends EditorTreeMenu {
|
||||
var songFolder:String = '${Paths.getAssetsRoot()}/songs/${curSong.name}';
|
||||
|
||||
// Save Files
|
||||
CoolUtil.safeSaveFile('$songFolder/charts/${name}.json', Json.stringify(data, Constants.JSON_PRETTY_PRINT));
|
||||
CoolUtil.safeSaveFile('$songFolder/charts/${name}.json', Json.stringify(data, Flags.JSON_PRETTY_PRINT));
|
||||
|
||||
// Add to List
|
||||
curSong.difficulties.push(name);
|
||||
|
||||
@@ -39,7 +39,7 @@ class CharterStrumlineScreen extends UISubstateWindow {
|
||||
|
||||
if (creatingStrumLine)
|
||||
strumLine = {
|
||||
characters: [Constants.DEFAULT_OPPONENT],
|
||||
characters: [Flags.DEFAULT_OPPONENT],
|
||||
type: OPPONENT,
|
||||
notes: [],
|
||||
position: "dad",
|
||||
@@ -205,7 +205,7 @@ class CharacterButton extends UIButton {
|
||||
char = Character.getIconFromCharName(char);
|
||||
var image = Paths.image("icons/" + char);
|
||||
if(!Assets.exists(image))
|
||||
image = Paths.image("icons/" + Constants.DEFAULT_HEALTH_ICON);
|
||||
image = Paths.image("icons/" + Flags.DEFAULT_HEALTH_ICON);
|
||||
charIcon.loadGraphic(image, true, 150, 150);
|
||||
charIcon.updateHitbox();
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ class SongCreationScreen extends UISubstateWindow {
|
||||
|
||||
var voicesUIText:UIText = null;
|
||||
|
||||
instExplorer = new UIFileExplorer(songNameTextBox.x, songNameTextBox.y + 32 + 36, null, null, Constants.SOUND_EXT, function (res) {
|
||||
instExplorer = new UIFileExplorer(songNameTextBox.x, songNameTextBox.y + 32 + 36, null, null, Flags.SOUND_EXT, function (res) {
|
||||
var audioPlayer:UIAudioPlayer = new UIAudioPlayer(instExplorer.x + 8, instExplorer.y + 8, res);
|
||||
instExplorer.members.push(audioPlayer);
|
||||
instExplorer.uiElement = audioPlayer;
|
||||
@@ -92,7 +92,7 @@ class SongCreationScreen extends UISubstateWindow {
|
||||
"Inst Audio File $* Required$",
|
||||
[new FlxTextFormatMarkerPair(new FlxTextFormat(0xFFAD1212), "$")]);
|
||||
|
||||
voicesExplorer = new UIFileExplorer(instExplorer.x + 320 + 26, instExplorer.y, null, null, Constants.SOUND_EXT, function (res) {
|
||||
voicesExplorer = new UIFileExplorer(instExplorer.x + 320 + 26, instExplorer.y, null, null, Flags.SOUND_EXT, function (res) {
|
||||
var audioPlayer:UIAudioPlayer = new UIAudioPlayer(voicesExplorer.x + 8, voicesExplorer.y + 8, res);
|
||||
voicesExplorer.members.push(audioPlayer);
|
||||
voicesExplorer.uiElement = audioPlayer;
|
||||
@@ -213,7 +213,7 @@ class SongCreationScreen extends UISubstateWindow {
|
||||
@:privateAccess iconSprite.animation.clearAnimations();
|
||||
|
||||
var path:String = Paths.image('icons/$icon');
|
||||
if (!Assets.exists(path)) path = Paths.image('icons/' + Constants.DEFAULT_HEALTH_ICON);
|
||||
if (!Assets.exists(path)) path = Paths.image('icons/' + Flags.DEFAULT_HEALTH_ICON);
|
||||
|
||||
iconSprite.loadGraphic(path, true, 150, 150);
|
||||
iconSprite.animation.add(icon, [0], 0, false);
|
||||
|
||||
@@ -34,8 +34,8 @@ using StringTools;
|
||||
@:allow(funkin.game.PlayState)
|
||||
class Character extends FunkinSprite implements IBeatReceiver implements IOffsetCompatible {
|
||||
public var isPlayer:Bool = false;
|
||||
public var curCharacter:String = Constants.DEFAULT_CHARACTER;
|
||||
public var sprite:String = Constants.DEFAULT_CHARACTER;
|
||||
public var curCharacter:String = Flags.DEFAULT_CHARACTER;
|
||||
public var sprite:String = Flags.DEFAULT_CHARACTER;
|
||||
|
||||
public var lastHit:Float = Math.NEGATIVE_INFINITY;
|
||||
public var holdTime:Float = 4;
|
||||
@@ -70,7 +70,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
|
||||
super(x, y);
|
||||
|
||||
animOffsets = new Map<String, FlxPoint>();
|
||||
curCharacter = character != null ? character : Constants.DEFAULT_CHARACTER;
|
||||
curCharacter = character != null ? character : Flags.DEFAULT_CHARACTER;
|
||||
this.isPlayer = isPlayer;
|
||||
__switchAnims = switchAnims;
|
||||
|
||||
@@ -130,7 +130,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
|
||||
scripts.call("update", [elapsed]);
|
||||
if (stunned) {
|
||||
__stunnedTime += elapsed;
|
||||
if (__stunnedTime > Constants.STUNNED_TIME)
|
||||
if (__stunnedTime > Flags.STUNNED_TIME)
|
||||
stunned = false;
|
||||
}
|
||||
|
||||
@@ -482,9 +482,8 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
|
||||
@:noCompletion private function get_danceInterval()
|
||||
return beatInterval;
|
||||
|
||||
// these wont update when you change the constants!!! they just start from the constant for qol if we'll ever edit them in the future - Nex
|
||||
public static var FALLBACK_CHARACTER:String = Constants.DEFAULT_CHARACTER;
|
||||
public static var FALLBACK_DEAD_CHARACTER:String = Constants.DEFAULT_GAMEOVER_CHARACTER;
|
||||
public static var FALLBACK_CHARACTER:String = Flags.DEFAULT_CHARACTER;
|
||||
public static var FALLBACK_DEAD_CHARACTER:String = Flags.DEFAULT_GAMEOVER_CHARACTER;
|
||||
|
||||
private function set_script(script:Script):Script {
|
||||
if (scripts == null) (scripts = new ScriptPack("Character")).setParent(this);
|
||||
@@ -539,7 +538,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
|
||||
}
|
||||
|
||||
public static function getIconFromCharName(?character:String, ?defaultIcon:String = null) {
|
||||
if(character == null) return Constants.DEFAULT_HEALTH_ICON;
|
||||
if(character == null) return Flags.DEFAULT_HEALTH_ICON;
|
||||
if(defaultIcon == null) defaultIcon = character;
|
||||
var icon:String = defaultIcon;
|
||||
|
||||
|
||||
@@ -43,10 +43,10 @@ class GameOverSubstate extends MusicBeatSubstate
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.player = player;
|
||||
this.characterName = character != null ? character : Constants.DEFAULT_GAMEOVER_CHARACTER;
|
||||
this.gameOverSong = gameOverSong != null ? gameOverSong : Constants.DEFAULT_GAMEOVER_SONG;
|
||||
this.lossSFXName = lossSFX != null ? lossSFX : Constants.DEFAULT_GAMEOVER_LOSS_SFX;
|
||||
this.retrySFX = retrySFX != null ? retrySFX : Constants.DEFAULT_GAMEOVER_RETRY_SFX;
|
||||
this.characterName = character != null ? character : Flags.DEFAULT_GAMEOVER_CHARACTER;
|
||||
this.gameOverSong = gameOverSong != null ? gameOverSong : Flags.DEFAULT_GAMEOVER_SONG;
|
||||
this.lossSFXName = lossSFX != null ? lossSFX : Flags.DEFAULT_GAMEOVER_LOSS_SFX;
|
||||
this.retrySFX = retrySFX != null ? retrySFX : Flags.DEFAULT_GAMEOVER_RETRY_SFX;
|
||||
}
|
||||
|
||||
public override function create()
|
||||
@@ -128,7 +128,7 @@ class GameOverSubstate extends MusicBeatSubstate
|
||||
|
||||
if (!isEnding && ((!lossSFX.playing) || (character.getAnimName() == "firstDeath" && character.isAnimFinished())) && (FlxG.sound.music == null || !FlxG.sound.music.playing))
|
||||
{
|
||||
CoolUtil.playMusic(Paths.music(gameOverSong), false, 1, true, Constants.DEFAULT_BPM);
|
||||
CoolUtil.playMusic(Paths.music(gameOverSong), false, 1, true, Flags.DEFAULT_BPM);
|
||||
beatHit(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class HealthIcon extends FlxSprite
|
||||
super();
|
||||
health = 0.5;
|
||||
this.isPlayer = isPlayer;
|
||||
setIcon(char != null ? char : Constants.DEFAULT_CHARACTER);
|
||||
setIcon(char != null ? char : Flags.DEFAULT_CHARACTER);
|
||||
|
||||
scrollFactor.set();
|
||||
}
|
||||
@@ -62,7 +62,7 @@ class HealthIcon extends FlxSprite
|
||||
if(curCharacter != char || this.width != width || this.height != height) {
|
||||
curCharacter = char;
|
||||
var path = Paths.image('icons/$char');
|
||||
if (!Assets.exists(path)) path = Paths.image('icons/' + Constants.DEFAULT_HEALTH_ICON);
|
||||
if (!Assets.exists(path)) path = Paths.image('icons/' + Flags.DEFAULT_HEALTH_ICON);
|
||||
|
||||
loadGraphic(path, true, width, height);
|
||||
|
||||
|
||||
@@ -99,6 +99,8 @@ class Note extends FlxSprite
|
||||
return __customNoteTypeExists[path] = Assets.exists(path);
|
||||
}
|
||||
|
||||
public static var DEFAULT_NOTE_FIELDS:Array<String> = ["time", "id", "type", "sLen"];
|
||||
|
||||
public function new(strumLine:StrumLine, noteData:ChartNote, sustain:Bool = false, sustainLength:Float = 0, sustainOffset:Float = 0, ?prev:Note)
|
||||
{
|
||||
super();
|
||||
@@ -115,7 +117,7 @@ class Note extends FlxSprite
|
||||
this.isSustainNote = sustain;
|
||||
this.sustainLength = sustainLength;
|
||||
this.strumLine = strumLine;
|
||||
for(field in Reflect.fields(noteData)) if(!Constants.DEFAULT_NOTE_FIELDS.contains(field))
|
||||
for(field in Reflect.fields(noteData)) if(!DEFAULT_NOTE_FIELDS.contains(field))
|
||||
this.extra.set(field, Reflect.field(noteData, field));
|
||||
|
||||
x += 50;
|
||||
@@ -127,7 +129,7 @@ class Note extends FlxSprite
|
||||
|
||||
var customType = Paths.image('game/notes/${this.noteType}');
|
||||
var event = EventManager.get(NoteCreationEvent).recycle(this, strumID, this.noteType, noteTypeID, PlayState.instance.strumLines.members.indexOf(strumLine), mustPress,
|
||||
(this.noteType != null && customTypePathExists(customType)) ? 'game/notes/${this.noteType}' : 'game/notes/default', @:privateAccess strumLine.strumScale * Constants.DEFAULT_NOTE_SCALE, animSuffix);
|
||||
(this.noteType != null && customTypePathExists(customType)) ? 'game/notes/${this.noteType}' : 'game/notes/default', @:privateAccess strumLine.strumScale * Flags.DEFAULT_NOTE_SCALE, animSuffix);
|
||||
|
||||
if (PlayState.instance != null)
|
||||
event = PlayState.instance.gameAndCharsEvent("onNoteCreation", event);
|
||||
|
||||
@@ -12,7 +12,7 @@ class NoteGroup extends FlxTypedGroup<Note> {
|
||||
/**
|
||||
* How many ms it should show a note before it should be hit
|
||||
**/
|
||||
public var limit:Float = Constants.DEFAULT_NOTE_MS_LIMIT;
|
||||
public var limit:Float = Flags.DEFAULT_NOTE_MS_LIMIT;
|
||||
|
||||
/**
|
||||
* Preallocates the members array with nulls, but if theres anything in the array already it clears it
|
||||
|
||||
@@ -61,7 +61,7 @@ class PlayState extends MusicBeatState
|
||||
/**
|
||||
* The selected difficulty name
|
||||
*/
|
||||
public static var difficulty:String = Constants.DEFAULT_DIFFICULTY;
|
||||
public static var difficulty:String = Flags.DEFAULT_DIFFICULTY;
|
||||
/**
|
||||
* Whenever the week is coming from the mods folder or not.
|
||||
*/
|
||||
@@ -73,11 +73,11 @@ class PlayState extends MusicBeatState
|
||||
/**
|
||||
* Whenever the song has been started with opponent mode on.
|
||||
*/
|
||||
public static var opponentMode:Bool = Constants.DEFAULT_OPPONENT_MODE;
|
||||
public static var opponentMode:Bool = Flags.DEFAULT_OPPONENT_MODE;
|
||||
/**
|
||||
* Whenever the song has been started with co-op mode on.
|
||||
*/
|
||||
public static var coopMode:Bool = Constants.DEFAULT_COOP_MODE;
|
||||
public static var coopMode:Bool = Flags.DEFAULT_COOP_MODE;
|
||||
|
||||
/**
|
||||
* Script Pack of all the scripts being ran.
|
||||
@@ -96,15 +96,15 @@ class PlayState extends MusicBeatState
|
||||
/**
|
||||
* Game Over Song. (assets/music/gameOver.ogg)
|
||||
*/
|
||||
public var gameOverSong:String = Constants.DEFAULT_GAMEOVER_SONG;
|
||||
public var gameOverSong:String = Flags.DEFAULT_GAMEOVER_SONG;
|
||||
/**
|
||||
* Game Over Song. (assets/sounds/gameOverSFX.ogg)
|
||||
*/
|
||||
public var lossSFX:String = Constants.DEFAULT_GAMEOVER_LOSS_SFX;
|
||||
public var lossSFX:String = Flags.DEFAULT_GAMEOVER_LOSS_SFX;
|
||||
/**
|
||||
* Game Over End SFX, used when retrying. (assets/sounds/gameOverEnd.ogg)
|
||||
*/
|
||||
public var retrySFX:String = Constants.DEFAULT_GAMEOVER_RETRY_SFX;
|
||||
public var retrySFX:String = Flags.DEFAULT_GAMEOVER_RETRY_SFX;
|
||||
|
||||
/**
|
||||
* Current Stage.
|
||||
@@ -209,15 +209,15 @@ class PlayState extends MusicBeatState
|
||||
/**
|
||||
* Whenever the vocals should be muted when a note is missed.
|
||||
*/
|
||||
public var muteVocalsOnMiss:Bool = Constants.DEFAULT_MUTE_VOCALS_ON_MISS;
|
||||
public var muteVocalsOnMiss:Bool = Flags.DEFAULT_MUTE_VOCALS_ON_MISS;
|
||||
/**
|
||||
* Whenever the player can press 7, 8 or 9 to access the debug menus.
|
||||
*/
|
||||
public var canAccessDebugMenus:Bool = Constants.DEFAULT_CAN_ACCESS_DEBUG_MENUS;
|
||||
public var canAccessDebugMenus:Bool = Flags.DEFAULT_CAN_ACCESS_DEBUG_MENUS;
|
||||
/**
|
||||
* Whether or not to show the secret gitaroo pause.
|
||||
*/
|
||||
public var allowGitaroo:Bool = Constants.DEFAULT_GITAROO;
|
||||
public var allowGitaroo:Bool = Flags.DEFAULT_GITAROO;
|
||||
/**
|
||||
* Whether or not to bop the icons on beat.
|
||||
*/
|
||||
@@ -231,15 +231,15 @@ class PlayState extends MusicBeatState
|
||||
* Interval of cam zooming (beats).
|
||||
* For example: if set to 4, the camera will zoom every 4 beats.
|
||||
*/
|
||||
public var camZoomingInterval:Int = Constants.DEFAULT_CAM_ZOOM_INTERVAL;
|
||||
public var camZoomingInterval:Int = Flags.DEFAULT_CAM_ZOOM_INTERVAL;
|
||||
/**
|
||||
* How strong the cam zooms should be (defaults to 1)
|
||||
*/
|
||||
public var camZoomingStrength:Float = Constants.DEFAULT_CAM_ZOOM_STRENGTH;
|
||||
public var camZoomingStrength:Float = Flags.DEFAULT_CAM_ZOOM_STRENGTH;
|
||||
/**
|
||||
* Maximum amount of zoom for the camera.
|
||||
*/
|
||||
public var maxCamZoom:Float = Constants.MAX_CAMERA_ZOOM;
|
||||
public var maxCamZoom:Float = Flags.MAX_CAMERA_ZOOM;
|
||||
/**
|
||||
* Current song name (lowercase)
|
||||
*/
|
||||
@@ -261,12 +261,12 @@ class PlayState extends MusicBeatState
|
||||
/**
|
||||
* Current health. Goes from 0 to maxHealth (defaults to 2)
|
||||
*/
|
||||
public var health:Float = Constants.DEFAULT_HEALTH;
|
||||
public var health:Float = 1;
|
||||
|
||||
/**
|
||||
* Maximum health the player can have. Defaults to 2.
|
||||
*/
|
||||
@:isVar public var maxHealth(get, set):Float = Constants.DEFAULT_MAX_HEALTH;
|
||||
@:isVar public var maxHealth(get, set):Float = Flags.DEFAULT_MAX_HEALTH;
|
||||
/**
|
||||
* Current combo.
|
||||
*/
|
||||
@@ -366,25 +366,25 @@ class PlayState extends MusicBeatState
|
||||
/**
|
||||
* Camera zoom at which the game lerps to.
|
||||
*/
|
||||
public var defaultCamZoom:Float = Constants.DEFAULT_CAM_ZOOM;
|
||||
public var defaultCamZoom:Float = Flags.DEFAULT_CAM_ZOOM;
|
||||
/**
|
||||
* Speed at which the game camera zoom lerps to.
|
||||
*/
|
||||
public var camGameZoomLerp:Float = Constants.DEFAULT_CAM_ZOOM_LERP;
|
||||
public var camGameZoomLerp:Float = Flags.DEFAULT_CAM_ZOOM_LERP;
|
||||
|
||||
/**
|
||||
* Camera zoom at which the hud lerps to.
|
||||
*/
|
||||
public var defaultHudZoom:Float = Constants.DEFAULT_HUD_ZOOM;
|
||||
public var defaultHudZoom:Float = Flags.DEFAULT_HUD_ZOOM;
|
||||
/**
|
||||
* Speed at which the hud camera zoom lerps to.
|
||||
*/
|
||||
public var camHUDZoomLerp:Float = Constants.DEFAULT_HUD_ZOOM_LERP;
|
||||
public var camHUDZoomLerp:Float = Flags.DEFAULT_HUD_ZOOM_LERP;
|
||||
|
||||
/**
|
||||
* Zoom for the pixel assets.
|
||||
*/
|
||||
public static var daPixelZoom:Float = Constants.PIXEL_ART_SCALE;
|
||||
public static var daPixelZoom:Float = Flags.PIXEL_ART_SCALE;
|
||||
|
||||
/**
|
||||
* Whenever the game is currently in a cutscene or not.
|
||||
@@ -603,7 +603,7 @@ class PlayState extends MusicBeatState
|
||||
// CHARACTER INITIALIZATION
|
||||
#if REGION
|
||||
comboGroup = new RotatingSpriteGroup(FlxG.width * 0.55, (FlxG.height * 0.5) - 60);
|
||||
comboGroup.maxSize = Constants.DEFAULT_COMBO_GROUP_MAX_SIZE;
|
||||
comboGroup.maxSize = Flags.DEFAULT_COMBO_GROUP_MAX_SIZE;
|
||||
#end
|
||||
|
||||
// CAMERA FOLLOW, SCRIPTS & STAGE INITIALIZATION
|
||||
@@ -611,7 +611,7 @@ class PlayState extends MusicBeatState
|
||||
camFollow = new FlxObject(0, 0, 2, 2);
|
||||
add(camFollow);
|
||||
|
||||
if (SONG.stage == null || SONG.stage.trim() == "") SONG.stage = Constants.DEFAULT_STAGE;
|
||||
if (SONG.stage == null || SONG.stage.trim() == "") SONG.stage = Flags.DEFAULT_STAGE;
|
||||
add(stage = new Stage(SONG.stage));
|
||||
|
||||
if (!chartingMode || Options.charterEnablePlaytestScripts) {
|
||||
@@ -721,7 +721,7 @@ class PlayState extends MusicBeatState
|
||||
|
||||
// HUD INITIALIZATION & CAMERA INITIALIZATION
|
||||
#if REGION
|
||||
var event = EventManager.get(AmountEvent).recycle(Constants.DEFAULT_STRUM_AMOUNT);
|
||||
var event = EventManager.get(AmountEvent).recycle(Flags.DEFAULT_STRUM_AMOUNT);
|
||||
if (!gameAndCharsEvent("onPreGenerateStrums", event).cancelled) {
|
||||
generateStrums(event.amount);
|
||||
gameAndCharsEvent("onPostGenerateStrums", event);
|
||||
@@ -730,7 +730,7 @@ class PlayState extends MusicBeatState
|
||||
for(str in strumLines)
|
||||
str.generate(str.data, (chartingMode && Charter.startHere) ? Charter.startTime : null);
|
||||
|
||||
FlxG.camera.follow(camFollow, LOCKON, Constants.DEFAULT_CAMERA_FOLLOW_SPEED);
|
||||
FlxG.camera.follow(camFollow, LOCKON, Flags.DEFAULT_CAMERA_FOLLOW_SPEED);
|
||||
FlxG.camera.zoom = defaultCamZoom;
|
||||
// camHUD.zoom = defaultHudZoom;
|
||||
|
||||
@@ -759,10 +759,11 @@ class PlayState extends MusicBeatState
|
||||
healthBar.createFilledBar(leftColor, rightColor);
|
||||
add(healthBar);
|
||||
|
||||
health = maxHealth / 2;
|
||||
if (Flags.DEFAULT_HEALTH != null) health = Flags.DEFAULT_HEALTH;
|
||||
else health = maxHealth / 2;
|
||||
|
||||
iconP1 = new HealthIcon(boyfriend != null ? boyfriend.getIcon() : Constants.DEFAULT_HEALTH_ICON, true);
|
||||
iconP2 = new HealthIcon(dad != null ? dad.getIcon() : Constants.DEFAULT_HEALTH_ICON, false);
|
||||
iconP1 = new HealthIcon(boyfriend != null ? boyfriend.getIcon() : Flags.DEFAULT_HEALTH_ICON, true);
|
||||
iconP2 = new HealthIcon(dad != null ? dad.getIcon() : Flags.DEFAULT_HEALTH_ICON, false);
|
||||
for(icon in [iconP1, iconP2]) {
|
||||
icon.y = healthBar.y - (icon.height / 2);
|
||||
add(icon);
|
||||
@@ -799,7 +800,7 @@ class PlayState extends MusicBeatState
|
||||
FlxG.sound.load(Paths.sound(s));
|
||||
|
||||
if (chartingMode) {
|
||||
WindowUtils.prefix = Charter.undos.unsaved ? Constants.UNDO_PREFIX : "";
|
||||
WindowUtils.prefix = Charter.undos.unsaved ? Flags.UNDO_PREFIX : "";
|
||||
WindowUtils.suffix = " (Chart Playtesting)";
|
||||
|
||||
SaveWarning.showWarning = Charter.undos.unsaved;
|
||||
@@ -855,7 +856,7 @@ class PlayState extends MusicBeatState
|
||||
|
||||
inCutscene = true;
|
||||
var videoCutscene = Paths.video('$songName-${prefix}cutscene');
|
||||
var videoCutsceneAlt = Paths.file('songs/$songName/${prefix}cutscene.${Constants.VIDEO_EXT}');
|
||||
var videoCutsceneAlt = Paths.file('songs/$songName/${prefix}cutscene.${Flags.VIDEO_EXT}');
|
||||
var dialogue = Paths.file('songs/$songName/${prefix}dialogue.xml');
|
||||
persistentUpdate = true;
|
||||
var toCall:Void->Void = function() {
|
||||
@@ -1169,7 +1170,7 @@ class PlayState extends MusicBeatState
|
||||
paused = true;
|
||||
|
||||
// 1 / 1000 chance for Gitaroo Man easter egg
|
||||
if (allowGitaroo && FlxG.random.bool(Constants.GITAROO_CHANCE))
|
||||
if (allowGitaroo && FlxG.random.bool(Flags.GITAROO_CHANCE))
|
||||
{
|
||||
// gitaroo man easter egg
|
||||
FlxG.switchState(new GitarooPause());
|
||||
@@ -1226,7 +1227,7 @@ class PlayState extends MusicBeatState
|
||||
}
|
||||
|
||||
function updateIconPositions() {
|
||||
var iconOffset:Int = Constants.ICON_OFFSET;
|
||||
var iconOffset = Flags.ICON_OFFSET;
|
||||
|
||||
var center:Float = healthBar.x + healthBar.width * FlxMath.remapToRange(healthBar.percent, 0, 100, 1, 0);
|
||||
|
||||
@@ -1283,7 +1284,7 @@ class PlayState extends MusicBeatState
|
||||
}
|
||||
|
||||
if (doIconBop) {
|
||||
var iconLerp = Constants.ICON_LERP;
|
||||
var iconLerp = Flags.ICON_LERP;
|
||||
iconP1.scale.set(lerp(iconP1.scale.x, 1, iconLerp), lerp(iconP1.scale.y, 1, iconLerp));
|
||||
iconP2.scale.set(lerp(iconP2.scale.x, 1, iconLerp), lerp(iconP2.scale.y, 1, iconLerp));
|
||||
|
||||
@@ -1304,7 +1305,7 @@ class PlayState extends MusicBeatState
|
||||
var instTime = FlxG.sound.music.time;
|
||||
var isOffsync = vocals.time != instTime || [for(strumLine in strumLines.members) strumLine.vocals.time != instTime].contains(true);
|
||||
__vocalOffsetViolation = Math.max(0, __vocalOffsetViolation + (isOffsync ? elapsed : -elapsed / 2));
|
||||
if (__vocalOffsetViolation > Constants.VOCAL_OFFSET_VIOLATION_THRESHOLD) {
|
||||
if (__vocalOffsetViolation > Flags.VOCAL_OFFSET_VIOLATION_THRESHOLD) {
|
||||
resyncVocals();
|
||||
__vocalOffsetViolation = 0;
|
||||
}
|
||||
@@ -1444,7 +1445,7 @@ class PlayState extends MusicBeatState
|
||||
charToUse == null ? 0 : charToUse.x,
|
||||
charToUse == null ? 0 : charToUse.y,
|
||||
charToUse,
|
||||
deathCharID.getDefault(charToUse != null ? charToUse.gameOverCharacter : Constants.DEFAULT_GAMEOVER_CHARACTER),
|
||||
deathCharID.getDefault(charToUse != null ? charToUse.gameOverCharacter : Flags.DEFAULT_GAMEOVER_CHARACTER),
|
||||
charToUse != null ? charToUse.isPlayer : true,
|
||||
gameOverSong.getDefault(this.gameOverSong),
|
||||
lossSFX.getDefault(this.lossSFX),
|
||||
@@ -1840,13 +1841,13 @@ class PlayState extends MusicBeatState
|
||||
if (camZoomingInterval < 1) camZoomingInterval = 1;
|
||||
if (Options.camZoomOnBeat && camZooming && FlxG.camera.zoom < maxCamZoom && curBeat % camZoomingInterval == 0)
|
||||
{
|
||||
FlxG.camera.zoom += Constants.CAM_BOP_STRENGTH * camZoomingStrength;
|
||||
camHUD.zoom += Constants.HUD_BOP_STRENGTH * camZoomingStrength;
|
||||
FlxG.camera.zoom += Flags.CAM_BOP_STRENGTH * camZoomingStrength;
|
||||
camHUD.zoom += Flags.HUD_BOP_STRENGTH * camZoomingStrength;
|
||||
}
|
||||
|
||||
if (doIconBop)
|
||||
{
|
||||
var iconScale = Constants.BOP_ICON_SCALE;
|
||||
var iconScale = Flags.BOP_ICON_SCALE;
|
||||
iconP1.scale.set(iconScale, iconScale);
|
||||
iconP2.scale.set(iconScale, iconScale);
|
||||
|
||||
@@ -1937,7 +1938,7 @@ class PlayState extends MusicBeatState
|
||||
* @param difficulty Week Difficulty
|
||||
*/
|
||||
public static function loadWeek(weekData:WeekData, ?difficulty:String) {
|
||||
if (difficulty == null) difficulty = Constants.DEFAULT_DIFFICULTY;
|
||||
if (difficulty == null) difficulty = Flags.DEFAULT_DIFFICULTY;
|
||||
storyWeek = weekData;
|
||||
storyPlaylist = [for(e in weekData.songs) e.name];
|
||||
isStoryMode = true;
|
||||
@@ -1958,7 +1959,7 @@ class PlayState extends MusicBeatState
|
||||
* @param coopMode Whenever co-op mode is on.
|
||||
*/
|
||||
public static function loadSong(_name:String, ?_difficulty:String, _opponentMode:Bool = false, _coopMode:Bool = false) {
|
||||
if (_difficulty == null) difficulty = Constants.DEFAULT_DIFFICULTY;
|
||||
if (_difficulty == null) difficulty = Flags.DEFAULT_DIFFICULTY;
|
||||
isStoryMode = false;
|
||||
opponentMode = _opponentMode;
|
||||
chartingMode = false;
|
||||
|
||||
@@ -42,7 +42,7 @@ class SplashGroup extends FlxTypedGroup<FunkinSprite> {
|
||||
Logs.trace('Couldn\'t parse splash data for "${path}": ${e.toString()}', ERROR);
|
||||
valid = false;
|
||||
}
|
||||
maxSize = Constants.MAX_SPLASHES;
|
||||
maxSize = Flags.MAX_SPLASHES;
|
||||
}
|
||||
|
||||
function createSplash(imagePath:String) {
|
||||
|
||||
@@ -50,7 +50,7 @@ class SplashHandler extends FlxTypedGroup<FunkinSprite> {
|
||||
add(event.splash);
|
||||
|
||||
// max 8 rendered splashes
|
||||
while(members.length > Constants.MAX_SPLASHES)
|
||||
while(members.length > Flags.MAX_SPLASHES)
|
||||
remove(members[0], true);
|
||||
}
|
||||
}
|
||||
@@ -157,7 +157,7 @@ class StrumLine extends FlxTypedGroup<Strum> {
|
||||
/*var limit = FlxG.height / 0.45;
|
||||
notes.limit = limit / scrollSpeed;
|
||||
OR
|
||||
notes.limit = Constants.DEFAULT_NOTE_MS_LIMIT / scrollSpeed;*/
|
||||
notes.limit = Flags.DEFAULT_NOTE_MS_LIMIT / scrollSpeed;*/
|
||||
}
|
||||
|
||||
public override function update(elapsed:Float) {
|
||||
@@ -295,7 +295,7 @@ class StrumLine extends FlxTypedGroup<Strum> {
|
||||
PlayState.instance.health += health * (opponentSide ? -1 : 1);
|
||||
|
||||
public inline function generateStrums(amount:Int = -1) {
|
||||
if(amount == -1) amount = Constants.DEFAULT_STRUM_AMOUNT;
|
||||
if(amount == -1) amount = Flags.DEFAULT_STRUM_AMOUNT;
|
||||
for (i in 0...amount)
|
||||
add(createStrum(i));
|
||||
}
|
||||
@@ -333,7 +333,7 @@ class StrumLine extends FlxTypedGroup<Strum> {
|
||||
babyArrow.animation.addByPrefix('red', 'arrowRIGHT');
|
||||
|
||||
babyArrow.antialiasing = true;
|
||||
babyArrow.setGraphicSize(Std.int((babyArrow.width * Constants.DEFAULT_NOTE_SCALE) * strumScale));
|
||||
babyArrow.setGraphicSize(Std.int((babyArrow.width * Flags.DEFAULT_NOTE_SCALE) * strumScale));
|
||||
|
||||
babyArrow.animation.addByPrefix('static', 'arrow${event.animPrefix.toUpperCase()}');
|
||||
babyArrow.animation.addByPrefix('pressed', '${event.animPrefix} press', 24, false);
|
||||
|
||||
@@ -28,7 +28,7 @@ class Cutscene extends MusicBeatSubstate {
|
||||
__callback = callback;
|
||||
__pausable = allowPause;
|
||||
|
||||
pauseItems = Constants.DEFAULT_CUTSCENE_PAUSE_ITEMS;
|
||||
pauseItems = Flags.DEFAULT_CUTSCENE_PAUSE_ITEMS;
|
||||
skippable = canSkip;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import flixel.tweens.FlxEase;
|
||||
import flixel.util.FlxDestroyUtil;
|
||||
|
||||
import funkin.backend.system.Flags;
|
||||
import funkin.Constants;
|
||||
|
||||
import funkin.menus.ui.Alphabet;
|
||||
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||
|
||||
@@ -19,7 +19,7 @@ class BetaWarningState extends MusicBeatState {
|
||||
|
||||
disclaimer = new FunkinText(16, titleAlphabet.y + titleAlphabet.height + 10, FlxG.width - 32, "", 32);
|
||||
disclaimer.alignment = CENTER;
|
||||
disclaimer.applyMarkup('This engine is still in a *${Constants.RELEASE_CYCLE}* state. That means *majority of the features* are either *buggy* or *non finished*. If you find any bugs, please report them to the Codename Engine GitHub.\n\nPress ENTER to continue',
|
||||
disclaimer.applyMarkup('This engine is still in a *${Flags.RELEASE_CYCLE}* state. That means *majority of the features* are either *buggy* or *non finished*. If you find any bugs, please report them to the Codename Engine GitHub.\n\nPress ENTER to continue',
|
||||
[
|
||||
new FlxTextFormatMarkerPair(new FlxTextFormat(0xFFFF4444), "*")
|
||||
]
|
||||
|
||||
@@ -456,7 +456,7 @@ class FreeplaySonglist {
|
||||
|
||||
if (songsFound.length > 0) {
|
||||
for(s in songsFound)
|
||||
songs.push(Chart.loadChartMeta(s, Constants.DEFAULT_DIFFICULTY, source == MODS));
|
||||
songs.push(Chart.loadChartMeta(s, Flags.DEFAULT_DIFFICULTY, source == MODS));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -24,7 +24,7 @@ class MainMenuState extends MusicBeatState
|
||||
var camFollow:FlxObject;
|
||||
var versionText:FunkinText;
|
||||
|
||||
public var canAccessDebugMenus:Bool = Constants.DEFAULT_CAN_ACCESS_DEBUG_MENUS;
|
||||
public var canAccessDebugMenus:Bool = Flags.DEFAULT_CAN_ACCESS_DEBUG_MENUS;
|
||||
|
||||
override function create()
|
||||
{
|
||||
@@ -72,7 +72,7 @@ class MainMenuState extends MusicBeatState
|
||||
|
||||
FlxG.camera.follow(camFollow, null, 0.06);
|
||||
|
||||
versionText = new FunkinText(5, FlxG.height - 2, 0, '${Constants.VERSION_MESSAGE}\n${Constants.COMMIT_MESSAGE}\n[${controls.getKeyName(SWITCHMOD)}] Open Mods menu\n');
|
||||
versionText = new FunkinText(5, FlxG.height - 2, 0, '${Flags.VERSION_MESSAGE}\n${Flags.COMMIT_MESSAGE}\n[${controls.getKeyName(SWITCHMOD)}] Open Mods menu\n');
|
||||
versionText.y -= versionText.height;
|
||||
versionText.scrollFactor.set();
|
||||
add(versionText);
|
||||
|
||||
@@ -36,7 +36,7 @@ class PauseSubState extends MusicBeatSubstate
|
||||
|
||||
public function new(?items:Array<String>, ?selectCall:NameEvent->Void) {
|
||||
super();
|
||||
menuItems = items != null ? items : Constants.DEFAULT_PAUSE_ITEMS;
|
||||
menuItems = items != null ? items : Flags.DEFAULT_PAUSE_ITEMS;
|
||||
this.selectCall = selectCall;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ class CreditsCodename extends funkin.options.OptionsScreen {
|
||||
var text:String = parent.treeParent.pathDesc.text;
|
||||
parent.treeParent.pathDesc.text = "";
|
||||
parent.treeParent.pathDesc.applyMarkup(text, contribFormats = [
|
||||
new FlxTextFormatMarkerPair(new FlxTextFormat(Constants.MAIN_DEVS_COLOR), '*'),
|
||||
new FlxTextFormatMarkerPair(new FlxTextFormat(FlxColor.interpolate(Constants.MIN_CONTRIBUTIONS_COLOR, Constants.MAIN_DEVS_COLOR, Options.contributors[curSelected].contributions / totalContributions)), '~')
|
||||
new FlxTextFormatMarkerPair(new FlxTextFormat(Flags.MAIN_DEVS_COLOR), '*'),
|
||||
new FlxTextFormatMarkerPair(new FlxTextFormat(FlxColor.interpolate(Flags.MIN_CONTRIBUTIONS_COLOR, Flags.MAIN_DEVS_COLOR, Options.contributors[curSelected].contributions / totalContributions)), '~')
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class CreditsCodename extends funkin.options.OptionsScreen {
|
||||
Options.lastUpdated = curTime;
|
||||
|
||||
error = false;
|
||||
var idk = GitHub.getContributors(Constants.REPO_OWNER, Constants.REPO_NAME, function(e) {
|
||||
var idk = GitHub.getContributors(Flags.REPO_OWNER, Flags.REPO_NAME, function(e) {
|
||||
error = true;
|
||||
var errMsg:String = 'Error while trying to download contributors list:\n${CoolUtil.removeIP(e.message)}';
|
||||
Logs.traceColored([Logs.logText(errMsg.replace('\n', ' '), RED)], ERROR);
|
||||
@@ -84,9 +84,9 @@ class CreditsCodename extends funkin.options.OptionsScreen {
|
||||
Logs.trace('[CreditsCodename] Contributors list Updated!', VERBOSE);
|
||||
|
||||
var errorOnMain:Bool = false;
|
||||
var idk2 = GitHub.getOrganizationMembers(Constants.REPO_OWNER, function(e) {
|
||||
var idk2 = GitHub.getOrganizationMembers(Flags.REPO_OWNER, function(e) {
|
||||
errorOnMain = true;
|
||||
var errMsg:String = 'Error while trying to download ${Constants.REPO_OWNER} members list:\n${CoolUtil.removeIP(e.message)}';
|
||||
var errMsg:String = 'Error while trying to download ${Flags.REPO_OWNER} members list:\n${CoolUtil.removeIP(e.message)}';
|
||||
Logs.traceColored([Logs.logText(errMsg.replace('\n', ' '), RED)], ERROR);
|
||||
funkin.backend.utils.NativeAPI.showMessageBox("Codename Engine Warning", errMsg, MSG_WARNING);
|
||||
});
|
||||
@@ -114,7 +114,7 @@ class CreditsCodename extends funkin.options.OptionsScreen {
|
||||
var opt:GithubIconOption = new GithubIconOption(c, 'Total Contributions: ~${c.contributions}~ / *${totalContributions}* (~${FlxMath.roundDecimal(c.contributions / totalContributions * 100, 2)}%~) - Select to open GitHub account');
|
||||
if(Options.mainDevs.contains(c.id)) {
|
||||
opt.desc += " *- Public member of the main Devs!*";
|
||||
@:privateAccess opt.__text.color = Constants.MAIN_DEVS_COLOR;
|
||||
@:privateAccess opt.__text.color = Flags.MAIN_DEVS_COLOR;
|
||||
}
|
||||
add(opt);
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ class Alphabet extends FlxSpriteGroup
|
||||
splitWords = _finalText.split("");
|
||||
}
|
||||
|
||||
//public var personTalking:String = Constants.DEFAULT_GIRLFRIEND;
|
||||
//public var personTalking:String = Flags.DEFAULT_GIRLFRIEND;
|
||||
|
||||
public function startTypedText():Void
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user