diff --git a/assets/data/scripts/pixel.hx b/assets/data/scripts/pixel.hx index cc8239cf..0b3f0c59 100644 --- a/assets/data/scripts/pixel.hx +++ b/assets/data/scripts/pixel.hx @@ -1,3 +1,4 @@ +// import funkin.game.HudCamera; import funkin.backend.scripting.events.NoteHitEvent; diff --git a/source/funkin/Constants.hx b/source/funkin/Constants.hx new file mode 100644 index 00000000..8cf399cc --- /dev/null +++ b/source/funkin/Constants.hx @@ -0,0 +1,132 @@ +package funkin; + +import lime.app.Application; +import funkin.backend.system.macros.GitCommitMacro; +import flixel.util.FlxColor; + +using StringTools; + +class Constants { + public static var COMMIT_NUMBER = GitCommitMacro.commitNumber; + public static var COMMIT_HASH = GitCommitMacro.commitHash; + public static var COMMIT_MESSAGE = 'Commit $COMMIT_NUMBER ($COMMIT_HASH)'; + + 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 = ["time", "id", "type", "sLen"]; +} \ No newline at end of file diff --git a/source/funkin/backend/assets/Paths.hx b/source/funkin/backend/assets/Paths.hx index d7567b82..4cc555b5 100644 --- a/source/funkin/backend/assets/Paths.hx +++ b/source/funkin/backend/assets/Paths.hx @@ -13,12 +13,6 @@ using StringTools; class Paths { - /** - * Preferred sound extension for the game's audio files. - * Currently is set to `mp3` for web targets, and `ogg` for other targets. - */ - inline public static final SOUND_EXT = #if web "mp3" #else "ogg" #end; - public static var assetsTree:AssetsLibraryList; public static var tempFramesCache:Map = []; @@ -32,8 +26,8 @@ class Paths public static inline function getPath(file:String, ?library:String) return library != null ? '$library:assets/$library/$file' : 'assets/$file'; - public static inline function video(key:String, ?ext:String = "mp4") - return getPath('videos/$key.$ext'); + public static inline function video(key:String, ?ext:String) + return getPath('videos/$key.${ext != null ? ext : Constants.VIDEO_EXT}'); public static inline function ndll(key:String) return getPath('ndlls/$key.ndll'); @@ -66,28 +60,31 @@ class Paths return getPath('data/$key.ps1', library); static public function sound(key:String, ?library:String) - return getPath('sounds/$key.$SOUND_EXT', library); + return getPath('sounds/$key.${Constants.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) - return getPath('music/$key.$SOUND_EXT', library); + return getPath('music/$key.${Constants.SOUND_EXT}', library); - inline static public function voices(song:String, difficulty:String = "normal", ?prefix:String = "") + inline static public function voices(song:String, ?difficulty:String, ?prefix:String = "") { - var diff = getPath('songs/${song.toLowerCase()}/song/Voices$prefix-${difficulty.toLowerCase()}.$SOUND_EXT', null); - return OpenFlAssets.exists(diff) ? diff : getPath('songs/${song.toLowerCase()}/song/Voices$prefix.$SOUND_EXT', null); + if (difficulty == null) difficulty = Constants.DEFAULT_DIFFICULTY; + var diff = getPath('songs/${song.toLowerCase()}/song/Voices$prefix-${difficulty.toLowerCase()}.${Constants.SOUND_EXT}', null); + return OpenFlAssets.exists(diff) ? diff : getPath('songs/${song.toLowerCase()}/song/Voices$prefix.${Constants.SOUND_EXT}', null); } - inline static public function inst(song:String, difficulty:String = "normal", ?prefix:String = "") + inline static public function inst(song:String, ?difficulty:String, ?prefix:String = "") { - var diff = getPath('songs/${song.toLowerCase()}/song/Inst$prefix-${difficulty.toLowerCase()}.$SOUND_EXT', null); - return OpenFlAssets.exists(diff) ? diff : getPath('songs/${song.toLowerCase()}/song/Inst$prefix.$SOUND_EXT', null); + if (difficulty == null) difficulty = Constants.DEFAULT_DIFFICULTY; + var diff = getPath('songs/${song.toLowerCase()}/song/Inst$prefix-${difficulty.toLowerCase()}.${Constants.SOUND_EXT}', null); + return OpenFlAssets.exists(diff) ? diff : getPath('songs/${song.toLowerCase()}/song/Inst$prefix.${Constants.SOUND_EXT}', null); } - static public function image(key:String, ?library:String, checkForAtlas:Bool = false, ?ext:String = "png") + static public function image(key:String, ?library:String, checkForAtlas:Bool = false, ?ext:String) { + if (ext == null) ext = Constants.IMAGE_EXT; if (checkForAtlas) { var atlasPath = getPath('images/$key/spritemap.$ext', library); var multiplePath = getPath('images/$key/1.$ext', library); @@ -112,8 +109,8 @@ class Paths return scriptPath; } - static public function chart(song:String, ?difficulty:String = "normal"):String { - difficulty = difficulty.toLowerCase(); + static public function chart(song:String, ?difficulty:String):String { + difficulty = (difficulty != null ? difficulty : Constants.DEFAULT_DIFFICULTY).toLowerCase(); song = song.toLowerCase(); return getPath('songs/$song/charts/$difficulty.json', null); @@ -152,19 +149,19 @@ class Paths return FlxAtlasFrames.fromSparrow(image(key, library), file('images/$key.xml', library)); inline static public function getSparrowAtlasAlt(key:String) - return FlxAtlasFrames.fromSparrow('$key.png', '$key.xml'); + return FlxAtlasFrames.fromSparrow('$key.${Constants.IMAGE_EXT}', '$key.xml'); inline static public function getPackerAtlas(key:String, ?library:String) return FlxAtlasFrames.fromSpriteSheetPacker(image(key, library), file('images/$key.txt', library)); inline static public function getPackerAtlasAlt(key:String) - return FlxAtlasFrames.fromSpriteSheetPacker('$key.png', '$key.txt'); + return FlxAtlasFrames.fromSpriteSheetPacker('$key.${Constants.IMAGE_EXT}', '$key.txt'); inline static public function getAsepriteAtlas(key:String, ?library:String) return FlxAtlasFrames.fromAseprite(image(key, library), file('images/$key.json', library)); inline static public function getAsepriteAtlasAlt(key:String) - return FlxAtlasFrames.fromAseprite('$key.png', '$key.json'); + return FlxAtlasFrames.fromAseprite('$key.${Constants.IMAGE_EXT}', '$key.json'); inline static public function getAssetsRoot():String return ModsFolder.currentModFolder != null ? '${ModsFolder.modsPath}${ModsFolder.currentModFolder}' : './assets'; @@ -197,7 +194,7 @@ class Paths static function loadFrames(path:String, Unique:Bool = false, Key:String = null, SkipAtlasCheck:Bool = false):FlxFramesCollection { var noExt = Path.withoutExtension(path); - if (Assets.exists('$noExt/1.png')) { + if (Assets.exists('$noExt/1.${Constants.IMAGE_EXT}')) { // MULTIPLE SPRITESHEETS!! var graphic = FlxG.bitmap.add("flixel/images/logo/default.png", false, '$noExt/mult'); @@ -208,8 +205,8 @@ class Paths trace("no frames yet for multiple atlases!!"); var cur = 1; var finalFrames = new MultiFramesCollection(graphic); - while(Assets.exists('$noExt/$cur.png')) { - var spr = loadFrames('$noExt/$cur.png'); + while(Assets.exists('$noExt/$cur.${Constants.IMAGE_EXT}')) { + var spr = loadFrames('$noExt/$cur.${Constants.IMAGE_EXT}'); finalFrames.addFrames(spr); cur++; } diff --git a/source/funkin/backend/chart/Chart.hx b/source/funkin/backend/chart/Chart.hx index 87302b71..4932145d 100644 --- a/source/funkin/backend/chart/Chart.hx +++ b/source/funkin/backend/chart/Chart.hx @@ -12,11 +12,6 @@ import sys.FileSystem; using StringTools; class Chart { - /** - * Default background colors for songs without bg color - */ - public inline static var defaultColor:FlxColor = 0xFF9271FD; - public static function loadEventsJson(songName:String) { var path = Paths.file('songs/${songName.toLowerCase()}/events.json'); var data:Array = null; @@ -30,7 +25,9 @@ class Chart { return data; } - public static function loadChartMeta(songName:String, difficulty:String = "normal", fromMods:Bool = true) { + public static function loadChartMeta(songName:String, ?difficulty:String, fromMods:Bool = true) { + if (difficulty == null) difficulty = Constants.DEFAULT_DIFFICULTY; + var metaPath = Paths.file('songs/${songName.toLowerCase()}/meta.json'); var metaDiffPath = Paths.file('songs/${songName.toLowerCase()}/meta-${difficulty.toLowerCase()}.json'); @@ -51,18 +48,18 @@ class Chart { if (data == null) data = { name: songName, - bpm: 100 + bpm: Constants.DEFAULT_BPM }; data.setFieldDefault("name", songName); - data.setFieldDefault("beatsPerMeasure", 4); - data.setFieldDefault("stepsPerBeat", 4); + data.setFieldDefault("beatsPerMeasure", Constants.DEFAULT_BEATS_PER_MEASURE); + data.setFieldDefault("stepsPerBeat", Constants.DEFAULT_STEPS_PER_BEAT); data.setFieldDefault("needsVoices", true); - data.setFieldDefault("icon", "face"); + data.setFieldDefault("icon", Constants.DEFAULT_HEALTH_ICON); data.setFieldDefault("difficulties", []); - data.setFieldDefault("coopAllowed", false); - data.setFieldDefault("opponentModeAllowed", false); + data.setFieldDefault("coopAllowed", Constants.DEFAULT_COOP_ALLOWED); + data.setFieldDefault("opponentModeAllowed", Constants.DEFAULT_OPPONENT_MODE_ALLOWED); data.setFieldDefault("displayName", data.name); - data.setFieldDefault("parsedColor", data.color.getColorFromDynamic().getDefault(defaultColor)); + data.setFieldDefault("parsedColor", data.color.getColorFromDynamic().getDefault(Constants.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)]; @@ -86,7 +83,9 @@ class Chart { return data; } - public static function parse(songName:String, difficulty:String = "normal"):ChartData { + public static function parse(songName:String, ?difficulty:String):ChartData { + if (difficulty == null) difficulty = Constants.DEFAULT_DIFFICULTY; + var chartPath = Paths.chart(songName, difficulty); var base:ChartData = { strumLines: [], @@ -95,8 +94,8 @@ class Chart { meta: { name: null }, - scrollSpeed: 2, - stage: "stage", + scrollSpeed: Constants.DEFAULT_SCROLL_SPEED , + stage: Constants.DEFAULT_STAGE, codenameChart: true, fromMods: Paths.assetsTree.existsSpecific(chartPath, "TEXT", MODS) }; @@ -192,7 +191,8 @@ class Chart { * @param saveSettings * @return Filtered chart used for saving. */ - public static function save(songFolderPath:String, chart:ChartData, difficulty:String = "normal", ?saveSettings:ChartSaveSettings):ChartData { + public static function save(songFolderPath:String, chart:ChartData, ?difficulty:String, ?saveSettings:ChartSaveSettings):ChartData { + if (difficulty == null) difficulty = Constants.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 ? "\t" : null)); + CoolUtil.safeSaveFile(chartPath, Json.stringify(filteredChart, null, saveSettings.prettyPrint == true ? Constants.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 ? "\t" : null)); + CoolUtil.safeSaveFile(metaPath, Json.stringify(meta, null, saveSettings.prettyPrint == true ? Constants.JSON_PRETTY_PRINT : null)); #end return filteredChart; } diff --git a/source/funkin/backend/chart/FNFLegacyParser.hx b/source/funkin/backend/chart/FNFLegacyParser.hx index 0e5f55df..80d7d815 100644 --- a/source/funkin/backend/chart/FNFLegacyParser.hx +++ b/source/funkin/backend/chart/FNFLegacyParser.hx @@ -45,7 +45,7 @@ class FNFLegacyParser { var camFocusedBF:Bool = false; var altAnims:Bool = false; - var beatsPerMeasure:Float = data.beatsPerMeasure.getDefault(4); + var beatsPerMeasure:Float = data.beatsPerMeasure.getDefault(Constants.DEFAULT_BEATS_PER_MEASURE); var curBPM:Float = data.bpm; var curTime:Float = 0; var curCrochet:Float = ((60 / curBPM) * 1000); @@ -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(["dad"])[0]; + if (base.player2 == null) base.player2 = strumLine.characters.getDefault([Constants.DEFAULT_OPPONENT])[0]; case PLAYER: - if (base.player1 == null) base.player1 = strumLine.characters.getDefault(["bf"])[0]; + if (base.player1 == null) base.player1 = strumLine.characters.getDefault([Constants.DEFAULT_CHARACTER])[0]; case ADDITIONAL: // do nothing } diff --git a/source/funkin/backend/chart/PsychParser.hx b/source/funkin/backend/chart/PsychParser.hx index 2d5a8b7b..5fb420d3 100644 --- a/source/funkin/backend/chart/PsychParser.hx +++ b/source/funkin/backend/chart/PsychParser.hx @@ -32,7 +32,7 @@ class PsychParser { for (note in strumLine.notes) { var section:Int = Math.floor(Conductor.getStepForTime(note.time) / Conductor.getMeasureLength()); var swagSection:SwagSection = base.notes[section]; - + if (section >= 0 && section < base.notes.length) { var sectionNote:Array = [ note.time, // TIME @@ -47,7 +47,7 @@ class PsychParser { swagSection.sectionNotes.push(sectionNote); } } - + var groupedEvents:Array> = []; var __last:Array = null; var __lastTime:Float = Math.NaN; @@ -106,7 +106,7 @@ class PsychParser { for (psychEvent in psychEvents) for (i in 1...3) // Turn both vals into strings - if (!(psychEvent[i] is String)) + if (!(psychEvent[i] is String)) psychEvent[i] = Std.string(psychEvent[i]); base.events.push([events[0].time, psychEvents]); diff --git a/source/funkin/backend/scripting/Script.hx b/source/funkin/backend/scripting/Script.hx index 1ea7e123..2f7f0344 100644 --- a/source/funkin/backend/scripting/Script.hx +++ b/source/funkin/backend/scripting/Script.hx @@ -54,8 +54,8 @@ class Script extends FlxBasic implements IFlxDestroyable { // Engine related stuff "engine" => { - commit: funkin.backend.system.macros.GitCommitMacro.commitNumber, - hash: funkin.backend.system.macros.GitCommitMacro.commitHash, + commit: Constants.COMMIT_NUMBER, + hash: Constants.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", funkin.backend.system.macros.GitCommitMacro.commitNumber); + defines.set("CODENAME_COMMIT", Constants.COMMIT_NUMBER); return defines; } /** diff --git a/source/funkin/backend/system/Conductor.hx b/source/funkin/backend/system/Conductor.hx index 8d4ef85a..25fd21c7 100644 --- a/source/funkin/backend/system/Conductor.hx +++ b/source/funkin/backend/system/Conductor.hx @@ -25,7 +25,7 @@ class Conductor /** * Current BPM */ - public static var bpm:Float = 100; + public static var bpm:Float = Constants.DEFAULT_BPM; /** * Current Crochet (time per beat), in milliseconds. diff --git a/source/funkin/backend/system/Main.hx b/source/funkin/backend/system/Main.hx index 649a09d9..de57faf1 100644 --- a/source/funkin/backend/system/Main.hx +++ b/source/funkin/backend/system/Main.hx @@ -28,10 +28,6 @@ import android.os.Build; class Main extends Sprite { - // make this empty once you guys are done with the project. - // good luck /gen <3 @crowplexus - public static final releaseCycle:String = "Beta"; - public static var instance:Main; public static var modToLoad:String = null; diff --git a/source/funkin/backend/system/framerate/CodenameBuildField.hx b/source/funkin/backend/system/framerate/CodenameBuildField.hx index 3175a01e..d6f36fed 100644 --- a/source/funkin/backend/system/framerate/CodenameBuildField.hx +++ b/source/funkin/backend/system/framerate/CodenameBuildField.hx @@ -9,6 +9,6 @@ class CodenameBuildField extends TextField { defaultTextFormat = Framerate.textFormat; autoSize = LEFT; multiline = wordWrap = false; - text = 'Codename Engine ${Main.releaseCycle}\nCommit ${GitCommitMacro.commitNumber} (${GitCommitMacro.commitHash})'; + text = 'Codename Engine ${Constants.RELEASE_CYCLE}\n${Constants.COMMIT_MESSAGE}'; } } diff --git a/source/funkin/backend/system/updating/UpdateScreen.hx b/source/funkin/backend/system/updating/UpdateScreen.hx index d7da6539..abfc77f7 100644 --- a/source/funkin/backend/system/updating/UpdateScreen.hx +++ b/source/funkin/backend/system/updating/UpdateScreen.hx @@ -56,7 +56,7 @@ class UpdateScreen extends MusicBeatState { generalProgress.alignment = CENTER; add(generalProgress); - overSound = FlxG.sound.load(Paths.sound('gameOverEnd')); + overSound = FlxG.sound.load(Paths.sound(Constants.DEFAULT_GAMEOVER_RETRY_SFX)); updater.execute(); diff --git a/source/funkin/backend/system/updating/UpdateUtil.hx b/source/funkin/backend/system/updating/UpdateUtil.hx index 9515b990..eeee9fc4 100644 --- a/source/funkin/backend/system/updating/UpdateUtil.hx +++ b/source/funkin/backend/system/updating/UpdateUtil.hx @@ -22,7 +22,7 @@ class UpdateUtil { } public static function checkForUpdates():UpdateCheckCallback { - var curTag = 'v${Application.current.meta.get('version')}'; + var curTag = 'v${Constants.VERSION}'; trace(curTag); var error = false; diff --git a/source/funkin/backend/utils/CoolUtil.hx b/source/funkin/backend/utils/CoolUtil.hx index cf7166f4..681b93fe 100644 --- a/source/funkin/backend/utils/CoolUtil.hx +++ b/source/funkin/backend/utils/CoolUtil.hx @@ -392,7 +392,7 @@ class CoolUtil * @param Looped Whenever the music loops (true) * @param Group A group that this music belongs to (default) */ - @:noUsing public static function playMusic(path:String, Persist:Bool = false, Volume:Int = 1, Looped:Bool = true, DefaultBPM:Int = 102, ?Group:FlxSoundGroup) { + @:noUsing public static function playMusic(path:String, Persist:Bool = false, Volume:Int = 1, Looped:Bool = true, DefaultBPM:Float = 102, ?Group:FlxSoundGroup) { Conductor.reset(); FlxG.sound.playMusic(path, Volume, Looped, Group); if (FlxG.sound.music != null) { @@ -403,17 +403,17 @@ class CoolUtil if (Assets.exists(infoPath)) { var musicInfo = IniUtil.parseAsset(infoPath, [ "BPM" => null, - "TimeSignature" => "4/4" + "TimeSignature" => Constants.DEFAULT_BEATS_PER_MEASURE + "/" + Constants.DEFAULT_STEPS_PER_BEAT ]); var timeSignParsed:Array> = musicInfo["TimeSignature"] == null ? [] : [for(s in musicInfo["TimeSignature"].split("/")) Std.parseFloat(s)]; - var beatsPerMeasure:Float = 4; - var stepsPerBeat:Float = 4; + var beatsPerMeasure:Float = Constants.DEFAULT_BEATS_PER_MEASURE; + var stepsPerBeat:Float = Constants.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 ? 4 : cast timeSignParsed[0]; - stepsPerBeat = timeSignParsed[1] == null || timeSignParsed[1] <= 0 ? 4 : cast timeSignParsed[1]; + 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]; } var bpm:Null = Std.parseFloat(musicInfo["BPM"]).getDefault(DefaultBPM); diff --git a/source/funkin/backend/utils/DiscordUtil.hx b/source/funkin/backend/utils/DiscordUtil.hx index 0ea8e5b3..4184f907 100644 --- a/source/funkin/backend/utils/DiscordUtil.hx +++ b/source/funkin/backend/utils/DiscordUtil.hx @@ -86,9 +86,9 @@ class DiscordUtil if (config == null) config = {}; - config.logoKey = config.logoKey.getDefault("icon"); - config.logoText = config.logoText.getDefault(Application.current.meta.get('title')); - config.clientID = config.clientID.getDefault("1027994136193810442"); + 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); currentID = config.clientID; #end } diff --git a/source/funkin/editors/character/CharacterEditor.hx b/source/funkin/editors/character/CharacterEditor.hx index a0dbaef8..552422ab 100644 --- a/source/funkin/editors/character/CharacterEditor.hx +++ b/source/funkin/editors/character/CharacterEditor.hx @@ -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 ? "* " : ""; + WindowUtils.prefix = undos.unsaved ? Constants.UNDO_PREFIX : ""; SaveWarning.showWarning = undos.unsaved; } @@ -354,7 +354,7 @@ class CharacterEditor extends UIState { ]); // clean - if (charXML.exists("gameOverChar") && character.gameOverCharacter == "bf-dead") charXML.remove("gameOverChar"); + if (charXML.exists("gameOverChar") && character.gameOverCharacter == Constants.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"); diff --git a/source/funkin/editors/character/CharacterInfoScreen.hx b/source/funkin/editors/character/CharacterInfoScreen.hx index 83a27a7f..20d96c58 100644 --- a/source/funkin/editors/character/CharacterInfoScreen.hx +++ b/source/funkin/editors/character/CharacterInfoScreen.hx @@ -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/face'); + if (!Assets.exists(path)) path = Paths.image('icons/' + Constants.DEFAULT_HEALTH_ICON); iconSprite.loadGraphic(path, true, 150, 150); iconSprite.animation.add(icon, [0], 0, false); diff --git a/source/funkin/editors/charter/ChartCreationScreen.hx b/source/funkin/editors/charter/ChartCreationScreen.hx index 78983762..3238c872 100644 --- a/source/funkin/editors/charter/ChartCreationScreen.hx +++ b/source/funkin/editors/charter/ChartCreationScreen.hx @@ -1,5 +1,6 @@ package funkin.editors.charter; +import haxe.macro.Expr.Constant; import flixel.text.FlxText.FlxTextFormat; import flixel.text.FlxText.FlxTextFormatMarkerPair; import funkin.backend.chart.ChartData; @@ -73,7 +74,7 @@ class ChartCreationScreen extends UISubstateWindow { strumLineList.addButton.callback = function() { strumLineList.add(new StrumLineButton(strumLineList.buttons.length, { - characters: ["dad"], + characters: [Constants.DEFAULT_OPPONENT], type: 0, notes: null, position: "DAD", @@ -84,7 +85,7 @@ class ChartCreationScreen extends UISubstateWindow { // DEFAULTS strumLineList.add(new StrumLineButton(0, { - characters: ["dad"], + characters: [Constants.DEFAULT_OPPONENT], type: 0, notes: null, position: "DAD", @@ -93,7 +94,7 @@ class ChartCreationScreen extends UISubstateWindow { scrollSpeed: 1, }, strumLineList)); strumLineList.add(new StrumLineButton(1, { - characters: ["bf"], + characters: [Constants.DEFAULT_CHARACTER], type: 1, notes: null, position: "BOYFRIEND", @@ -102,7 +103,7 @@ class ChartCreationScreen extends UISubstateWindow { scrollSpeed: 1, }, strumLineList)); strumLineList.add(new StrumLineButton(2, { - characters: ["gf"], + characters: [Constants.DEFAULT_GIRLFRIEND], type: 2, notes: null, position: "GIRLFRIEND", @@ -333,7 +334,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/face"); + image = Paths.image("icons/" + Constants.DEFAULT_HEALTH_ICON); charIcon.loadGraphic(image, true, 150, 150); charIcon.updateHitbox(); } diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index dc862cc4..ce7a67ff 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -1233,7 +1233,7 @@ class Charter extends UIState { if (strumLines != null) strumlineLockButton.button.animation.play(strumLines.draggable ? "1" : "0", true); - WindowUtils.prefix = undos.unsaved ? "* " : ""; + WindowUtils.prefix = undos.unsaved ? Constants.UNDO_PREFIX : ""; SaveWarning.showWarning = undos.unsaved; __firstFrame = false; @@ -1285,7 +1285,7 @@ class Charter extends UIState { } function _file_saveas(_) { - openSubState(new SaveSubstate(Json.stringify(Chart.filterChartForSaving(PlayState.SONG, false), null, Options.editorPrettyPrint ? "\t" : null), { + openSubState(new SaveSubstate(Json.stringify(Chart.filterChartForSaving(PlayState.SONG, false), null, Options.editorPrettyPrint ? Constants.JSON_PRETTY_PRINT : null), { defaultSaveFile: '${__diff.toLowerCase()}.json' })); undos.save(); @@ -1301,7 +1301,7 @@ class Charter extends UIState { } function _file_saveas_no_events(_) { - openSubState(new SaveSubstate(Json.stringify(Chart.filterChartForSaving(PlayState.SONG, false, false), null, Options.editorPrettyPrint ? "\t" : null), { + openSubState(new SaveSubstate(Json.stringify(Chart.filterChartForSaving(PlayState.SONG, false, false), null, Options.editorPrettyPrint ? Constants.JSON_PRETTY_PRINT : null), { defaultSaveFile: '${__diff.toLowerCase()}.json' })); undos.save(); @@ -1311,7 +1311,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, "\t") + Json.stringify(PlayState.SONG.meta == null ? {} : PlayState.SONG.meta, null, Constants.JSON_PRETTY_PRINT) ); #else _file_meta_saveas(_); @@ -1319,20 +1319,20 @@ class Charter extends UIState { } function _file_meta_saveas(_) { - openSubState(new SaveSubstate(Json.stringify(PlayState.SONG.meta == null ? {} : PlayState.SONG.meta, null, "\t"), { // always pretty print meta + openSubState(new SaveSubstate(Json.stringify(PlayState.SONG.meta == null ? {} : PlayState.SONG.meta, null, Constants.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 ? "\t" : null), { - defaultSaveFile: '${__song.toLowerCase().replace(" ", "-")}${__diff.toLowerCase() == "normal" ? "" : '-${__diff.toLowerCase()}'}.json', + 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', })); } - + function _file_saveas_psych(_) { - openSubState(new SaveSubstate(Json.stringify(PsychParser.encode(PlayState.SONG), null, Options.editorPrettyPrint ? "\t" : null), { - defaultSaveFile: '${__song.toLowerCase().replace(" ", "-")}${__diff.toLowerCase() == "normal" ? "" : '-${__diff.toLowerCase()}'}.json', + 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', })); } @@ -1340,7 +1340,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 ? "\t" : null) + Json.stringify({events: PlayState.SONG.events == null ? [] : PlayState.SONG.events}, null, Options.editorPrettyPrint ? Constants.JSON_PRETTY_PRINT : null) ); #else _file_events_saveas(_); @@ -1349,7 +1349,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 ? "\t" : null), { + openSubState(new SaveSubstate(Json.stringify({events: PlayState.SONG.events == null ? [] : PlayState.SONG.events}, null, Options.editorPrettyPrint ? Constants.JSON_PRETTY_PRINT : null), { defaultSaveFile: 'events.json' })); #end diff --git a/source/funkin/editors/charter/CharterMetaDataScreen.hx b/source/funkin/editors/charter/CharterMetaDataScreen.hx index 660e3d89..c4c619c8 100644 --- a/source/funkin/editors/charter/CharterMetaDataScreen.hx +++ b/source/funkin/editors/charter/CharterMetaDataScreen.hx @@ -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/face'); + if (!Assets.exists(path)) path = Paths.image('icons/' + Constants.DEFAULT_HEALTH_ICON); iconSprite.loadGraphic(path, true, 150, 150); iconSprite.animation.add(icon, [0], 0, false); diff --git a/source/funkin/editors/charter/CharterSelection.hx b/source/funkin/editors/charter/CharterSelection.hx index 24fe55f4..dc741a71 100644 --- a/source/funkin/editors/charter/CharterSelection.hx +++ b/source/funkin/editors/charter/CharterSelection.hx @@ -109,9 +109,9 @@ class CharterSelection extends EditorTreeMenu { sys.FileSystem.createDirectory('$songFolder/charts'); // Save Files - CoolUtil.safeSaveFile('$songFolder/meta.json', Json.stringify(creation.meta, "\t")); - if (creation.instBytes != null) sys.io.File.saveBytes('$songFolder/song/Inst.${Paths.SOUND_EXT}', creation.instBytes); - if (creation.voicesBytes != null) sys.io.File.saveBytes('$songFolder/song/Voices.${Paths.SOUND_EXT}', creation.voicesBytes); + 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); #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, "\t")); + CoolUtil.safeSaveFile('$songFolder/charts/${name}.json', Json.stringify(data, Constants.JSON_PRETTY_PRINT)); // Add to List curSong.difficulties.push(name); diff --git a/source/funkin/editors/charter/CharterStrumlineScreen.hx b/source/funkin/editors/charter/CharterStrumlineScreen.hx index 997a294f..992a0cb6 100644 --- a/source/funkin/editors/charter/CharterStrumlineScreen.hx +++ b/source/funkin/editors/charter/CharterStrumlineScreen.hx @@ -39,7 +39,7 @@ class CharterStrumlineScreen extends UISubstateWindow { if (creatingStrumLine) strumLine = { - characters: ["dad"], + characters: [Constants.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/face"); + image = Paths.image("icons/" + Constants.DEFAULT_HEALTH_ICON); charIcon.loadGraphic(image, true, 150, 150); charIcon.updateHitbox(); } diff --git a/source/funkin/editors/charter/SongCreationScreen.hx b/source/funkin/editors/charter/SongCreationScreen.hx index 7915cae0..e35744a5 100644 --- a/source/funkin/editors/charter/SongCreationScreen.hx +++ b/source/funkin/editors/charter/SongCreationScreen.hx @@ -82,7 +82,7 @@ class SongCreationScreen extends UISubstateWindow { var voicesUIText:UIText = null; - instExplorer = new UIFileExplorer(songNameTextBox.x, songNameTextBox.y + 32 + 36, null, null, Paths.SOUND_EXT, function (res) { + instExplorer = new UIFileExplorer(songNameTextBox.x, songNameTextBox.y + 32 + 36, null, null, Constants.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, Paths.SOUND_EXT, function (res) { + voicesExplorer = new UIFileExplorer(instExplorer.x + 320 + 26, instExplorer.y, null, null, Constants.SOUND_EXT, function (res) { var audioPlayer:UIAudioPlayer = new UIAudioPlayer(voicesExplorer.x + 8, voicesExplorer.y + 8, res); voicesExplorer.members.push(audioPlayer); voicesExplorer.uiElement = audioPlayer; @@ -217,7 +217,7 @@ class SongCreationScreen extends UISubstateWindow { @:privateAccess iconSprite.animation.clearAnimations(); var path:String = Paths.image('icons/$icon'); - if (!Assets.exists(path)) path = Paths.image('icons/face'); + if (!Assets.exists(path)) path = Paths.image('icons/' + Constants.DEFAULT_HEALTH_ICON); iconSprite.loadGraphic(path, true, 150, 150); iconSprite.animation.add(icon, [0], 0, false); diff --git a/source/funkin/game/Character.hx b/source/funkin/game/Character.hx index cf942fbd..ff183a7c 100644 --- a/source/funkin/game/Character.hx +++ b/source/funkin/game/Character.hx @@ -29,8 +29,8 @@ using StringTools; @:allow(funkin.game.PlayState) class Character extends FunkinSprite implements IBeatReceiver implements IOffsetCompatible { public var isPlayer:Bool = false; - public var curCharacter:String = 'bf'; - public var sprite:String = 'bf'; + public var curCharacter:String = Constants.DEFAULT_CHARACTER; + public var sprite:String = Constants.DEFAULT_CHARACTER; public var lastHit:Float = Math.NEGATIVE_INFINITY; public var holdTime:Float = 4; @@ -55,12 +55,12 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset @:noCompletion var __switchAnims:Bool = true; - public function new(x:Float, y:Float, ?character:String = "bf", isPlayer:Bool = false, switchAnims:Bool = true, disableScripts:Bool = false) + public function new(x:Float, y:Float, ?character:String, isPlayer:Bool = false, switchAnims:Bool = true, disableScripts:Bool = false) { super(x, y); animOffsets = new Map(); - curCharacter = character; + curCharacter = character != null ? character : Constants.DEFAULT_CHARACTER; this.isPlayer = isPlayer; __switchAnims = switchAnims; @@ -121,7 +121,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset script.call("update", [elapsed]); if (stunned) { __stunnedTime += elapsed; - if (__stunnedTime > 5 / 60) + if (__stunnedTime > Constants.STUNNED_TIME) stunned = false; } @@ -430,8 +430,8 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset return beatInterval; - public static var FALLBACK_CHARACTER:String = "bf"; - public static var FALLBACK_DEAD_CHARACTER:String = "bf-dead"; + public static var FALLBACK_CHARACTER:String = Constants.DEFAULT_CHARACTER; + public static var FALLBACK_DEAD_CHARACTER:String = Constants.DEFAULT_GAMEOVER_CHARACTER; public static function getXMLFromCharName(character:OneOfTwo):Access { var char:Character = null; if (character is Character) { @@ -468,7 +468,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset } public static function getIconFromCharName(?character:String) { - if(character == null) return "face"; + if(character == null) return Constants.DEFAULT_HEALTH_ICON; var icon:String = character; var xml:Access = getXMLFromCharName(character); diff --git a/source/funkin/game/GameOverSubstate.hx b/source/funkin/game/GameOverSubstate.hx index 4351a9dc..093b27d0 100644 --- a/source/funkin/game/GameOverSubstate.hx +++ b/source/funkin/game/GameOverSubstate.hx @@ -36,16 +36,16 @@ class GameOverSubstate extends MusicBeatSubstate public var lossSFX:FlxSound; - public function new(x:Float, y:Float, character:String = "bf-dead", player:Bool = true, gameOverSong:String = "gameOver", lossSFX:String = "gameOverSFX", retrySFX:String = "gameOverEnd") + public function new(x:Float, y:Float, ?character:String, player:Bool = true, ?gameOverSong:String, ?lossSFX:String, ?retrySFX:String) { super(); this.x = x; this.y = y; - this.characterName = character; + this.characterName = character != null ? character : Constants.DEFAULT_GAMEOVER_CHARACTER; this.player = player; - this.gameOverSong = gameOverSong; - this.lossSFXName = lossSFX; - this.retrySFX = retrySFX; + this.gameOverSong = gameOverSong != null ? gameOverSong : Constants.DEFAULT_GAMEOVER_SONG; + this.lossSFXName = lossSFX != null ? lossSFXName : Constants.DEFAULT_GAMEOVER_LOSS_SFX; + this.retrySFX = retrySFX != null ? retrySFX : Constants.DEFAULT_GAMEOVER_RETRY_SFX; } public override function create() @@ -127,7 +127,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, 100); + CoolUtil.playMusic(Paths.music(gameOverSong), false, 1, true, Constants.DEFAULT_BPM); beatHit(0); } } diff --git a/source/funkin/game/HealthIcon.hx b/source/funkin/game/HealthIcon.hx index 1c7bb59d..4dd9a4fb 100644 --- a/source/funkin/game/HealthIcon.hx +++ b/source/funkin/game/HealthIcon.hx @@ -48,12 +48,12 @@ class HealthIcon extends FlxSprite ]; } - public function new(char:String = 'bf', isPlayer:Bool = false) + public function new(?char:String, isPlayer:Bool = false) { super(); health = 0.5; this.isPlayer = isPlayer; - setIcon(char); + setIcon(char != null ? char : Constants.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/face'); + if (!Assets.exists(path)) path = Paths.image('icons/' + Constants.DEFAULT_HEALTH_ICON); loadGraphic(path, true, width, height); diff --git a/source/funkin/game/Note.hx b/source/funkin/game/Note.hx index 21e70a6e..f8acd280 100644 --- a/source/funkin/game/Note.hx +++ b/source/funkin/game/Note.hx @@ -99,8 +99,6 @@ class Note extends FlxSprite return __customNoteTypeExists[path] = Assets.exists(path); } - static var DEFAULT_FIELDS:Array = ["time", "id", "type", "sLen"]; - public function new(strumLine:StrumLine, noteData:ChartNote, sustain:Bool = false, sustainLength:Float = 0, sustainOffset:Float = 0, ?prev:Note) { super(); @@ -117,11 +115,8 @@ class Note extends FlxSprite this.isSustainNote = sustain; this.sustainLength = sustainLength; this.strumLine = strumLine; - for(field in Reflect.fields(noteData)) { - if(!DEFAULT_FIELDS.contains(field)) { - this.extra.set(field, Reflect.field(noteData, field)); - } - } + for(field in Reflect.fields(noteData)) if(!Constants.DEFAULT_NOTE_FIELDS.contains(field)) + this.extra.set(field, Reflect.field(noteData, field)); x += 50; // MAKE SURE ITS DEFINITELY OFF SCREEN? @@ -132,7 +127,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 * 0.7, animSuffix); + (this.noteType != null && customTypePathExists(customType)) ? 'game/notes/${this.noteType}' : 'game/notes/default', @:privateAccess strumLine.strumScale * Constants.DEFAULT_NOTE_SCALE, animSuffix); if (PlayState.instance != null) event = PlayState.instance.scripts.event("onNoteCreation", event); diff --git a/source/funkin/game/NoteGroup.hx b/source/funkin/game/NoteGroup.hx index 98b6477e..4d37b5da 100644 --- a/source/funkin/game/NoteGroup.hx +++ b/source/funkin/game/NoteGroup.hx @@ -12,7 +12,7 @@ class NoteGroup extends FlxTypedGroup { /** * How many ms it should show a note before it should be hit **/ - public var limit:Float = 1500; + public var limit:Float = Constants.DEFAULT_NOTE_MS_LIMIT; /** * Preallocates the members array with nulls, but if theres anything in the array already it clears it diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index f7b58c9e..3bfaf5d3 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -61,7 +61,7 @@ class PlayState extends MusicBeatState /** * The selected difficulty name */ - public static var difficulty:String = "normal"; + public static var difficulty:String = Constants.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 = false; + public static var opponentMode:Bool = Constants.DEFAULT_OPPONENT_MODE; /** * Whenever the song has been started with co-op mode on. */ - public static var coopMode:Bool = false; + public static var coopMode:Bool = Constants.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 = "gameOver"; + public var gameOverSong:String = Constants.DEFAULT_GAMEOVER_SONG; /** * Game Over Song. (assets/sounds/gameOverSFX.ogg) */ - public var lossSFX:String = "gameOverSFX"; + public var lossSFX:String = Constants.DEFAULT_GAMEOVER_LOSS_SFX; /** * Game Over End SFX, used when retrying. (assets/sounds/gameOverEnd.ogg) */ - public var retrySFX:String = "gameOverEnd"; + public var retrySFX:String = Constants.DEFAULT_GAMEOVER_RETRY_SFX; /** * Current Stage. @@ -204,15 +204,15 @@ class PlayState extends MusicBeatState /** * Whenever the vocals should be muted when a note is missed. */ - public var muteVocalsOnMiss:Bool = true; + public var muteVocalsOnMiss:Bool = Constants.DEFAULT_MUTE_VOCALS_ON_MISS; /** * Whenever the player can press 7, 8 or 9 to access the debug menus. */ - public var canAccessDebugMenus:Bool = true; + public var canAccessDebugMenus:Bool = Constants.DEFAULT_CAN_ACCESS_DEBUG_MENUS; /** * Whether or not to show the secret gitaroo pause. */ - public var allowGitaroo:Bool = true; + public var allowGitaroo:Bool = Constants.DEFAULT_GITAROO; /** * Whether or not to bop the icons on beat. */ @@ -226,15 +226,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 = 4; + public var camZoomingInterval:Int = Constants.DEFAULT_CAM_ZOOM_INTERVAL; /** * How strong the cam zooms should be (defaults to 1) */ - public var camZoomingStrength:Float = 1; + public var camZoomingStrength:Float = Constants.DEFAULT_CAM_ZOOM_STRENGTH; /** * Maximum amount of zoom for the camera. */ - public var maxCamZoom:Float = 1.35; + public var maxCamZoom:Float = Constants.MAX_CAMERA_ZOOM; /** * Current song name (lowercase) */ @@ -252,12 +252,12 @@ class PlayState extends MusicBeatState /** * Current health. Goes from 0 to maxHealth (defaults to 2) */ - public var health:Float = 1; + public var health:Float = Constants.DEFAULT_HEALTH; /** * Maximum health the player can have. Defaults to 2. */ - @:isVar public var maxHealth(get, set):Float = 2; + @:isVar public var maxHealth(get, set):Float = Constants.DEFAULT_MAX_HEALTH; /** * Current combo. */ @@ -357,25 +357,25 @@ class PlayState extends MusicBeatState /** * Camera zoom at which the game lerps to. */ - public var defaultCamZoom:Float = 1.05; + public var defaultCamZoom:Float = Constants.DEFAULT_CAM_ZOOM; /** * Speed at which the game camera zoom lerps to. */ - public var camGameZoomLerp:Float = 0.05; - + public var camGameZoomLerp:Float = Constants.DEFAULT_CAM_ZOOM_LERP; + /** * Camera zoom at which the hud lerps to. */ - public var defaultHudZoom:Float = 1.0; + public var defaultHudZoom:Float = Constants.DEFAULT_HUD_ZOOM; /** * Speed at which the hud camera zoom lerps to. */ - public var camHUDZoomLerp:Float = 0.05; + public var camHUDZoomLerp:Float = Constants.DEFAULT_HUD_ZOOM_LERP; /** * Zoom for the pixel assets. */ - public static var daPixelZoom:Float = 6; + public static var daPixelZoom:Float = Constants.PIXEL_ART_SCALE; /** * Whenever the game is currently in a cutscene or not. @@ -568,7 +568,7 @@ class PlayState extends MusicBeatState // CHARACTER INITIALIZATION #if REGION comboGroup = new RotatingSpriteGroup(FlxG.width * 0.55, (FlxG.height * 0.5) - 60); - comboGroup.maxSize = 25; + comboGroup.maxSize = Constants.DEFAULT_COMBO_GROUP_MAX_SIZE; #end // CAMERA FOLLOW, SCRIPTS & STAGE INITIALIZATION @@ -576,7 +576,7 @@ class PlayState extends MusicBeatState camFollow = new FlxObject(0, 0, 2, 2); add(camFollow); - if (SONG.stage == null || SONG.stage.trim() == "") SONG.stage = "stage"; + if (SONG.stage == null || SONG.stage.trim() == "") SONG.stage = Constants.DEFAULT_STAGE; add(stage = new Stage(SONG.stage)); if (!chartingMode || Options.charterEnablePlaytestScripts) { @@ -684,7 +684,7 @@ class PlayState extends MusicBeatState // HUD INITIALIZATION & CAMERA INITIALIZATION #if REGION - var event = EventManager.get(AmountEvent).recycle(4); + var event = EventManager.get(AmountEvent).recycle(Constants.DEFAULT_STRUM_AMOUNT); if (!scripts.event("onPreGenerateStrums", event).cancelled) { generateStrums(event.amount); scripts.event("onPostGenerateStrums", event); @@ -693,7 +693,7 @@ class PlayState extends MusicBeatState for(str in strumLines) str.generate(str.data, (chartingMode && Charter.startHere) ? Charter.startTime : null); - FlxG.camera.follow(camFollow, LOCKON, 0.04); + FlxG.camera.follow(camFollow, LOCKON, Constants.DEFAULT_CAMERA_FOLLOW_SPEED); FlxG.camera.zoom = defaultCamZoom; // camHUD.zoom = defaultHudZoom; @@ -724,8 +724,8 @@ class PlayState extends MusicBeatState health = maxHealth / 2; - iconP1 = new HealthIcon(boyfriend != null ? boyfriend.getIcon() : "face", true); - iconP2 = new HealthIcon(dad != null ? dad.getIcon() : "face", false); + iconP1 = new HealthIcon(boyfriend != null ? boyfriend.getIcon() : Constants.DEFAULT_HEALTH_ICON, true); + iconP2 = new HealthIcon(dad != null ? dad.getIcon() : Constants.DEFAULT_HEALTH_ICON, false); for(icon in [iconP1, iconP2]) { icon.y = healthBar.y - (icon.height / 2); add(icon); @@ -762,7 +762,7 @@ class PlayState extends MusicBeatState FlxG.sound.load(Paths.sound(s)); if (chartingMode) { - WindowUtils.prefix = Charter.undos.unsaved ? "* " : ""; + WindowUtils.prefix = Charter.undos.unsaved ? Constants.UNDO_PREFIX : ""; WindowUtils.suffix = " (Chart Playtesting)"; SaveWarning.showWarning = Charter.undos.unsaved; @@ -818,7 +818,7 @@ class PlayState extends MusicBeatState inCutscene = true; var videoCutscene = Paths.video('$songName-${prefix}cutscene'); - var videoCutsceneAlt = Paths.file('songs/$songName/${prefix}cutscene.mp4'); + var videoCutsceneAlt = Paths.file('songs/$songName/${prefix}cutscene.${Constants.VIDEO_EXT}'); var dialogue = Paths.file('songs/$songName/${prefix}dialogue.xml'); persistentUpdate = true; var toCall:Void->Void = function() { @@ -1131,7 +1131,7 @@ class PlayState extends MusicBeatState paused = true; // 1 / 1000 chance for Gitaroo Man easter egg - if (allowGitaroo && FlxG.random.bool(0.1)) + if (allowGitaroo && FlxG.random.bool(Constants.GITAROO_CHANCE)) { // gitaroo man easter egg FlxG.switchState(new GitarooPause()); @@ -1188,7 +1188,7 @@ class PlayState extends MusicBeatState } function updateIconPositions() { - var iconOffset:Int = 26; + var iconOffset:Int = Constants.ICON_OFFSET; var center:Float = healthBar.x + healthBar.width * FlxMath.remapToRange(healthBar.percent, 0, 100, 1, 0); @@ -1245,8 +1245,9 @@ class PlayState extends MusicBeatState } if (doIconBop) { - iconP1.scale.set(lerp(iconP1.scale.x, 1, 0.33), lerp(iconP1.scale.y, 1, 0.33)); - iconP2.scale.set(lerp(iconP2.scale.x, 1, 0.33), lerp(iconP2.scale.y, 1, 0.33)); + var iconLerp = Constants.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)); iconP1.updateHitbox(); iconP2.updateHitbox(); @@ -1265,7 +1266,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 > 25) { + if (__vocalOffsetViolation > Constants.VOCAL_OFFSET_VIOLATION_THRESHOLD) { resyncVocals(); __vocalOffsetViolation = 0; } @@ -1402,7 +1403,7 @@ class PlayState extends MusicBeatState charToUse == null ? 0 : charToUse.x, charToUse == null ? 0 : charToUse.y, charToUse, - deathCharID.getDefault(charToUse != null ? charToUse.gameOverCharacter : "bf-dead"), + deathCharID.getDefault(charToUse != null ? charToUse.gameOverCharacter : Constants.DEFAULT_GAMEOVER_CHARACTER), charToUse != null ? charToUse.isPlayer : true, gameOverSong.getDefault(this.gameOverSong), lossSFX.getDefault(this.lossSFX), @@ -1798,14 +1799,15 @@ class PlayState extends MusicBeatState if (camZoomingInterval < 1) camZoomingInterval = 1; if (Options.camZoomOnBeat && camZooming && FlxG.camera.zoom < maxCamZoom && curBeat % camZoomingInterval == 0) { - FlxG.camera.zoom += 0.015 * camZoomingStrength; - camHUD.zoom += 0.03 * camZoomingStrength; + FlxG.camera.zoom += Constants.CAM_BOP_STRENGTH * camZoomingStrength; + camHUD.zoom += Constants.HUD_BOP_STRENGTH * camZoomingStrength; } if (doIconBop) { - iconP1.scale.set(1.2, 1.2); - iconP2.scale.set(1.2, 1.2); + var iconScale = Constants.BOP_ICON_SCALE; + iconP1.scale.set(iconScale, iconScale); + iconP2.scale.set(iconScale, iconScale); iconP1.updateHitbox(); iconP2.updateHitbox(); @@ -1883,7 +1885,8 @@ class PlayState extends MusicBeatState * @param weekData Week Data * @param difficulty Week Difficulty */ - public static function loadWeek(weekData:WeekData, difficulty:String = "normal") { + public static function loadWeek(weekData:WeekData, ?difficulty:String) { + if (difficulty == null) difficulty = Constants.DEFAULT_DIFFICULTY; storyWeek = weekData; storyPlaylist = [for(e in weekData.songs) e.name]; isStoryMode = true; @@ -1903,7 +1906,8 @@ class PlayState extends MusicBeatState * @param opponentMode Whenever opponent mode is on * @param coopMode Whenever co-op mode is on. */ - public static function loadSong(_name:String, _difficulty:String = "normal", _opponentMode:Bool = false, _coopMode:Bool = false) { + public static function loadSong(_name:String, ?_difficulty:String, _opponentMode:Bool = false, _coopMode:Bool = false) { + if (_difficulty == null) difficulty = Constants.DEFAULT_DIFFICULTY; isStoryMode = false; opponentMode = _opponentMode; chartingMode = false; diff --git a/source/funkin/game/SplashGroup.hx b/source/funkin/game/SplashGroup.hx index 75008a29..d34bcb4f 100644 --- a/source/funkin/game/SplashGroup.hx +++ b/source/funkin/game/SplashGroup.hx @@ -42,7 +42,7 @@ class SplashGroup extends FlxTypedGroup { Logs.trace('Couldn\'t parse splash data for "${path}": ${e.toString()}', ERROR); valid = false; } - maxSize = 8; + maxSize = Constants.MAX_SPLASHES; } function createSplash(imagePath:String) { diff --git a/source/funkin/game/SplashHandler.hx b/source/funkin/game/SplashHandler.hx index 1776bdb8..9ee68046 100644 --- a/source/funkin/game/SplashHandler.hx +++ b/source/funkin/game/SplashHandler.hx @@ -46,7 +46,7 @@ class SplashHandler extends FlxTypedGroup { add(event.value1); // max 8 rendered splashes - while(members.length > 8) + while(members.length > Constants.MAX_SPLASHES) remove(members[0], true); } } \ No newline at end of file diff --git a/source/funkin/game/StrumLine.hx b/source/funkin/game/StrumLine.hx index dd952d19..f2982ad8 100644 --- a/source/funkin/game/StrumLine.hx +++ b/source/funkin/game/StrumLine.hx @@ -152,7 +152,7 @@ class StrumLine extends FlxTypedGroup { var scrollSpeed = strumLine.scrollSpeed; if(scrollSpeed == null) if (PlayState.instance != null) scrollSpeed = PlayState.instance.scrollSpeed; if(scrollSpeed == null) scrollSpeed = 1; - notes.limit = 1500 / scrollSpeed; + notes.limit = Constants.DEFAULT_NOTE_MS_LIMIT / scrollSpeed; } public override function update(elapsed:Float) { @@ -288,7 +288,8 @@ class StrumLine extends FlxTypedGroup { public inline function addHealth(health:Float) PlayState.instance.health += health * (opponentSide ? -1 : 1); - public inline function generateStrums(amount:Int = 4) { + public inline function generateStrums(amount:Int = -1) { + if(amount == -1) amount = Constants.DEFAULT_STRUM_AMOUNT; for (i in 0...amount) add(createStrum(i)); } @@ -326,7 +327,7 @@ class StrumLine extends FlxTypedGroup { babyArrow.animation.addByPrefix('red', 'arrowRIGHT'); babyArrow.antialiasing = true; - babyArrow.setGraphicSize(Std.int((babyArrow.width * 0.7) * strumScale)); + babyArrow.setGraphicSize(Std.int((babyArrow.width * Constants.DEFAULT_NOTE_SCALE) * strumScale)); babyArrow.animation.addByPrefix('static', 'arrow${event.animPrefix.toUpperCase()}'); babyArrow.animation.addByPrefix('pressed', '${event.animPrefix} press', 24, false); diff --git a/source/funkin/game/cutscenes/VideoCutscene.hx b/source/funkin/game/cutscenes/VideoCutscene.hx index f12210eb..96293177 100644 --- a/source/funkin/game/cutscenes/VideoCutscene.hx +++ b/source/funkin/game/cutscenes/VideoCutscene.hx @@ -92,7 +92,7 @@ class VideoCutscene extends Cutscene { // ZIP PATH: EXPORT // TODO: this but better and more ram friendly - localPath = './.temp/video-${curVideo++}.mp4'; + localPath = './.temp/video-${curVideo++}.${Constants.VIDEO_EXT}'; Main.execAsync(function() { File.saveBytes(localPath, Assets.getBytes(path)); videoReady = true; diff --git a/source/funkin/import.hx b/source/funkin/import.hx index eca238fd..b8675783 100644 --- a/source/funkin/import.hx +++ b/source/funkin/import.hx @@ -22,6 +22,8 @@ import flixel.math.FlxMath; import flixel.tweens.FlxEase; import flixel.util.FlxDestroyUtil; +import funkin.Constants; + import funkin.menus.ui.Alphabet; import flixel.group.FlxGroup.FlxTypedGroup; import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup; diff --git a/source/funkin/menus/BetaWarningState.hx b/source/funkin/menus/BetaWarningState.hx index d436138f..eb77ff88 100644 --- a/source/funkin/menus/BetaWarningState.hx +++ b/source/funkin/menus/BetaWarningState.hx @@ -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 *${Main.releaseCycle}* 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 *${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', [ new FlxTextFormatMarkerPair(new FlxTextFormat(0xFFFF4444), "*") ] diff --git a/source/funkin/menus/FreeplayState.hx b/source/funkin/menus/FreeplayState.hx index 3d3a4d15..22f0d1a1 100644 --- a/source/funkin/menus/FreeplayState.hx +++ b/source/funkin/menus/FreeplayState.hx @@ -456,7 +456,7 @@ class FreeplaySonglist { if (songsFound.length > 0) { for(s in songsFound) - songs.push(Chart.loadChartMeta(s, "normal", source == MODS)); + songs.push(Chart.loadChartMeta(s, Constants.DEFAULT_DIFFICULTY, source == MODS)); return false; } return true; diff --git a/source/funkin/menus/MainMenuState.hx b/source/funkin/menus/MainMenuState.hx index cd40bc90..15d45ee2 100644 --- a/source/funkin/menus/MainMenuState.hx +++ b/source/funkin/menus/MainMenuState.hx @@ -24,7 +24,7 @@ class MainMenuState extends MusicBeatState var camFollow:FlxObject; var versionText:FunkinText; - public var canAccessDebugMenus:Bool = true; + public var canAccessDebugMenus:Bool = Constants.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, 'Codename Engine v${Application.current.meta.get('version')}\nCommit ${funkin.backend.system.macros.GitCommitMacro.commitNumber} (${funkin.backend.system.macros.GitCommitMacro.commitHash})\n[${controls.getKeyName(SWITCHMOD)}] Open Mods menu\n'); + versionText = new FunkinText(5, FlxG.height - 2, 0, 'Codename Engine v${Application.current.meta.get('version')}\n${Constants.COMMIT_MESSAGE}\n[${controls.getKeyName(SWITCHMOD)}] Open Mods menu\n'); versionText.y -= versionText.height; versionText.scrollFactor.set(); add(versionText); diff --git a/source/funkin/menus/PauseSubState.hx b/source/funkin/menus/PauseSubState.hx index ff45f20a..4f451954 100644 --- a/source/funkin/menus/PauseSubState.hx +++ b/source/funkin/menus/PauseSubState.hx @@ -20,7 +20,7 @@ class PauseSubState extends MusicBeatSubstate var grpMenuShit:FlxTypedGroup; - var menuItems:Array = ['Resume', 'Restart Song', 'Change Controls', 'Change Options', 'Exit to menu', "Exit to charter"]; + var menuItems:Array = Constants.DEFAULT_PAUSE_ITEMS; var curSelected:Int = 0; var pauseMusic:FlxSound; diff --git a/source/funkin/menus/credits/CreditsCodename.hx b/source/funkin/menus/credits/CreditsCodename.hx index 3e09c990..8b3538e4 100644 --- a/source/funkin/menus/credits/CreditsCodename.hx +++ b/source/funkin/menus/credits/CreditsCodename.hx @@ -10,9 +10,6 @@ using StringTools; class CreditsCodename extends funkin.options.OptionsScreen { public var error:Bool = false; - public var author:String = "FNF-CNE-Devs"; - public var mainDevCol:FlxColor = 0xFF9C35D5; - public var minContrCol:FlxColor = 0xFFB4A7DA; public var totalContributions:Int = 0; public override function new() @@ -59,8 +56,8 @@ class CreditsCodename extends funkin.options.OptionsScreen { var text:String = parent.treeParent.pathDesc.text; parent.treeParent.pathDesc.text = ""; parent.treeParent.pathDesc.applyMarkup(text, [ - new FlxTextFormatMarkerPair(new FlxTextFormat(mainDevCol), '*'), - new FlxTextFormatMarkerPair(new FlxTextFormat(FlxColor.interpolate(minContrCol, mainDevCol, Options.contributors[curSelected].contributions / totalContributions)), '~') + 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)), '~') ]); } @@ -70,7 +67,7 @@ class CreditsCodename extends funkin.options.OptionsScreen { Options.lastUpdated = curTime; error = false; - var idk = GitHub.getContributors(author, "CodenameEngine", function(e) { + var idk = GitHub.getContributors(Constants.REPO_OWNER, Constants.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); @@ -81,9 +78,9 @@ class CreditsCodename extends funkin.options.OptionsScreen { Logs.trace('[CreditsCodename] Contributors list Updated!', VERBOSE); var errorOnMain:Bool = false; - var idk2 = GitHub.getOrganizationMembers(author, function(e) { + var idk2 = GitHub.getOrganizationMembers(Constants.REPO_OWNER, function(e) { errorOnMain = true; - var errMsg:String = 'Error while trying to download $author members list:\n${CoolUtil.removeIP(e.message)}'; + var errMsg:String = 'Error while trying to download ${Constants.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); }); @@ -111,7 +108,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 = mainDevCol; + @:privateAccess opt.__text.color = Constants.MAIN_DEVS_COLOR; } add(opt); } diff --git a/source/funkin/menus/ui/Alphabet.hx b/source/funkin/menus/ui/Alphabet.hx index 663fa1b1..5b443b44 100644 --- a/source/funkin/menus/ui/Alphabet.hx +++ b/source/funkin/menus/ui/Alphabet.hx @@ -162,7 +162,7 @@ class Alphabet extends FlxSpriteGroup splitWords = _finalText.split(""); } - //public var personTalking:String = 'gf'; + //public var personTalking:String = Constants.DEFAULT_GIRLFRIEND; public function startTypedText():Void {