Merge remote-tracking branch 'origin/note-redux' into feature/chart-editor

This commit is contained in:
Eric Myllyoja 2022-09-14 22:28:04 -04:00
commit 51a7282d40
22 changed files with 926 additions and 225 deletions

View file

@ -1,21 +1,41 @@
name: build-upload
on: [push, workflow_dispatch]
on:
schedule:
- cron: '30 17 * * *'
jobs:
check_date:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v2
- name: print latest_commit
run: echo ${{ github.sha }}
- id: should_run
continue-on-error: true
name: check latest commit is less than a day
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"
create-nightly-html5:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-haxeshit
- name: Build game?
run: |
haxelib run lime build html5 -debug
ls
- uses: ./.github/actions/upload-itch
with:
butler-key: ${{ secrets.BUTLER_API_KEY}}
build-dir: export/debug/html5/bin
target: html5
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false'}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-haxeshit
- name: Build game?
run: |
haxelib run lime build html5 -debug
ls
- uses: ./.github/actions/upload-itch
with:
butler-key: ${{ secrets.BUTLER_API_KEY}}
build-dir: export/debug/html5/bin
target: html5
create-nightly-win:
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false'}}
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
@ -30,6 +50,8 @@ jobs:
build-dir: export/debug/windows/bin
target: win
create-nightly-mac:
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false'}}
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
@ -44,6 +66,8 @@ jobs:
build-dir: export/debug/macos/bin
target: mac
create-nightly-linux:
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false'}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
@ -59,5 +83,4 @@ jobs:
with:
butler-key: ${{ secrets.BUTLER_API_KEY}}
build-dir: export/debug/linux/bin
target: linux
target: linux

View file

@ -122,6 +122,8 @@
<!--In case you want to use the addons package-->
<haxelib name="flixel-addons" />
<haxelib name="hscript" />
<haxelib name="haxeui-core"/>
<haxelib name="haxeui-flixel"/>
<haxelib name="flixel-ui" />
<haxelib name="haxeui-core"/>
@ -150,6 +152,9 @@
<!-- HScript relies heavily on Reflection, which means we can't use DCE. -->
<haxeflag name="-dce no" />
<haxeflag name="--macro" value="include('funkin')" />
<!-- Ensure all UI components are available at runtime. -->
<haxeflag name="--macro" value="include('haxe.ui.components')" />
<haxeflag name="--macro" value="include('haxe.ui.containers')" />
<!-- Ensure all UI components are available at runtime. -->
<haxeflag name="--macro" value="include('haxe.ui.components')" />
@ -205,7 +210,7 @@
<!-- <prebuild haxe="trace('prebuilding');"/> -->
<!-- <postbuild haxe="art/Postbuild.hx"/> -->
<config:ios allow-provisioning-updates="true" team-id="" />
<!-- <config:ios allow-provisioning-updates="true" team-id="" /> -->
<!-- Options for Polymod -->
<section if="polymod">

View file

@ -101,4 +101,4 @@
"version": "0.2.2"
}
]
}
}

View file

@ -81,9 +81,14 @@ class Main extends Sprite
initialState = funkin.TitleState;
#end
<<<<<<< HEAD
initHaxeUI();
addChild(new FlxGame(gameWidth, gameHeight, initialState, framerate, framerate, skipSplash, startFullscreen));
=======
haxe.ui.Toolkit.init();
addChild(new FlxGame(gameWidth, gameHeight, initialState, zoom, framerate, framerate, skipSplash, startFullscreen));
>>>>>>> origin/note-redux
#if debug
fpsCounter = new FPS(10, 3, 0xFFFFFF);

View file

@ -46,6 +46,8 @@ class Conductor
public static var songPosition:Float;
public static var lastSongPos:Float;
public static var visualOffset:Float = 0;
public static var audioOffset:Float = 0;
public static var offset:Float = 0;
public static var bpmChangeMap:Array<BPMChangeEvent> = [];

View file

@ -176,6 +176,11 @@ class InitState extends FlxTransitionableState
FlxG.switchState(new PicoFight());
#elseif ANIMDEBUG
FlxG.switchState(new funkin.ui.animDebugShit.DebugBoundingState());
<<<<<<< HEAD
=======
#elseif LATENCY
FlxG.switchState(new LatencyState());
>>>>>>> origin/note-redux
#elseif NETTEST
FlxG.switchState(new netTest.NetTest());
#else

View file

@ -1,23 +1,128 @@
package funkin;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.FlxSubState;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.group.FlxGroup;
import flixel.math.FlxMath;
import flixel.system.FlxSound;
import flixel.system.debug.stats.StatsGraph;
import flixel.text.FlxText;
import flixel.util.FlxColor;
import funkin.audiovis.PolygonSpectogram;
import funkin.ui.CoolStatsGraph;
import haxe.Timer;
import openfl.events.KeyboardEvent;
class LatencyState extends FlxState
class LatencyState extends MusicBeatSubstate
{
var offsetText:FlxText;
var noteGrp:FlxTypedGroup<Note>;
var strumLine:FlxSprite;
var blocks:FlxTypedGroup<FlxSprite>;
var songPosVis:FlxSprite;
var songVisFollowVideo:FlxSprite;
var songVisFollowAudio:FlxSprite;
var beatTrail:FlxSprite;
var diffGrp:FlxTypedGroup<FlxText>;
var offsetsPerBeat:Array<Int> = [];
var swagSong:HomemadeMusic;
var funnyStatsGraph:CoolStatsGraph;
var realStats:CoolStatsGraph;
override function create()
{
FlxG.sound.playMusic(Paths.sound('soundTest'));
swagSong = new HomemadeMusic();
swagSong.loadEmbedded(Paths.sound('soundTest'), true);
FlxG.sound.music = swagSong;
FlxG.sound.music.play();
funnyStatsGraph = new CoolStatsGraph(0, Std.int(FlxG.height / 2), FlxG.width, Std.int(FlxG.height / 2), FlxColor.PINK, "time");
FlxG.addChildBelowMouse(funnyStatsGraph);
realStats = new CoolStatsGraph(0, Std.int(FlxG.height / 2), FlxG.width, Std.int(FlxG.height / 2), FlxColor.YELLOW, "REAL");
FlxG.addChildBelowMouse(realStats);
FlxG.stage.addEventListener(KeyboardEvent.KEY_DOWN, key ->
{
trace(key.charCode);
if (key.charCode == 120)
generateBeatStuff();
trace("\tEVENT PRESS: \t" + FlxG.sound.music.time + " " + Timer.stamp());
// trace(FlxG.sound.music.prevTimestamp);
trace(FlxG.sound.music.time);
trace("\tFR FR PRESS: \t" + swagSong.getTimeWithDiff());
// trace("\tREDDIT: \t" + swagSong.frfrTime + " " + Timer.stamp());
@:privateAccess
trace("\tREDDIT: \t" + FlxG.sound.music._channel.position + " " + Timer.stamp());
// trace("EVENT LISTENER: " + key);
});
// FlxG.sound.playMusic(Paths.sound('soundTest'));
// funnyStatsGraph.hi
Conductor.bpm = 60;
noteGrp = new FlxTypedGroup<Note>();
add(noteGrp);
diffGrp = new FlxTypedGroup<FlxText>();
add(diffGrp);
// var musSpec:PolygonSpectogram = new PolygonSpectogram(FlxG.sound.music, FlxColor.RED, FlxG.height, Math.floor(FlxG.height / 2));
// musSpec.x += 170;
// musSpec.scrollFactor.set();
// musSpec.waveAmplitude = 100;
// musSpec.realtimeVisLenght = 0.45;
// // musSpec.visType = FREQUENCIES;
// add(musSpec);
for (beat in 0...Math.floor(FlxG.sound.music.length / Conductor.crochet))
{
var beatTick:FlxSprite = new FlxSprite(songPosToX(beat * Conductor.crochet), FlxG.height - 15);
beatTick.makeGraphic(2, 15);
beatTick.alpha = 0.3;
add(beatTick);
var offsetTxt:FlxText = new FlxText(songPosToX(beat * Conductor.crochet), FlxG.height - 26, 0, "swag");
offsetTxt.alpha = 0.5;
diffGrp.add(offsetTxt);
offsetsPerBeat.push(0);
}
songVisFollowAudio = new FlxSprite(0, FlxG.height - 20).makeGraphic(2, 20, FlxColor.YELLOW);
add(songVisFollowAudio);
songVisFollowVideo = new FlxSprite(0, FlxG.height - 20).makeGraphic(2, 20, FlxColor.BLUE);
add(songVisFollowVideo);
songPosVis = new FlxSprite(0, FlxG.height - 20).makeGraphic(2, 20, FlxColor.RED);
add(songPosVis);
beatTrail = new FlxSprite(0, songPosVis.y).makeGraphic(2, 20, FlxColor.PURPLE);
beatTrail.alpha = 0.7;
add(beatTrail);
blocks = new FlxTypedGroup<FlxSprite>();
add(blocks);
for (i in 0...8)
{
var block = new FlxSprite(2, 50 * i).makeGraphic(48, 48);
block.alpha = 0;
blocks.add(block);
}
for (i in 0...32)
{
var note:Note = new Note(Conductor.crochet * i, 1);
@ -31,43 +136,185 @@ class LatencyState extends FlxState
strumLine = new FlxSprite(FlxG.width / 2, 100).makeGraphic(FlxG.width, 5);
add(strumLine);
Conductor.bpm = 120;
super.create();
}
override function stepHit()
{
if (curStep % 4 == 2)
{
blocks.members[((curBeat % 8) + 1) % 8].alpha = 0.5;
}
super.stepHit();
}
override function beatHit()
{
if (curBeat % 8 == 0)
blocks.forEach(blok ->
{
blok.alpha = 0;
});
blocks.members[curBeat % 8].alpha = 1;
// block.visible = !block.visible;
super.beatHit();
}
override function update(elapsed:Float)
{
offsetText.text = "Offset: " + Conductor.offset + "ms";
/* trace("1: " + swagSong.frfrTime);
@:privateAccess
trace(FlxG.sound.music._channel.position);
*/
Conductor.songPosition = FlxG.sound.music.time - Conductor.offset;
funnyStatsGraph.update(FlxG.sound.music.time % 500);
realStats.update(swagSong.getTimeWithDiff() % 500);
var multiply:Float = 1;
if (FlxG.keys.pressed.SHIFT)
multiply = 10;
if (FlxG.keys.justPressed.RIGHT)
Conductor.offset += 1 * multiply;
if (FlxG.keys.justPressed.LEFT)
Conductor.offset -= 1 * multiply;
if (FlxG.keys.justPressed.S)
{
trace("\tUPDATE PRESS: \t" + FlxG.sound.music.time + " " + Timer.stamp());
}
if (FlxG.keys.justPressed.SPACE)
{
FlxG.sound.music.stop();
FlxG.resetState();
if (FlxG.sound.music.playing)
FlxG.sound.music.pause();
else
FlxG.sound.music.resume();
}
if (FlxG.keys.pressed.D)
FlxG.sound.music.time += 1000 * FlxG.elapsed;
Conductor.songPosition = swagSong.getTimeWithDiff() - Conductor.offset;
// Conductor.songPosition += (Timer.stamp() * 1000) - FlxG.sound.music.prevTimestamp;
songPosVis.x = songPosToX(Conductor.songPosition);
songVisFollowAudio.x = songPosToX(Conductor.songPosition - Conductor.audioOffset);
songVisFollowVideo.x = songPosToX(Conductor.songPosition - Conductor.visualOffset);
offsetText.text = "AUDIO Offset: " + Conductor.audioOffset + "ms";
offsetText.text += "\nVIDOE Offset: " + Conductor.visualOffset + "ms";
offsetText.text += "\ncurStep: " + curStep;
offsetText.text += "\ncurBeat: " + curBeat;
var avgOffsetInput:Float = 0;
for (offsetThing in offsetsPerBeat)
avgOffsetInput += offsetThing;
avgOffsetInput /= offsetsPerBeat.length;
offsetText.text += "\naverage input offset needed: " + avgOffsetInput;
var multiply:Float = 10;
if (FlxG.keys.pressed.SHIFT)
multiply = 1;
if (FlxG.keys.pressed.CONTROL)
{
if (FlxG.keys.justPressed.RIGHT)
{
Conductor.audioOffset += 1 * multiply;
}
if (FlxG.keys.justPressed.LEFT)
{
Conductor.audioOffset -= 1 * multiply;
}
}
else
{
if (FlxG.keys.justPressed.RIGHT)
{
Conductor.visualOffset += 1 * multiply;
}
if (FlxG.keys.justPressed.LEFT)
{
Conductor.visualOffset -= 1 * multiply;
}
}
/* if (FlxG.keys.justPressed.SPACE)
{
FlxG.sound.music.stop();
FlxG.resetState();
}*/
noteGrp.forEach(function(daNote:Note)
{
daNote.y = (strumLine.y - (Conductor.songPosition - daNote.data.strumTime) * 0.45);
daNote.y = (strumLine.y - ((Conductor.songPosition - Conductor.audioOffset) - daNote.data.strumTime) * 0.45);
daNote.x = strumLine.x + 30;
if (daNote.y < strumLine.y)
daNote.kill();
daNote.alpha = 0.5;
if (daNote.y < 0 - daNote.height)
{
daNote.alpha = 1;
// daNote.data.strumTime += Conductor.crochet * 8;
}
});
super.update(elapsed);
}
function generateBeatStuff()
{
Conductor.songPosition = swagSong.getTimeWithDiff();
var closestBeat:Int = Math.round(Conductor.songPosition / Conductor.crochet) % diffGrp.members.length;
var getDiff:Float = Conductor.songPosition - (closestBeat * Conductor.crochet);
getDiff -= Conductor.visualOffset;
// lil fix for end of song
if (closestBeat == 0 && getDiff >= Conductor.crochet * 2)
getDiff -= FlxG.sound.music.length;
trace("\tDISTANCE TO CLOSEST BEAT: " + getDiff + "ms");
trace("\tCLOSEST BEAT: " + closestBeat);
beatTrail.x = songPosVis.x;
diffGrp.members[closestBeat].text = getDiff + "ms";
offsetsPerBeat[closestBeat] = Std.int(getDiff);
}
function songPosToX(pos:Float):Float
{
return FlxMath.remapToRange(pos, 0, FlxG.sound.music.length, 0, FlxG.width);
}
}
class HomemadeMusic extends FlxSound
{
public var prevTimestamp:Int = 0;
public var timeWithDiff:Float = 0;
public function new()
{
super();
}
var prevTime:Float = 0;
override function update(elapsed:Float)
{
super.update(elapsed);
if (prevTime != time)
{
prevTime = time;
prevTimestamp = Std.int(Timer.stamp() * 1000);
}
}
public function getTimeWithDiff():Float
{
return time + (Std.int(Timer.stamp() * 1000) - prevTimestamp);
}
}

View file

@ -13,9 +13,16 @@ class MenuCharacter extends FlxSprite
this.character = character;
var tex = Paths.getSparrowAtlas('campaign_menu_UI_characters');
var suffix:String = character;
if (character != "darnell" && character != "nene")
suffix = "characters";
var tex = Paths.getSparrowAtlas('campaign_menu_UI_' + suffix);
frames = tex;
trace(character);
animation.addByPrefix('bf', "BF idle dance white", 24);
animation.addByPrefix('bfConfirm', 'BF HEY!!', 24, false);
animation.addByPrefix('gf', "GF Dancing Beat WHITE", 24);
@ -26,6 +33,8 @@ class MenuCharacter extends FlxSprite
animation.addByPrefix('parents-christmas', "Parent Christmas Idle", 24);
animation.addByPrefix('senpai', "SENPAI idle Black Lines", 24);
animation.addByPrefix('tankman', "Tankman Menu BLACK", 24);
animation.addByPrefix('darnell', "Darnell Black Lines To Scale", 24);
animation.addByPrefix('nene', "Nene Black Lines To Scale", 24);
// Parent Christmas Idle
animation.play(character);

View file

@ -12,10 +12,19 @@ class MenuItem extends FlxSpriteGroup
public var week:FlxSprite;
public var flashingInt:Int = 0;
public function new(x:Float, y:Float, weekNum:Int = 0)
public function new(x:Float, y:Float, weekNum:Int = 0, weekType:WeekType)
{
super(x, y);
week = new FlxSprite().loadGraphic(Paths.image('storymenu/week' + weekNum));
var weekStr:String = switch (weekType)
{
case WEEK:
"week";
case WEEKEND:
"weekend";
}
week = new FlxSprite().loadGraphic(Paths.image('storymenu/' + weekStr + weekNum));
add(week);
}
@ -46,3 +55,9 @@ class MenuItem extends FlxSpriteGroup
week.color = FlxColor.WHITE;
}
}
enum abstract WeekType(String) to String
{
var WEEK;
var WEEKEND;
}

View file

@ -50,7 +50,7 @@ class MusicBeatSubstate extends FlxSubState
lastChange = Conductor.bpmChangeMap[i];
}
curStep = lastChange.stepTime + Math.floor((Conductor.songPosition - lastChange.songTime) / Conductor.stepCrochet);
curStep = lastChange.stepTime + Math.floor(((Conductor.songPosition - Conductor.audioOffset) - lastChange.songTime) / Conductor.stepCrochet);
}
public function stepHit():Bool

View file

@ -1,8 +1,5 @@
package funkin;
#if discord_rpc
import Discord.DiscordClient;
#end
import flixel.FlxSprite;
import flixel.addons.transition.FlxTransitionableState;
import flixel.graphics.frames.FlxAtlasFrames;
@ -13,11 +10,17 @@ import flixel.text.FlxText;
import flixel.tweens.FlxTween;
import flixel.util.FlxColor;
import flixel.util.FlxTimer;
import lime.net.curl.CURLCode;
import funkin.MenuItem.WeekType;
import funkin.play.PlayState;
import lime.net.curl.CURLCode;
import openfl.Assets;
using StringTools;
#if discord_rpc
import Discord.DiscordClient;
#end
class StoryMenuState extends MusicBeatState
{
var scoreText:FlxText;
@ -30,13 +33,14 @@ class StoryMenuState extends MusicBeatState
['Satin-Panties', "High", "Milf"],
['Cocoa', 'Eggnog', 'Winter-Horrorland'],
['Senpai', 'Roses', 'Thorns'],
['Ugh', 'Guns', 'Stress']
['Ugh', 'Guns', 'Stress'],
['Darnell', "lit-up", "2hot"]
];
var curDifficulty:Int = 1;
// TODO: This info is just hardcoded right now.
// We should probably make it so that weeks must be completed in order to unlock the next week.
public static var weekUnlocked:Array<Bool> = [true, true, true, true, true, true, true, true];
public static var weekUnlocked:Array<Bool> = [true, true, true, true, true, true, true, true, true];
var weekCharacters:Array<Dynamic> = [
['dad', 'bf', 'gf'],
@ -47,6 +51,7 @@ class StoryMenuState extends MusicBeatState
['parents-christmas', 'bf', 'gf'],
['senpai', 'bf', 'gf'],
['tankman', 'bf', 'gf'],
['darnell', 'pico', 'nene']
];
var weekNames:Array<String> = [
@ -57,9 +62,13 @@ class StoryMenuState extends MusicBeatState
"MOMMY MUST MURDER",
"RED SNOW",
"hating simulator ft. moawling",
"TANKMAN"
"TANKMAN",
"Due Debts"
];
var weekType:Array<WeekType> = [WEEK, WEEK, WEEK, WEEK, WEEK, WEEK, WEEK, WEEK, WEEKEND];
var weekTypeInc:Map<WeekType, Int> = new Map();
var txtWeekTitle:FlxText;
var curWeek:Int = 0;
@ -67,14 +76,17 @@ class StoryMenuState extends MusicBeatState
var txtTracklist:FlxText;
var grpWeekText:FlxTypedGroup<MenuItem>;
var grpWeekCharacters:FlxTypedGroup<MenuCharacter>;
var grpWeekCharacters:Array<FlxTypedGroup<MenuCharacter>>;
// var grpWeekCharacters:FlxTypedGroup<MenuCharacter>;
var grpLocks:FlxTypedGroup<FlxSprite>;
var difficultySelectors:FlxGroup;
var sprDifficulty:FlxSprite;
var leftArrow:FlxSprite;
var rightArrow:FlxSprite;
var yellowBG:FlxSprite; // not actually, yellow, lol!
var targetColor:Int = 0xFFF9CF51;
override function create()
{
@ -103,7 +115,10 @@ class StoryMenuState extends MusicBeatState
rankText.screenCenter(X);
var ui_tex = Paths.getSparrowAtlas('campaign_menu_UI_assets');
var yellowBG:FlxSprite = new FlxSprite(0, 56).makeGraphic(FlxG.width, 400, 0xFFF9CF51);
yellowBG = new FlxSprite(0, 56).makeGraphic(FlxG.width, 400, FlxColor.WHITE);
yellowBG.color = 0xFFF9CF51;
// 0xFF413CAE blue
// 0xFFF9CF51 yello
grpWeekText = new FlxTypedGroup<MenuItem>();
add(grpWeekText);
@ -111,7 +126,8 @@ class StoryMenuState extends MusicBeatState
var blackBarThingie:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, 56, FlxColor.BLACK);
add(blackBarThingie);
grpWeekCharacters = new FlxTypedGroup<MenuCharacter>();
// grpWeekCharacters = new FlxTypedGroup<MenuCharacter>();
grpWeekCharacters = [];
grpLocks = new FlxTypedGroup<FlxSprite>();
add(grpLocks);
@ -123,11 +139,19 @@ class StoryMenuState extends MusicBeatState
for (i in 0...weekData.length)
{
var weekThing:MenuItem = new MenuItem(0, yellowBG.y + yellowBG.height + 10, i);
if (!weekTypeInc.exists(weekType[i]))
weekTypeInc[weekType[i]] = 1;
if (i == 0 && weekType[i] == WEEK)
weekTypeInc[weekType[i]] = 0; // set week to 0 by default?
var weekThing:MenuItem = new MenuItem(0, yellowBG.y + yellowBG.height + 10, weekTypeInc[weekType[i]], weekType[i]);
weekThing.y += ((weekThing.height + 20) * i);
weekThing.targetY = i;
grpWeekText.add(weekThing);
weekTypeInc[weekType[i]] += 1;
weekThing.screenCenter(X);
weekThing.antialiasing = true;
// weekThing.updateHitbox();
@ -145,32 +169,67 @@ class StoryMenuState extends MusicBeatState
}
}
for (char in 0...3)
{
var weekCharacterThing:MenuCharacter = new MenuCharacter((FlxG.width * 0.25) * (1 + char) - 150, weekCharacters[curWeek][char]);
weekCharacterThing.y += 70;
weekCharacterThing.antialiasing = true;
switch (weekCharacterThing.character)
{
case 'dad':
weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * 0.5));
weekCharacterThing.updateHitbox();
var sizeChart:Map<String, Array<Float>> = new Map();
case 'bf':
weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * 0.9));
weekCharacterThing.updateHitbox();
weekCharacterThing.x -= 80;
case 'gf':
weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * 0.5));
weekCharacterThing.updateHitbox();
case 'pico':
weekCharacterThing.flipX = true;
case 'parents-christmas':
weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * 0.9));
weekCharacterThing.updateHitbox();
var sizeTxt:Array<String> = Assets.getText(Paths.file("data/storychardata.txt")).split("\n");
for (item in sizeTxt)
{
var items:Array<String> = item.split(" ");
var stuf:Array<Float> = [];
var name:String = items.shift();
for (num in items)
stuf.push(Std.parseFloat(num));
sizeChart.set(name, stuf);
}
for (index => week in weekCharacters)
{
grpWeekCharacters.push(new FlxTypedGroup<MenuCharacter>());
for (char in 0...week.length)
{
var weekCharacterThing:MenuCharacter = new MenuCharacter((FlxG.width * 0.25) * (1 + char) - 150, weekCharacters[index][char]);
weekCharacterThing.y += 70;
weekCharacterThing.antialiasing = true;
var size:Float = 0.9;
switch (char)
{
case 0 | 2:
size = 0.5;
if (char == 0 && weekCharacterThing.character == "pico")
weekCharacterThing.flipX = true;
case 1:
size = 0.9;
weekCharacterThing.x -= 80;
}
if (sizeChart.exists(weekCharacterThing.character))
{
var nums:Array<Float> = sizeChart[weekCharacterThing.character];
size = nums[char];
// IDK, this might be busted ass null shit?
if (char != 1)
{
weekCharacterThing.x += nums[3];
weekCharacterThing.y += nums[4];
}
}
weekCharacterThing.setGraphicSize(Std.int(weekCharacterThing.width * size));
weekCharacterThing.updateHitbox();
grpWeekCharacters[index].add(weekCharacterThing);
trace("ADD CHARACTER");
}
grpWeekCharacters.add(weekCharacterThing);
trace(grpWeekCharacters[index].toString());
}
difficultySelectors = new FlxGroup();
@ -201,7 +260,13 @@ class StoryMenuState extends MusicBeatState
difficultySelectors.add(rightArrow);
add(yellowBG);
add(grpWeekCharacters);
for (grp in grpWeekCharacters)
{
add(grp);
// trace("ADDED GRP");
}
// add(grpWeekCharacters);
txtTracklist = new FlxText(FlxG.width * 0.05, yellowBG.x + yellowBG.height + 100, 0, "Tracks", 32);
txtTracklist.alignment = CENTER;
@ -220,6 +285,9 @@ class StoryMenuState extends MusicBeatState
override function update(elapsed:Float)
{
// scoreText.setFormat('VCR OSD Mono', 32);
yellowBG.color = FlxColor.interpolate(yellowBG.color, targetColor, 0.06);
lerpScore = CoolUtil.coolLerp(lerpScore, intendedScore, 0.5);
scoreText.text = "WEEK SCORE:" + Math.round(lerpScore);
@ -295,7 +363,7 @@ class StoryMenuState extends MusicBeatState
FlxG.sound.play(Paths.sound('confirmMenu'));
grpWeekText.members[curWeek].startFlashing();
grpWeekCharacters.members[1].animation.play('bfConfirm');
grpWeekCharacters[curWeek].members[1].animation.play('bfConfirm');
stopspamming = true;
}
@ -391,38 +459,19 @@ class StoryMenuState extends MusicBeatState
function updateText()
{
grpWeekCharacters.members[0].animation.play(weekCharacters[curWeek][0]);
grpWeekCharacters.members[1].animation.play(weekCharacters[curWeek][1]);
grpWeekCharacters.members[2].animation.play(weekCharacters[curWeek][2]);
txtTracklist.text = "Tracks\n";
switch (grpWeekCharacters.members[0].animation.curAnim.name)
switch (weekType[curWeek])
{
case 'parents-christmas':
grpWeekCharacters.members[0].offset.set(200, 200);
grpWeekCharacters.members[0].setGraphicSize(Std.int(grpWeekCharacters.members[0].width * 0.99));
case 'senpai':
grpWeekCharacters.members[0].offset.set(130, 0);
grpWeekCharacters.members[0].setGraphicSize(Std.int(grpWeekCharacters.members[0].width * 1.4));
case 'mom':
grpWeekCharacters.members[0].offset.set(100, 200);
grpWeekCharacters.members[0].setGraphicSize(Std.int(grpWeekCharacters.members[0].width * 1));
case 'dad':
grpWeekCharacters.members[0].offset.set(120, 200);
grpWeekCharacters.members[0].setGraphicSize(Std.int(grpWeekCharacters.members[0].width * 1));
case 'tankman':
grpWeekCharacters.members[0].offset.set(60, -20);
grpWeekCharacters.members[0].setGraphicSize(Std.int(grpWeekCharacters.members[0].width * 1));
default:
grpWeekCharacters.members[0].offset.set(100, 100);
grpWeekCharacters.members[0].setGraphicSize(Std.int(grpWeekCharacters.members[0].width * 1));
// grpWeekCharacters.members[0].updateHitbox();
case WEEK:
targetColor = 0xFFF9CF51;
case WEEKEND:
targetColor = 0xFF413CAE;
}
for (ind => grp in grpWeekCharacters)
grp.visible = ind == curWeek;
txtTracklist.text = "Tracks\n";
var trackNames:Array<String> = weekData[curWeek];
for (i in trackNames)
{

View file

@ -0,0 +1,12 @@
package funkin.audiovis;
import flixel.FlxSprite;
import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup;
class ABot extends FlxTypedSpriteGroup<FlxSprite>
{
public function new()
{
super();
}
}

View file

@ -9,6 +9,12 @@ import flixel.system.FlxSound;
import flixel.util.FlxColor;
import funkin.audiovis.PolygonSpectogram.VISTYPE;
import funkin.audiovis.VisShit.CurAudioInfo;
<<<<<<< HEAD
=======
import funkin.audiovis.dsp.FFT;
import haxe.Timer;
import lime.system.ThreadPool;
>>>>>>> origin/note-redux
import lime.utils.Int16Array;
using Lambda;
@ -165,39 +171,20 @@ class SpectogramSprite extends FlxTypedSpriteGroup<FlxSprite>
else
remappedShit = Std.int(FlxMath.remapToRange(Conductor.songPosition, 0, vis.snd.length, 0, numSamples));
var i = remappedShit;
var prevLine:FlxPoint = new FlxPoint();
var swagheight:Int = 200;
var fftSamples:Array<Float> = [];
// var array:Array<Float> = cast audioData.subarray(remappedShit, remappedShit + lengthOfShit);
if (FlxG.keys.justPressed.M)
{
trace('POOP LOL');
var funnyAud = audioData.subarray(remappedShit, remappedShit + lengthOfShit);
for (poop in funnyAud)
{
// trace("actual audio: " + poop);
trace("win: " + poop);
}
// trace(audioData.subarray(remappedShit, remappedShit + lengthOfShit).buffer);
}
var i = remappedShit;
for (sample in remappedShit...remappedShit + (Std.int((44100 * (1 / 144)))))
{
var curAud:CurAudioInfo = VisShit.getCurAud(audioData, i);
i += 2;
// var remappedSample:Float = FlxMath.remapToRange(sample, remappedShit, remappedShit + lengthOfShit, 0, lengthOfShit - 1);
fftSamples.push(curAud.balanced);
}
var freqShit = vis.funnyFFT(fftSamples);
var prevLine:FlxPoint = new FlxPoint();
var swagheight:Int = 200;
for (i in 0...group.members.length)
{

View file

@ -1,8 +1,10 @@
package funkin.audiovis;
import funkin.audiovis.dsp.FFT;
import flixel.math.FlxMath;
import flixel.system.FlxSound;
import funkin.audiovis.dsp.FFT;
import haxe.Timer;
import lime.system.ThreadPool;
import lime.utils.Int16Array;
using Lambda;
@ -51,8 +53,8 @@ class VisShit
final maxFreq = 4000.01;
final melodicBandPass = function(k:Int, s:Float)
{
// final freq = indexToFreq(k);
// final filter = freq > minFreq - binSize && freq < maxFreq + binSize ? 1 : 0;
final freq = indexToFreq(k);
final filter = freq > minFreq - binSize && freq < maxFreq + binSize ? 1 : 0;
return s;
};

View file

@ -1002,6 +1002,8 @@ class PlayState extends MusicBeatState
if (FlxG.keys.justPressed.U)
{
// hack for HaxeUI generation, doesn't work unless persistentUpdate is false at state creation!!
persistentUpdate = false;
openSubState(new StageOffsetSubstate());
}

View file

@ -294,7 +294,7 @@ class BaseCharacter extends Bopper
super.onUpdate(event);
// Reset hold timer for each note pressed.
if (justPressedNote())
if (justPressedNote() && this.characterType == BF)
{
holdTimer = 0;
}
@ -326,12 +326,20 @@ class BaseCharacter extends Bopper
holdTimer += event.elapsed;
var singTimeMs:Float = singTimeCrochet * (Conductor.crochet * 0.001); // x beats, to ms.
if (getCurrentAnimation().endsWith("miss"))
singTimeMs *= 2; // makes it feel more awkward when you miss
// Without this check here, the player character would only play the `sing` animation
// for one beat, as opposed to holding it as long as the player is holding the button.
var shouldStopSinging:Bool = (this.characterType == BF) ? !isHoldingNote() : true;
FlxG.watch.addQuick('singTimeMs-${characterId}', singTimeMs);
<<<<<<< HEAD
if (holdTimer > singTimeMs && shouldStopSinging) // && !getCurrentAnimation().endsWith("miss")
=======
if (holdTimer > singTimeMs && shouldStopSinging)
>>>>>>> origin/note-redux
{
// trace('holdTimer reached ${holdTimer}sec (> ${singTimeMs}), stopping sing animation');
holdTimer = 0;
@ -453,16 +461,20 @@ class BaseCharacter extends Bopper
{
super.onNoteHit(event);
holdTimer = 0;
if (event.note.mustPress && characterType == BF)
{
// If the note is from the same strumline, play the sing animation.
<<<<<<< HEAD
this.playSingAnimation(event.note.data.dir, false);
=======
this.playSingAnimation(event.note.data.dir, false, event.note.data.altNote);
holdTimer = 0;
>>>>>>> origin/note-redux
}
else if (!event.note.mustPress && characterType == DAD)
{
// If the note is from the same strumline, play the sing animation.
<<<<<<< HEAD
this.playSingAnimation(event.note.data.dir, false);
}
else if (characterType == GF)
@ -472,6 +484,10 @@ class BaseCharacter extends Bopper
trace('Playing GF combo animation: combo${event.comboCount}');
this.playAnimation('combo${event.comboCount}', true, true);
}
=======
this.playSingAnimation(event.note.data.dir, false, event.note.data.altNote);
holdTimer = 0;
>>>>>>> origin/note-redux
}
}

View file

@ -0,0 +1,162 @@
package funkin.ui;
import flash.display.Graphics;
import flash.display.Shape;
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormatAlign;
import flixel.math.FlxMath;
import flixel.system.debug.DebuggerUtil;
import flixel.system.debug.stats.Stats;
import flixel.util.FlxColor;
import flixel.util.FlxDestroyUtil;
/**
* This is a helper function for the stats window to draw a graph with given values.
* SHAMELESSLY STOLEN FROM FLIXEL
* https://github.com/HaxeFlixel/flixel/blob/master/flixel/system/debug/stats/StatsGraph.hx
*/
#if FLX_DEBUG
class CoolStatsGraph extends Sprite
{
static inline var AXIS_COLOR:FlxColor = 0xffffff;
static inline var AXIS_ALPHA:Float = 0.5;
static inline var HISTORY_MAX:Int = 500;
public var minLabel:TextField;
public var curLabel:TextField;
public var maxLabel:TextField;
public var avgLabel:TextField;
public var minValue:Float = FlxMath.MAX_VALUE_FLOAT;
public var maxValue:Float = FlxMath.MIN_VALUE_FLOAT;
public var graphColor:FlxColor;
public var history:Array<Float> = [];
var _axis:Shape;
var _width:Int;
var _height:Int;
var _unit:String;
var _labelWidth:Int;
var _label:String;
public function new(X:Int, Y:Int, Width:Int, Height:Int, GraphColor:FlxColor, Unit:String, LabelWidth:Int = 45, ?Label:String)
{
super();
x = X;
y = Y;
_width = Width - LabelWidth;
_height = Height;
graphColor = GraphColor;
_unit = Unit;
_labelWidth = LabelWidth;
_label = (Label == null) ? "" : Label;
_axis = new Shape();
_axis.x = _labelWidth + 10;
maxLabel = DebuggerUtil.createTextField(0, 0, Stats.LABEL_COLOR, Stats.TEXT_SIZE);
curLabel = DebuggerUtil.createTextField(0, (_height / 2) - (Stats.TEXT_SIZE / 2), graphColor, Stats.TEXT_SIZE);
minLabel = DebuggerUtil.createTextField(0, _height - Stats.TEXT_SIZE, Stats.LABEL_COLOR, Stats.TEXT_SIZE);
avgLabel = DebuggerUtil.createTextField(_labelWidth + 20, (_height / 2) - (Stats.TEXT_SIZE / 2) - 10, Stats.LABEL_COLOR, Stats.TEXT_SIZE);
avgLabel.width = _width;
avgLabel.defaultTextFormat.align = TextFormatAlign.CENTER;
avgLabel.alpha = 0.5;
addChild(_axis);
addChild(maxLabel);
addChild(curLabel);
addChild(minLabel);
addChild(avgLabel);
drawAxes();
}
/**
* Redraws the axes of the graph.
*/
function drawAxes():Void
{
var gfx = _axis.graphics;
gfx.clear();
gfx.lineStyle(1, AXIS_COLOR, AXIS_ALPHA);
// y-Axis
gfx.moveTo(0, 0);
gfx.lineTo(0, _height);
// x-Axis
gfx.moveTo(0, _height);
gfx.lineTo(_width, _height);
}
/**
* Redraws the graph based on the values stored in the history.
*/
function drawGraph():Void
{
var gfx:Graphics = graphics;
gfx.clear();
gfx.lineStyle(1, graphColor, 1);
var inc:Float = _width / (HISTORY_MAX - 1);
var range:Float = Math.max(maxValue - minValue, maxValue * 0.1);
var graphX = _axis.x + 1;
for (i in 0...history.length)
{
var value = (history[i] - minValue) / range;
var pointY = (-value * _height - 1) + _height;
if (i == 0)
gfx.moveTo(graphX, _axis.y + pointY);
gfx.lineTo(graphX + (i * inc), pointY);
}
}
public function update(Value:Float):Void
{
history.unshift(Value);
if (history.length > HISTORY_MAX)
history.pop();
// Update range
maxValue = Math.max(maxValue, Value);
minValue = Math.min(minValue, Value);
minLabel.text = formatValue(minValue);
curLabel.text = formatValue(Value);
maxLabel.text = formatValue(maxValue);
avgLabel.text = _label + "\nAvg: " + formatValue(average());
drawGraph();
}
function formatValue(value:Float):String
{
return FlxMath.roundDecimal(value, Stats.DECIMALS) + " " + _unit;
}
public function average():Float
{
var sum:Float = 0;
for (value in history)
sum += value;
return sum / history.length;
}
public function destroy():Void
{
_axis = FlxDestroyUtil.removeChild(this, _axis);
minLabel = FlxDestroyUtil.removeChild(this, minLabel);
curLabel = FlxDestroyUtil.removeChild(this, curLabel);
maxLabel = FlxDestroyUtil.removeChild(this, maxLabel);
avgLabel = FlxDestroyUtil.removeChild(this, avgLabel);
history = null;
}
}
#end

View file

@ -1,13 +1,11 @@
package funkin.ui.animDebugShit;
import funkin.play.character.CharacterData.CharacterDataParser;
import funkin.play.character.SparrowCharacter;
import flixel.addons.display.FlxGridOverlay;
import flixel.addons.ui.FlxInputText;
import flixel.addons.ui.FlxUIDropDownMenu;
import flixel.FlxCamera;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.addons.display.FlxGridOverlay;
import flixel.addons.ui.FlxInputText;
import flixel.addons.ui.FlxUIDropDownMenu;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.graphics.frames.FlxFrame;
import flixel.group.FlxGroup;
@ -18,6 +16,13 @@ import flixel.util.FlxColor;
import flixel.util.FlxSpriteUtil;
import flixel.util.FlxTimer;
import funkin.play.character.BaseCharacter;
import funkin.play.character.CharacterData.CharacterDataParser;
import funkin.play.character.SparrowCharacter;
import haxe.ui.RuntimeComponentBuilder;
import haxe.ui.components.DropDown;
import haxe.ui.core.Component;
import haxe.ui.events.ItemEvent;
import haxe.ui.events.UIEvent;
import lime.utils.Assets as LimeAssets;
import openfl.Assets;
import openfl.events.Event;
@ -51,8 +56,6 @@ class DebugBoundingState extends FlxState
var hudCam:FlxCamera;
var charInput:FlxUIDropDownMenu;
var curView:ANIMDEBUGVIEW = SPRITESHEET;
var spriteSheetView:FlxGroup;
@ -63,10 +66,37 @@ class DebugBoundingState extends FlxState
var onionSkinChar:FlxSprite;
var txtOffsetShit:FlxText;
var uiStuff:Component;
override function create()
{
Paths.setCurrentLevel('week1');
var str = Paths.xml('ui/offset-editor-view');
uiStuff = RuntimeComponentBuilder.fromAsset(str);
// uiStuff.findComponent("btnViewSpriteSheet").onClick = _ -> curView = SPRITESHEET;
var dropdown:DropDown = cast uiStuff.findComponent("swapper");
dropdown.onChange = function(e:UIEvent)
{
trace(e.type);
curView = cast e.data.curView;
trace(e.data);
// trace(e.data);
};
// lv.
// lv.onChange = function(e:UIEvent)
// {
// trace(e.type);
// // trace(e.data.curView);
// // var item:haxe.ui.core.ItemRenderer = cast e.target;
// trace(e.target);
// // if (e.type == "change")
// // {
// // curView = cast e.data;
// // }
// };
hudCam = new FlxCamera();
hudCam.bgColor.alpha = 0;
@ -81,10 +111,9 @@ class DebugBoundingState extends FlxState
initSpritesheetView();
initOffsetView();
// charInput = new FlxInputText(300, 10, 150, "bf", 16);
// charInput.focusCam = hudCam;
// charInput.cameras = [hudCam];
// charInput.scrollFactor.set();
uiStuff.cameras = [hudCam];
add(uiStuff);
super.create();
}
@ -222,15 +251,16 @@ class DebugBoundingState extends FlxState
var characters:Array<String> = CoolUtil.coolTextFile(Paths.txt('characterList'));
// charInput isnt only exclusive to offsetView shit now
charInput = new FlxUIDropDownMenu(500, 20, FlxUIDropDownMenu.makeStrIdLabelArray(characters, true), function(str:String)
var charDropdown:DropDown = cast uiStuff.findComponent('characterDropdown');
for (char in characters)
{
loadAnimShit(characters[Std.parseInt(str)]);
// trace();
});
// charInput.
charInput.cameras = [hudCam];
add(charInput);
charDropdown.dataSource.add({text: char});
}
charDropdown.onChange = function(e:UIEvent)
{
loadAnimShit(e.data.text);
};
}
public var mouseOffset:FlxPoint = FlxPoint.get(0, 0);
@ -290,9 +320,16 @@ class DebugBoundingState extends FlxState
override function update(elapsed:Float)
{
if (FlxG.keys.justPressed.ONE)
{
var lv:DropDown = cast uiStuff.findComponent("swapper");
lv.selectedIndex = 0;
curView = SPRITESHEET;
}
if (FlxG.keys.justReleased.TWO)
{
var lv:DropDown = cast uiStuff.findComponent("swapper");
lv.selectedIndex = 1;
curView = OFFSETSHIT;
if (swagChar != null)
{
@ -318,11 +355,6 @@ class DebugBoundingState extends FlxState
if (FlxG.keys.justPressed.H)
hudCam.visible = !hudCam.visible;
/* if (charInput.hasFocus && FlxG.keys.justPressed.ENTER)
{
loadAnimShit();
}*/
CoolUtil.mouseCamDrag();
CoolUtil.mouseWheelZoom();
@ -437,6 +469,9 @@ class DebugBoundingState extends FlxState
var swagChar:BaseCharacter;
/*
Called when animation dropdown is changed!
*/
function loadAnimShit(char:String)
{
if (swagChar != null)
@ -528,8 +563,8 @@ class DebugBoundingState extends FlxState
}
}
enum ANIMDEBUGVIEW
enum abstract ANIMDEBUGVIEW(String)
{
SPRITESHEET;
OFFSETSHIT;
var SPRITESHEET;
var OFFSETSHIT;
}

View file

@ -1,103 +1,191 @@
package funkin.ui.stageBuildShit;
import flixel.FlxSprite;
import flixel.input.mouse.FlxMouseEventManager;
import flixel.math.FlxPoint;
import flixel.ui.FlxButton;
import funkin.play.PlayState;
import funkin.play.character.BaseCharacter;
import funkin.play.stage.StageData;
import haxe.Json;
import haxe.ui.ComponentBuilder;
import haxe.ui.RuntimeComponentBuilder;
import haxe.ui.Toolkit;
import haxe.ui.components.Button;
import haxe.ui.containers.HBox;
import haxe.ui.containers.VBox;
import haxe.ui.core.Component;
import openfl.Assets;
import openfl.events.Event;
import openfl.events.IOErrorEvent;
import openfl.net.FileReference;
class StageOffsetSubstate extends MusicBeatSubstate
{
public function new()
var uiStuff:Component;
override function create()
{
super();
super.create();
FlxG.mouse.visible = true;
PlayState.instance.pauseMusic();
FlxG.camera.target = null;
var btn:FlxButton = new FlxButton(200, 10, "SAVE COMPILE", function()
var str = Paths.xml('ui/stage-editor-view');
uiStuff = RuntimeComponentBuilder.fromAsset(str);
uiStuff.findComponent("lol").onClick = saveCharacterCompile;
uiStuff.findComponent('saveAs').onClick = saveStageFileRef;
add(uiStuff);
PlayState.instance.persistentUpdate = true;
uiStuff.cameras = [PlayState.instance.camHUD];
// btn.cameras = [PlayState.instance.camHUD];
for (thing in PlayState.instance.currentStage)
{
var stageLol:StageData = StageDataParser.parseStageData(PlayState.instance.currentStageId);
FlxMouseEventManager.add(thing, spr ->
{
char = cast thing;
trace("JUST PRESSED!");
sprOld.x = thing.x;
sprOld.y = thing.y;
var bfPos = PlayState.instance.currentStage.getBoyfriend().feetPosition;
stageLol.characters.bf.position[0] = Std.int(bfPos.x);
stageLol.characters.bf.position[1] = Std.int(bfPos.y);
var dadPos = PlayState.instance.currentStage.getDad().feetPosition;
stageLol.characters.dad.position[0] = Std.int(dadPos.x);
stageLol.characters.dad.position[1] = Std.int(dadPos.y);
var GF_FEET_SNIIIIIIIIIIIIIFFFF = PlayState.instance.currentStage.getGirlfriend().feetPosition;
stageLol.characters.gf.position[0] = Std.int(GF_FEET_SNIIIIIIIIIIIIIFFFF.x);
stageLol.characters.gf.position[1] = Std.int(GF_FEET_SNIIIIIIIIIIIIIFFFF.y);
var outputJson = CoolUtil.jsonStringify(stageLol);
#if sys
// save "local" to the current export.
sys.io.File.saveContent('./assets/data/stages/' + PlayState.instance.currentStageId + '.json', outputJson);
// save to the dev version
sys.io.File.saveContent('../../../../assets/preload/data/stages/' + PlayState.instance.currentStageId + '.json', outputJson);
#end
// trace(dipshitJson);
// put character position data to a file of some sort
});
btn.scrollFactor.set();
add(btn);
btn.cameras = [PlayState.instance.camHUD];
mosPosOld.x = FlxG.mouse.x;
mosPosOld.y = FlxG.mouse.y;
}, null, spr ->
{
// ID tag is to see if currently overlapping hold basically!, a bit more reliable than checking transparency!
// used for bug where you can click, and if you click on NO sprite, it snaps the thing to position! unintended!
spr.ID = 1;
spr.alpha = 0.5;
}, spr ->
{
spr.ID = 0;
spr.alpha = 1;
});
}
}
var mosPosOld:FlxPoint = new FlxPoint();
var sprOld:FlxPoint = new FlxPoint();
var char:BaseCharacter = null;
var char:FlxSprite = null;
var overlappingChar:Bool = false;
override function update(elapsed:Float)
{
super.update(elapsed);
if (char != null && char.ID == 1 && FlxG.mouse.pressed)
{
char.x = sprOld.x - (mosPosOld.x - FlxG.mouse.x);
char.y = sprOld.y - (mosPosOld.y - FlxG.mouse.y);
}
CoolUtil.mouseCamDrag();
if (FlxG.keys.pressed.CONTROL)
CoolUtil.mouseWheelZoom();
if (FlxG.mouse.pressed)
{
if (FlxG.mouse.justPressed)
{
for (thing in PlayState.instance.currentStage)
{
if (FlxG.mouse.overlaps(thing) && Std.isOfType(thing, BaseCharacter))
char = cast thing;
}
if (char != null)
{
sprOld.x = char.x;
sprOld.y = char.y;
}
mosPosOld.x = FlxG.mouse.x;
mosPosOld.y = FlxG.mouse.y;
}
if (char != null)
{
char.x = sprOld.x - (mosPosOld.x - FlxG.mouse.x);
char.y = sprOld.y - (mosPosOld.y - FlxG.mouse.y);
}
}
if (FlxG.keys.justPressed.Y)
{
for (thing in PlayState.instance.currentStage)
{
FlxMouseEventManager.remove(thing);
thing.alpha = 1;
}
if (uiStuff != null)
remove(uiStuff);
uiStuff = null;
PlayState.instance.resetCamera();
FlxG.mouse.visible = false;
close();
}
}
var _file:FileReference;
private function saveStageFileRef(_):Void
{
var jsonStr = prepStageStuff();
_file = new FileReference();
_file.addEventListener(Event.COMPLETE, onSaveComplete);
_file.addEventListener(Event.CANCEL, onSaveCancel);
_file.addEventListener(IOErrorEvent.IO_ERROR, onSaveError);
_file.save(jsonStr, PlayState.instance.currentStageId + ".json");
}
function onSaveComplete(_)
{
fileRemoveListens();
FlxG.log.notice("Successfully saved!");
}
function onSaveCancel(_)
{
fileRemoveListens();
}
function onSaveError(_)
{
fileRemoveListens();
FlxG.log.error("Problem saving Stage file!");
}
function fileRemoveListens()
{
_file.removeEventListener(Event.COMPLETE, onSaveComplete);
_file.removeEventListener(Event.CANCEL, onSaveCancel);
_file.removeEventListener(IOErrorEvent.IO_ERROR, onSaveError);
_file = null;
}
private function saveCharacterCompile(_):Void
{
var outputJson:String = prepStageStuff();
#if sys
// save "local" to the current export.
sys.io.File.saveContent('./assets/data/stages/' + PlayState.instance.currentStageId + '.json', outputJson);
// save to the dev version
sys.io.File.saveContent('../../../../assets/preload/data/stages/' + PlayState.instance.currentStageId + '.json', outputJson);
#end
}
private function prepStageStuff():String
{
var stageLol:StageData = StageDataParser.parseStageData(PlayState.instance.currentStageId);
for (prop in stageLol.props)
{
@:privateAccess
var posStuff = PlayState.instance.currentStage.namedProps.get(prop.name);
prop.position[0] = posStuff.x;
prop.position[1] = posStuff.y;
}
var bfPos = PlayState.instance.currentStage.getBoyfriend().feetPosition;
stageLol.characters.bf.position[0] = Std.int(bfPos.x);
stageLol.characters.bf.position[1] = Std.int(bfPos.y);
var dadPos = PlayState.instance.currentStage.getDad().feetPosition;
stageLol.characters.dad.position[0] = Std.int(dadPos.x);
stageLol.characters.dad.position[1] = Std.int(dadPos.y);
var GF_FEET_SNIIIIIIIIIIIIIFFFF = PlayState.instance.currentStage.getGirlfriend().feetPosition;
stageLol.characters.gf.position[0] = Std.int(GF_FEET_SNIIIIIIIIIIIIIFFFF.x);
stageLol.characters.gf.position[1] = Std.int(GF_FEET_SNIIIIIIIIIIIIIFFFF.y);
return CoolUtil.jsonStringify(stageLol);
}
}

View file

@ -25,10 +25,11 @@ class Constants
#if debug
public static final GIT_HASH = funkin.util.macro.GitCommit.getGitCommitHash();
public static final GIT_BRANCH = funkin.util.macro.GitCommit.getGitBranch();
static function get_VERSION():String
{
return 'v${Application.current.meta.get('version')} (${GIT_HASH})' + VERSION_SUFFIX;
return 'v${Application.current.meta.get('version')} (${GIT_BRANCH} : ${GIT_HASH})' + VERSION_SUFFIX;
}
#else
static function get_VERSION():String

View file

@ -31,5 +31,31 @@ class GitCommit
return macro $v{commitHashSplice};
#end
}
public static macro function getGitBranch():haxe.macro.Expr.ExprOf<String>
{
#if !display
// Get the current line number.
var pos = haxe.macro.Context.currentPos();
var branchProcess = new sys.io.Process('git', ['rev-parse', '--abbrev-ref', 'HEAD']);
if (branchProcess.exitCode() != 0)
{
var message = branchProcess.stderr.readAll().toString();
haxe.macro.Context.info('[WARN] Could not determine current git commit; is this a proper Git repository?', pos);
}
var branchName:String = branchProcess.stdout.readLine();
trace('Current Working Branch: ${branchName}');
// Generates a string expression
return macro $v{branchName};
#else
// `#if display` is used for code completion. In this case returning an
// empty string is good enough; We don't want to call git on every hint.
var branchName:String = "";
return macro $v{branchName};
#end
}
}
#end

View file

@ -1,4 +1,8 @@
<<<<<<< HEAD
<?xml version="1.0" encoding="utf-8" ?>
=======
<?xml version="1.0" encoding="utf-8"?>
>>>>>>> origin/note-redux
<module>
<!-- A module provides additional behavior and configuration for HaxeUI. -->
<components>
@ -7,6 +11,7 @@
This needs to be done HERE and not via the `include` macro because `Toolkit.init()`
reads this to build the component registry.
-->
<<<<<<< HEAD
<class package="haxe.ui.core" loadAll="true" />
<class package="haxe.ui.components" loadAll="true" />
@ -18,5 +23,10 @@
<!-- Custom components. -->
<class package="funkin.ui.haxeui.components" loadAll="true" />
=======
<class package="haxe.ui.components" loadAll="true" />
<class package="haxe.ui.containers" loadAll="true" />
<class package="haxe.ui.core" loadAll="true" />
>>>>>>> origin/note-redux
</components>
</module>