diff --git a/assets/sounds/soundtray/VolMAX.mp3 b/assets/sounds/soundtray/VolMAX.mp3 new file mode 100644 index 00000000..22d4bef0 Binary files /dev/null and b/assets/sounds/soundtray/VolMAX.mp3 differ diff --git a/assets/sounds/soundtray/VolMAX.ogg b/assets/sounds/soundtray/VolMAX.ogg new file mode 100644 index 00000000..bed37706 Binary files /dev/null and b/assets/sounds/soundtray/VolMAX.ogg differ diff --git a/assets/sounds/soundtray/Voldown.mp3 b/assets/sounds/soundtray/Voldown.mp3 new file mode 100644 index 00000000..fe36c490 Binary files /dev/null and b/assets/sounds/soundtray/Voldown.mp3 differ diff --git a/assets/sounds/soundtray/Voldown.ogg b/assets/sounds/soundtray/Voldown.ogg new file mode 100644 index 00000000..03833c02 Binary files /dev/null and b/assets/sounds/soundtray/Voldown.ogg differ diff --git a/assets/sounds/soundtray/Volup.mp3 b/assets/sounds/soundtray/Volup.mp3 new file mode 100644 index 00000000..b5b7aca0 Binary files /dev/null and b/assets/sounds/soundtray/Volup.mp3 differ diff --git a/assets/sounds/soundtray/Volup.ogg b/assets/sounds/soundtray/Volup.ogg new file mode 100644 index 00000000..221ff5ce Binary files /dev/null and b/assets/sounds/soundtray/Volup.ogg differ diff --git a/source/Init.hx b/source/Init.hx index 5d05095c..9986a116 100644 --- a/source/Init.hx +++ b/source/Init.hx @@ -141,6 +141,10 @@ class Init extends FlxState FlxG.save.bind('j64enginerewrite', 'joalor64gh'); ClientPrefs.loadPrefs(); + + #if ACHIEVEMENTS_ALLOWED + Achievements.loadAchievements(); + #end #if CHECK_FOR_UPDATES if (ClientPrefs.checkForUpdates && !OutdatedState.leftState) diff --git a/source/Main.hx b/source/Main.hx index 6c8141da..f243176d 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -253,6 +253,7 @@ class Joalor64Game extends FlxGame class Joalor64SoundTray extends flixel.system.ui.FlxSoundTray { var _bar:Bitmap; + var volumeMaxSound:String; public function new() { @@ -266,7 +267,7 @@ class Joalor64SoundTray extends flixel.system.ui.FlxSoundTray _bar.x = 2.5; addChild(_bar); - final tmp:Bitmap = new Bitmap(Assets.getBitmapData("assets/images/soundtray.png", false), null, true); + final tmp:Bitmap = new Bitmap(Assets.getBitmapData(Paths.image("soundtray"), false), null, true); addChild(tmp); screenCenter(); @@ -278,6 +279,10 @@ class Joalor64SoundTray extends flixel.system.ui.FlxSoundTray y = -height; visible = false; + + volumeUpSound = Paths.sound("soundtray/Volup"); + volumeDownSound = Paths.sound("soundtray/Voldown"); + volumeMaxSound = Paths.sound("soundtray/VolMAX"); } override function update(elapsed:Float) { @@ -288,8 +293,9 @@ class Joalor64SoundTray extends flixel.system.ui.FlxSoundTray { if (!silent) { - final sound = flixel.system.FlxAssets.getSound("assets/sounds/scrollMenu"); - if (sound != null) FlxG.sound.load(sound).play(); + var sound = up ? volumeUpSound : volumeDownSound; + if (globalVolume == 10) sound = volumeMaxSound; + if (sound != null) FlxG.sound.load(sound).play(); } _timer = 4; diff --git a/source/Paths.hx b/source/Paths.hx index 68db98be..8feb0028 100644 --- a/source/Paths.hx +++ b/source/Paths.hx @@ -1,10 +1,5 @@ package; -import animateatlas.AtlasFrameMaker; - -import flixel.graphics.frames.FlxAtlasFrames; -import flixel.graphics.FlxGraphic; - import openfl.utils.AssetType; import openfl.media.Sound; @@ -479,7 +474,7 @@ class Paths localTrackedAssets.push(path); return currentTrackedAssets.get(path); } - trace('oh no!!' + ' $key ' + 'returned null!'); + trace('oh no!! $key returned null!'); return null; } diff --git a/source/meta/CoolUtil.hx b/source/meta/CoolUtil.hx index 8cdbfb3b..6b475006 100644 --- a/source/meta/CoolUtil.hx +++ b/source/meta/CoolUtil.hx @@ -60,8 +60,6 @@ class CoolUtil for (e in 0...splitCoolSong.length) coolSong += Std.string(splitCoolSong[e+1]).toLowerCase(); - coolSong = coolReplace(coolSong, 'null', ''); - for (l in 0...splitSong.length) { var stringSong:String = Std.string(splitSong[l+1]); @@ -73,12 +71,9 @@ class CoolUtil for (l in 0...splitStringSong.length) stringSong += Std.string(splitStringSong[l+1]).toLowerCase(); - stringSong = coolReplace(stringSong, 'null', ''); - coolSong += '$stringSong'; } - song = coolSong.replace(' Null', ''); return song; } diff --git a/source/meta/data/ClientPrefs.hx b/source/meta/data/ClientPrefs.hx index 063e09aa..ff5258c6 100644 --- a/source/meta/data/ClientPrefs.hx +++ b/source/meta/data/ClientPrefs.hx @@ -165,6 +165,10 @@ class ClientPrefs { } public static function loadPrefs() { + #if ACHIEVEMENTS_ALLOWED + Achievements.loadAchievements(); + #end + if(FlxG.save.data.downScroll != null) { downScroll = FlxG.save.data.downScroll; } diff --git a/source/meta/data/options/NoteOffsetState.hx b/source/meta/data/options/NoteOffsetState.hx index 6191f43e..7f83e137 100644 --- a/source/meta/data/options/NoteOffsetState.hx +++ b/source/meta/data/options/NoteOffsetState.hx @@ -1,7 +1,5 @@ package meta.data.options; -import flixel.ui.FlxBar; - import objects.userinterface.menu.*; import objects.background.*; @@ -23,8 +21,7 @@ class NoteOffsetState extends MusicBeatState var barPercent:Float = 0; var delayMin:Int = 0; var delayMax:Int = 500; - var timeBarBG:FlxSprite; - var timeBar:FlxBar; + var timeBar:Bar; var timeTxt:FlxText; var beatText:Alphabet; var beatTween:FlxTween; @@ -50,6 +47,7 @@ class NoteOffsetState extends MusicBeatState persistentUpdate = true; FlxG.sound.pause(); + // Stage var bg:BGSprite = new BGSprite('stages/stage/stageback', -600, -200, 0.9, 0.9); add(bg); @@ -159,22 +157,13 @@ class NoteOffsetState extends MusicBeatState barPercent = ClientPrefs.noteOffset; updateNoteDelay(); - timeBarBG = new FlxSprite(0, timeTxt.y + 8).loadGraphic(Paths.image('timeBar')); - timeBarBG.setGraphicSize(Std.int(timeBarBG.width * 1.2)); - timeBarBG.updateHitbox(); - timeBarBG.cameras = [camHUD]; - timeBarBG.screenCenter(X); - timeBarBG.visible = false; - - timeBar = new FlxBar(0, timeBarBG.y + 4, LEFT_TO_RIGHT, Std.int(timeBarBG.width - 8), Std.int(timeBarBG.height - 8), this, 'barPercent', delayMin, delayMax); + timeBar = new Bar(0, timeTxt.y + (timeTxt.height / 3), 'healthBar', function() return barPercent, delayMin, delayMax); timeBar.scrollFactor.set(); timeBar.screenCenter(X); - timeBar.createFilledBar(0xFF000000, 0xFFFFFFFF); - timeBar.numDivisions = 800; //How much lag this causes?? Should i tone it down to idk, 400 or 200? timeBar.visible = false; timeBar.cameras = [camHUD]; + timeBar.leftBar.color = FlxColor.LIME; - add(timeBarBG); add(timeBar); add(timeTxt); @@ -496,7 +485,6 @@ class NoteOffsetState extends MusicBeatState comboNums.visible = onComboMenu; dumbTexts.visible = onComboMenu; - timeBarBG.visible = !onComboMenu; timeBar.visible = !onComboMenu; timeTxt.visible = !onComboMenu; beatText.visible = !onComboMenu; @@ -509,4 +497,4 @@ class NoteOffsetState extends MusicBeatState changeModeText.text = changeModeText.text.toUpperCase(); FlxG.mouse.visible = onComboMenu; } -} +} \ No newline at end of file diff --git a/source/meta/state/MainMenuState.hx b/source/meta/state/MainMenuState.hx index f1f6c851..b6d3e8dd 100644 --- a/source/meta/state/MainMenuState.hx +++ b/source/meta/state/MainMenuState.hx @@ -267,7 +267,6 @@ class MainMenuState extends MusicBeatState tipTextStartScrolling(); #if ACHIEVEMENTS_ALLOWED - Achievements.loadAchievements(); var leDate = Date.now(); if (leDate.getDay() == 5 && leDate.getHours() >= 18) { var achieveID:Int = Achievements.getAchievementIndex('friday_night_play'); diff --git a/source/meta/state/PlayState.hx b/source/meta/state/PlayState.hx index 2ba817ef..fbfac7f1 100644 --- a/source/meta/state/PlayState.hx +++ b/source/meta/state/PlayState.hx @@ -1281,7 +1281,8 @@ class PlayState extends MusicBeatState strumLine.scrollFactor.set(); var showTime:Bool = (ClientPrefs.timeBarType != 'Disabled'); - timeTxt = new FlxText(STRUM_X + (FlxG.width / 2) - 248, 19, 400, "", 32); + timeTxt = new FlxText(0, 19, 400, "", 32); + timeTxt.screenCenter(X); timeTxt.setFormat(Paths.font("vcr.ttf"), 32, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); timeTxt.scrollFactor.set(); timeTxt.alpha = 0; @@ -3717,8 +3718,12 @@ class PlayState extends MusicBeatState if (FlxG.keys.anyJustPressed(debugKeysChart) && !endingSong && !inCutscene) openChartEditor(); - if (healthBar.bounds.max != null && health > healthBar.bounds.max) - health = healthBar.bounds.max; + if (healthBar.bounds.max != null) { + if (health > healthBar.bounds.max) health = healthBar.bounds.max; + } else { + // Old system for safety?? idk + if (health > 2) health = 2; + } updateIconsPosition(); @@ -3728,8 +3733,6 @@ class PlayState extends MusicBeatState cancelMusicFadeTween(); MusicBeatState.switchState(new CharacterEditorState(SONG.player2)); } - - if (health > 2) health = 2; if (startedCountdown && !paused) Conductor.songPosition += FlxG.elapsed * 1000 * playbackRate; diff --git a/source/meta/state/SimpleMainMenuState.hx b/source/meta/state/SimpleMainMenuState.hx index e31e48cd..02013eac 100644 --- a/source/meta/state/SimpleMainMenuState.hx +++ b/source/meta/state/SimpleMainMenuState.hx @@ -107,7 +107,7 @@ class SimpleMainMenuState extends MusicBeatState grpOptions.add(optionText); } - var versionShit:FlxText = new FlxText(12, FlxG.height - 64, 0, "Joalor64 Engine Rewritten v" + MainMenuState.joalor64EngineVersion #if nightly + MainMenuState.nightly #end, 12); + var versionShit:FlxText = new FlxText(12, FlxG.height - 64, 0, "Joalor64 Engine Rewritten v" + MainMenuState.joalor64EngineVersion #if nightly + MainMenuState.nightly #end + " [" + Main.commitId + "]", 12); versionShit.scrollFactor.set(); versionShit.setFormat(Paths.font('vcr.ttf'), 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); add(versionShit); @@ -130,7 +130,6 @@ class SimpleMainMenuState extends MusicBeatState changeSelection(); #if ACHIEVEMENTS_ALLOWED - Achievements.loadAchievements(); var leDate = Date.now(); if (leDate.getDay() == 5 && leDate.getHours() >= 18) { var achieveID:Int = Achievements.getAchievementIndex('friday_night_play'); @@ -149,7 +148,6 @@ class SimpleMainMenuState extends MusicBeatState function giveAchievement() { add(new AchievementObject('friday_night_play', camAchievement)); FlxG.sound.play(Paths.sound('confirmMenu'), 0.7); - trace('Giving achievement "friday_night_play"'); } #end @@ -204,17 +202,10 @@ class SimpleMainMenuState extends MusicBeatState } function changeSelection(change:Int = 0) { - curSelected += change; - if (curSelected < 0) - curSelected = options.length - 1; - if (curSelected >= options.length) - curSelected = 0; + curSelected = FlxMath.wrap(curSelected + change, 0, options.length - 1); - var bullShit:Int = 0; - - for (item in grpOptions.members) { - item.targetY = bullShit - curSelected; - bullShit++; + for (num => item in grpOptions.members) { + item.targetY = num - curSelected; item.alpha = 0.6; if (item.targetY == 0) { @@ -229,4 +220,4 @@ class SimpleMainMenuState extends MusicBeatState } FlxG.sound.play(Paths.sound('scrollMenu')); } -} +} \ No newline at end of file diff --git a/source/objects/userinterface/Bar.hx b/source/objects/userinterface/Bar.hx index e4c62887..18a93aed 100644 --- a/source/objects/userinterface/Bar.hx +++ b/source/objects/userinterface/Bar.hx @@ -57,10 +57,10 @@ class Bar extends FlxSpriteGroup bounds.max = max; } - public function setColors(left:FlxColor, right:FlxColor) + public function setColors(left:FlxColor = null, right:FlxColor = null) { - leftBar.color = left; - rightBar.color = right; + if (left != null) leftBar.color = left; + if (right != null) rightBar.color = right; } public function updateBar()