Skip to content

Commit

Permalink
fixes and tweaks outside of the health drain fix
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesisfeline committed Dec 30, 2023
1 parent 47d3b64 commit 9ea18ad
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 37 deletions.
28 changes: 23 additions & 5 deletions Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@

<!-- ______________________ FOXA/PSYCH ENGINE CUSTOMIZATION ______________________ -->

<define name="MODS_ALLOWED" if="desktop || android" />
<define name="HSCRIPT_ALLOWED" if="desktop || android" />
<define name="LUA_ALLOWED" if="desktop || android" />
<define name="MODS_ALLOWED" if="desktop || mobile" />
<define name="HSCRIPT_ALLOWED" if="desktop || mobile" />
<define name="LUA_ALLOWED" if="desktop || mobile" />
<define name="CRASH_HANDLER" if="desktop" />
<define name="GITHUB_ALLOWED" />
<define name="ACHIEVEMENTS_ALLOWED" />
<define name="LOADING_SCREEN" /> <!-- i'll fix later-->
<define name="LOADING_SCREEN" />
<define name="VIDEOS_ALLOWED" if="windows || linux || android" unless="32bits" /><!-- wait why is there some hints of an official android port wtf -->
<define name="PSYCH_WATERMARKS" /> <!-- DELETE THIS TO REMOVE WATERMARKS/DEV NAMES ON TITLE SCREEN -->
<define name="TITLE_SCREEN_EASTER_EGG" /> <!-- DELETE THE if="officialBuild" for enabling this on an unofficial build -->
Expand All @@ -43,7 +43,7 @@
<window if="mac" orientation="auto" fullscreen="false" resizable="true" vsync="false" allow-high-dpi="true" />

<!--Mobile-specific-->
<window if="mobile" orientation="landscape" fullscreen="true" width="0" height="0" resizable="false" />
<window if="mobile" orientation="landscape" fullscreen="true" resizable="true" allow-shaders="true" require-shaders="true" allow-high-dpi="true" />

<!-- _____________________________ Path Settings ____________________________ -->

Expand Down Expand Up @@ -98,6 +98,9 @@
<haxelib name="flxanimate"/>
<haxelib name="tjson" />

<!-- Android tools required for external storage access -->
<haxelib name="extension-androidtools" if="android" />

<!-- Enables a terminal log prompt on debug builds -->
<haxelib name="hxcpp-debug-server" if="debug"/>
<haxedef name="HXC_LIBVLC_LOGGING" if="VIDEOS_ALLOWED debug" />
Expand Down Expand Up @@ -145,6 +148,21 @@
<!--Disables the use of precompiled headers but can cause issues with build times and memory usage-->
<haxedef name="NO_PRECOMPILED_HEADERS" if="linux" />

<!-- Android & iOS specifications -->
<section if="android">
<config>
<!--Gradle-->
<!--<android gradle-version="7.4.2" gradle-plugin="7.3.1" /-->
<!--Target SDK-->
<android target-sdk-version="28" />
</config>
</section>

<section if="ios">
<!--Dependency-->
<dependency name="Metal.framework" if="${lime &lt; 8.0.0}" />
</section>

<!-- _________________________________ Custom _______________________________ -->

<assets path='art/icon16.png' rename='icon.png' if="linux" />
Expand Down
12 changes: 6 additions & 6 deletions source/backend/Mods.hx
Original file line number Diff line number Diff line change
Expand Up @@ -105,24 +105,24 @@ class Mods
foldersToCheck.push(path + fileToFind);

#if MODS_ALLOWED
if(mods)
{
if(mods){
// Global mods first
for(mod in Mods.getGlobalMods())
{
for(mod in Mods.getGlobalMods()){
var folder:String = Paths.mods(mod + '/' + fileToFind);
if(FileSystem.exists(folder)) foldersToCheck.push(folder);
if(FileSystem.exists(folder) && !foldersToCheck.contains(folder)) foldersToCheck.push(folder);
}

// Then "PsychEngine/mods/" main folder
var folder:String = Paths.mods(fileToFind);
if(FileSystem.exists(folder)) foldersToCheck.push(Paths.mods(fileToFind));
if(FileSystem.exists(folder) && !foldersToCheck.contains(folder)) foldersToCheck.push(Paths.mods(fileToFind));

// And lastly, the loaded mod's folder
if(Mods.currentModDirectory != null && Mods.currentModDirectory.length > 0)
{
if(Mods.currentModDirectory != null && Mods.currentModDirectory.length > 0){
var folder:String = Paths.mods(Mods.currentModDirectory + '/' + fileToFind);
if(FileSystem.exists(folder)) foldersToCheck.push(folder);
if(FileSystem.exists(folder) && !foldersToCheck.contains(folder)) foldersToCheck.push(folder);
}
}
#end
Expand Down
6 changes: 3 additions & 3 deletions source/backend/WeekData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ class WeekData {
// HELP: Is there any way to convert a WeekFile to WeekData without having to put all variables there manually? I'm kind of a noob in haxe lmao
public function new(weekFile:WeekFile, fileName:String) {
// here ya go - MiguelItsOut
for (field in Reflect.fields(weekFile)) {
Reflect.setProperty(this, field, Reflect.getProperty(weekFile, field));
}
for (field in Reflect.fields(weekFile))
if(Reflect.fields(this).contains(field)) // Reflect.hasField() won't fucking work :/
Reflect.setProperty(this, field, Reflect.getProperty(weekFile, field));

this.fileName = fileName;
}
Expand Down
17 changes: 11 additions & 6 deletions source/openfl/display/FPS.hx
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,21 @@ class FPS extends TextField
@:noCompletion
private #if !flash override #end function __enterFrame(deltaTime:Float):Void
{
if(deltaTimeout > 1000) {
// there's no need to update this every frame and it only causes performance losses.
// prevents the overlay from updating every frame, why would you need to anyways
if (deltaTimeout > 1000) {
deltaTimeout = 0.0;
return;
}
currentTime += deltaTime;
times.push(currentTime);
while(times[0] < currentTime - 1000) times.shift();

currentFPS = currentFPS < FlxG.updateFramerate ? times.length : FlxG.updateFramerate;
var now:Float = haxe.Timer.stamp();
final now:Float = haxe.Timer.stamp() * 1000;
times.push(now);
while (times[0] < now - 1000)
times.shift();
while (times[0] < now - 1000) times.shift();

currentFPS = currentFPS < FlxG.updateFramerate ? times.length : FlxG.updateFramerate;
currentFPS = times.length < FlxG.updateFramerate ? times.length : FlxG.updateFramerate;

if(currentFPS > ClientPrefs.data.framerate) currentFPS = ClientPrefs.data.framerate;

Expand Down
2 changes: 1 addition & 1 deletion source/states/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ class FreeplayState extends MusicBeatState {
player.switchPlayMusic();

FlxG.sound.playMusic(Paths.music('freakyMenu'), 0);
FlxTween.tween(FlxG.sound, {volume: 1}, 2);
FlxTween.tween(FlxG.sound.music, {volume: 1}, 1);
}else{
persistentUpdate = false;
if(colorTween != null) colorTween.cancel();
Expand Down
14 changes: 7 additions & 7 deletions source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2814,13 +2814,13 @@ class PlayState extends MusicBeatState
if(releaseArray[i] || strumsBlocked[i] == true) keyReleased(i);
}

function noteMiss(daNote:Note):Void{ // You didn't hit the key and let it go offscreen, also used by Hurt Notes
function noteMiss(daNote:Note):Void { //You didn't hit the key and let it go offscreen, also used by Hurt Notes
//Dupe note remove
notes.forEachAlive(function(note:Note) {
if(daNote != note && daNote.mustPress && daNote.noteData == note.noteData && daNote.isSustainNote == note.isSustainNote && Math.abs(daNote.strumTime - note.strumTime) < 1)
if (daNote != note && daNote.mustPress && daNote.noteData == note.noteData && daNote.isSustainNote == note.isSustainNote && Math.abs(daNote.strumTime - note.strumTime) < 1)
invalidateNote(note);
});

noteMissCommon(daNote.noteData, daNote);
var result:Dynamic = callOnLuas('noteMiss', [notes.members.indexOf(daNote), daNote.noteData, daNote.noteType, daNote.isSustainNote]);
if(result != FunkinLua.Function_Stop && result != FunkinLua.Function_StopHScript && result != FunkinLua.Function_StopAll) callOnHScript('noteMiss', [daNote]);
Expand Down Expand Up @@ -2868,8 +2868,8 @@ class PlayState extends MusicBeatState
}
if (note != null && guitarHeroSustains && note.parent != null && note.isSustainNote) {
if (note.missed)
return;
return;

var parentNote:Note = note.parent;
if (parentNote.wasGoodHit && parentNote.tail.length > 0) {
for (child in parentNote.tail) if (child != note) {
Expand Down Expand Up @@ -2899,15 +2899,15 @@ class PlayState extends MusicBeatState
// play character anims
var char:Character = boyfriend;
if((note != null && note.gfNote) || (SONG.notes[curSection] != null && SONG.notes[curSection].gfSection)) char = gf;

if(char != null && (note == null || !note.noMissAnimation) && char.hasMissAnimations)
{
var suffix:String = '';
if(note != null) suffix = note.animSuffix;

var animToPlay:String = singAnimations[Std.int(Math.abs(Math.min(singAnimations.length-1, direction)))] + 'miss' + suffix;
char.playAnim(animToPlay, true);

if(char != gf && lastCombo > 5 && gf != null && gf.animOffsets.exists('sad'))
{
gf.playAnim('sad');
Expand Down
2 changes: 1 addition & 1 deletion source/states/editors/CharacterEditorState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ class CharacterEditorState extends MusicBeatState
if (data.length > 0)
{
_file = new FileReference();
_file.addEventListener(Event.COMPLETE, onSaveComplete);
_file.addEventListener(#if desktop Event.SELECT #else Event.COMPLETE #end, onSaveComplete);
_file.addEventListener(Event.CANCEL, onSaveCancel);
_file.addEventListener(IOErrorEvent.IO_ERROR, onSaveError);
_file.save(data, '$_char.json');
Expand Down
21 changes: 13 additions & 8 deletions source/substates/PauseSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ class PauseSubState extends MusicBeatSubstate
var missingTextBG:FlxSprite;
var missingText:FlxText;

public static var songName:String = '';
public static var songName:String = null;

public function new(x:Float, y:Float)
{
public function new(x:Float, y:Float) {
super();
if(Difficulty.list.length < 2) menuItemsOG.remove('Change Difficulty'); //No need to change difficulty if there is only one!

Expand Down Expand Up @@ -69,11 +68,17 @@ class PauseSubState extends MusicBeatSubstate


pauseMusic = new FlxSound();
if(songName != null) {
pauseMusic.loadEmbedded(Paths.music(songName), true, true);
} else if (songName != 'None') {
pauseMusic.loadEmbedded(Paths.music(Paths.formatToSongPath(ClientPrefs.data.pauseMusic)), true, true);
}
try
{
if(songName == null || songName.toLowerCase() != 'none'){
if(songName == null){
var path:String = Paths.formatToSongPath(ClientPrefs.data.pauseMusic);
if(path.toLowerCase() != 'none')
pauseMusic.loadEmbedded(Paths.music(Paths.formatToSongPath(ClientPrefs.data.pauseMusic)), true, true);
}
else pauseMusic.loadEmbedded(Paths.music(songName), true, true);
}
} catch(e:Dynamic) {}
pauseMusic.volume = 0;
pauseMusic.play(false, FlxG.random.int(0, Std.int(pauseMusic.length / 2)));

Expand Down

0 comments on commit 9ea18ad

Please sign in to comment.