Skip to content
This repository has been archived by the owner on Jul 23, 2022. It is now read-only.

Commit

Permalink
Character changing thing and austinJson additions
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylveondev committed Jul 7, 2022
1 parent 85d77d0 commit 4497b44
Show file tree
Hide file tree
Showing 23 changed files with 144 additions and 38 deletions.
4 changes: 4 additions & 0 deletions assets/preload/data/blammed/chars.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bf
bf-pixel
bf-christmas
pico-player
4 changes: 4 additions & 0 deletions assets/preload/data/bopeebo/chars.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bf
bf-pixel
bf-christmas
pico-player
4 changes: 4 additions & 0 deletions assets/preload/data/cocoa/chars.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bf
bf-pixel
bf-christmas
pico-player
4 changes: 4 additions & 0 deletions assets/preload/data/dad-battle/chars.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bf
bf-pixel
bf-christmas
pico-player
4 changes: 4 additions & 0 deletions assets/preload/data/eggnog/chars.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bf
bf-pixel
bf-christmas
pico-player
4 changes: 4 additions & 0 deletions assets/preload/data/fresh/chars.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bf
bf-pixel
bf-christmas
pico-player
4 changes: 4 additions & 0 deletions assets/preload/data/high/chars.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bf
bf-pixel
bf-christmas
pico-player
4 changes: 4 additions & 0 deletions assets/preload/data/milf/chars.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bf
bf-pixel
bf-christmas
pico-player
4 changes: 4 additions & 0 deletions assets/preload/data/monster/chars.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bf
bf-pixel
bf-christmas
pico-player
4 changes: 4 additions & 0 deletions assets/preload/data/philly-nice/chars.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bf
bf-pixel
bf-christmas
pico-player
4 changes: 4 additions & 0 deletions assets/preload/data/pico/chars.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bf
bf-pixel
bf-christmas
pico-player
4 changes: 4 additions & 0 deletions assets/preload/data/south/chars.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bf
bf-pixel
bf-christmas
pico-player
4 changes: 4 additions & 0 deletions assets/preload/data/spookeez/chars.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bf
bf-pixel
bf-christmas
pico-player
4 changes: 4 additions & 0 deletions assets/preload/data/tutorial/chars.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bf
bf-pixel
bf-christmas
pico-player
4 changes: 4 additions & 0 deletions assets/preload/data/winter-horrorland/chars.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bf
bf-pixel
bf-christmas
pico-player
File renamed without changes
6 changes: 3 additions & 3 deletions source/AustinData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ typedef AustinJSON =
Youtube:String,
},
gameplay:{
gfEnabled:Bool,
watermark:Bool,
watermarkText:String,
comboSprite:Bool
comboSprite:Bool,
ratings:Array<Dynamic>
}
}

Expand All @@ -53,7 +53,7 @@ class AustinData {
#if sys
if(FileSystem.exists(fileName)) {
#else
if(OpenFlAssets.exists(fileName)) {
if(Assets.exists(fileName)) {
#end
foundFile = true;
}
Expand Down
19 changes: 16 additions & 3 deletions source/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class FreeplayState extends MusicBeatState

var scoreBG:FlxSprite;
var scoreText:FlxText;
var changeBfText:FlxText;
var diffText:FlxText;
var speedText:FlxText;
var daBfIcon:HealthIcon;
Expand Down Expand Up @@ -229,6 +230,11 @@ class FreeplayState extends MusicBeatState
daBfIcon.y = scoreText.y + (36 * 2.5);
add(daBfIcon);

changeBfText = new FlxText(scoreText.x, scoreText.y + (36 * 4), 512, "[TAB] Change BF", 48);
changeBfText.setFormat(Paths.font("vcr.ttf"), 26, FlxColor.WHITE, LEFT);
changeBfText.scrollFactor.set();
add(changeBfText);

if(curSelected >= songs.length) curSelected = 0;
bg.color = songs[curSelected].color;
intendedColor = bg.color;
Expand Down Expand Up @@ -713,10 +719,12 @@ class FreeplayState extends MusicBeatState
}
}
if (foundFile == true) {
changeBfText.text = "[TAB] Change BF";
foundbfs = CoolUtil.coolTextFile(fileName);
daBfs = foundbfs;
PlayState.charChangeEnabled = true;
}else{
changeBfText.text = "[ / ] Disabled";
trace('No bf chars found. Using chart\'s default');
var poop:String = Highscore.formatSong(songs[curSelected].songName, curDifficulty);
daBfs = [Song.loadFromJson(poop, songs[curSelected].songName).player1.toLowerCase()];
Expand All @@ -734,6 +742,7 @@ class FreeplayState extends MusicBeatState
var lebf = Character.getIconFromCharacter(daBfs[curBf]);
daBfIcon.changeIcon(lebf);
PlayState.chosenBF = daBfs[curBf];
changeBfText.text += '\nSelected: '+daBfs[curBf];
}

private function positionHighscore() {
Expand All @@ -748,20 +757,24 @@ class FreeplayState extends MusicBeatState
sidebar.scale.x = FlxG.width - scoreText.x + 6;

daBfIcon.x = scoreText.x - 46;
changeBfText.x = Std.int(scoreBG.x + (scoreBG.width / 2));
changeBfText.x -= changeBfText.width / 4;

if (posHigh){
if (sidebar.alpha == 0 && sidebar.visible == false){
sidebar.x = FlxG.width - (sidebar.scale.x / 2);
posHigh = false;
//posHigh = false;
sidebar.visible = true;
sidebarText.visible = true;
sidebarText.x = FlxG.width + 306;
sidebar.x = FlxG.width + 306;
FlxTween.tween(sidebar,{x: FlxG.width - (scoreBG.scale.x * 6.8)},2,{ease:FlxEase.elasticOut ,startDelay:0.5,onComplete:function(twn:FlxTween){
sidebar.alpha = 0.6;
sidebarText.alpha = 1;
/*FlxTween.tween(sidebar,{x: FlxG.width - (scoreBG.scale.x * 6.8)},2,{ease:FlxEase.elasticOut ,startDelay:0.5,onComplete:function(twn:FlxTween){
posHigh = true;
}});
FlxTween.tween(sidebar,{alpha: 0.6},2,{ease:FlxEase.quadOut, startDelay:0.5});
FlxTween.tween(sidebarText,{alpha: 1},2,{ease:FlxEase.quadOut,startDelay:2.5});
FlxTween.tween(sidebarText,{alpha: 1},2,{ease:FlxEase.quadOut,startDelay:2.5});*/
}else{
sidebarText.x = FlxG.width - scoreText.width - 64;

Expand Down
8 changes: 5 additions & 3 deletions source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ import lime.app.Application;
import flixel.util.FlxColor;
using flixel.util.FlxSpriteUtil;
import flixel.FlxSprite;
import source.AustinData;



class Main extends Sprite
{
var gameWidth:Int = 1280; // Width of the game in pixels (might be less / more in actual pixels depending on your zoom).
var gameHeight:Int = 720; // Height of the game in pixels (might be less / more in actual pixels depending on your zoom).
var initialState:Class<FlxState> = PreloadState; // The FlxState the game starts with.
var initialState:Class<FlxState> = #if sys PreloadState #else TitleState #end; // The FlxState the game starts with.
var zoom:Float = -1; // If -1, zoom is automatically calculated to fit the window dimensions.
var framerate:Int = 60; // How many frames per second the game should run at.
var skipSplash:Bool = true; // Whether to skip the flixel splash screen that appears in release mode.
Expand All @@ -42,7 +43,7 @@ class Main extends Sprite
public static function main():Void
{
Lib.current.addChild(new Main());
}
}

public function new()
{
Expand Down Expand Up @@ -161,7 +162,8 @@ class Main extends Sprite


#if !html5
initialState = PreloadState;
if (AustinData.get().preload)
initialState = PreloadState;
#else
initialState = TitleState;
ClientPrefs.loadDefaultKeys();
Expand Down
34 changes: 34 additions & 0 deletions source/ModsMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class ModsMenuState extends MusicBeatState
var mods:Array<ModMetadata> = [];
static var changedAThing = false;
var bg:FlxSprite;
var modbg:FlxSprite;
var intendedColor:Int;
var colorTween:FlxTween;

Expand Down Expand Up @@ -78,11 +79,24 @@ class ModsMenuState extends MusicBeatState
DiscordClient.changePresence("In the Menus", null);
#end



bg = new FlxSprite().loadGraphic(Paths.image('menuDesat'));
bg.antialiasing = ClientPrefs.globalAntialiasing;
add(bg);
bg.screenCenter();

modbg = new FlxSprite().loadGraphic(Paths.image('menuDesat'));
modbg.antialiasing = ClientPrefs.globalAntialiasing;
add(modbg);
modbg.screenCenter();

var blackbg = new FlxSprite().makeGraphic(Std.int(FlxG.height / 2), Std.int(FlxG.width), FlxColor.BLACK);
blackbg.antialiasing = ClientPrefs.globalAntialiasing;
//add(blackbg);
blackbg.screenCenter(X);
blackbg.y += FlxG.height / 2;

var austinJson:AustinJSON = AustinData.get();
var bgOverlay = new FlxBackdrop(Paths.image('menubgOverlay'), 0.2, 0, true, true);
bgOverlay.velocity.set(200, 200);
Expand Down Expand Up @@ -381,6 +395,8 @@ class ModsMenuState extends MusicBeatState
bg.color = defaultColor;
else
bg.color = mods[curSelected].color;
modbg.color = defaultColor;


intendedColor = bg.color;
changeSelection();
Expand Down Expand Up @@ -563,11 +579,17 @@ class ModsMenuState extends MusicBeatState
colorTween.cancel();
}
intendedColor = newColor;
FlxTween.cancelTweensOf(modbg);
colorTween = FlxTween.color(bg, 1, bg.color, intendedColor, {
onComplete: function(twn:FlxTween) {
colorTween = null;
}
});
FlxTween.color(modbg, 1, modbg.color, intendedColor, {
onComplete: function(twn:FlxTween) {
colorTween = null;
}
});
}

var i:Int = 0;
Expand All @@ -583,6 +605,17 @@ class ModsMenuState extends MusicBeatState
descriptionTxt.text += " (This Mod will restart the game!)";
}

modbg.visible = false;
var loadedMenu:BitmapData = null;
var bgToUse:String = Paths.mods(modsList[i][0] + '/splash.png');
if(FileSystem.exists(bgToUse))
{
loadedMenu = BitmapData.fromFile(bgToUse);
}if (loadedMenu != null){
modbg.loadGraphic(loadedMenu);
modbg.visible = true;
}

// correct layering
var stuffArray:Array<FlxSprite> = [/*removeButton, installButton,*/ selector, descriptionTxt, mod.alphabet, mod.icon];
for (obj in stuffArray)
Expand All @@ -596,6 +629,7 @@ class ModsMenuState extends MusicBeatState
insert(members.length, obj);
}
}

i++;
}
updateButtonToggle();
Expand Down
21 changes: 7 additions & 14 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,7 @@ class PlayState extends MusicBeatState
public static var STRUM_X = 42;
public static var STRUM_X_MIDDLESCROLL = -278;

public static var ratingStuff:Array<Dynamic> = [
['You Suck!', 0.2], //From 0% to 19%
['Shit', 0.4], //From 20% to 39%
['Bad', 0.5], //From 40% to 49%
['Bruh', 0.6], //From 50% to 59%
['Meh', 0.69], //From 60% to 68%
['Nice', 0.7], //69%
['Good', 0.8], //From 70% to 79%
['Great', 0.9], //From 80% to 89%
['Sick!', 1], //From 90% to 99%
['Perfect!!', 1] //The value on this one isn't used actually, since Perfect is always "1"
];
public static var ratingStuff:Array<Dynamic> = AustinData.get().gameplay.ratings;
public var modchartTweens:Map<String, FlxTween> = new Map<String, FlxTween>();
public var modchartSprites:Map<String, ModchartSprite> = new Map<String, ModchartSprite>();
public var modchartTimers:Map<String, FlxTimer> = new Map<String, FlxTimer>();
Expand Down Expand Up @@ -260,6 +249,7 @@ class PlayState extends MusicBeatState
var scoreTxtTween:FlxTween;

var allNotesMs:Float = 0;
var msTiming:Float = 0;
var averageMs:Float = 0;

public var poisonTxt:FlxText;
Expand Down Expand Up @@ -881,7 +871,7 @@ class PlayState extends MusicBeatState
SONG.gfVersion = gfVersion; //Fix for the Chart Editor
}

if (!stageData.hide_girlfriend || austinJson.gameplay.gfEnabled != false)
if (!stageData.hide_girlfriend)
{
gf = new Character(0, 0, gfVersion);
startCharacterPos(gf);
Expand Down Expand Up @@ -3801,7 +3791,7 @@ class PlayState extends MusicBeatState
rating.x += ClientPrefs.comboOffset[0];
rating.y -= ClientPrefs.comboOffset[1];

var msTiming = HelperFunctions.truncateFloat(noteDiff, 3);
msTiming = HelperFunctions.truncateFloat(noteDiff, 3);
if(cpuControlled) msTiming = 0;


Expand Down Expand Up @@ -4397,6 +4387,9 @@ class PlayState extends MusicBeatState
var isSus:Bool = note.isSustainNote; //GET OUT OF MY HEAD, GET OUT OF MY HEAD, GET OUT OF MY HEAD
var leData:Int = Math.round(Math.abs(note.noteData));
var leType:String = note.noteType;

setOnLuas('averageMs',averageMs);
setOnLuas('noteHitMs',msTiming);
callOnLuas('goodNoteHit', [notes.members.indexOf(note), leData, leType, isSus]);

if (!note.isSustainNote)
Expand Down
Loading

0 comments on commit 4497b44

Please sign in to comment.