Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed some more issues + Mods folder stuff #15422

Open
wants to merge 4 commits into
base: experimental
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,16 @@ class Main extends Sprite
}
#end

#if !MODS_ALLOWED
final path:String = 'mods';
if (sys.FileSystem.exists(path) && sys.FileSystem.isDirectory(path))
{
var entries = sys.FileSystem.readDirectory(path);
for (entry in entries) sys.FileSystem.deleteFile(path + '/' + entry);
FileSystem.deleteDirectory(path);
}
#end

#if linux
var icon = Image.fromFile("icon.png");
Lib.current.stage.window.setIcon(icon);
Expand Down
2 changes: 1 addition & 1 deletion source/objects/Character.hx
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ class Character extends FlxSprite
if (hasAnimation(AnimName))
{
var daOffset = animOffsets.get(AnimName);
offset.set(daOffset[0], daOffset[1]);
offset.set(daOffset[0] * scale.x, daOffset[1] * scale.y);
}
//else offset.set(0, 0);

Expand Down
2 changes: 1 addition & 1 deletion source/objects/MenuCharacter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class MenuCharacter extends FlxSprite
scale.set(charFile.scale, charFile.scale);
updateHitbox();
}
offset.set(charFile.position[0], charFile.position[1]);
offset.set(charFile.position[0] * scale.x, charFile.position[1] * scale.y);
animation.play('idle');

antialiasing = (charFile.antialiasing != false && ClientPrefs.data.antialiasing);
Expand Down
2 changes: 2 additions & 0 deletions source/options/LanguageSubState.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package options;

import openfl.Assets;

class LanguageSubState extends MusicBeatSubstate
{
#if TRANSLATIONS_ALLOWED
Expand Down
9 changes: 8 additions & 1 deletion source/states/FreeplayState.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package states;

import openfl.Assets;
import backend.WeekData;
import backend.Highscore;
import backend.Song;
Expand Down Expand Up @@ -69,7 +70,10 @@ class FreeplayState extends MusicBeatState
persistentUpdate = false;
MusicBeatState.switchState(new states.ErrorState("NO WEEKS ADDED FOR FREEPLAY\n\nPress ACCEPT to go to the Week Editor Menu.\nPress BACK to return to Main Menu.",
function() MusicBeatState.switchState(new states.editors.WeekEditorState()),
function() MusicBeatState.switchState(new states.MainMenuState())));
function() {
FlxG.sound.play(Paths.sound('cancelMenu'));
MusicBeatState.switchState(new states.MainMenuState());
}));
return;
}

Expand Down Expand Up @@ -215,7 +219,10 @@ class FreeplayState extends MusicBeatState
override function update(elapsed:Float)
{
if(WeekData.weeksList.length < 1)
{
super.update(elapsed);
return;
}

if (FlxG.sound.music.volume < 0.7)
FlxG.sound.music.volume += 0.5 * FlxG.elapsed;
Expand Down
17 changes: 9 additions & 8 deletions source/states/StoryMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ class StoryMenuState extends MusicBeatState
persistentUpdate = false;
MusicBeatState.switchState(new states.ErrorState("NO WEEKS ADDED FOR STORY MODE\n\nPress ACCEPT to go to the Week Editor Menu.\nPress BACK to return to Main Menu.",
function() MusicBeatState.switchState(new states.editors.WeekEditorState()),
function() MusicBeatState.switchState(new states.MainMenuState())));
function() {
FlxG.sound.play(Paths.sound('cancelMenu'));
movedBack = true;
MusicBeatState.switchState(new states.MainMenuState());
}));
return;
}

Expand Down Expand Up @@ -196,14 +200,8 @@ class StoryMenuState extends MusicBeatState

override function update(elapsed:Float)
{
if(grpWeekText.length < 1)
if(WeekData.weeksList.length < 1)
{
if (controls.BACK && !movedBack && !selectedWeek)
{
FlxG.sound.play(Paths.sound('cancelMenu'));
movedBack = true;
MusicBeatState.switchState(new MainMenuState());
}
super.update(elapsed);
return;
}
Expand Down Expand Up @@ -326,6 +324,9 @@ class StoryMenuState extends MusicBeatState
catch(e:Dynamic)
{
trace('ERROR! $e');

FlxG.sound.play(Paths.sound('cancelMenu'));
selectedWeek = false;
return;
}

Expand Down
3 changes: 2 additions & 1 deletion source/states/editors/CharacterEditorState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ class CharacterEditorState extends MusicBeatState implements PsychUIEventHandler
spr.scale.set(character.scale.x, character.scale.y);
spr.updateHitbox();

spr.offset.set(character.offset.x, character.offset.y);
spr.offset.set(character.offset.x * spr.scale.x, character.offset.y * spr.scale.y);
spr.visible = true;

var otherSpr:FlxSprite = (spr == animateGhost) ? ghost : animateGhost;
Expand Down Expand Up @@ -736,6 +736,7 @@ class CharacterEditorState extends MusicBeatState implements PsychUIEventHandler
character.jsonScale = sender.value;
character.scale.set(character.jsonScale, character.jsonScale);
character.updateHitbox();
character.playAnim(anims[curAnim].anim, true);
updatePointerPos(false);
unsavedProgress = true;
}
Expand Down
1 change: 1 addition & 0 deletions source/states/editors/ChartingState.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package states.editors;

import openfl.Assets as OpenFlAssets;
import flixel.FlxSubState;
import flixel.util.FlxSave;
import flixel.util.FlxSort;
Expand Down
4 changes: 2 additions & 2 deletions source/states/editors/DialogueCharacterEditorState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,8 @@ class DialogueCharacterEditorState extends MusicBeatState implements PsychUIEven
if(moved) {
offsetLoopText.text = 'Loop: ' + animShit.loop_offsets;
offsetIdleText.text = 'Idle: ' + animShit.idle_offsets;
ghostLoop.offset.set(animShit.loop_offsets[0], animShit.loop_offsets[1]);
ghostIdle.offset.set(animShit.idle_offsets[0], animShit.idle_offsets[1]);
ghostLoop.offset.set(animShit.loop_offsets[0] * ghostLoop.scale.x, animShit.loop_offsets[1] * ghostLoop.scale.x);
ghostIdle.offset.set(animShit.idle_offsets[0] * ghostLoop.scale.y, animShit.idle_offsets[1] * ghostLoop.scale.y);
}
}

Expand Down
1 change: 1 addition & 0 deletions source/states/editors/StageEditorState.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package states.editors;

import openfl.Assets;
import backend.StageData;
import backend.PsychCamera;
import objects.Character;
Expand Down
Loading