Fixed ghost miss, Fix incorrect values, Cleanup

This commit is contained in:
NeeEoo
2023-05-26 01:23:26 +02:00
parent 7f14cbb986
commit 573b76db4c
10 changed files with 39 additions and 66 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

@@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="gfPixel.png">
<!-- Created with Adobe Animate version 20.0.0.17400 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="GF IDLE0000" x="0" y="0" width="120" height="106"/>
<SubTexture name="GF IDLE0001" x="0" y="0" width="120" height="106"/>
<SubTexture name="GF IDLE0002" x="130" y="0" width="120" height="106"/>
<SubTexture name="GF IDLE0003" x="130" y="0" width="120" height="106"/>
<SubTexture name="GF IDLE0004" x="130" y="0" width="120" height="106"/>
<SubTexture name="GF IDLE0005" x="260" y="0" width="120" height="106"/>
<SubTexture name="GF IDLE0006" x="260" y="0" width="120" height="106"/>
<SubTexture name="GF IDLE0007" x="260" y="0" width="120" height="106"/>
<SubTexture name="GF IDLE0008" x="260" y="0" width="120" height="106"/>
<SubTexture name="GF IDLE0009" x="390" y="0" width="120" height="106"/>
<SubTexture name="GF IDLE0010" x="390" y="0" width="120" height="106"/>
<SubTexture name="GF IDLE0011" x="390" y="0" width="120" height="106"/>
<SubTexture name="GF IDLE0012" x="390" y="0" width="120" height="106"/>
<SubTexture name="GF IDLE0013" x="0" y="116" width="120" height="106"/>
<SubTexture name="GF IDLE0014" x="0" y="116" width="120" height="106"/>
<SubTexture name="GF IDLE0015" x="130" y="116" width="120" height="106"/>
<SubTexture name="GF IDLE0016" x="130" y="116" width="120" height="106"/>
<SubTexture name="GF IDLE0017" x="260" y="116" width="120" height="106"/>
<SubTexture name="GF IDLE0018" x="260" y="116" width="120" height="106"/>
<SubTexture name="GF IDLE0019" x="260" y="116" width="120" height="106"/>
<SubTexture name="GF IDLE0020" x="390" y="116" width="120" height="106"/>
<SubTexture name="GF IDLE0021" x="390" y="116" width="120" height="106"/>
<SubTexture name="GF IDLE0022" x="390" y="116" width="120" height="106"/>
<SubTexture name="GF IDLE0023" x="390" y="116" width="120" height="106"/>
<SubTexture name="GF IDLE0024" x="390" y="116" width="120" height="106"/>
<SubTexture name="GF IDLE0025" x="0" y="232" width="120" height="106"/>
<SubTexture name="GF IDLE0026" x="0" y="232" width="120" height="106"/>
<SubTexture name="GF IDLE0027" x="0" y="232" width="120" height="106"/>
<SubTexture name="GF IDLE0028" x="0" y="232" width="120" height="106"/>
<SubTexture name="GF IDLE0029" x="0" y="232" width="120" height="106"/>
</TextureAtlas>
@@ -0,0 +1,8 @@
package funkin.backend.scripting.events;
final class AmountEvent extends CancellableEvent {
/**
* Amount
*/
public var amount:Int;
}
@@ -28,7 +28,7 @@ class AssetTreeInfo extends FramerateCategory {
}
if (text != "")
text = text.substr(0, text.length-1);
this.text.text = text;
super.__enterFrame(t);
}
+1 -1
View File
@@ -198,7 +198,7 @@ class Note extends FlxSprite
frameOffset.y += __notePosFrameOffset.y * 2;
super.drawComplex(camera);
frameOffset.y -= __notePosFrameOffset.y * 2;
} else
} else
super.drawComplex(camera);
}
+13 -13
View File
@@ -565,7 +565,7 @@ class PlayState extends MusicBeatState
for(content in [Paths.getFolderContent('songs/${SONG.meta.name.toLowerCase()}/scripts', true, fromMods ? MODS : BOTH), Paths.getFolderContent('data/charts/', true, fromMods ? MODS : BOTH)])
for(file in content) addScript(file);
for (file in Paths.getFolderContent('data/events/', true, fromMods ? MODS : BOTH))
for (file in Paths.getFolderContent('data/events/', true, fromMods ? MODS : BOTH))
if (EventsData.eventsList.contains(Path.withoutExtension(Path.withoutDirectory(file)))) addScript(file);
}
}
@@ -601,7 +601,7 @@ class PlayState extends MusicBeatState
}
}
for(strumLine in SONG.strumLines) {
for(i=>strumLine in SONG.strumLines) {
if (strumLine == null) continue;
var chars = [];
@@ -621,6 +621,7 @@ class PlayState extends MusicBeatState
strLine.cameras = [camHUD];
strLine.data = strumLine;
strLine.visible = (strumLine.visible != false);
strLine.ID = i;
strumLines.add(strLine);
}
@@ -635,9 +636,9 @@ class PlayState extends MusicBeatState
// CAMERA & HUD INITIALISATION
#if REGION
if (!scripts.event("onPreGenerateStrums", new CancellableEvent()).cancelled) {
generateStrums();
var event = EventManager.get(AmountEvent).recycle(4);
if (!scripts.event("onPreGenerateStrums", event).cancelled) {
generateStrums(event.amount);
scripts.call("onPostGenerateStrums");
}
@@ -798,7 +799,6 @@ class PlayState extends MusicBeatState
var swagCounter:Int = 0;
startTimer = new FlxTimer().start(Conductor.crochet / 1000, function(tmr:FlxTimer)
{
countdown(swagCounter++);
@@ -935,9 +935,9 @@ class PlayState extends MusicBeatState
}
@:dox(hide)
private inline function generateStrums():Void
private inline function generateStrums(amount:Int = 4):Void
for(p in strumLines)
p.generateStrums();
p.generateStrums(amount);
@:dox(hide)
override function openSubState(SubState:FlxSubState)
@@ -1105,7 +1105,7 @@ class PlayState extends MusicBeatState
{
if (startedCountdown)
{
Conductor.songPosition += FlxG.elapsed * 1000;
Conductor.songPosition += elapsed * 1000;
if (Conductor.songPosition >= 0)
startSong();
}
@@ -1336,6 +1336,7 @@ class PlayState extends MusicBeatState
/**
* Misses a note
* @param strumLine The strumline the miss happened on.
* @param note Note to miss.
* @param direction Specify a custom direction in case note is null.
* @param player Specify a custom player in case note is null.
@@ -1344,14 +1345,13 @@ class PlayState extends MusicBeatState
{
var playerID:Null<Int> = note == null ? player : strumLines.members.indexOf(strumLine);
var directionID:Null<Int> = note == null ? direction : note.strumID;
if (playerID == null || directionID == null) return;
if (playerID == null || directionID == null || playerID == -1) return;
var event:NoteHitEvent = scripts.event("onPlayerMiss", EventManager.get(NoteHitEvent).recycle(true, false, false, note, strumLines.members[playerID].characters, true, note != null ? note.noteType : null, "", "", "", directionID, -10, 0, -0.04, "shit"));
var event:NoteHitEvent = scripts.event("onPlayerMiss", EventManager.get(NoteHitEvent).recycle(true, false, false, note, strumLines.members[playerID].characters, true, note != null ? note.noteType : null, "", "", "", directionID, -10, 0, note != null ? -0.0475 : -0.04, "shit"));
strumLine.onMiss.dispatch(event);
if (event.cancelled) return;
if (event.note != null && strumLine != null) strumLine.addHealth(event.healthGain);
if (strumLine != null) strumLine.addHealth(event.healthGain);
if (gf != null && combo > 5 && gf.hasAnimation('sad'))
gf.playAnim('sad', event.forceAnim, MISS);
combo = 0;
+1 -1
View File
@@ -66,7 +66,7 @@ class SplashGroup extends FlxTypedGroup<FunkinSprite> {
splashSprite.animation.finishCallback = function(name) {
splashSprite.active = splashSprite.visible = false;
};
if (xml.has.scale) splashSprite.scale.scale(Std.parseFloat(xml.att.scale).getDefault(1));
if (xml.has.alpha) splashSprite.alpha = Std.parseFloat(xml.att.alpha).getDefault(1);
if (xml.has.antialiasing) splashSprite.antialiasing = xml.att.antialiasing == "true";
+6 -4
View File
@@ -72,22 +72,24 @@ class Stage extends FlxBasic implements IBeatReceiver {
stageSprites.set(spr.name, spr);
state.add(spr);
spr;
case "box":
case "box" | "solid":
if ( !node.has.name || !node.has.width || !node.has.height) continue;
var spr = new FlxSprite(
(node.has.x) ? Std.parseFloat(node.att.x) : 0,
(node.has.y) ? Std.parseFloat(node.att.y) : 0
).makeGraphic(
);
(node.name == "solid" ? spr.makeSolid : spr.makeGraphic)(
Std.parseInt(node.att.width),
Std.parseInt(node.att.height),
(node.has.color) ? CoolUtil.getColorFromDynamic(node.att.color) : 0xFFFFFFFF
(node.has.color) ? CoolUtil.getColorFromDynamic(node.att.color) : -1
);
stageSprites.set(node.getAtt("name"), spr);
state.add(spr);
spr;
case "boyfriend" | "bf":
case "boyfriend" | "bf" | "player":
addCharPos("boyfriend", node, {
x: 770,
y: 100,
+8 -10
View File
@@ -65,6 +65,10 @@ class StrumLine extends FlxTypedGroup<Strum> {
* Whenever alt animation is enabled on this strumline.
*/
public var altAnim:Bool = false;
/**
* TODO: Write documention about this being a variable that can help when making multi key
*/
public var strumAnimPrefix = ["left", "down", "up", "right"];
private function get_ghostTapping() {
if (this.ghostTapping != null) return this.ghostTapping;
@@ -200,7 +204,7 @@ class StrumLine extends FlxTypedGroup<Strum> {
__justPressed = CoolUtil.getDefault(event.justPressed, []);
__justReleased = CoolUtil.getDefault(event.justReleased, []);
__notePerStrum = [for(_ in 0...4) null];
__notePerStrum = [for(_ in 0...members.length) null];
if (__pressed.contains(true)) {
@@ -235,7 +239,7 @@ class StrumLine extends FlxTypedGroup<Strum> {
PlayState.instance.health += health * (opponentSide ? -1 : 1);
public inline function generateStrums(amount:Int = 4) {
for (i in 0...4)
for (i in 0...amount)
add(createStrum(i));
}
@@ -246,13 +250,7 @@ class StrumLine extends FlxTypedGroup<Strum> {
*/
public function createStrum(i:Int, ?animPrefix:String) {
if (animPrefix == null)
animPrefix = switch(i % 4) {
case 0: "left";
case 1: "down";
case 2: "up";
case 3: "right";
case _: "up";
}
animPrefix = strumAnimPrefix[i % strumAnimPrefix.length];
var babyArrow:Strum = new Strum((FlxG.width * strumOffset) + (Note.swagWidth * (i - 2)), PlayState.instance.strumLine.y);
babyArrow.ID = i;
@@ -284,7 +282,7 @@ class StrumLine extends FlxTypedGroup<Strum> {
FlxTween.tween(babyArrow, {y: babyArrow.y + 10, alpha: 1}, 1, {ease: FlxEase.circOut, startDelay: 0.5 + (0.2 * i)});
}
babyArrow.playAnim('static');
insert(i, babyArrow);
return babyArrow;
}
+1 -1
View File
@@ -1,2 +1,2 @@
#!/bin/sh
haxe -cp update -D analyzer-optimize -main Update --interp
haxe -cp commandline -D analyzer-optimize --run Main setup