Skip to content

Commit

Permalink
changes and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vortex2Oblivion committed Sep 6, 2024
1 parent 32c5686 commit 27731c0
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 113 deletions.
14 changes: 3 additions & 11 deletions assets/preload/data/character data/gf-tankmen/offsets.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cheer 0 0
sad -2 -21
danceLeft 0 -9
danceRight 0 -9
singUP 0 4
singRIGHT 0 -20
singLEFT 0 -19
singDOWN 0 -20
hairBlow 45 -8
hairFall 0 -9
scared -2 -17
danceRight 0 -9
danceLeft 0 -9
sad 0 -27
4 changes: 4 additions & 0 deletions source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class Main extends Sprite {
Lib.current.loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, onCrash);
#end

#if cpp
untyped __global__.__hxcpp_set_critical_error_handler(onCrash); //this is important i guess?
#end

CoolUtil.haxe_trace = Log.trace;
Log.trace = CoolUtil.haxe_print;

Expand Down
4 changes: 2 additions & 2 deletions source/game/Song.hx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ typedef SwagSong = SongLoader.SongData;
* Compatibility class for fnf-modcharting-tools.
**/
class Song {
public static function loadFromJson(name:String):SwagSong {
return SongLoader.loadFromJson(name, name);
public static function loadFromJson(name:String, ?folder:String):SwagSong {
return SongLoader.loadFromJson(name, folder ?? name);
}
}
2 changes: 1 addition & 1 deletion source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1664,7 +1664,7 @@ class PlayState extends MusicBeatState {
var sustainGroup:Array<Note> = [];

for (susNote in 0...Math.floor(swagNote.sustainLength / Std.int(Conductor.stepCrochet))) {
oldNote = unspawnNotes[Std.int(unspawnNotes.length - 1)];
oldNote = unspawnNotes[unspawnNotes.length - 1];

var sustainNote:Note = new Note(daStrumTime + (Conductor.stepCrochet * susNote) + Conductor.stepCrochet, noteData, oldNote, true, char,
songNotes[4], null, chars, gottaHitNote);
Expand Down
1 change: 0 additions & 1 deletion source/substates/PauseSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class PauseSubState extends MusicBeatSubstate {
var pauseCamera:FlxCamera = new FlxCamera();

var curTime:Float = Math.max(0, Conductor.songPosition);
var skipTimeTracker:Alphabet;

public function new() {
super();
Expand Down
77 changes: 37 additions & 40 deletions source/substates/ScrollSpeedMenu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -8,57 +8,54 @@ import flixel.util.FlxColor;
import flixel.FlxG;
import flixel.FlxSprite;

class ScrollSpeedMenu extends MusicBeatSubstate
{
var alpha_Value:Float = 0.0;
var offsetText:FlxText = new FlxText(0,0,0,"Scrollspeed: 0",64).setFormat(Paths.font("vcr.ttf"), 64, FlxColor.WHITE, CENTER, OUTLINE, FlxColor.BLACK);
class ScrollSpeedMenu extends MusicBeatSubstate {
var alpha_Value:Float = 0.0;
var offsetText:FlxText = new FlxText(0, 0, 0, "Scrollspeed: 0", 64).setFormat(Paths.font("vcr.ttf"), 64, FlxColor.WHITE, CENTER, OUTLINE, FlxColor.BLACK);

public function new()
{
super();
public function new() {
super();

alpha_Value = Options.getData("customScrollSpeed");

var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
bg.alpha = 0;
bg.scrollFactor.set();
add(bg);
alpha_Value = Options.getData("customScrollSpeed");

FlxTween.tween(bg, {alpha: 0.5}, 1, {ease: FlxEase.circOut, startDelay: 0});
var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
bg.alpha = 0;
bg.scrollFactor.set();
add(bg);

offsetText.text = "Scrollspeed: " + alpha_Value;
offsetText.screenCenter();
add(offsetText);
}
FlxTween.tween(bg, {alpha: 0.5}, 1, {ease: FlxEase.circOut, startDelay: 0});

override function update(elapsed:Float) {
super.update(elapsed);
offsetText.text = "Scrollspeed: " + alpha_Value;
offsetText.screenCenter();
add(offsetText);
}

var leftP = controls.LEFT_P;
override function update(elapsed:Float) {
super.update(elapsed);

var leftP = controls.LEFT_P;
var rightP = controls.RIGHT_P;

var back = controls.BACK;
var back = controls.BACK;

if(back)
{
Options.setData(alpha_Value, "customScrollSpeed");
FlxG.state.closeSubState();
}
if (back) {
Options.setData(alpha_Value, "customScrollSpeed");
FlxG.state.closeSubState();
}

if(leftP)
alpha_Value -= 0.1;
if(rightP)
alpha_Value += 0.1;
if (leftP)
alpha_Value -= 0.1;
if (rightP)
alpha_Value += 0.1;

alpha_Value = FlxMath.roundDecimal(alpha_Value, 1);
alpha_Value = FlxMath.roundDecimal(alpha_Value, 1);

if(alpha_Value > 10)
alpha_Value = 10;
if (alpha_Value > 10)
alpha_Value = 10;

if(alpha_Value < 0.1)
alpha_Value = 0.1;
if (alpha_Value < 0.1)
alpha_Value = 0.1;

offsetText.text = "Scrollspeed: " + alpha_Value;
offsetText.screenCenter();
}
}
offsetText.text = "Scrollspeed: " + alpha_Value;
offsetText.screenCenter();
}
}
6 changes: 3 additions & 3 deletions source/substates/UISkinSelect.hx
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ class UISkinSelect extends MusicBeatSubstate

Note.swagWidth = 160 * 0.7;

var arrow_Tex:FlxAtlasFrames;

arrow_Tex = Paths.getSparrowAtlas('ui skins/' + ui_Skin + "/arrows/default", 'shared');
var arrow_Tex:FlxAtlasFrames = Assets.exists('assets/shared/images/ui skins/$ui_Skin/arrows/strums.png') ?
Paths.getSparrowAtlas('ui skins/' + ui_Skin + "/arrows/strums", 'shared') :
Paths.getSparrowAtlas('ui skins/' + ui_Skin + "/arrows/default", 'shared');

for (i in 0...key_Count)
{
Expand Down
94 changes: 47 additions & 47 deletions source/toolbox/ChartingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ChartingState extends MusicBeatState {
var dummyArrow:FlxSprite;

var curRenderedNotes:FlxTypedGroup<Note>;
var curRenderedSustains:FlxTypedGroup<FlxSprite>;
var curRenderedSustains:FlxTypedGroup<Note>;
var curRenderedIds:FlxTypedGroup<FlxSprite>;
var curRenderedEvents:FlxTypedGroup<EventSprite>;

Expand Down Expand Up @@ -225,7 +225,7 @@ class ChartingState extends MusicBeatState {
add(gridEventBlackLine);

curRenderedNotes = new FlxTypedGroup<Note>();
curRenderedSustains = new FlxTypedGroup<FlxSprite>();
curRenderedSustains = new FlxTypedGroup<Note>();
curRenderedEvents = new FlxTypedGroup<EventSprite>();
curRenderedIds = new FlxTypedGroup<FlxSprite>();

Expand All @@ -234,11 +234,8 @@ class ChartingState extends MusicBeatState {
else
_song = SongLoader.loadFromJson("normal", "tutorial");

@:privateAccess
{
for (event in PlayState.instance.baseEvents) {
events.push(event);
}
for (event in PlayState.instance.baseEvents) {
events.push(event);
}

_song.events = [];
Expand Down Expand Up @@ -284,9 +281,7 @@ class ChartingState extends MusicBeatState {
{name: "Events", label: "Events"}
];

var rawEventList = CoolUtil.coolTextFile(Paths.txt("eventList"));

for (event in rawEventList) {
for (event in CoolUtil.coolTextFile(Paths.txt("eventList"))) {
var eventData = event.split("~");

eventListData.push(eventData);
Expand All @@ -312,15 +307,22 @@ class ChartingState extends MusicBeatState {
updateHeads();
updateGrid();

new FlxTimer().start(Options.getData("backupDuration") * 60, backupChart, 0);
new FlxTimer().start(Options.getData("backupDuration") * 60, backupEvents, 0);
new FlxTimer().start(Options.getData("backupDuration") * 60, _backup, 0);

FlxG.sound.cache(Paths.sound('CLAP'));
FlxG.sound.cache(Paths.sound('snap'));

super.create();

loadedAutosave = false;
}

private function backupChart(_):Void {
private function _backup(_) {
backupChart();
backupEvents();
}

private function backupChart():Void {
trace("trying to make a backup of the chart...");
var json:Dynamic;
var date:String = Date.now().toString();
Expand Down Expand Up @@ -349,7 +351,7 @@ class ChartingState extends MusicBeatState {
}
}

private function backupEvents(_):Void {
private function backupEvents():Void {
trace("trying to make a backup of the events...");
var json:Dynamic;
var date:String = Date.now().toString();
Expand Down Expand Up @@ -531,16 +533,6 @@ class ChartingState extends MusicBeatState {
updateGrid();
});

var compatibilityLabel = new FlxText(10, 540, 0, "Compatibility", 9);

var finalDestinationButton:FlxButton = new FlxButton(10, 560, "Final Dest", function() {
for (i in 0..._song.notes.length) {
convertSectionToShaggy(i);
}

updateGrid();
});

// labels

var songNameLabel = new FlxText(UI_songTitle.x + UI_songTitle.width + 1, UI_songTitle.y, 0, "Song Name", 9);
Expand Down Expand Up @@ -597,7 +589,6 @@ class ChartingState extends MusicBeatState {
#if FLX_PITCH
tab_group_song.add(slider_playback_speed);
#end
tab_group_song.add(compatibilityLabel);

// tab_group_song.add(lilBuddiesBox);

Expand Down Expand Up @@ -1079,6 +1070,10 @@ class ChartingState extends MusicBeatState {
FlxG.sound.music.time = 0;
changeSection();
};

for (i in 0..._song.notes.length) {
convertSectionToShaggy(i);
}
}

#if FLX_PITCH
Expand Down Expand Up @@ -1887,7 +1882,7 @@ class ChartingState extends MusicBeatState {
NoteVariables.Other_Note_Anim_Stuff[_song.keyCount - 1][note.noteData] + "0", 12);
note.sustainLength = daSus;

note.setGraphicSize((Std.parseInt(PlayState.instance.arrow_Configs.get(daType)[4]) != null ? Std.parseInt(PlayState.instance.arrow_Configs.get(daType)[4]) : 0),
note.setGraphicSize((Std.parseInt(PlayState.instance.arrow_Configs.get(daType)[4]) ?? Std.parseInt(PlayState.instance.arrow_Configs.get(daType)[4])),
Std.parseInt(PlayState.instance.arrow_Configs.get(daType)[2]));
note.updateHitbox();

Expand Down Expand Up @@ -1918,33 +1913,38 @@ class ChartingState extends MusicBeatState {
curRenderedIds.add(id);
}

if (daSus > 0) {
var sustainVis:FlxSprite = new FlxSprite(note.x
+ (GRID_SIZE / 2)
- Std.parseFloat(PlayState.instance.arrow_Configs.get(daType)[1]),
note.y
+ GRID_SIZE
- Std.parseFloat(PlayState.instance.arrow_Configs.get(daType)[3])).makeGraphic(8,
Math.floor(FlxMath.remapToRange(daSus, 0, Conductor.stepCrochet * Conductor.stepsPerSection, 0, gridBG.height)));
sustainVis.color = note.affectedbycolor ? FlxColor.fromRGB(Std.int(note.colorSwap.r), Std.int(note.colorSwap.g),
Std.int(note.colorSwap.b)) : CoolUtil.dominantColorFrame(note);
curRenderedSustains.add(sustainVis);
var sustainGroup:Array<Note> = [];
for (susNote in 0...Math.floor(note.sustainLength / Std.int(Conductor.stepCrochet))) {
var oldNote = curRenderedNotes.members[curRenderedNotes.members.length - 1];
var sustainNote:Note = new Note(daStrumTime + (Conductor.stepCrochet * susNote) + Conductor.stepCrochet, goodNoteInfo, oldNote, true, 0,
daType, _song, [0], mustPress, true);
sustainNote.setGraphicSize(sustainNote.width / 3, 40);
sustainNote.updateHitbox();
sustainNote.x = note.x + (GRID_SIZE / 2) - Std.parseFloat(PlayState.instance.arrow_Configs.get(daType)[1]) - sustainNote.width / 2;
sustainNote.y = note.height
+ Math.floor(getYfromStrum((oldNote.strumTime - sectionStartTime())) + Std.parseFloat(PlayState.instance.arrow_Configs.get(daType)[3]));
curRenderedNotes.add(sustainNote);

sustainGroup.push(sustainNote);
sustainNote.sustains = sustainGroup;
}
}
note.sustains = sustainGroup;

if (events.length >= 1) {
for (event in events) {
if (Std.int(event[1]) >= Std.int(sectionStartTime()) && Std.int(event[1]) < Std.int(sectionStartTime(curSection + 1))) {
var eventSprite:EventSprite = new EventSprite(event[1]);
if (events.length >= 1) {
for (event in events) {
if (Std.int(event[1]) >= Std.int(sectionStartTime())
&& Std.int(event[1]) < Std.int(sectionStartTime(curSection + 1))) {
var eventSprite:EventSprite = new EventSprite(event[1]);

eventSprite.loadGraphic(Paths.image("charter/eventSprite", "shared"));
eventSprite.loadGraphic(Paths.image("charter/eventSprite", "shared"));

eventSprite.setGraphicSize(GRID_SIZE, GRID_SIZE);
eventSprite.updateHitbox();
eventSprite.setGraphicSize(GRID_SIZE, GRID_SIZE);
eventSprite.updateHitbox();

eventSprite.y = Math.floor(getYfromStrum((event[1] - sectionStartTime()) % (Conductor.stepCrochet * Conductor.stepsPerSection)));
eventSprite.y = Math.floor(getYfromStrum((event[1] - sectionStartTime()) % (Conductor.stepCrochet * Conductor.stepsPerSection)));

curRenderedEvents.add(eventSprite);
curRenderedEvents.add(eventSprite);
}
}
}
}
Expand Down
18 changes: 10 additions & 8 deletions source/utilities/EventHandeler.hx
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,16 @@ class EventHandeler {
game.addBgStuff();
}
case "change keycount":
var toChange:Int = Std.parseInt(event[2]);
var toChangeAlt:Int = Std.parseInt(event[3]);
if (toChange < 1 || Math.isNaN(toChange))
toChange = 1;
var newPlayerKeyCount:Int = Std.parseInt(event[2]);
var newKeyCount:Int = Std.parseInt(event[3]);
if (newPlayerKeyCount < 1 || Math.isNaN(newPlayerKeyCount))
newPlayerKeyCount = 1;

if (toChangeAlt < 1 || Math.isNaN(toChangeAlt))
toChangeAlt = 1;
if (newKeyCount < 1 || Math.isNaN(newKeyCount))
newKeyCount = 1;

PlayState.SONG.keyCount = toChangeAlt;
PlayState.SONG.playerKeyCount = toChange;
PlayState.SONG.keyCount = newKeyCount;
PlayState.SONG.playerKeyCount = newPlayerKeyCount;
PlayState.playerStrums.clear();
PlayState.enemyStrums.clear();
PlayState.strumLineNotes.clear();
Expand All @@ -250,6 +250,8 @@ class EventHandeler {
}
}
#if LUA_ALLOWED
game.setLuaVar("playerKeyCount", newPlayerKeyCount);
game.setLuaVar("keyCount", newKeyCount);
for (i in 0...PlayState.strumLineNotes.length) {
var member = PlayState.strumLineNotes.members[i];

Expand Down

0 comments on commit 27731c0

Please sign in to comment.