Skip to content

Commit

Permalink
judgements and combo can now be toggled off in hscript (#439)
Browse files Browse the repository at this point in the history
* Update PlayState.hx

* movin and changin names

* the fucking space

* e e ee e ee ee SANS??

* mama SANS behind you❤️

help me

* brother...

* BROTHER...

---------

Co-authored-by: ⍚~Nex <[email protected]>
  • Loading branch information
crowplexus and NexIsDumb authored Nov 11, 2024
1 parent 759dbae commit 5ea2f57
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 10 deletions.
12 changes: 11 additions & 1 deletion source/funkin/backend/scripting/events/NoteHitEvent.hx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,19 @@ final class NoteHitEvent extends CancellableEvent {
*/
public var countScore:Bool = true;
/**
* Whenever ratings should be shown or not.
* Whenever ratings (Rating sprite, Digits sprites and Combo sprite) should be shown or not.
*
* NOTE: Whether it's `true` use `displayRating` and `displayCombo` (plus `minDigitDisplay` in the PlayState class) to change what's going to pop up!
*/
public var showRating:Null<Bool> = null;
/**
* Whenever the Rating sprites should be shown or not.
*/
public var displayRating:Bool;
/**
* Whenever the Combo sprite should be shown or not (like old Week 7 patches).
*/
public var displayCombo:Bool;
/**
* Note that has been pressed
*/
Expand Down
34 changes: 25 additions & 9 deletions source/funkin/game/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,22 @@ class PlayState extends MusicBeatState
* Group containing all of the combo sprites.
*/
public var comboGroup:RotatingSpriteGroup;
/**
* Whenever the Rating sprites should be shown or not.
*
* NOTE: This is just a default value for the final value, the final value can be changed through notes hit events.
*/
public var defDisplayRating:Bool = true;
/**
* Whenever the Combo sprite should be shown or not (like old Week 7 patches).
*
* NOTE: This is just a default value for the final value, the final value can be changed through notes hit events.
*/
public var defDisplayCombo:Bool = false;
/**
* Minimum Combo Count to display the combo digits. Anything less than 0 means it won't be shown.
*/
public var minDigitDisplay:Int = 10;
/**
* Array containing all of the note types names.
*/
Expand Down Expand Up @@ -1645,9 +1661,9 @@ class PlayState extends MusicBeatState

var event:NoteHitEvent;
if (strumLine != null && !strumLine.cpu)
event = EventManager.get(NoteHitEvent).recycle(false, !note.isSustainNote, !note.isSustainNote, note, strumLine.characters, true, note.noteType, note.animSuffix.getDefault(note.strumID < strumLine.members.length ? strumLine.members[note.strumID].animSuffix : strumLine.animSuffix), "game/score/", "", note.strumID, score, note.isSustainNote ? null : accuracy, 0.023, daRating, Options.splashesEnabled && !note.isSustainNote && daRating == "sick");
event = EventManager.get(NoteHitEvent).recycle(false, !note.isSustainNote, !note.isSustainNote, null, defDisplayRating, defDisplayCombo, note, strumLine.characters, true, note.noteType, note.animSuffix.getDefault(note.strumID < strumLine.members.length ? strumLine.members[note.strumID].animSuffix : strumLine.animSuffix), "game/score/", "", note.strumID, score, note.isSustainNote ? null : accuracy, 0.023, daRating, Options.splashesEnabled && !note.isSustainNote && daRating == "sick");
else
event = EventManager.get(NoteHitEvent).recycle(false, false, false, note, strumLine.characters, false, note.noteType, note.animSuffix.getDefault(note.strumID < strumLine.members.length ? strumLine.members[note.strumID].animSuffix : strumLine.animSuffix), "game/score/", "", note.strumID, 0, null, 0, daRating, false);
event = EventManager.get(NoteHitEvent).recycle(false, false, false, null, defDisplayRating, defDisplayCombo, note, strumLine.characters, false, note.noteType, note.animSuffix.getDefault(note.strumID < strumLine.members.length ? strumLine.members[note.strumID].animSuffix : strumLine.animSuffix), "game/score/", "", note.strumID, 0, null, 0, daRating, false);
event.deleteNote = !note.isSustainNote; // work around, to allow sustain notes to be deleted
event = scripts.event(strumLine != null && !strumLine.cpu ? "onPlayerHit" : "onDadHit", event);
strumLine.onHit.dispatch(event);
Expand All @@ -1666,7 +1682,8 @@ class PlayState extends MusicBeatState
if (event.showRating || (event.showRating == null && event.player))
{
displayCombo(event);
displayRating(event.rating, event);
if (event.displayRating)
displayRating(event.rating, event);
ratingNum += 1;
}
}
Expand Down Expand Up @@ -1724,13 +1741,11 @@ class PlayState extends MusicBeatState
}

public function displayCombo(?evt:NoteHitEvent = null):Void {
var pre:String = evt != null ? evt.ratingPrefix : "";
var suf:String = evt != null ? evt.ratingSuffix : "";

var separatedScore:String = Std.string(combo).addZeros(3);
if (minDigitDisplay >= 0 && (combo == 0 || combo >= minDigitDisplay)) {
var pre:String = evt != null ? evt.ratingPrefix : "";
var suf:String = evt != null ? evt.ratingSuffix : "";

if (combo == 0 || combo >= 10) {
if (combo >= 10) {
if (evt.displayCombo) {
var comboSpr:FlxSprite = comboGroup.recycleLoop(FlxSprite).loadAnimatedGraphic(Paths.image('${pre}combo${suf}'));
comboSpr.resetSprite(comboGroup.x, comboGroup.y);
comboSpr.acceleration.y = 600;
Expand All @@ -1752,6 +1767,7 @@ class PlayState extends MusicBeatState
});
}

var separatedScore:String = Std.string(combo).addZeros(3);
for (i in 0...separatedScore.length)
{
var numScore:FlxSprite = comboGroup.recycleLoop(FlxSprite).loadAnimatedGraphic(Paths.image('${pre}num${separatedScore.charAt(i)}${suf}'));
Expand Down

0 comments on commit 5ea2f57

Please sign in to comment.