Skip to content

Commit

Permalink
Merge branch 'Yoshubs:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ImCodist authored Sep 16, 2021
2 parents b65e7f1 + 8d3e7f9 commit 9b968c0
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 125 deletions.
1 change: 1 addition & 0 deletions source/Init.hx
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ class Init extends FlxState
FlxG.mouse.useSystemCursor = true; // Use system cursor because it's prettier
FlxG.mouse.visible = false; // Hide mouse on start

// Main.switchState(this, new TestState());
gotoTitleScreen();
}

Expand Down
17 changes: 9 additions & 8 deletions source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Main extends Sprite

public static var gameVersion:String = '0.2.3.1';

public static var loadedAssets:Array<FlxBasic> = [];
public static var loadedAssets:Array<Dynamic> = [];

var zoom:Float = -1; // If -1, zoom is automatically calculated to fit the window dimensions.
var skipSplash:Bool = true; // Whether to skip the flixel splash screen that appears in release mode.
Expand Down Expand Up @@ -213,7 +213,7 @@ class Main extends Sprite
FlxG.switchState(target);

// this dont work yet but maybe soon
dumpCache(curState);
// dumpCache(curState);
}

public static function updateFramerate(newFramerate:Int)
Expand All @@ -233,12 +233,13 @@ class Main extends Sprite

public static function dumpCache(curState:FlxState)
{
/*
for (asset in loadedAssets)
{
curState.remove(asset);
}
// */
///*
for (asset in loadedAssets)
{
loadedAssets.remove(asset);
}

// */
}

function onCrash(e:UncaughtErrorEvent):Void
Expand Down
9 changes: 8 additions & 1 deletion source/Paths.hx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class Paths

inline static public function getSparrowAtlas(key:String, ?library:String)
{
return FlxAtlasFrames.fromSparrow(image(key, library), file('images/$key.xml', library));
return cacheGet(FlxAtlasFrames.fromSparrow(image(key, library), file('images/$key.xml', library)));
}

inline static public function getPackerAtlas(key:String, ?library:String)
Expand All @@ -175,4 +175,11 @@ class Paths
}

// WIP STUFFS GONNA GO HERE, HI FLIPPY AND SMOKEY LMAO

static function cacheGet(theAsset:Dynamic):Dynamic
{
if (!Main.loadedAssets.contains(theAsset))
Main.loadedAssets.push(theAsset);
return Main.loadedAssets[Main.loadedAssets.indexOf(theAsset)];
}
}
2 changes: 1 addition & 1 deletion source/gameFolder/gameObjects/userInterface/ClassHUD.hx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class ClassHUD extends FlxTypedGroup<FlxBasic>
// small info bar, kinda like the KE watermark
// based on scoretxt which I will set up as well
var infoDisplay:String = CoolUtil.dashToSpace(PlayState.SONG.song) + ' - ' + CoolUtil.difficultyFromNumber(PlayState.storyDifficulty)
+ " - Forever BETA v" + Main.gameVersion;
+ " - FE BETA v" + Main.gameVersion;

infoBar = new FlxText(5, FlxG.height - 30, 0, infoDisplay, 20);
infoBar.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
Expand Down
2 changes: 1 addition & 1 deletion source/gameFolder/meta/data/Timings.hx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Timings
// from left to right
// max milliseconds, score from it and percentage
public static var ratingsMap:Map<String, Array<Dynamic>> = [
"sick" => [30, 350, 100],
"sick" => [45, 350, 100],
"good" => [100, 150, 50],
"bad" => [120, 0, 15],
"shit" => [140, -20, -75],
Expand Down
6 changes: 4 additions & 2 deletions source/gameFolder/meta/state/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,8 @@ class PlayState extends MusicBeatState
vocals.volume = 1;

characterPlayAnimation(coolNote, character);
characterStrums.members[coolNote.noteData].playAnim('confirm', true);
if (characterStrums.members[coolNote.noteData] != null)
characterStrums.members[coolNote.noteData].playAnim('confirm', true);

if (canDisplayRating)
{
Expand Down Expand Up @@ -1235,7 +1236,8 @@ class PlayState extends MusicBeatState
{
// coolNote.callMods();
coolNote.kill();
notes.remove(coolNote, true);
if (notes.members.contains(coolNote))
notes.remove(coolNote, true);
coolNote.destroy();
}
//
Expand Down
81 changes: 81 additions & 0 deletions source/gameFolder/meta/state/charting/TestState.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package gameFolder.meta.state.charting;

import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.FlxStrip;
import flixel.addons.display.FlxTiledSprite;
import flixel.util.FlxColor;
import gameFolder.gameObjects.Note;
import gameFolder.meta.MusicBeat.MusicBeatState;
import haxe.io.Bytes;
import lime.media.AudioBuffer;
import lime.media.vorbis.VorbisFile;
import openfl.geom.Rectangle;
import openfl.media.Sound;
#if !html5
import sys.thread.Thread;
#end

/**
This is just code I stole from gedehari, he's a really cool guy. Here's a link to the source.
https://github.com/gedehari/HaxeFlixel-Waveform-Rendering
This is only used to test waveforms, I'm going to write my own code based on this later
**/
class TestState extends MusicBeatState
{
var note:Note;
var newNote:FlxTiledSprite;

override public function create()
{
super.create();

var note = ForeverAssets.generateArrow(PlayState.assetModifier, 0, 0, 0, 0);
note.noteQuant = 0;

note.screenCenter();

newNote = new FlxTiledSprite(null, 109, 0, false, true);
newNote.frames = Paths.getSparrowAtlas(ForeverTools.returnSkinAsset('NOTE_assets', "base", Init.trueSettings.get("Note Skin"), 'noteskins/notes'));

newNote.animation.addByPrefix('purpleholdend', 'pruple end hold');
newNote.animation.addByPrefix('greenholdend', 'green hold end');
newNote.animation.addByPrefix('redholdend', 'red hold end');
newNote.animation.addByPrefix('blueholdend', 'blue hold end');

newNote.animation.addByPrefix('purplehold', 'purple hold piece');
newNote.animation.addByPrefix('greenhold', 'green hold piece');
newNote.animation.addByPrefix('redhold', 'red hold piece');
newNote.animation.addByPrefix('bluehold', 'blue hold piece');

// newNote.setGraphicSize(Std.int(newNote.width * 0.7));
// newNote.updateHitbox();
newNote.antialiasing = (!Init.trueSettings.get('Disable Antialiasing'));

newNote.animation.play('redhold');

add(newNote);
newNote.screenCenter();
newNote.y = note.y + note.height / 2;

add(note);
}

override public function update(elapsed:Float)
{
super.update(elapsed);

if (controls.RIGHT)
{
newNote.height++;
// newNote.scrollY++;
}

if (controls.LEFT)
{
newNote.height--;
// newNote.scrollY++;
}
}
}
112 changes: 0 additions & 112 deletions source/gameFolder/meta/state/charting/WaveformRenderTest.hx

This file was deleted.

0 comments on commit 9b968c0

Please sign in to comment.