Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
CrusherNotDrip committed Aug 1, 2024
2 parents dde1aee + f42458e commit beba1c4
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 31 deletions.
Binary file added assets/videos/best_intro.mp4
Binary file not shown.
51 changes: 49 additions & 2 deletions source/backend/SystemUtil.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@ package backend;

#if (windows && cpp)
@:buildXml('
<target id="haxe"> <lib name="dwmapi.lib" if="windows" /> </target>
<target id="haxe">
<lib name="dwmapi.lib" if="windows" />
<lib name="Shell32.lib" if="windows" />
</target>
')
@:cppFileCode('
#include <dwmapi.h>
#include <stdio.h>
#include <windows.h>
#include <winuser.h>
#include <dwmapi.h>
#include <strsafe.h>
#include <shellapi.h>
#include <iostream>
#include <string>
')
#end

Expand Down Expand Up @@ -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;
}
}
2 changes: 1 addition & 1 deletion source/cutscenes/CutsceneHandler.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions source/objects/VideoSprite.hx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class VideoSprite extends FlxSpriteGroup {
cover.destroy();
}

PlayState.instance.remove(this);
FlxG.state.remove(this);
destroy();
alreadyDestroyed = true;
});
Expand Down Expand Up @@ -102,7 +102,7 @@ class VideoSprite extends FlxSpriteGroup {
finishCallback();
onSkip = null;

PlayState.instance.remove(this);
FlxG.state.remove(this);
super.destroy();
}

Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion source/states/MainMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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<FlxSprite>;
Expand Down
1 change: 1 addition & 0 deletions source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2504,6 +2504,7 @@ class PlayState extends MusicBeatState
FlxG.save.flush();
}
changedDifficulty = false;

}
else
{
Expand Down
27 changes: 27 additions & 0 deletions source/states/TitleState.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package states;


#if VIDEOS_ALLOWED
import objects.VideoSprite;
#end

import psychlua.LuaUtils;
import backend.Highscore;

Expand Down Expand Up @@ -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 {
Expand Down
87 changes: 63 additions & 24 deletions source/states/WelcomeState.hx
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -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)
Expand All @@ -49,7 +49,10 @@ class WelcomeState extends MusicBeatState
#if debug
else if(controls.RESET)
{
isCommunityGame = !isCommunityGame;
stage++;
if(stage == 3)
stage = 0;

changeText();
}
#end
Expand All @@ -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;
}
2 changes: 2 additions & 0 deletions source/states/stages/GBStage.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit beba1c4

Please sign in to comment.