Skip to content

Commit 0b32ff6

Browse files
committed
yeah
1 parent 8ae849b commit 0b32ff6

File tree

8 files changed

+233
-301
lines changed

8 files changed

+233
-301
lines changed

source/archipelago/APDisconnectSubstate.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class APDisconnectSubstate extends FlxSubState
2727

2828
// AP.disconnect_socket();
2929
states.ExitState.addExitCallback(function() {
30-
var restartProcess = new Process("Mixtape.exe", ["APDisconnectError", "restart"]);
30+
//var restartProcess = new Process("Mixtape.exe", ["APDisconnectError", "restart"]);
3131

3232
});
3333
FlxG.switchState(new states.ExitState());

source/backend/Conductor.hx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class Conductor
2929
@:noCompletion static function get_jackLimit()
3030
return (jackLimit < 0) ? (jackLimit = Conductor.stepCrochet / _internalJackLimit) : jackLimit;
3131

32+
public static var ROWS_PER_BEAT = 48; // from Stepmania
33+
3234
public static function judgeNote(arr:Array<Rating>, diff:Float=0):Rating // die
3335
{
3436
var data:Array<Rating> = arr;
@@ -44,6 +46,9 @@ class Conductor
4446
return lastChange.stepCrochet*4;
4547
}
4648

49+
public inline static function secsToRow(sex:Float):Int
50+
return Math.round(getBeat(sex) * ROWS_PER_BEAT);
51+
4752
public static function getBPMFromSeconds(time:Float){
4853
var lastChange:BPMChangeEvent = {
4954
stepTime: 0,

source/backend/MusicBeatState.hx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ class MusicBeatState extends FlxState
5858

5959
// if (backend.window.CppAPI.getWindowOpacity()!=1)
6060
#if windows
61-
if (emergencyOpacityFix) {
62-
CppAPI.setWindowOppacity(1);
63-
}
6461

6562
if (firstRun) {
6663
FlxTween.num(0, 1, 0.5, {
@@ -137,6 +134,11 @@ class MusicBeatState extends FlxState
137134

138135
override function update(elapsed:Float)
139136
{
137+
if (emergencyOpacityFix) {
138+
CppAPI.setWindowOppacity(1);
139+
emergencyOpacityFix = false;
140+
}
141+
140142
if (Main.audioDisconnected && getState() == PlayState.instance)
141143
{
142144
//Save your progress and THEN reset it (I knew there was a common use for this)

source/objects/Character.hx

Lines changed: 83 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ enum CharType {
4545
OTHER;
4646
}
4747

48-
class Character extends FunkinSprite
48+
class Character extends FlxSprite
4949
{
5050
/**
5151
* In case a character is missing, it will use this on its place
@@ -91,13 +91,28 @@ class Character extends FunkinSprite
9191
public var invuln:Bool = false;
9292
public var controlled:Bool = false;
9393

94+
public var doubleGhosts:Array<FunkinSprite> = [];
95+
public var ghostID:Int = 0;
96+
public var ghostAnim:String = '';
97+
public var ghostTweenGRP:Array<FlxTween> = [];
98+
99+
public var mostRecentRow:Int = 0; // for ghost anims n shit
100+
94101
// This is literally only for the dropshadow shader
95102
public var charType:CharType = OTHER;
96103

97104
public function new(x:Float, y:Float, ?character:String = 'bf', ?isPlayer:Bool = false, ?chType:CharType = OTHER)
98105
{
99106
super(x, y);
100107

108+
for(i in 0...4){
109+
var ghost = new FunkinSprite();
110+
ghost.visible = false;
111+
ghost.antialiasing = true;
112+
ghost.alpha = 0.6;
113+
doubleGhosts.push(ghost);
114+
}
115+
101116
animation = new PsychAnimationController(this);
102117

103118
animOffsets = new Map<String, Array<Dynamic>>();
@@ -118,6 +133,7 @@ class Character extends FunkinSprite
118133

119134
public function changeCharacter(character:String)
120135
{
136+
121137
animationsArray = [];
122138
animOffsets = [];
123139
curCharacter = character;
@@ -256,6 +272,8 @@ class Character extends FunkinSprite
256272

257273
if(debugMode || (!isAnimateAtlas && animation.curAnim == null) || (isAnimateAtlas && (atlas.anim.curInstance == null || atlas.anim.curSymbol == null)))
258274
{
275+
for (ghost in doubleGhosts)
276+
ghost.update(elapsed);
259277
super.update(elapsed);
260278
return;
261279
}
@@ -365,9 +383,8 @@ class Character extends FunkinSprite
365383

366384
return value;
367385
}
368-
386+
369387
public var danced:Bool = false;
370-
371388
/**
372389
* FOR GF DANCING SHIT
373390
*/
@@ -477,6 +494,64 @@ class Character extends FunkinSprite
477494
animation.addByPrefix(name, anim, 24, false);
478495
}
479496

497+
public function playGhostAnim(ghostID = 0, AnimName:String, Force:Bool = false, Reversed:Bool = false, Frame:Int = 0) {
498+
try {
499+
var ghost:FlxSprite = doubleGhosts[ghostID];
500+
ghost.scale.copyFrom(scale);
501+
ghost.frames = frames;
502+
ghost.animation.copyFrom(animation);
503+
// ghost.shader = shader;
504+
ghost.x = x;
505+
ghost.y = y;
506+
ghost.flipX = flipX;
507+
ghost.flipY = flipY;
508+
ghost.alpha = alpha * 0.6;
509+
ghost.visible = true;
510+
ghost.color = FlxColor.fromRGB(healthColorArray[0], healthColorArray[1], healthColorArray[2]);
511+
ghost.animation.play(AnimName, Force, Reversed, Frame);
512+
if (ghostTweenGRP[ghostID] != null)
513+
ghostTweenGRP[ghostID].cancel();
514+
515+
var direction:String = AnimName.substring(4);
516+
517+
var directionMap:Map<String, Array<Float>> = [
518+
'UP' => [0, -45],
519+
'DOWN' => [0, 45],
520+
'RIGHT' => [45, 0],
521+
'LEFT' => [-45, 0],
522+
'UP-alt' => [0, -45],
523+
'DOWN-alt' => [0, 45],
524+
'RIGHT-alt' => [45, 0],
525+
'LEFT-alt' => [-45, 0],
526+
];
527+
//had to add alt cuz it kept crashing on room code LOL
528+
529+
var moveDirections:Array<Float> = [
530+
x + (directionMap.get(direction)[0]),
531+
y + (directionMap.get(direction)[1])
532+
];
533+
534+
ghostTweenGRP[ghostID] = FlxTween.tween(ghost, {alpha: 0, x: moveDirections[0], y: moveDirections[1]}, 0.75, {
535+
ease: FlxEase.linear,
536+
onComplete: function(twn:FlxTween)
537+
{
538+
ghost.visible = false;
539+
ghostTweenGRP[ghostID].destroy(); // maybe?
540+
ghostTweenGRP[ghostID] = null;
541+
}
542+
});
543+
544+
var daOffset = animOffsets.get(AnimName);
545+
if (animOffsets.exists(AnimName))
546+
ghost.offset.set(daOffset[0], daOffset[1]);
547+
else
548+
ghost.offset.set(0, 0);
549+
}
550+
catch(e) {
551+
trace('ERROR: $e');
552+
}
553+
}
554+
480555
// Atlas support
481556
// special thanks ne_eo for the references, you're the goat!!
482557
@:allow(states.editors.CharacterEditorState)
@@ -485,6 +560,11 @@ class Character extends FunkinSprite
485560
public var atlas:FlxAnimate;
486561
public override function draw()
487562
{
563+
for(ghost in doubleGhosts){
564+
if(ghost.visible)
565+
ghost.draw();
566+
}
567+
488568
var lastAlpha:Float = alpha;
489569
var lastColor:FlxColor = color;
490570
if(missingCharacter)

source/objects/FunkinSprite.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ class FunkinSprite extends FlxSprite
431431
frames = null;
432432
// Cancel all tweens so they don't continue to run on a destroyed sprite.
433433
// This prevents crashes.
434-
FlxTween.cancelTweensOf(this);
434+
//FlxTween.cancelTweensOf(this);
435435
super.destroy();
436436
}
437437
}

source/objects/Note.hx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,9 @@ class Note extends NoteObject
267267
'No Animation'
268268
];
269269
public var strumTime:Float = 0;
270-
270+
271+
public var row:Int = 0;
272+
271273
public var mustPress:Bool = false;
272274
public var canBeHit:Bool = false;
273275
public var tooLate:Bool = false;

source/objects/NoteObject.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ enum abstract ObjectType(#if cpp cpp.UInt8 #else Int #end)
1414
var SPLASH;
1515
}
1616

17-
class NoteObject extends FunkinSprite {
17+
class NoteObject extends FlxSprite {
1818
public var zIndex:Float = 0;
1919
public var objType:ObjectType = UNKNOWN;
2020

0 commit comments

Comments
 (0)