Skip to content

Commit adcb023

Browse files
committed
Merge branch 'Archipelago' of https://github.com/Z11Coding/Mixtape-Engine-Rework into Archipelago
2 parents 3e1c425 + 7061b58 commit adcb023

File tree

2 files changed

+157
-58
lines changed

2 files changed

+157
-58
lines changed

source/states/FirstCheckState.hx

Lines changed: 104 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class FirstCheckState extends MusicBeatState
1717
var updateAlphabet:Alphabet;
1818
var updateIcon:FlxSprite;
1919
var updateRibbon:FlxSprite;
20+
var allowProgression:Bool = true; //For april fools
2021

2122
public static function checkInternetConnection():Bool {
2223
var response:Dynamic = null;
@@ -84,15 +85,114 @@ class FirstCheckState extends MusicBeatState
8485

8586
if (AprilFools.allowAF)
8687
{
88+
allowProgression = false;
89+
var randoTimer:Int = FlxG.random.int(2, 10);
8790
var aprilFoolsText = new FlxText(0, 0, FlxG.width, "April Fools!");
88-
aprilFoolsText.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, LEFT);
91+
aprilFoolsText.setFormat(Paths.font("vcr.ttf"), 128, FlxColor.WHITE, CENTER);
92+
aprilFoolsText.screenCenter();
93+
aprilFoolsText.alpha = 0;
8994
add(aprilFoolsText);
95+
FlxTween.num(0, 1, randoTimer, {ease: FlxEase.linear,
96+
onComplete: function(twn:FlxTween) {
97+
if (!relaunch)
98+
{
99+
remove(aprilFoolsText);
100+
updateRibbon = new FlxSprite(0, FlxG.height - 75).makeGraphic(FlxG.width, 75, 0x88FFFFFF, true);
101+
updateRibbon.visible = false;
102+
updateRibbon.alpha = 0;
103+
add(updateRibbon);
104+
105+
updateIcon = new FlxSprite(FlxG.width - 75, FlxG.height - 75);
106+
updateIcon.frames = Paths.getSparrowAtlas("pause/pauseAlt/bfLol");
107+
updateIcon.animation.addByPrefix("dance", "funnyThing instance 1", 20, true);
108+
updateIcon.animation.play("dance");
109+
updateIcon.setGraphicSize(65);
110+
updateIcon.updateHitbox();
111+
updateIcon.antialiasing = true;
112+
updateIcon.visible = false;
113+
add(updateIcon);
114+
115+
updateAlphabet = new ColoredAlphabet(0, 0, "Checking Your Vibe...", true, FlxColor.WHITE);
116+
for(c in updateAlphabet.members) {
117+
c.scale.x /= 2;
118+
c.scale.y /= 2;
119+
c.updateHitbox();
120+
c.x /= 2;
121+
c.y /= 2;
122+
}
123+
updateAlphabet.visible = false;
124+
updateAlphabet.x = updateIcon.x - updateAlphabet.width - 10;
125+
updateAlphabet.y = updateIcon.y;
126+
add(updateAlphabet);
127+
updateIcon.y += 15;
128+
129+
130+
var tmr = new FlxTimer().start(2, function(tmr:FlxTimer)
131+
{
132+
trace('checking for update');
133+
if (!checkInternetConnection())
134+
{
135+
updateAlphabet.text = 'Failed the vibe check! (No internet connection?)';
136+
updateAlphabet.color = FlxColor.RED;
137+
updateIcon.visible = false;
138+
FlxTween.tween(updateAlphabet, {alpha: 0}, 2, {ease:FlxEase.sineOut});
139+
FlxTween.tween(updateIcon, {alpha: 0}, 2, {ease:FlxEase.sineOut});
140+
new FlxTimer().start(2, function(tmr:FlxTimer) {
141+
trace("Ew, no internet!");
142+
FlxG.switchState(new states.SplashScreen());
143+
});
144+
return;
145+
}
146+
var http = new haxe.Http("https://raw.githubusercontent.com/Z11Coding/Mixtape-Engine-Rework/refs/heads/Archipelago/gitVersion.txt");
147+
148+
http.onData = function(data:String)
149+
{
150+
updateVersion = data.split(':')[0].trim();
151+
betaVersion = data.split(':')[1].trim();
152+
var curVersion:String = MainMenuState.mixtapeEngineVersion.trim();
153+
trace('version online: ' + updateVersion + ', your version: ' + curVersion);
154+
var updateVersionNum = Std.parseFloat(updateVersion.replace(".", ""));
155+
var curVersionNum = Std.parseFloat(curVersion.replace(".", ""));
156+
if (curVersionNum < updateVersionNum && ClientPrefs.data.checkForUpdates)
157+
{
158+
trace('versions arent matching!');
159+
MusicBeatState.switchState(new states.OutdatedState());
160+
}
161+
else FlxG.switchState(new APCheckState());
162+
}
163+
164+
http.onError = function(error)
165+
{
166+
trace('error: $error');
167+
updateAlphabet.text = 'Failed the vibe check!';
168+
updateAlphabet.color = FlxColor.RED;
169+
updateIcon.visible = false;
170+
FlxTween.tween(updateAlphabet, {alpha: 0}, 2, {ease:FlxEase.sineOut});
171+
FlxTween.tween(updateIcon, {alpha: 0}, 2, {ease:FlxEase.sineOut});
172+
new FlxTimer().start(2, function(tmr:FlxTimer) {
173+
FlxG.switchState(new states.SplashScreen());
174+
});
175+
}
176+
177+
http.request();
178+
updateIcon.visible = true;
179+
updateAlphabet.visible = true;
180+
updateRibbon.visible = true;
181+
updateRibbon.alpha = 1;
182+
});
183+
}
184+
else
185+
{
186+
FlxG.switchState(new TitleState());
187+
}
188+
}},
189+
function(num){aprilFoolsText.alpha = num;});
90190
}
91191
else {
92192
ClientPrefs.data.aprilFools = true;
93193
}
94194

95-
if (!relaunch)
195+
if (!relaunch && allowProgression)
96196
{
97197
updateRibbon = new FlxSprite(0, FlxG.height - 75).makeGraphic(FlxG.width, 75, 0x88FFFFFF, true);
98198
updateRibbon.visible = false;
@@ -177,10 +277,8 @@ class FirstCheckState extends MusicBeatState
177277
updateRibbon.visible = true;
178278
updateRibbon.alpha = 1;
179279
});
180-
181-
182-
}
183-
else
280+
}
281+
else if (allowProgression)
184282
{
185283
FlxG.switchState(new TitleState());
186284
}

source/states/PlayState.hx

Lines changed: 53 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ class PlayState extends MusicBeatState
451451
public var loopPlayMult:Float = ClientPrefs.getGameplaySetting('loopPlayMult', 1.05);
452452
public var maniaMode:Bool = ClientPrefs.getGameplaySetting('maniaMode', false);
453453
public var RandomSpeedChange:Bool = ClientPrefs.getGameplaySetting('randomspeedchange', false);
454+
public var RandomSpeedChangeWild:Bool = false;
454455
public var gimmicksAllowed:Bool = false;
455456
public var mixupMode:Bool = false;
456457

@@ -1365,35 +1366,6 @@ class PlayState extends MusicBeatState
13651366
raveLightsColors = [0xFF31A2FD, 0xFF31FD8C, 0xFFFB33F5, 0xFFFD4531, 0xFFFBA633];
13661367
if (!inArchipelagoMode) MaxHP = 2 + (ClientPrefs.data.healthMode == "Tabi" ? 2 : 0);
13671368
initY = healthBar.y;
1368-
1369-
// my latest invention: THE CHAOS BRINGER
1370-
if (AprilFools.allowAF && !inArchipelagoMode) {
1371-
switch (FlxG.random.int(0, 5)) {
1372-
case 0: //Random Speed
1373-
playbackRate *= FlxG.random.float(0.1, 2);
1374-
case 1: //Reverse Input
1375-
reverseNoteRules = FlxG.random.bool(15.7) && !inArchipelagoMode || archipelago.APItem.activeItem?.name == "Input Reversal";
1376-
case 2: //Progressive Speed
1377-
FlxTween.num(playbackRate, 2, inst.length-1, {ease: FlxEase.linear,
1378-
onComplete: function(twn:FlxTween)
1379-
{
1380-
playbackRate = 1;
1381-
}},
1382-
function(num){playbackRate = num;});
1383-
case 3: //Regressive Speed
1384-
FlxTween.num(playbackRate, 0.1, inst.length-1, {ease: FlxEase.linear,
1385-
onComplete: function(twn:FlxTween)
1386-
{
1387-
playbackRate = 1;
1388-
}},
1389-
function(num){playbackRate = num;});
1390-
case 4: //Random Modchart for no reason
1391-
AprilFools.randomModchartEffect();
1392-
case 5:
1393-
//Nothing
1394-
1395-
}
1396-
}
13971369
}
13981370

13991371
function doStaticSign(lestatic:Int = 0)
@@ -2234,6 +2206,32 @@ class PlayState extends MusicBeatState
22342206

22352207
setOnScripts('songLength', songLength);
22362208
callOnScripts('onSongStart');
2209+
2210+
// my latest invention: THE CHAOS BRINGER
2211+
if (AprilFools.allowAF && !inArchipelagoMode) {
2212+
switch (FlxG.random.int(0, 5)) {
2213+
case 0: //Random Speed
2214+
trace("Random Speed");
2215+
playbackRate *= FlxG.random.float(0.1, 2);
2216+
case 1: //Reverse Input
2217+
trace("Reverse Input");
2218+
reverseNoteRules = !inArchipelagoMode || archipelago.APItem.activeItem?.name == "Input Reversal";
2219+
case 2: //Random Speed Change
2220+
trace("Random Speed Change");
2221+
RandomSpeedChange = true;
2222+
case 3: //Wild Random Speed Change
2223+
trace("Wild Random Speed Change");
2224+
RandomSpeedChange = true;
2225+
RandomSpeedChangeWild = true;
2226+
case 4: //Random Modchart for no reason
2227+
trace("Random Modchart for no reason");
2228+
AprilFools.randomModchartEffect();
2229+
case 5:
2230+
trace("Nothing");
2231+
//Nothing
2232+
2233+
}
2234+
}
22372235
}
22382236

22392237
private var noteTypes:Array<String> = [];
@@ -6571,35 +6569,37 @@ class PlayState extends MusicBeatState
65716569
callOnScripts('onStepHit');
65726570
}
65736571

6574-
public function lerpSongSpeed(num:Float, time:Float):Void
6572+
public function lerpSongSpeed(num:Float, time:Float, ?staticLines:Bool = true):Void
65756573
{
65766574
FlxTween.num(playbackRate, num, time, {ease: FlxEase.sineInOut}, function(value:Float)
65776575
{
65786576
playbackRate = value * currentRate;
65796577
resyncVocals();
65806578
});
65816579

6582-
var staticLinesNum = FlxG.random.int(3, 5);
6583-
for (i in 0...staticLinesNum)
6584-
{
6585-
var startPos = FlxG.random.float(0, FlxG.height);
6586-
var endPos = FlxG.random.float(0, FlxG.height);
6587-
6588-
var line:FlxSprite = new FlxSprite().loadGraphic(Paths.image("effects/staticline"));
6589-
line.y = startPos;
6590-
line.updateHitbox();
6591-
line.cameras = [camHUD];
6592-
line.alpha = 0.3;
6593-
6594-
line.screenCenter(X);
6595-
add(line);
6596-
FlxTween.tween(line, {y: endPos}, time, {
6597-
ease: FlxEase.circInOut,
6598-
onComplete: function(twn:FlxTween)
6599-
{
6600-
line.destroy();
6601-
}
6602-
});
6580+
if (staticLines) {
6581+
var staticLinesNum = FlxG.random.int(3, 5);
6582+
for (i in 0...staticLinesNum)
6583+
{
6584+
var startPos = FlxG.random.float(0, FlxG.height);
6585+
var endPos = FlxG.random.float(0, FlxG.height);
6586+
6587+
var line:FlxSprite = new FlxSprite().loadGraphic(Paths.image("effects/staticline"));
6588+
line.y = startPos;
6589+
line.updateHitbox();
6590+
line.cameras = [camHUD];
6591+
line.alpha = 0.3;
6592+
6593+
line.screenCenter(X);
6594+
add(line);
6595+
FlxTween.tween(line, {y: endPos}, time, {
6596+
ease: FlxEase.circInOut,
6597+
onComplete: function(twn:FlxTween)
6598+
{
6599+
line.destroy();
6600+
}
6601+
});
6602+
}
66036603
}
66046604
}
66056605

@@ -6614,7 +6614,8 @@ class PlayState extends MusicBeatState
66146614
if (curBeat % 32 == 0 && RandomSpeedChange && !songAboutToLoop)
66156615
{
66166616
// goes up to 3x speed cuz screw you thats why
6617-
var randomShit = FlxMath.roundDecimal(FlxG.random.float(0.45, 2), 2);
6617+
var randomSpeed = RandomSpeedChangeWild ? FlxG.random.float(0.2, 5) : FlxG.random.float(0.45, 2);
6618+
var randomShit = FlxMath.roundDecimal(randomSpeed, 2);
66186619
lerpSongSpeed(randomShit, 1);
66196620
}
66206621

0 commit comments

Comments
 (0)