Merge changes from main (#892)
* repair ScriptableShader.shader = null (#877) * optimize updateInput (#878) * optimize updateInput * resize optimize * __notePerStrum optimize * Update StrumLine.hx * NoteGroup optimize (#881) * NoteGroup optimize * CoolUtil.bound faster * makes commit with github desktop W FRAKITS * Use fastSinCos for notes (#889) * Update Strum.hx * Update Strum.hx --------- Co-authored-by: HEIHUAa <112499486+HEIHUAa@users.noreply.github.com> Co-authored-by: Frakits <90983918+Frakits@users.noreply.github.com>
This commit is contained in:
co-authored by
HEIHUAa
Frakits
parent
e9dc588b30
commit
33070946bd
+1
-1
@@ -73,7 +73,7 @@ _**QOL = Quality of Life**_
|
||||
- If you need to rearrange the weeks in-game, you can use the `data/weeks/weeks.txt` file.
|
||||
- Editors for Charts and Characters (Stage coming soon)
|
||||
- Undos/Redos supported
|
||||
- Warning on closing unsaved work
|
||||
- Warning on closing unsaved work.
|
||||
- Clean UI (for ocd freaks)
|
||||
- Mature Chart editor (Character editor rework soon)
|
||||
- Features not found in other editors!
|
||||
|
||||
@@ -30,6 +30,8 @@ class ScriptableShader extends FlxBasic implements IHScriptCustomBehaviour {
|
||||
if((shader is CustomShader)) scriptName = cast(shader, CustomShader).fileName;
|
||||
else throw "Missing name for shader script, please provide a scriptName, or use CustomShader";
|
||||
|
||||
this.shader = shader;
|
||||
|
||||
script = Script.create(Paths.script('shaders/$scriptName'));
|
||||
script.setParent(shader);
|
||||
script.set("shader", shader);
|
||||
|
||||
@@ -311,7 +311,7 @@ class Note extends FlxSprite
|
||||
}
|
||||
|
||||
public function updateSustainClip() if (wasGoodHit && !noSustainClip) {
|
||||
var t = FlxMath.bound((Conductor.songPosition - strumTime) / height * 0.45 * lastScrollSpeed, 0, 1);
|
||||
var t = CoolUtil.bound((Conductor.songPosition - strumTime) / height * 0.45 * lastScrollSpeed, 0, 1);
|
||||
var rect = clipRect == null ? FlxRect.get() : clipRect;
|
||||
clipRect = rect.set(0, frameHeight * t, frameWidth, frameHeight * (1 - t));
|
||||
}
|
||||
|
||||
@@ -53,14 +53,11 @@ class NoteGroup extends FlxTypedGroup<Note> {
|
||||
public override function update(elapsed:Float) {
|
||||
i = length-1;
|
||||
__loopSprite = null;
|
||||
__time = __getSongPos();
|
||||
__time = __getSongPos() + limit;
|
||||
while(i >= 0) {
|
||||
__loopSprite = members[i--];
|
||||
if (__loopSprite == null || !__loopSprite.exists || !__loopSprite.active) {
|
||||
continue;
|
||||
}
|
||||
if (__loopSprite.strumTime - __time > limit)
|
||||
break;
|
||||
if (__loopSprite == null || !__loopSprite.exists || !__loopSprite.active) continue;
|
||||
if (__loopSprite.strumTime > __time) break;
|
||||
__loopSprite.update(elapsed);
|
||||
}
|
||||
}
|
||||
@@ -74,12 +71,11 @@ class NoteGroup extends FlxTypedGroup<Note> {
|
||||
|
||||
i = length-1;
|
||||
__loopSprite = null;
|
||||
__time = __getSongPos();
|
||||
__time = __getSongPos() + limit;
|
||||
while(i >= 0) {
|
||||
__loopSprite = members[i--];
|
||||
if (__loopSprite == null || !__loopSprite.exists || !__loopSprite.visible)
|
||||
continue;
|
||||
if (__loopSprite.strumTime - __time > limit) break;
|
||||
if (__loopSprite == null || !__loopSprite.exists || !__loopSprite.visible) continue;
|
||||
if (__loopSprite.strumTime > __time) break;
|
||||
__loopSprite.draw();
|
||||
}
|
||||
__currentlyLooping = oldCur;
|
||||
@@ -97,16 +93,15 @@ class NoteGroup extends FlxTypedGroup<Note> {
|
||||
public override function forEach(noteFunc:Note->Void, recursive:Bool = false) {
|
||||
i = length-1;
|
||||
__loopSprite = null;
|
||||
__time = __getSongPos();
|
||||
__time = __getSongPos() + limit;
|
||||
|
||||
var oldCur = __currentlyLooping;
|
||||
__currentlyLooping = true;
|
||||
|
||||
while(i >= 0) {
|
||||
__loopSprite = members[i--];
|
||||
if (__loopSprite == null || !__loopSprite.exists)
|
||||
continue;
|
||||
if (__loopSprite.strumTime - __time > limit) break;
|
||||
if (__loopSprite == null || !__loopSprite.exists) continue;
|
||||
if (__loopSprite.strumTime > __time) break;
|
||||
noteFunc(__loopSprite);
|
||||
}
|
||||
__currentlyLooping = oldCur;
|
||||
|
||||
@@ -174,8 +174,9 @@ class Strum extends FlxSprite {
|
||||
if (daNote.isSustainNote) offset.y -= height * 0.5;
|
||||
|
||||
if (Std.int(daNote.__noteAngle % 360) != 0) {
|
||||
var noteAngleCos = FlxMath.fastCos(daNote.__noteAngle / PIX180);
|
||||
var noteAngleSin = FlxMath.fastSin(daNote.__noteAngle / PIX180);
|
||||
var noteAngle = FlxMath.fastSinCos(daNote.__noteAngle / PIX180);
|
||||
var noteAngleCos = noteAngle.cos;
|
||||
var noteAngleSin = noteAngle.sin;
|
||||
|
||||
var aOffset:FlxPoint = FlxPoint.get(
|
||||
(daNote.origin.x / daNote.scale.x) - daNote.offset.x,
|
||||
|
||||
@@ -253,7 +253,7 @@ class StrumLine extends FlxTypedGroup<Strum> {
|
||||
var __notePerStrum:Array<Note> = [];
|
||||
|
||||
function __inputProcessPressed(note:Note) {
|
||||
if (__pressed[note.strumID] && note.isSustainNote && note.sustainParent.wasGoodHit && note.strumTime < __updateNote_songPos && !note.wasGoodHit) {
|
||||
if (__pressed[note.strumID] && note.isSustainNote && note.strumTime < __updateNote_songPos && !note.wasGoodHit && note.sustainParent.wasGoodHit) {
|
||||
PlayState.instance.goodNoteHit(this, note);
|
||||
}
|
||||
}
|
||||
@@ -284,9 +284,11 @@ class StrumLine extends FlxTypedGroup<Strum> {
|
||||
|
||||
if (cpu) return;
|
||||
|
||||
__pressed.resize(members.length);
|
||||
__justPressed.resize(members.length);
|
||||
__justReleased.resize(members.length);
|
||||
if (__pressed.length != members.length) {
|
||||
__pressed.resize(members.length);
|
||||
__justPressed.resize(members.length);
|
||||
__justReleased.resize(members.length);
|
||||
}
|
||||
|
||||
for (i in 0...members.length) {
|
||||
__pressed[i] = members[i].__getPressed(this);
|
||||
@@ -304,17 +306,17 @@ class StrumLine extends FlxTypedGroup<Strum> {
|
||||
|
||||
__notePerStrum = cast new haxe.ds.Vector(members.length); // [for(_ in 0...members.length) null];
|
||||
|
||||
if (__justPressed.contains(true)) {
|
||||
notes.forEachAlive(__inputProcessJustPressed);
|
||||
|
||||
if (!ghostTapping) for (k => pr in __justPressed) if (pr && __notePerStrum[k] == null)
|
||||
PlayState.instance.noteMiss(this, null, k, ID); // FUCK YOU
|
||||
}
|
||||
|
||||
if (__pressed.contains(true)) {
|
||||
for (e in __notePerStrum)
|
||||
if (e != null)
|
||||
PlayState.instance.goodNoteHit(this, e);
|
||||
if (__justPressed.contains(true)) {
|
||||
notes.forEachAlive(__inputProcessJustPressed);
|
||||
|
||||
if (!ghostTapping) for (k => pr in __justPressed) if (pr && __notePerStrum[k] == null)
|
||||
PlayState.instance.noteMiss(this, null, k, ID); // FUCK YOU
|
||||
|
||||
for (e in __notePerStrum)
|
||||
if (e != null)
|
||||
PlayState.instance.goodNoteHit(this, e);
|
||||
}
|
||||
|
||||
for (c in characters)
|
||||
if (c.lastAnimContext != DANCE)
|
||||
@@ -324,7 +326,7 @@ class StrumLine extends FlxTypedGroup<Strum> {
|
||||
}
|
||||
|
||||
forEach(function(str:Strum) {
|
||||
str.updatePlayerInput(str.__getPressed(this), str.__getJustPressed(this), str.__getJustReleased(this));
|
||||
str.updatePlayerInput(__pressed[str.ID], __justPressed[str.ID], __justReleased[str.ID]);
|
||||
});
|
||||
|
||||
PlayState.instance.gameAndCharsCall("onPostInputUpdate");
|
||||
|
||||
Reference in New Issue
Block a user