diff --git a/source/FlxVideo.hx b/source/FlxVideo.hx new file mode 100644 index 000000000..76543ccd7 --- /dev/null +++ b/source/FlxVideo.hx @@ -0,0 +1,62 @@ +package; + +import flixel.FlxBasic; +import flixel.FlxG; +import flixel.FlxSprite; +import openfl.events.NetStatusEvent; +import openfl.media.Video; +import openfl.net.NetConnection; +import openfl.net.NetStream; + +class FlxVideo extends FlxBasic +{ + var video:Video; + var netStream:NetStream; + + public var finishCallback:Void->Void; + + /** + * Doesn't actually interact with Flixel shit, only just a pleasant to use class + */ + public function new(vidSrc:String) + { + super(); + + video = new Video(); + video.x = 0; + video.y = 0; + + FlxG.addChildBelowMouse(video); + + var netConnection = new NetConnection(); + netConnection.connect(null); + + netStream = new NetStream(netConnection); + netStream.client = {onMetaData: client_onMetaData}; + netConnection.addEventListener(NetStatusEvent.NET_STATUS, netConnection_onNetStatus); + netStream.play(Paths.file(vidSrc)); + } + + public function finishVideo():Void + { + netStream.dispose(); + FlxG.removeChild(video); + + if (finishCallback != null) + finishCallback(); + } + + public function client_onMetaData(metaData:Dynamic) + { + video.attachNetStream(netStream); + + video.width = FlxG.width; + video.height = FlxG.height; + } + + private function netConnection_onNetStatus(event:NetStatusEvent):Void + { + if (event.info.code == 'NetStream.Play.Complete') + finishVideo(); + } +} diff --git a/source/PlayState.hx b/source/PlayState.hx index d09d83dd1..3c407fcf0 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -933,66 +933,80 @@ class PlayState extends MusicBeatState { inCutscene = true; - FlxG.sound.playMusic(Paths.music('DISTORTO'), 0); - FlxG.sound.music.fadeIn(5, 0, 0.5); + var vid:FlxVideo = new FlxVideo('music/ughCutscene.mp4'); + vid.finishCallback = function() + { + startCountdown(); + cameraMovement(); + }; - dad.visible = false; - var tankCutscene:TankCutscene = new TankCutscene(-20, 320); - tankCutscene.frames = Paths.getSparrowAtlas('cutsceneStuff/tankTalkSong1'); - tankCutscene.animation.addByPrefix('wellWell', 'TANK TALK 1 P1', 24, false); - tankCutscene.animation.addByPrefix('killYou', 'TANK TALK 1 P2', 24, false); - tankCutscene.animation.play('wellWell'); - tankCutscene.antialiasing = true; - gfCutsceneLayer.add(tankCutscene); + FlxG.camera.zoom = defaultCamZoom * 1.2; - camHUD.visible = false; - - FlxG.camera.zoom *= 1.2; + camFollow.x += 100; camFollow.y += 100; - tankCutscene.startSyncAudio = FlxG.sound.load(Paths.sound('wellWellWell')); + /* + FlxG.sound.playMusic(Paths.music('DISTORTO'), 0); + FlxG.sound.music.fadeIn(5, 0, 0.5); - new FlxTimer().start(3, function(tmr:FlxTimer) - { - camFollow.x += 800; + dad.visible = false; + var tankCutscene:TankCutscene = new TankCutscene(-20, 320); + tankCutscene.frames = Paths.getSparrowAtlas('cutsceneStuff/tankTalkSong1'); + tankCutscene.animation.addByPrefix('wellWell', 'TANK TALK 1 P1', 24, false); + tankCutscene.animation.addByPrefix('killYou', 'TANK TALK 1 P2', 24, false); + tankCutscene.animation.play('wellWell'); + tankCutscene.antialiasing = true; + gfCutsceneLayer.add(tankCutscene); + + camHUD.visible = false; + + FlxG.camera.zoom *= 1.2; camFollow.y += 100; - FlxTween.tween(FlxG.camera, {zoom: defaultCamZoom * 1.2}, 0.27, {ease: FlxEase.quadInOut}); - new FlxTimer().start(1.5, function(bep:FlxTimer) - { - boyfriend.playAnim('singUP'); - // play sound - FlxG.sound.play(Paths.sound('bfBeep'), function() { - boyfriend.playAnim('idle'); - }); - }); + tankCutscene.startSyncAudio = FlxG.sound.load(Paths.sound('wellWellWell')); - new FlxTimer().start(3, function(swaggy:FlxTimer) + new FlxTimer().start(3, function(tmr:FlxTimer) { - camFollow.x -= 800; - camFollow.y -= 100; - FlxTween.tween(FlxG.camera, {zoom: defaultCamZoom * 1.2}, 0.5, {ease: FlxEase.quadInOut}); - tankCutscene.animation.play('killYou'); - FlxG.sound.play(Paths.sound('killYou')); - new FlxTimer().start(6.1, function(swagasdga:FlxTimer) + camFollow.x += 800; + camFollow.y += 100; + FlxTween.tween(FlxG.camera, {zoom: defaultCamZoom * 1.2}, 0.27, {ease: FlxEase.quadInOut}); + + new FlxTimer().start(1.5, function(bep:FlxTimer) { - FlxTween.tween(FlxG.camera, {zoom: defaultCamZoom}, (Conductor.crochet / 1000) * 5, {ease: FlxEase.quadInOut}); - - FlxG.sound.music.fadeOut((Conductor.crochet / 1000) * 5, 0); - - new FlxTimer().start((Conductor.crochet / 1000) * 5, function(money:FlxTimer) + boyfriend.playAnim('singUP'); + // play sound + FlxG.sound.play(Paths.sound('bfBeep'), function() { - dad.visible = true; - gfCutsceneLayer.remove(tankCutscene); + boyfriend.playAnim('idle'); }); - - cameraMovement(); - - startCountdown(); - camHUD.visible = true; }); - }); - }); + + new FlxTimer().start(3, function(swaggy:FlxTimer) + { + camFollow.x -= 800; + camFollow.y -= 100; + FlxTween.tween(FlxG.camera, {zoom: defaultCamZoom * 1.2}, 0.5, {ease: FlxEase.quadInOut}); + tankCutscene.animation.play('killYou'); + FlxG.sound.play(Paths.sound('killYou')); + new FlxTimer().start(6.1, function(swagasdga:FlxTimer) + { + FlxTween.tween(FlxG.camera, {zoom: defaultCamZoom}, (Conductor.crochet / 1000) * 5, {ease: FlxEase.quadInOut}); + + FlxG.sound.music.fadeOut((Conductor.crochet / 1000) * 5, 0); + + new FlxTimer().start((Conductor.crochet / 1000) * 5, function(money:FlxTimer) + { + dad.visible = true; + gfCutsceneLayer.remove(tankCutscene); + }); + + cameraMovement(); + + startCountdown(); + camHUD.visible = true; + }); + }); + });*/ } function gunsIntro() diff --git a/source/animate/FlxSymbol.hx b/source/animate/FlxSymbol.hx index 5f7aa3273..749abbe7b 100644 --- a/source/animate/FlxSymbol.hx +++ b/source/animate/FlxSymbol.hx @@ -62,18 +62,20 @@ class FlxSymbol extends FlxSprite { if (Reflect.hasField(element, 'ASI')) { + var m3d = element.ASI.M3D; + var dumbassMatrix:Matrix = new Matrix(m3d[0], m3d[1], m3d[4], m3d[5], m3d[12], m3d[13]); + var spr:FlxSymbol = new FlxSymbol(0, 0, coolParsed); matrixExposed = true; spr.frames = frames; spr.frame = spr.frames.getByName(element.ASI.N); - var m3d = element.ASI.M3D; - var dumbassMatrix:Matrix = new Matrix(m3d[0], m3d[1], m3d[4], m3d[5], m3d[12], m3d[13]); + // dumbassMatrix.translate(origin.x, origin.y); dumbassMatrix.concat(_matrix); spr.matrixExposed = true; - spr.transformMatrix.concat(dumbassMatrix); + // spr._matrix.concat(spr.transformMatrix); spr.origin.set(); spr.origin.x += origin.x; @@ -85,39 +87,15 @@ class FlxSymbol extends FlxSprite else { var nestedSymbol = symbolMap.get(element.SI.SN); - - // nestedSymbol - - // if (element.SI.M3D[0] == -1 || flipX) - // nestedShit.flipX = true; - - // nestedSymbol.TL.L.reverse(); - - // _matrix.identity(); - // _matrix.scale(1, 1); - - var nestedShit:FlxSymbol = new FlxSymbol(x, y, coolParse); + var nestedShit:FlxSymbol = new FlxSymbol(0, 0, coolParse); nestedShit.frames = frames; var swagMatrix:FlxMatrix = new FlxMatrix(element.SI.M3D[0], element.SI.M3D[1], element.SI.M3D[4], element.SI.M3D[5], element.SI.M3D[12], element.SI.M3D[13]); - // _matrix.concat(swagMatrix); - swagMatrix.concat(_matrix); nestedShit._matrix.concat(swagMatrix); - // nestedShit.x = swagMatrix.tx; - // nestedShit.y = swagMatrix.ty; - - // nestedShit._skewMatrix.identity(); - // nestedShit._skewMatrix.concat(swagMatrix); - // _matrix.setTo(element.SI.M3D[0], element.SI.M3D[1], element.SI.M3D[4], element.SI.M3D[5], element.SI.M3D[12], element.SI.M3D[13]); - - // nestedShit.scale.x = Math.sqrt(_matrix.a * _matrix.a + _matrix.b + _matrix.b); - // nestedShit.scale.y = Math.sqrt(_matrix.a * _matrix.a + _matrix.b * _matrix.b); - // nestedShit.origin.set(element.SI.TRP.x, element.SI.TRP.y); - nestedShit.origin.set(element.SI.TRP.x, element.SI.TRP.y); // nestedShit.angle += ((180 / Math.PI) * Math.atan2(swagMatrix.b, swagMatrix.a)); // nestedShit.angle += angle;