Skip to content

Commit 42a32c5

Browse files
committed
things
1 parent 823c7fe commit 42a32c5

File tree

8 files changed

+103
-95
lines changed

8 files changed

+103
-95
lines changed

source/archipelago/APItem.hx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,13 +458,14 @@ class APAprilFools extends APItem {
458458
});
459459

460460
// Windows Only, as notifications can't be sent this way on other platforms
461+
// We can do this because thanks to the conditional block it will only trigger on windows anyway
461462
#if windows
462463
options.set(7, function() {
463464
APItem.createCustomItem("April Fools - Windows Notification", ConditionHelper.Everywhere(), function() {
464-
var notification = new haxe.win32.Notification("April Fools!", "This is a Windows notification!");
465-
notification.show();
465+
backend.window.CppAPI.sendWindowsNotification("April Fools!", "This is a Windows notification!");
466466
});
467467
});
468+
#end
468469

469470

470471

source/backend/Constants.hx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,29 @@ class Constants {
99
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/$daSong')), volume);
1010
if (BPM != null) Conductor.bpm = BPM;
1111
} else {
12-
changeMenuMusic(ClientPrefs.data.menuSong, null, volume);
12+
setMenuMusic(ClientPrefs.data.menuSong, null, volume, true);
1313
}
1414
}
15-
16-
public static function changeMenuMusic(daSong:String, ?BPM:Null<Float>, ?volume:Float) { //It's a float because custom songs can be weird
15+
16+
public static function setMenuMusic(daSong:String, ?BPM:Null<Float>, ?volume:Float, ?playMusic:Bool = false) { //It's a float because custom songs can be weird
1717
switch (daSong) {
1818
case "None":
19-
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/empty')), volume);
19+
if (playMusic) FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/empty')), volume);
2020
Conductor.bpm = 0;
2121
case "Panix Press":
22-
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/panixPress')), volume);
22+
if (playMusic) FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/panixPress')), volume);
2323
Conductor.bpm = 150;
2424
case "TitleMania":
25-
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/titlemania')), volume);
25+
if (playMusic) FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/titlemania')), volume);
2626
Conductor.bpm = 100;
2727
case "Base Game":
28-
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/freakyMenu')), volume);
28+
if (playMusic) FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/freakyMenu')), volume);
2929
Conductor.bpm = 102;
3030
case "Freeplay Random":
31-
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/freeplayRandom')), volume);
31+
if (playMusic) FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/freeplayRandom')), volume);
3232
Conductor.bpm = 145;
3333
case "Pause Menu":
34-
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('pauseMusic/${ClientPrefs.data.pauseMusic}')), volume);
34+
if (playMusic) FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('pauseMusic/${ClientPrefs.data.pauseMusic}')), volume);
3535
switch (ClientPrefs.data.pauseMusic)
3636
{
3737
//dont question it
@@ -59,7 +59,7 @@ class Constants {
5959
Conductor.bpm = MixtapeSettingsSubState.curBPMList[10];
6060
}
6161
default:
62-
FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/$daSong')), volume);
62+
if (playMusic) FlxG.sound.playMusic(Paths.music(Paths.formatToSongPath('menuMusic/$daSong')), volume);
6363
Conductor.bpm = BPM;
6464
}
6565

source/backend/MusicBeatState.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ class MusicBeatState extends FlxState
234234
var formattedSong:String = Highscore.formatSong(songLowercase, difficulty);
235235
songs.push(Song.loadFromJson(formattedSong, songLowercase));
236236
}
237-
PlayState.storyPlaylist = songs.map(function(song:SwagSong):String {
237+
PlayState.storyPlaylist = songs.map(function(song:backend.Song.SwagSong):String {
238238
return song.song;
239239
});
240240
PlayState.SONG = null;

source/backend/TransitionState.hx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ class TransitionState {
247247
switchState(targetState, onComplete, args);
248248
case 'transparent fade':
249249
#if windows
250+
MusicBeatState.emergencyOpacityFix = true;
250251
FlxTween.num(1, 0, 2, {ease: FlxEase.sineInOut, onComplete:
251252
function(twn:FlxTween)
252253
{
@@ -267,6 +268,7 @@ class TransitionState {
267268
{
268269
FlxG.sound.play(Paths.music('gameOverEnd'));
269270
}
271+
MusicBeatState.emergencyOpacityFix = true;
270272
if (ClientPrefs.data.flashing) FlxG.camera.flash(FlxColor.WHITE, 2);
271273
#if windows
272274
FlxTween.num(1, 0, 2, {ease: FlxEase.sineInOut, onComplete:

source/objects/Alphabet.hx

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class Alphabet extends FlxSpriteGroup implements Scrollable
4949

5050
public var distancePerItem:FlxPoint = new FlxPoint(20, 120);
5151
public var startPosition:FlxPoint = new FlxPoint(0, 0); // for the calculations
52+
public var doShuffle:Bool = true; // For dynamic text
5253

5354
public function new(x:Float, y:Float, text:String = "", ?bold:Bool = true)
5455
{
@@ -372,99 +373,98 @@ class ColoredAlphabet extends Alphabet
372373
}
373374
}
374375

375-
class DynamicAlphabet extends Alphabet
376-
{
377-
private var originalText:String;
378-
private var preserveType:Bool;
376+
class DynamicAlphabet extends Alphabet
377+
{
378+
private var originalText:String;
379+
private var preserveType:Bool;
379380

380-
public function new(x:Float, y:Float, text:String = "", ?bold:Bool = true, PreserveType:Bool = false)
381-
{
382-
super(x, y, text, bold);
383-
this.originalText = text;
384-
this.preserveType = PreserveType;
385-
}
381+
public function new(x:Float, y:Float, text:String = "", ?bold:Bool = true, PreserveType:Bool = false)
382+
{
383+
super(x, y, text, bold);
384+
this.originalText = text;
385+
this.preserveType = PreserveType;
386+
}
386387

387-
override public function update(elapsed:Float):Void
388-
{
389-
super.update(elapsed);
390-
this.text = getRandomizedText();
391-
}
388+
override public function update(elapsed:Float):Void
389+
{
390+
super.update(elapsed);
391+
this.text = doShuffle ? getRandomizedText() : originalText;
392+
}
392393

393-
private function getRandomizedText():String
394+
private function getRandomizedText():String
395+
{
396+
var randomizedText:String = '';
397+
for (i in 0...originalText.length)
394398
{
395-
var randomizedText:String = '';
396-
for (i in 0...originalText.length)
399+
var char = originalText.charAt(i);
400+
if (preserveType)
397401
{
398-
var char = originalText.charAt(i);
399-
if (preserveType)
402+
if (isLetter(char))
400403
{
401-
if (isLetter(char))
402-
{
403-
randomizedText += getRandomLetter();
404-
}
405-
else if (isNumber(char))
406-
{
407-
randomizedText += getRandomNumber();
408-
}
409-
else if (isSymbol(char))
410-
{
411-
randomizedText += getRandomSymbol();
412-
}
404+
randomizedText += getRandomLetter();
413405
}
414-
else
406+
else if (isNumber(char))
415407
{
416-
randomizedText += getRandomCharacter();
408+
randomizedText += getRandomNumber();
409+
}
410+
else if (isSymbol(char))
411+
{
412+
randomizedText += getRandomSymbol();
417413
}
418414
}
419-
return randomizedText;
415+
else
416+
{
417+
randomizedText += getRandomCharacter();
418+
}
420419
}
420+
return randomizedText;
421+
}
421422

422-
private function isLetter(char:String):Bool
423-
{
424-
return char >= 'A' && char <= 'Z' || char >= 'a' && char <= 'z';
425-
}
423+
private function isLetter(char:String):Bool
424+
{
425+
return char >= 'A' && char <= 'Z' || char >= 'a' && char <= 'z';
426+
}
426427

427-
private function isNumber(char:String):Bool
428-
{
429-
return char >= '0' && char <= '9';
430-
}
428+
private function isNumber(char:String):Bool
429+
{
430+
return char >= '0' && char <= '9';
431+
}
431432

432-
private function isSymbol(char:String):Bool
433-
{
434-
return !isLetter(char) && !isNumber(char);
435-
}
433+
private function isSymbol(char:String):Bool
434+
{
435+
return !isLetter(char) && !isNumber(char);
436+
}
436437

437-
private function getRandomLetter():String
438-
{
439-
var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
440-
return letters.charAt(FlxG.random.int(0, letters.length - 1));
441-
}
438+
private function getRandomLetter():String
439+
{
440+
var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
441+
return letters.charAt(FlxG.random.int(0, letters.length - 1));
442+
}
442443

443-
private function getRandomNumber():String
444-
{
445-
var numbers = "0123456789";
446-
return numbers.charAt(FlxG.random.int(0, numbers.length - 1));
447-
}
444+
private function getRandomNumber():String
445+
{
446+
var numbers = "0123456789";
447+
return numbers.charAt(FlxG.random.int(0, numbers.length - 1));
448+
}
448449

449-
private function getRandomSymbol():String
450-
{
451-
var symbols = "!@#$%^&*()-_=+[]{}|;:'\",.<>?/`~";
452-
return symbols.charAt(FlxG.random.int(0, symbols.length - 1));
453-
}
450+
private function getRandomSymbol():String
451+
{
452+
var symbols = "!@#$%^&*()-_=+[]{}|;:'\",.<>?/`~";
453+
return symbols.charAt(FlxG.random.int(0, symbols.length - 1));
454+
}
454455

455-
private function getRandomCharacter():String
456-
{
457-
var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_=+[]{}|;:'\",.<>?/`~";
458-
return characters.charAt(FlxG.random.int(0, characters.length - 1));
459-
}
456+
private function getRandomCharacter():String
457+
{
458+
var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_=+[]{}|;:'\",.<>?/`~";
459+
return characters.charAt(FlxG.random.int(0, characters.length - 1));
460460
}
461+
}
461462
class DynamicColoredAlphabet extends ColoredAlphabet
462463
{
463464
private var originalText:String;
464465
private var preserveType:Bool;
465466
private var dynamicRainbow:Bool;
466467
private var rainbowThings:Array<flixel.addons.effects.chainable.FlxRainbowEffect>;
467-
468468
private var rainbowSettings = { index: 0, jump: 1 };
469469

470470
public function new(x:Float, y:Float, text:String = "", ?bold:Bool = true, ?color:FlxColor = 0xFFFFFF, PreserveType:Bool = false)
@@ -477,7 +477,7 @@ class ColoredAlphabet extends Alphabet
477477
override public function update(elapsed:Float):Void
478478
{
479479
super.update(elapsed);
480-
this.text = getRandomizedText();
480+
this.text = doShuffle ? getRandomizedText() : originalText;
481481
if (dynamicRainbow)
482482
{
483483
letters.forEachT(letter -> {

source/options/MixtapeSettingsSubState.hx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,7 @@ class MixtapeSettingsSubState extends BaseOptionsMenu
189189
ClientPrefs.data.pauseBPM = curBPMList[indeed];
190190
}
191191

192-
function onChangeMenuMusic()
193-
{
194-
Constants.changeMenuMusic(ClientPrefs.data.menuSong);
195-
changedMusic = true;
196-
}
192+
function onChangeMenuMusic() Constants.playMenuMusic(1);
197193

198194
override function update(e:Float)
199195
{
@@ -212,4 +208,9 @@ class MixtapeSettingsSubState extends BaseOptionsMenu
212208
ease: FlxEase.quadOut
213209
});
214210
}
211+
212+
override function destroy() {
213+
if (changedMusic) Constants.playMenuMusic(1);
214+
super.destroy();
215+
}
215216
}

source/states/FreeplayState.hx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,16 @@ import haxe.Json;
2828
import archipelago.PacketTypes.ClientStatus;
2929
import yutautil.ChanceSelector;
3030
import yutautil.ChanceSelector.Chance;
31+
import objects.Alphabet.DynamicAlphabet;
32+
import objects.Alphabet.DynamicColoredAlphabet;
33+
import yutautil.AprilFools;
3134

32-
class VictorySong extends ColoredAlphabet
35+
class VictorySong extends DynamicColoredAlphabet
3336
{
3437

35-
public function new(x:Float, y:Float, text:String, color:Int)
38+
public function new(x:Float, y:Float, text:String, color:Int, preserve:Bool)
3639
{
37-
super(x, y, text, color);
40+
super(x, y, text, color, preserve);
3841
}
3942

4043
var e:Int = 0;
@@ -704,10 +707,11 @@ class FreeplayState extends MusicBeatState
704707
if (APEntryState.inArchipelagoMode) {
705708
if (locationId.length > 0 && locationId.indexOf(0) == -1) {
706709
//trace('Song: ' + songName + ', Mod: ' + (modName != "" ? modName : "(not modded)") + ', Missing: ' + isMissing);
707-
songText = isVictorySong(songName, modName) ? (isMissing ? new VictorySong(90, 320, songName, color) : new ColoredAlphabet(90, 320, songName, true, 0xFFFFD700)) : new ColoredAlphabet(90, 320, songName, true, color);
710+
songText = isVictorySong(songName, modName) ? (isMissing ? new VictorySong(90, 320, songName, color, true) : new DynamicColoredAlphabet(90, 320, songName, true, 0xFFFFD700, true)) : new DynamicColoredAlphabet(90, 320, songName, true, color, true);
708711
} } else {
709-
songText = new Alphabet(90, 320, songs[i].songName, true);
712+
songText = new DynamicAlphabet(90, 320, songs[i].songName, true, true);
710713
}
714+
songText.doShuffle = AprilFools.allowAF ? FlxG.random.bool(songs.length*0.2) : true;
711715
songText.targetY = i;
712716
grpSongs.add(songText);
713717

@@ -1417,13 +1421,13 @@ class FreeplayState extends MusicBeatState
14171421
return null;
14181422
}
14191423

1420-
public function playFreakyMusic(?musName:String, ?bpm:Float = 102) {
1424+
public function playFreakyMusic(?musName:String, ?bpm:Float = 145) {
14211425
if (trackPlaying == musName)
14221426
return;
14231427

14241428
if (musName == null) {
1425-
trackPlaying = 'menu';
14261429
if (trackPlaying != 'menu') Constants.playMenuMusic(0);
1430+
trackPlaying = 'menu';
14271431
} else {
14281432
FlxG.sound.playMusic(Paths.music(musName), 0);
14291433
FlxG.sound.music.fadeIn(3, 0, 0.7);

source/states/TitleState.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class TitleState extends MusicBeatState
138138
{
139139
persistentUpdate = true;
140140
if (!initialized && FlxG.sound.music == null)
141-
Constants.changeMenuMusic(ClientPrefs.data.menuSong);
141+
Constants.setMenuMusic(ClientPrefs.data.menuSong);
142142

143143
loadJsonData();
144144
#if TITLE_SCREEN_EASTER_EGG easterEggData(); #end

0 commit comments

Comments
 (0)