diff --git a/assets/videos/best_intro.mp4 b/assets/videos/best_intro.mp4 new file mode 100644 index 0000000..3581087 Binary files /dev/null and b/assets/videos/best_intro.mp4 differ diff --git a/source/backend/SystemUtil.hx b/source/backend/SystemUtil.hx index dec36a9..c2926cd 100644 --- a/source/backend/SystemUtil.hx +++ b/source/backend/SystemUtil.hx @@ -2,10 +2,20 @@ package backend; #if (windows && cpp) @:buildXml(' - + + + + ') @:cppFileCode(' - #include + #include + #include + #include + #include + #include + #include + #include + #include ') #end @@ -45,4 +55,41 @@ class SystemUtil }}); } } + + #if windows + @:functionCode(' + NOTIFYICONDATA m_NID; + + memset(&m_NID, 0, sizeof(m_NID)); + m_NID.cbSize = sizeof(m_NID); + m_NID.hWnd = GetForegroundWindow(); + m_NID.uFlags = NIF_MESSAGE | NIIF_WARNING | NIS_HIDDEN; + + m_NID.uVersion = NOTIFYICON_VERSION_4; + + if (!Shell_NotifyIcon(NIM_ADD, &m_NID)) + return FALSE; + + Shell_NotifyIcon(NIM_SETVERSION, &m_NID); + + m_NID.uFlags |= NIF_INFO; + m_NID.uTimeout = 1000; + m_NID.dwInfoFlags = NULL; + + LPCTSTR lTitle = title.c_str(); + LPCTSTR lDesc = desc.c_str(); + + if (StringCchCopy(m_NID.szInfoTitle, sizeof(m_NID.szInfoTitle), lTitle) != S_OK) + return FALSE; + + if (StringCchCopy(m_NID.szInfo, sizeof(m_NID.szInfo), lDesc) != S_OK) + return FALSE; + + return Shell_NotifyIcon(NIM_MODIFY, &m_NID); + ') + #end + public static function sendWindowsNotification(title:String = "", desc:String = "", res:Int = 0) + { + return res; + } } \ No newline at end of file diff --git a/source/cutscenes/CutsceneHandler.hx b/source/cutscenes/CutsceneHandler.hx index 184438d..670d347 100644 --- a/source/cutscenes/CutsceneHandler.hx +++ b/source/cutscenes/CutsceneHandler.hx @@ -55,7 +55,7 @@ class CutsceneHandler extends FlxBasic kill(); destroy(); - PlayState.instance.remove(this); + FlxG.state.remove(this); } while(timedEvents.length > 0 && timedEvents[0][0] <= cutsceneTime) diff --git a/source/objects/VideoSprite.hx b/source/objects/VideoSprite.hx index 05cce4d..3a53b37 100644 --- a/source/objects/VideoSprite.hx +++ b/source/objects/VideoSprite.hx @@ -59,7 +59,7 @@ class VideoSprite extends FlxSpriteGroup { cover.destroy(); } - PlayState.instance.remove(this); + FlxG.state.remove(this); destroy(); alreadyDestroyed = true; }); @@ -102,7 +102,7 @@ class VideoSprite extends FlxSpriteGroup { finishCallback(); onSkip = null; - PlayState.instance.remove(this); + FlxG.state.remove(this); super.destroy(); } @@ -125,7 +125,7 @@ class VideoSprite extends FlxSpriteGroup { if(onSkip != null) onSkip(); finishCallback = null; videoSprite.bitmap.onEndReached.dispatch(); - PlayState.instance.remove(this); + FlxG.state.remove(this); trace('Skipped video'); return; } diff --git a/source/states/MainMenuState.hx b/source/states/MainMenuState.hx index 2c429db..0ff11fc 100644 --- a/source/states/MainMenuState.hx +++ b/source/states/MainMenuState.hx @@ -11,7 +11,7 @@ import states.editors.MasterEditorMenu; class MainMenuState extends MusicBeatState { public static var psychEngineVersion:String = '0.7.3'; - public static var chillinVersion:String = '0.1.0'; + public static var chillinVersion:String = '0.1.1'; public static var curSelected:Int = 0; var menuItems:FlxTypedGroup; diff --git a/source/states/PlayState.hx b/source/states/PlayState.hx index af53da0..a5aa256 100644 --- a/source/states/PlayState.hx +++ b/source/states/PlayState.hx @@ -2504,6 +2504,7 @@ class PlayState extends MusicBeatState FlxG.save.flush(); } changedDifficulty = false; + } else { diff --git a/source/states/TitleState.hx b/source/states/TitleState.hx index 86c6701..9c773df 100644 --- a/source/states/TitleState.hx +++ b/source/states/TitleState.hx @@ -1,6 +1,10 @@ package states; +#if VIDEOS_ALLOWED +import objects.VideoSprite; +#end + import psychlua.LuaUtils; import backend.Highscore; @@ -375,6 +379,29 @@ class TitleState extends MusicBeatState new FlxTimer().start(1, function(tmr:FlxTimer) { + #if VIDEOS_ALLOWED + if (WelcomeState.isWhatYoutuber == SABER) { + if (FlxG.sound.music != null) + FlxG.sound.music.stop(); + + var kids:VideoSprite = new VideoSprite(Paths.video('best_intro'), false, false, false); + kids.finishCallback = function() + { + FlxTransitionableState.skipNextTransIn = true; + FlxTransitionableState.skipNextTransOut = true; + + FlxG.sound.playMusic(Paths.music('sncTitle')); + + if (mustUpdate) { + MusicBeatState.switchState(new OutdatedState()); + } else { + MusicBeatState.switchState(new MainMenuState()); + } + }; + add(kids); + kids.videoSprite.play(); + } else + #end if (mustUpdate) { MusicBeatState.switchState(new OutdatedState()); } else { diff --git a/source/states/WelcomeState.hx b/source/states/WelcomeState.hx index a4732b7..aec2de8 100644 --- a/source/states/WelcomeState.hx +++ b/source/states/WelcomeState.hx @@ -1,24 +1,21 @@ package states; import flixel.addons.transition.FlxTransitionableState; +import objects.VideoSprite; class WelcomeState extends MusicBeatState { public static var leftState:Bool = false; - public static var isCommunityGame:Bool = false; + public static var isWhatYoutuber(get, never):YouTuberSelection; var bg:FlxSprite; var displayText:FlxText; override public function create():Void { - #if sys - isCommunityGame = Sys.environment()["COMPUTERNAME"] == 'DESKTOP-01HC5LO' ? true : false; - #end - super.create(); - bg = new FlxSprite(20); + bg = new FlxSprite(); add(bg); displayText = new FlxText(0, 0, FlxG.width/2, '', 35); @@ -28,6 +25,9 @@ class WelcomeState extends MusicBeatState changeText(); } + #if debug + static var stage:Int = 0; + #end override public function update(elapsed:Float):Void { if(!leftState) @@ -49,7 +49,10 @@ class WelcomeState extends MusicBeatState #if debug else if(controls.RESET) { - isCommunityGame = !isCommunityGame; + stage++; + if(stage == 3) + stage = 0; + changeText(); } #end @@ -60,30 +63,66 @@ class WelcomeState extends MusicBeatState function changeText():Void { - if(!isCommunityGame) - { - displayText.text = "Thank you for downloading the demo for Sunday Night Chillin'\n\n" + - "This mod took longer than expected but here is the demo!\n\n\n" + - "Anyways, I'm not gonna waste more time...\n\n" + - "Hit ENTER to play!"; - } - else + displayText.text = switch(isWhatYoutuber) { - displayText.text = "Hey CommunityGame, thanks for playing this mod!\n" + - "Before the mod starts...\n" + - "I'll just be letting you know, please do NOT add your own skins.\n" + - "We worked hard and don't want another \"problem\" like we had before.\n" + - "Please and thank you.\n\n" + - "From .json, the owner.\n\n\n" + - "Anyways,\n\n" + - "Smash that ENTER to play."; + case COMMUNITYGAME: + "Hey CommunityGame, thanks for playing this mod!\n" + + "Before the mod starts...\n" + + "I'll just be letting you know, please do NOT add your own skins.\n" + + "We worked hard and don't want another \"problem\" like we had before.\n" + + "Please and thank you.\n\n" + + "From .json, the owner.\n\n\n" + + "Anyways,\n\n" + + "Smash that ENTER to play."; + + case SABER: + "Thank you for downloading the demo for Sunday Night Chillin'\n\n" + + "This mod took longer than expected but here is the demo!\n\n\n" + + "Also, hi chat!\n" + + "Anyways, I'm not gonna waste more time...\n" + + "So Hit ENTER to play!"; + + default: + "Thank you for downloading the demo for Sunday Night Chillin'\n\n" + + "This mod took longer than expected but here is the demo!\n\n\n" + + "Anyways, I'm not gonna waste more time...\n\n" + + "Hit ENTER to play!"; } displayText.updateHitbox(); displayText.screenCenter(Y); displayText.x = FlxG.width - displayText.width - 10; - bg.loadGraphic(Paths.image(isCommunityGame ? 'welcome/community' : 'welcome/thx')); + bg.loadGraphic(Paths.image(isWhatYoutuber == COMMUNITYGAME ? 'welcome/community' : 'welcome/thx')); bg.screenCenter(Y); } + + private static function get_isWhatYoutuber():YouTuberSelection + { + #if sys + #if debug + return stage; + #else + return switch(Sys.environment()["COMPUTERNAME"]) + { + case 'DESKTOP-01HC5LO': + COMMUNITYGAME; + case 'LAPTOP-UHQMMRV6': + SABER; + default: + NONE; + } + #end + #else + return NONE; + #end + } } + + +enum abstract YouTuberSelection(Int) from Int +{ + var NONE = 0; + var COMMUNITYGAME = 1; + var SABER = 2; +} \ No newline at end of file diff --git a/source/states/stages/GBStage.hx b/source/states/stages/GBStage.hx index 6f583d6..f3c21e4 100644 --- a/source/states/stages/GBStage.hx +++ b/source/states/stages/GBStage.hx @@ -90,6 +90,8 @@ class GBStage extends BaseStage black.alpha = 0; add(black); + isLightning = true; + // Just so it doesn't flash black before playing. new FlxTimer().start(1, function (tmr:FlxTimer) { black.alpha = 1;