tried to fix something only to realize it isnt possible
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
package;
|
||||
|
||||
import flixel.FlxSprite;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
|
||||
class BackgroundGirls extends FlxSprite
|
||||
{
|
||||
public function new(x:Float, y:Float)
|
||||
{
|
||||
super(x, y);
|
||||
|
||||
// BG fangirls dissuaded
|
||||
frames = Paths.getSparrowAtlas('weeb/bgFreaks');
|
||||
|
||||
animation.addByIndices('danceLeft', 'BG girls group', CoolUtil.numberArray(14), "", 24, false);
|
||||
animation.addByIndices('danceRight', 'BG girls group', CoolUtil.numberArray(30, 15), "", 24, false);
|
||||
|
||||
animation.play('danceLeft');
|
||||
}
|
||||
|
||||
var danceDir:Bool = false;
|
||||
|
||||
public function getScared():Void
|
||||
{
|
||||
animation.addByIndices('danceLeft', 'BG fangirls dissuaded', CoolUtil.numberArray(14), "", 24, false);
|
||||
animation.addByIndices('danceRight', 'BG fangirls dissuaded', CoolUtil.numberArray(30, 15), "", 24, false);
|
||||
dance();
|
||||
}
|
||||
|
||||
public function dance():Void
|
||||
{
|
||||
danceDir = !danceDir;
|
||||
|
||||
if (danceDir)
|
||||
animation.play('danceRight', true);
|
||||
else
|
||||
animation.play('danceLeft', true);
|
||||
}
|
||||
}
|
||||
@@ -1,304 +0,0 @@
|
||||
package;
|
||||
|
||||
import lime.app.Promise;
|
||||
import lime.app.Future;
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxState;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.util.FlxTimer;
|
||||
|
||||
import openfl.utils.Assets;
|
||||
import lime.utils.Assets as LimeAssets;
|
||||
import lime.utils.AssetLibrary;
|
||||
import lime.utils.AssetManifest;
|
||||
|
||||
import haxe.io.Path;
|
||||
|
||||
class LoadingState extends MusicBeatState
|
||||
{
|
||||
inline static var MIN_TIME = 1.0;
|
||||
|
||||
var target:FlxState;
|
||||
var stopMusic = false;
|
||||
var callbacks:MultiCallback;
|
||||
|
||||
var logo:FlxSprite;
|
||||
var gfDance:FlxSprite;
|
||||
var danceLeft = false;
|
||||
|
||||
function new(target:FlxState, stopMusic:Bool)
|
||||
{
|
||||
super();
|
||||
this.target = target;
|
||||
this.stopMusic = stopMusic;
|
||||
}
|
||||
|
||||
override function create()
|
||||
{
|
||||
logo = new FlxSprite(-150, -100);
|
||||
logo.frames = Paths.getSparrowAtlas('logoBumpin');
|
||||
logo.antialiasing = true;
|
||||
logo.animation.addByPrefix('bump', 'logo bumpin', 24);
|
||||
logo.animation.play('bump');
|
||||
logo.updateHitbox();
|
||||
// logoBl.screenCenter();
|
||||
// logoBl.color = FlxColor.BLACK;
|
||||
|
||||
gfDance = new FlxSprite(FlxG.width * 0.4, FlxG.height * 0.07);
|
||||
gfDance.frames = Paths.getSparrowAtlas('gfDanceTitle');
|
||||
gfDance.animation.addByIndices('danceLeft', 'gfDance', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
|
||||
gfDance.animation.addByIndices('danceRight', 'gfDance', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
|
||||
gfDance.antialiasing = true;
|
||||
add(gfDance);
|
||||
add(logo);
|
||||
|
||||
initSongsManifest().onComplete
|
||||
(
|
||||
function (lib)
|
||||
{
|
||||
callbacks = new MultiCallback(onLoad);
|
||||
var introComplete = callbacks.add("introComplete");
|
||||
checkLoadSong(getSongPath());
|
||||
if (PlayState.SONG.needsVoices)
|
||||
checkLoadSong(getVocalPath());
|
||||
checkLibrary("shared");
|
||||
if (PlayState.storyWeek > 0)
|
||||
checkLibrary("week" + PlayState.storyWeek);
|
||||
else
|
||||
checkLibrary("tutorial");
|
||||
|
||||
var fadeTime = 0.5;
|
||||
FlxG.camera.fade(FlxG.camera.bgColor, fadeTime, true);
|
||||
new FlxTimer().start(fadeTime + MIN_TIME, function(_) introComplete());
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function checkLoadSong(path:String)
|
||||
{
|
||||
if (!Assets.cache.hasSound(path))
|
||||
{
|
||||
var library = Assets.getLibrary("songs");
|
||||
final symbolPath = path.split(":").pop();
|
||||
// @:privateAccess
|
||||
// library.types.set(symbolPath, SOUND);
|
||||
// @:privateAccess
|
||||
// library.pathGroups.set(symbolPath, [library.__cacheBreak(symbolPath)]);
|
||||
var callback = callbacks.add("song:" + path);
|
||||
Assets.loadSound(path).onComplete(function (_) { callback(); });
|
||||
}
|
||||
}
|
||||
|
||||
function checkLibrary(library:String)
|
||||
{
|
||||
trace(Assets.hasLibrary(library));
|
||||
if (Assets.getLibrary(library) == null)
|
||||
{
|
||||
@:privateAccess
|
||||
if (!LimeAssets.libraryPaths.exists(library))
|
||||
throw "Missing library: " + library;
|
||||
|
||||
var callback = callbacks.add("library:" + library);
|
||||
Assets.loadLibrary(library).onComplete(function (_) { callback(); });
|
||||
}
|
||||
}
|
||||
|
||||
override function beatHit()
|
||||
{
|
||||
super.beatHit();
|
||||
|
||||
logo.animation.play('bump');
|
||||
danceLeft = !danceLeft;
|
||||
|
||||
if (danceLeft)
|
||||
gfDance.animation.play('danceRight');
|
||||
else
|
||||
gfDance.animation.play('danceLeft');
|
||||
}
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
super.update(elapsed);
|
||||
#if debug
|
||||
if (FlxG.keys.justPressed.SPACE)
|
||||
trace('fired: ' + callbacks.getFired() + " unfired:" + callbacks.getUnfired());
|
||||
#end
|
||||
}
|
||||
|
||||
function onLoad()
|
||||
{
|
||||
if (stopMusic && FlxG.sound.music != null)
|
||||
FlxG.sound.music.stop();
|
||||
|
||||
FlxG.switchState(target);
|
||||
}
|
||||
|
||||
static function getSongPath()
|
||||
{
|
||||
return Paths.inst(PlayState.SONG.song);
|
||||
}
|
||||
|
||||
static function getVocalPath()
|
||||
{
|
||||
return Paths.voices(PlayState.SONG.song);
|
||||
}
|
||||
|
||||
static function getNextState(target:FlxState, stopMusic = false):FlxState
|
||||
{
|
||||
#if NO_PRELOAD_ALL
|
||||
var loaded = isSoundLoaded(getSongPath())
|
||||
&& (!PlayState.SONG.needsVoices || isSoundLoaded(getVocalPath()))
|
||||
&& isLibraryLoaded("shared");
|
||||
|
||||
if (!loaded)
|
||||
return new LoadingState(target, stopMusic);
|
||||
#end
|
||||
if (stopMusic && FlxG.sound.music != null)
|
||||
FlxG.sound.music.stop();
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
#if NO_PRELOAD_ALL
|
||||
static function isSoundLoaded(path:String):Bool
|
||||
{
|
||||
return Assets.cache.hasSound(path);
|
||||
}
|
||||
|
||||
static function isLibraryLoaded(library:String):Bool
|
||||
{
|
||||
return Assets.getLibrary(library) != null;
|
||||
}
|
||||
#end
|
||||
|
||||
override function destroy()
|
||||
{
|
||||
super.destroy();
|
||||
|
||||
callbacks = null;
|
||||
}
|
||||
|
||||
static function initSongsManifest()
|
||||
{
|
||||
var id = "songs";
|
||||
var promise = new Promise<AssetLibrary>();
|
||||
|
||||
var library = LimeAssets.getLibrary(id);
|
||||
|
||||
if (library != null)
|
||||
{
|
||||
return Future.withValue(library);
|
||||
}
|
||||
|
||||
var path = id;
|
||||
var rootPath = null;
|
||||
|
||||
@:privateAccess
|
||||
var libraryPaths = LimeAssets.libraryPaths;
|
||||
if (libraryPaths.exists(id))
|
||||
{
|
||||
path = libraryPaths[id];
|
||||
rootPath = Path.directory(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (StringTools.endsWith(path, ".bundle"))
|
||||
{
|
||||
rootPath = path;
|
||||
path += "/library.json";
|
||||
}
|
||||
else
|
||||
{
|
||||
rootPath = Path.directory(path);
|
||||
}
|
||||
@:privateAccess
|
||||
path = LimeAssets.__cacheBreak(path);
|
||||
}
|
||||
|
||||
AssetManifest.loadFromFile(path, rootPath).onComplete(function(manifest)
|
||||
{
|
||||
if (manifest == null)
|
||||
{
|
||||
promise.error("Cannot parse asset manifest for library \"" + id + "\"");
|
||||
return;
|
||||
}
|
||||
|
||||
var library = AssetLibrary.fromManifest(manifest);
|
||||
|
||||
if (library == null)
|
||||
{
|
||||
promise.error("Cannot open library \"" + id + "\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
@:privateAccess
|
||||
LimeAssets.libraries.set(id, library);
|
||||
library.onChange.add(LimeAssets.onChange.dispatch);
|
||||
promise.completeWith(Future.withValue(library));
|
||||
}
|
||||
}).onError(function(_)
|
||||
{
|
||||
promise.error("There is no asset library with an ID of \"" + id + "\"");
|
||||
});
|
||||
|
||||
return promise.future;
|
||||
}
|
||||
}
|
||||
|
||||
class MultiCallback
|
||||
{
|
||||
public var callback:Void->Void;
|
||||
public var logId:String = null;
|
||||
public var length(default, null) = 0;
|
||||
public var numRemaining(default, null) = 0;
|
||||
|
||||
var unfired = new Map<String, Void->Void>();
|
||||
var fired = new Array<String>();
|
||||
|
||||
public function new (callback:Void->Void, logId:String = null)
|
||||
{
|
||||
this.callback = callback;
|
||||
this.logId = logId;
|
||||
}
|
||||
|
||||
public function add(id = "untitled")
|
||||
{
|
||||
id = '$length:$id';
|
||||
length++;
|
||||
numRemaining++;
|
||||
var func:Void->Void = null;
|
||||
func = function ()
|
||||
{
|
||||
if (unfired.exists(id))
|
||||
{
|
||||
unfired.remove(id);
|
||||
fired.push(id);
|
||||
numRemaining--;
|
||||
|
||||
if (logId != null)
|
||||
log('fired $id, $numRemaining remaining');
|
||||
|
||||
if (numRemaining == 0)
|
||||
{
|
||||
if (logId != null)
|
||||
log('all callbacks fired');
|
||||
callback();
|
||||
}
|
||||
}
|
||||
else
|
||||
log('already fired $id');
|
||||
}
|
||||
unfired[id] = func;
|
||||
return func;
|
||||
}
|
||||
|
||||
inline function log(msg):Void
|
||||
{
|
||||
if (logId != null)
|
||||
trace('$logId: $msg');
|
||||
}
|
||||
|
||||
public function getFired() return fired.copy();
|
||||
public function getUnfired() return [for (id in unfired.keys()) id];
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package;
|
||||
|
||||
import flixel.FlxSprite;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
|
||||
class MenuCharacter extends FlxSprite
|
||||
{
|
||||
public var character:String;
|
||||
|
||||
public function new(x:Float, character:String = 'bf')
|
||||
{
|
||||
super(x);
|
||||
|
||||
this.character = character;
|
||||
|
||||
var tex = Paths.getSparrowAtlas('campaign_menu_UI_characters');
|
||||
frames = tex;
|
||||
|
||||
animation.addByPrefix('bf', "BF idle dance white", 24);
|
||||
animation.addByPrefix('bfConfirm', 'BF HEY!!', 24, false);
|
||||
animation.addByPrefix('gf', "GF Dancing Beat WHITE", 24);
|
||||
animation.addByPrefix('dad', "Dad idle dance BLACK LINE", 24);
|
||||
animation.addByPrefix('spooky', "spooky dance idle BLACK LINES", 24);
|
||||
animation.addByPrefix('pico', "Pico Idle Dance", 24);
|
||||
animation.addByPrefix('mom', "Mom Idle BLACK LINES", 24);
|
||||
animation.addByPrefix('parents-christmas', "Parent Christmas Idle", 24);
|
||||
animation.addByPrefix('senpai', "SENPAI idle Black Lines", 24);
|
||||
// Parent Christmas Idle
|
||||
|
||||
animation.play(character);
|
||||
updateHitbox();
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package;
|
||||
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.group.FlxSpriteGroup;
|
||||
import flixel.math.FlxMath;
|
||||
import flixel.util.FlxColor;
|
||||
|
||||
class MenuItem extends FlxSpriteGroup
|
||||
{
|
||||
public var targetY:Float = 0;
|
||||
public var week:FlxSprite;
|
||||
public var flashingInt:Int = 0;
|
||||
|
||||
public function new(x:Float, y:Float, weekNum:Int = 0)
|
||||
{
|
||||
super(x, y);
|
||||
week = new FlxSprite().loadGraphic(Paths.image('storymenu/week' + weekNum));
|
||||
add(week);
|
||||
}
|
||||
|
||||
private var isFlashing:Bool = false;
|
||||
|
||||
public function startFlashing():Void
|
||||
{
|
||||
isFlashing = true;
|
||||
}
|
||||
|
||||
// if it runs at 60fps, fake framerate will be 6
|
||||
// if it runs at 144 fps, fake framerate will be like 14, and will update the graphic every 0.016666 * 3 seconds still???
|
||||
// so it runs basically every so many seconds, not dependant on framerate??
|
||||
// I'm still learning how math works thanks whoever is reading this lol
|
||||
var fakeFramerate:Int = Math.round((1 / FlxG.elapsed) / 10);
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
super.update(elapsed);
|
||||
y = FlxMath.lerp(y, (targetY * 120) + 480, 0.17);
|
||||
|
||||
if (isFlashing)
|
||||
flashingInt += 1;
|
||||
|
||||
if (flashingInt % fakeFramerate >= Math.floor(fakeFramerate / 2))
|
||||
week.color = 0xFF33ffff;
|
||||
else
|
||||
week.color = FlxColor.WHITE;
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package;
|
||||
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.FlxSubState;
|
||||
import flixel.text.FlxText;
|
||||
import flixel.util.FlxColor;
|
||||
import lime.app.Application;
|
||||
|
||||
class OutdatedSubState extends MusicBeatState
|
||||
{
|
||||
public static var leftState:Bool = false;
|
||||
|
||||
override function create()
|
||||
{
|
||||
super.create();
|
||||
var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
|
||||
add(bg);
|
||||
var ver = "v" + Application.current.meta.get('version');
|
||||
var txt:FlxText = new FlxText(0, 0, FlxG.width,
|
||||
"HEY! You're running an outdated version of the game!\nCurrent version is "
|
||||
+ ver
|
||||
+ " while the most recent version is "
|
||||
// + NGio.GAME_VER
|
||||
+ "! Press Space to go to itch.io, or ESCAPE to ignore this!!",
|
||||
32);
|
||||
txt.setFormat("VCR OSD Mono", 32, FlxColor.WHITE, CENTER);
|
||||
txt.screenCenter();
|
||||
add(txt);
|
||||
}
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
if (controls.ACCEPT)
|
||||
{
|
||||
FlxG.openURL("https://ninja-muffin24.itch.io/funkin");
|
||||
}
|
||||
if (controls.BACK)
|
||||
{
|
||||
leftState = true;
|
||||
FlxG.switchState(new MainMenuState());
|
||||
}
|
||||
super.update(elapsed);
|
||||
}
|
||||
}
|
||||
-1288
File diff suppressed because it is too large
Load Diff
-332
@@ -1,332 +0,0 @@
|
||||
import h2d.Tweenie.TType;
|
||||
|
||||
//praise delahee, i'll figure out what this shit means later!
|
||||
|
||||
enum TVVar{
|
||||
TVVVolume;
|
||||
TVVPan;
|
||||
}
|
||||
|
||||
@:publicFields
|
||||
class TweenV {
|
||||
static var GUID = 0;
|
||||
var uid = 0;
|
||||
|
||||
var man : SndTV;
|
||||
var parent : Snd;
|
||||
var n : Float;
|
||||
var ln : Float;
|
||||
var speed : Float;
|
||||
var from : Float;
|
||||
var to : Float;
|
||||
var type : TType;
|
||||
var plays : Int; // -1 = infini, 1 et plus = nombre d'exécutions (1 par défaut)
|
||||
var varType : TVVar;
|
||||
var onUpdate : Null<TweenV->Void>;
|
||||
var onEnd : Null<TweenV->Void>;
|
||||
var isDebug = false;
|
||||
|
||||
public inline function new (
|
||||
parent:Snd ,
|
||||
n:Float ,
|
||||
ln:Float ,
|
||||
varType:TVVar,
|
||||
speed:Float ,
|
||||
from:Float ,
|
||||
to:Float ,
|
||||
type:h2d.Tweenie.TType ,
|
||||
plays ,
|
||||
onUpdate ,
|
||||
onEnd
|
||||
) {
|
||||
this.parent = parent ;
|
||||
this.n = n ;
|
||||
this.ln = ln ;
|
||||
this.varType = varType ;
|
||||
this.speed = speed ;
|
||||
this.from = from ;
|
||||
this.to = to ;
|
||||
this.type = type ;
|
||||
this.plays = plays ;
|
||||
this.onUpdate = onUpdate ;
|
||||
this.onEnd = onEnd ;
|
||||
}
|
||||
|
||||
public inline function reset(
|
||||
parent:Snd ,
|
||||
n:Float ,
|
||||
ln:Float ,
|
||||
varType:TVVar,
|
||||
speed:Float ,
|
||||
from:Float ,
|
||||
to:Float ,
|
||||
type:TType ,
|
||||
plays:Int ,
|
||||
onUpdate ,
|
||||
onEnd
|
||||
) {
|
||||
this.parent = parent ;
|
||||
this.n = n ;
|
||||
this.ln = ln ;
|
||||
this.speed = speed ;
|
||||
this.from = from ;
|
||||
this.to = to ;
|
||||
this.type = type ;
|
||||
this.plays = plays ;
|
||||
this.onUpdate = onUpdate ;
|
||||
this.onEnd = onEnd ;
|
||||
this.varType = varType ;
|
||||
isDebug = false;
|
||||
uid = GUID++;
|
||||
}
|
||||
|
||||
public function clear(){
|
||||
n = 0.0;
|
||||
ln = 0.0;
|
||||
speed = 0.0;
|
||||
plays = 0;
|
||||
from = 0.0;
|
||||
to = 0.0;
|
||||
parent = null;
|
||||
onEnd = null;
|
||||
onUpdate = null;
|
||||
isDebug = false;
|
||||
uid = GUID++;
|
||||
}
|
||||
|
||||
|
||||
public
|
||||
inline
|
||||
function apply( val ) {
|
||||
switch(varType){
|
||||
case TVVVolume: {
|
||||
parent.volume = val;
|
||||
#if debug
|
||||
if( isDebug )
|
||||
trace("tv:" + val);
|
||||
#end
|
||||
}
|
||||
case TVVPan: parent.pan = val;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public inline function kill( withCbk = true ) {
|
||||
if ( withCbk )
|
||||
man.terminateTween( this );
|
||||
else
|
||||
man.forceTerminateTween( this) ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* tween order is not respected
|
||||
*/
|
||||
class SndTV {
|
||||
static var DEFAULT_DURATION = DateTools.seconds(1);
|
||||
public var fps = 60.0;
|
||||
public var isDebug = false;
|
||||
|
||||
var tlist : hxd.Stack<TweenV>;
|
||||
|
||||
public function new() {
|
||||
tlist = new hxd.Stack<TweenV>();
|
||||
tlist.reserve(8);
|
||||
}
|
||||
|
||||
function onError(e) {
|
||||
trace(e);
|
||||
}
|
||||
|
||||
public function count() {
|
||||
return tlist.length;
|
||||
}
|
||||
|
||||
public inline function create(parent:Snd, vartype:TVVar, to:Float, ?tp:h2d.Tweenie.TType, ?duration_ms:Float) : TweenV{
|
||||
return create_(parent, vartype, to, tp, duration_ms);
|
||||
}
|
||||
|
||||
public function exists(p:Snd) {
|
||||
for (t in tlist)
|
||||
if (t.parent == p )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public var pool : hxd.Stack<TweenV> = new hxd.Stack();
|
||||
|
||||
function create_(p:Snd, vartype:TVVar,to:Float, ?tp:h2d.Tweenie.TType, ?duration_ms:Float) : TweenV{
|
||||
if ( duration_ms==null )
|
||||
duration_ms = DEFAULT_DURATION;
|
||||
|
||||
#if debug
|
||||
if ( p == null ) trace("tween2 creation failed to:"+to+" tp:"+tp);
|
||||
#end
|
||||
|
||||
if ( tp==null ) tp = TEase;
|
||||
|
||||
{
|
||||
// on supprime les tweens précédents appliqués à la même variable
|
||||
for(t in tlist.backWardIterator())
|
||||
if(t.parent==p && t.varType == vartype) {
|
||||
forceTerminateTween(t);
|
||||
}
|
||||
}
|
||||
|
||||
var from = switch( vartype ){
|
||||
case TVVVolume : p.volume;
|
||||
case TVVPan : p.pan;
|
||||
}
|
||||
var t : TweenV;
|
||||
if (pool.length == 0){
|
||||
t = new TweenV(
|
||||
p,
|
||||
0.0,
|
||||
0.0,
|
||||
vartype,
|
||||
1 / ( duration_ms*fps/1000 ), // une seconde
|
||||
from,
|
||||
to,
|
||||
tp,
|
||||
1,
|
||||
null,
|
||||
null
|
||||
);
|
||||
}
|
||||
else {
|
||||
t = pool.pop();
|
||||
t.reset(
|
||||
p,
|
||||
0.0,
|
||||
0.0,
|
||||
vartype,
|
||||
1 / ( duration_ms*fps/1000 ), // une seconde
|
||||
from,
|
||||
to,
|
||||
tp,
|
||||
1,
|
||||
null,
|
||||
null
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
if( t.from==t.to )
|
||||
t.ln = 1; // tweening inutile : mais on s'assure ainsi qu'un update() et un end() seront bien appelés
|
||||
|
||||
t.man = this;
|
||||
tlist.push(t);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
public static inline
|
||||
function fastPow2(n:Float):Float {
|
||||
return n*n;
|
||||
}
|
||||
|
||||
public static inline
|
||||
function fastPow3(n:Float):Float {
|
||||
return n*n*n;
|
||||
}
|
||||
|
||||
public static inline
|
||||
function bezier(t:Float, p0:Float, p1:Float,p2:Float, p3:Float) {
|
||||
return
|
||||
fastPow3(1-t)*p0 +
|
||||
3*( t*fastPow2(1-t)*p1 + fastPow2(t)*(1-t)*p2 ) +
|
||||
fastPow3(t)*p3;
|
||||
}
|
||||
|
||||
// suppression du tween sans aucun appel aux callbacks onUpdate, onUpdateT et onEnd (!)
|
||||
public function killWithoutCallbacks(parent:Snd) {
|
||||
for (t in tlist.backWardIterator())
|
||||
if (t.parent==parent ){
|
||||
forceTerminateTween(t);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function terminate(parent:Snd) {
|
||||
for (t in tlist.backWardIterator())
|
||||
if (t.parent==parent){
|
||||
forceTerminateTween(t);
|
||||
}
|
||||
}
|
||||
|
||||
public function forceTerminateTween(t:TweenV) {
|
||||
var tOk = tlist.remove(t);
|
||||
if( tOk ){
|
||||
t.clear();
|
||||
pool.push(t);
|
||||
}
|
||||
}
|
||||
|
||||
public function terminateTween(t:TweenV, ?fl_allowLoop=false) {
|
||||
var v = t.from + (t.to - t.from) * h2d.Tweenie.interp(t.type, 1);
|
||||
t.apply(v);
|
||||
onUpdate(t, 1);
|
||||
|
||||
var ouid = t.uid;
|
||||
|
||||
onEnd(t);
|
||||
|
||||
if( ouid == t.uid ){
|
||||
if( fl_allowLoop && (t.plays==-1 || t.plays>1) ) {
|
||||
if( t.plays!=-1 )
|
||||
t.plays--;
|
||||
t.n = t.ln = 0;
|
||||
}
|
||||
else {
|
||||
forceTerminateTween(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function terminateAll() {
|
||||
for(t in tlist)
|
||||
t.ln = 1;
|
||||
update();
|
||||
}
|
||||
|
||||
inline
|
||||
function onUpdate(t:TweenV, n:Float) {
|
||||
if ( t.onUpdate!=null )
|
||||
t.onUpdate(t);
|
||||
}
|
||||
|
||||
inline
|
||||
function onEnd(t:TweenV) {
|
||||
if ( t.onEnd!=null )
|
||||
t.onEnd(t);
|
||||
}
|
||||
|
||||
public function update(?tmod = 1.0) {
|
||||
if ( tlist.length > 0 ) {
|
||||
for (t in tlist.backWardIterator() ) {
|
||||
var dist = t.to-t.from;
|
||||
if (t.type==TRand)
|
||||
t.ln+=if(Std.random(100)<33) t.speed * tmod else 0;
|
||||
else
|
||||
t.ln += t.speed * tmod;
|
||||
|
||||
t.n = h2d.Tweenie.interp(t.type, t.ln);
|
||||
|
||||
if ( t.ln<1 ) {
|
||||
// en cours...
|
||||
var val = t.from + t.n*dist;
|
||||
|
||||
t.apply(val);
|
||||
|
||||
onUpdate(t, t.ln);
|
||||
}
|
||||
else // fini !
|
||||
{
|
||||
terminateTween(t, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package funkin.editors;
|
||||
|
||||
import funkin.system.Conductor.BPMChangeEvent;
|
||||
import Section.SwagSection;
|
||||
import funkin.system.Section.SwagSection;
|
||||
import funkin.system.Conductor;
|
||||
import funkin.system.Song.SwagSong;
|
||||
import funkin.system.Song;
|
||||
|
||||
@@ -5,10 +5,10 @@ import flixel.util.FlxDestroyUtil;
|
||||
#if desktop
|
||||
import funkin.system.Discord.DiscordClient;
|
||||
#end
|
||||
import Section.SwagSection;
|
||||
import funkin.system.Section.SwagSection;
|
||||
import funkin.system.Song.SwagSong;
|
||||
import funkin.scripting.ScriptPack;
|
||||
import WiggleEffect.WiggleEffectType;
|
||||
import funkin.shaders.WiggleEffect.WiggleEffectType;
|
||||
import flixel.FlxBasic;
|
||||
import flixel.FlxCamera;
|
||||
import flixel.FlxG;
|
||||
|
||||
@@ -17,6 +17,7 @@ import flixel.util.FlxTimer;
|
||||
import lime.net.curl.CURLCode;
|
||||
import funkin.system.Song;
|
||||
import funkin.game.Highscore;
|
||||
import flixel.group.FlxSpriteGroup;
|
||||
|
||||
using StringTools;
|
||||
|
||||
@@ -446,3 +447,74 @@ class StoryMenuState extends MusicBeatState
|
||||
#end
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class MenuCharacter extends FlxSprite
|
||||
{
|
||||
public var character:String;
|
||||
|
||||
public function new(x:Float, character:String = 'bf')
|
||||
{
|
||||
super(x);
|
||||
|
||||
this.character = character;
|
||||
|
||||
var tex = Paths.getSparrowAtlas('campaign_menu_UI_characters');
|
||||
frames = tex;
|
||||
|
||||
animation.addByPrefix('bf', "BF idle dance white", 24);
|
||||
animation.addByPrefix('bfConfirm', 'BF HEY!!', 24, false);
|
||||
animation.addByPrefix('gf', "GF Dancing Beat WHITE", 24);
|
||||
animation.addByPrefix('dad', "Dad idle dance BLACK LINE", 24);
|
||||
animation.addByPrefix('spooky', "spooky dance idle BLACK LINES", 24);
|
||||
animation.addByPrefix('pico', "Pico Idle Dance", 24);
|
||||
animation.addByPrefix('mom', "Mom Idle BLACK LINES", 24);
|
||||
animation.addByPrefix('parents-christmas', "Parent Christmas Idle", 24);
|
||||
animation.addByPrefix('senpai', "SENPAI idle Black Lines", 24);
|
||||
// Parent Christmas Idle
|
||||
|
||||
animation.play(character);
|
||||
updateHitbox();
|
||||
}
|
||||
}
|
||||
|
||||
class MenuItem extends FlxSpriteGroup
|
||||
{
|
||||
public var targetY:Float = 0;
|
||||
public var week:FlxSprite;
|
||||
public var flashingInt:Int = 0;
|
||||
|
||||
public function new(x:Float, y:Float, weekNum:Int = 0)
|
||||
{
|
||||
super(x, y);
|
||||
week = new FlxSprite().loadGraphic(Paths.image('storymenu/week' + weekNum));
|
||||
add(week);
|
||||
}
|
||||
|
||||
private var isFlashing:Bool = false;
|
||||
|
||||
public function startFlashing():Void
|
||||
{
|
||||
isFlashing = true;
|
||||
}
|
||||
|
||||
// if it runs at 60fps, fake framerate will be 6
|
||||
// if it runs at 144 fps, fake framerate will be like 14, and will update the graphic every 0.016666 * 3 seconds still???
|
||||
// so it runs basically every so many seconds, not dependant on framerate??
|
||||
// I'm still learning how math works thanks whoever is reading this lol
|
||||
var fakeFramerate:Int = Math.round((1 / FlxG.elapsed) / 10);
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
super.update(elapsed);
|
||||
y = FlxMath.lerp(y, (targetY * 120) + 480, 0.17);
|
||||
|
||||
if (isFlashing)
|
||||
flashingInt += 1;
|
||||
|
||||
if (flashingInt % fakeFramerate >= Math.floor(fakeFramerate / 2))
|
||||
week.color = 0xFF33ffff;
|
||||
else
|
||||
week.color = FlxColor.WHITE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package;
|
||||
package funkin.options;
|
||||
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
@@ -1,4 +1,4 @@
|
||||
package;
|
||||
package funkin.options;
|
||||
|
||||
import funkin.system.Controls;
|
||||
import flixel.FlxCamera;
|
||||
@@ -1,4 +1,4 @@
|
||||
package;
|
||||
package funkin.shaders;
|
||||
|
||||
import flixel.system.FlxAssets.FlxShader;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package;
|
||||
package funkin.shaders;
|
||||
|
||||
// STOLEN FROM HAXEFLIXEL DEMO LOL
|
||||
import flixel.system.FlxAssets.FlxShader;
|
||||
@@ -1,5 +1,6 @@
|
||||
package;
|
||||
package funkin.system;
|
||||
|
||||
import funkin.windows.WindowsAPI;
|
||||
import funkin.menus.TitleState;
|
||||
import funkin.game.Highscore;
|
||||
import funkin.options.Options;
|
||||
@@ -93,8 +94,31 @@ class Main extends Sprite
|
||||
#end
|
||||
}
|
||||
|
||||
@:dox(hide)
|
||||
public static var audioDisconnected:Bool = false;
|
||||
|
||||
@:dox(hide)
|
||||
@:noCompletion
|
||||
private #if !flash override #end function __enterFrame(deltaTime:Int):Void {
|
||||
super.__enterFrame(deltaTime);
|
||||
#if windows
|
||||
if (audioDisconnected) {
|
||||
lime.media.AudioManager.suspend();
|
||||
audioDisconnected = false;
|
||||
lime.media.AudioManager.init();
|
||||
// @:privateAccess
|
||||
// for(e in openfl.media.SoundMixer.__soundChannels) {
|
||||
// @:privateAccess
|
||||
// e.__source.__backend.parent.buffer.__srcBuffer = null;
|
||||
// @:privateAccess
|
||||
// e.__source.__backend.init();
|
||||
// }
|
||||
}
|
||||
#end
|
||||
}
|
||||
|
||||
public function loadGameSettings() {
|
||||
PlayerSettings.init();
|
||||
funkin.options.PlayerSettings.init();
|
||||
FlxG.save.bind('Save');
|
||||
Highscore.load();
|
||||
|
||||
@@ -120,6 +144,11 @@ class Main extends Sprite
|
||||
|
||||
Options.load();
|
||||
|
||||
WindowsAPI.registerAudio();
|
||||
// WindowsAPI.setAudioChangeCallback(function() {
|
||||
// trace("test");
|
||||
// });
|
||||
|
||||
var diamond:FlxGraphic = FlxGraphic.fromClass(GraphicTransTileDiamond);
|
||||
diamond.persist = true;
|
||||
diamond.destroyOnNoUse = false;
|
||||
@@ -9,6 +9,7 @@ import flixel.addons.ui.FlxUIState;
|
||||
import flixel.math.FlxRect;
|
||||
import flixel.math.FlxMath;
|
||||
import flixel.util.FlxTimer;
|
||||
import funkin.options.PlayerSettings;
|
||||
|
||||
class MusicBeatState extends FlxUIState
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@ package funkin.system;
|
||||
|
||||
import funkin.system.Conductor.BPMChangeEvent;
|
||||
import funkin.system.Conductor;
|
||||
import funkin.options.PlayerSettings;
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSubState;
|
||||
import flixel.math.FlxMath;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package;
|
||||
package funkin.system;
|
||||
|
||||
typedef SwagSection =
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
package funkin.system;
|
||||
|
||||
import Section.SwagSection;
|
||||
import funkin.system.Section.SwagSection;
|
||||
import haxe.Json;
|
||||
import haxe.format.JsonParser;
|
||||
import lime.utils.Assets;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
package funkin.windows;
|
||||
|
||||
/**
|
||||
* Class for Windows-only functions, such as transparent windows, message boxes, and more.
|
||||
* Does not have any effect on other platforms.
|
||||
*/
|
||||
class WindowsAPI {
|
||||
public static function registerAudio() {
|
||||
#if windows
|
||||
native.WinAPI.registerAudio();
|
||||
#end
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package native;
|
||||
|
||||
#if windows
|
||||
@:buildXml('
|
||||
<target id="haxe">
|
||||
<lib name="dwmapi.lib" if="windows" />
|
||||
<lib name="shell32.lib" if="windows" />
|
||||
<lib name="gdi32.lib" if="windows" />
|
||||
<lib name="ole32.lib" if="windows" />
|
||||
</target>
|
||||
')
|
||||
|
||||
// majority is taken from microsofts doc
|
||||
@:cppFileCode('
|
||||
#include "mmdeviceapi.h"
|
||||
#include "combaseapi.h"
|
||||
#include <iostream>
|
||||
|
||||
#define SAFE_RELEASE(punk) \\
|
||||
if ((punk) != NULL) \\
|
||||
{ (punk)->Release(); (punk) = NULL; }
|
||||
|
||||
static long lastDefId = 0;
|
||||
|
||||
class AudioFixClient : public IMMNotificationClient {
|
||||
LONG _cRef;
|
||||
IMMDeviceEnumerator *_pEnumerator;
|
||||
|
||||
public:
|
||||
AudioFixClient() :
|
||||
_cRef(1),
|
||||
_pEnumerator(NULL)
|
||||
{
|
||||
HRESULT result = CoCreateInstance(__uuidof(MMDeviceEnumerator),
|
||||
NULL, CLSCTX_INPROC_SERVER,
|
||||
__uuidof(IMMDeviceEnumerator),
|
||||
(void**)&_pEnumerator);
|
||||
if (result == S_OK) {
|
||||
_pEnumerator->RegisterEndpointNotificationCallback(this);
|
||||
}
|
||||
}
|
||||
|
||||
~AudioFixClient()
|
||||
{
|
||||
SAFE_RELEASE(_pEnumerator);
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE AddRef()
|
||||
{
|
||||
return InterlockedIncrement(&_cRef);
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE Release()
|
||||
{
|
||||
ULONG ulRef = InterlockedDecrement(&_cRef);
|
||||
if (0 == ulRef)
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
return ulRef;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(
|
||||
REFIID riid, VOID **ppvInterface)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceAdded(LPCWSTR pwstrDeviceId)
|
||||
{
|
||||
return S_OK;
|
||||
};
|
||||
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceRemoved(LPCWSTR pwstrDeviceId)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceStateChanged(
|
||||
LPCWSTR pwstrDeviceId,
|
||||
DWORD dwNewState)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE OnPropertyValueChanged(
|
||||
LPCWSTR pwstrDeviceId,
|
||||
const PROPERTYKEY key)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE OnDefaultDeviceChanged(
|
||||
EDataFlow flow, ERole role,
|
||||
LPCWSTR pwstrDeviceId)
|
||||
{
|
||||
std::cout << "fuck";
|
||||
::funkin::_hx_system::Main_obj::audioDisconnected = true;
|
||||
return S_OK;
|
||||
};
|
||||
};
|
||||
|
||||
AudioFixClient *curAudioFix;
|
||||
')
|
||||
@:dox(hide)
|
||||
class WinAPI {
|
||||
|
||||
public static var __audioChangeCallback:Void->Void = function() {
|
||||
trace("test");
|
||||
};
|
||||
|
||||
|
||||
@:functionCode('
|
||||
if (!curAudioFix) curAudioFix = new AudioFixClient();
|
||||
')
|
||||
public static function registerAudio() {
|
||||
funkin.system.Main.audioDisconnected = true;
|
||||
}
|
||||
}
|
||||
#end
|
||||
Reference in New Issue
Block a user