Skip to content

Commit

Permalink
gonna do some more stuff idk what
Browse files Browse the repository at this point in the history
  • Loading branch information
Joalor64GH authored Jun 7, 2024
1 parent 3a3520a commit cef6533
Show file tree
Hide file tree
Showing 16 changed files with 39 additions and 54 deletions.
Binary file added assets/sounds/soundtray/VolMAX.mp3
Binary file not shown.
Binary file added assets/sounds/soundtray/VolMAX.ogg
Binary file not shown.
Binary file added assets/sounds/soundtray/Voldown.mp3
Binary file not shown.
Binary file added assets/sounds/soundtray/Voldown.ogg
Binary file not shown.
Binary file added assets/sounds/soundtray/Volup.mp3
Binary file not shown.
Binary file added assets/sounds/soundtray/Volup.ogg
Binary file not shown.
4 changes: 4 additions & 0 deletions source/Init.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 9 additions & 3 deletions source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ class Joalor64Game extends FlxGame
class Joalor64SoundTray extends flixel.system.ui.FlxSoundTray
{
var _bar:Bitmap;
var volumeMaxSound:String;

public function new()
{
Expand All @@ -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();
Expand All @@ -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) {
Expand All @@ -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;
Expand Down
7 changes: 1 addition & 6 deletions source/Paths.hx
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -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;
}

Expand Down
5 changes: 0 additions & 5 deletions source/meta/CoolUtil.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand All @@ -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;
}

Expand Down
4 changes: 4 additions & 0 deletions source/meta/data/ClientPrefs.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
22 changes: 5 additions & 17 deletions source/meta/data/options/NoteOffsetState.hx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package meta.data.options;

import flixel.ui.FlxBar;

import objects.userinterface.menu.*;
import objects.background.*;

Expand All @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand All @@ -509,4 +497,4 @@ class NoteOffsetState extends MusicBeatState
changeModeText.text = changeModeText.text.toUpperCase();
FlxG.mouse.visible = onComboMenu;
}
}
}
1 change: 0 additions & 1 deletion source/meta/state/MainMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
13 changes: 8 additions & 5 deletions source/meta/state/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand All @@ -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;
Expand Down
19 changes: 5 additions & 14 deletions source/meta/state/SimpleMainMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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');
Expand All @@ -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

Expand Down Expand Up @@ -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) {
Expand All @@ -229,4 +220,4 @@ class SimpleMainMenuState extends MusicBeatState
}
FlxG.sound.play(Paths.sound('scrollMenu'));
}
}
}
6 changes: 3 additions & 3 deletions source/objects/userinterface/Bar.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit cef6533

Please sign in to comment.