Skip to content

Commit

Permalink
Added Instant Crash Option like my old engine
Browse files Browse the repository at this point in the history
  • Loading branch information
HRK-EXEX committed Jan 10, 2025
1 parent 6588b51 commit 56dd43b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 46 deletions.
1 change: 1 addition & 0 deletions source/backend/ClientPrefs.hx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ import states.TitleState;
'healthgain' => 1.0,
'healthloss' => 1.0,
'instakill' => false,
'instacrash' => false,
'practice' => false,
'botplay' => false,
'opponentplay' => false
Expand Down
3 changes: 2 additions & 1 deletion source/options/GameplayChangersSubstate.hx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ class GameplayChangersSubstate extends MusicBeatSubstate
option.displayFormat = '%vX';
optionsArray.push(option);

optionsArray.push(new GameplayOption('Instakill on Miss', 'instakill', BOOL, false));
optionsArray.push(new GameplayOption('Instant kill on Miss', 'instakill', BOOL, false));
optionsArray.push(new GameplayOption('Instant crash on Miss', 'instacrash', BOOL, false));
optionsArray.push(new GameplayOption('Practice Mode', 'practice', BOOL, false));
optionsArray.push(new GameplayOption('Botplay', 'botplay', BOOL, false));
}
Expand Down
2 changes: 1 addition & 1 deletion source/options/GameplaySettingsSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ class GameplaySettingsSubState extends BaseOptionsMenu
function onStepUpdateRate(){
stepRate.scrollSpeed = interpolate(20.0, 1000.0, (holdTime - 0.5) / 3.0, 3.0);
descText.text = stepRate.description =
'In this settings, Accurate up to ${
'In this settings, you can set the stepHit to be accurate up to ${
stepRate.getValue() != 0 ?
Std.string(stepRate.getValue() * defaultBPM * ClientPrefs.data.framerate) : "Infinite"
} BPM.';
Expand Down
51 changes: 7 additions & 44 deletions source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ class PlayState extends MusicBeatState

public final guitarHeroSustains:Bool = false;
public var instakillOnMiss:Bool = false;
public var instacrashOnMiss:Bool = false;
public var cpuControlled:Bool = false;
public var practiceMode:Bool = false;
public var pressMissDamage:Float = 0.05;
Expand Down Expand Up @@ -427,6 +428,7 @@ class PlayState extends MusicBeatState
healthGain = ClientPrefs.getGameplaySetting('healthgain');
healthLoss = ClientPrefs.getGameplaySetting('healthloss');
instakillOnMiss = ClientPrefs.getGameplaySetting('instakill');
instacrashOnMiss = ClientPrefs.getGameplaySetting('instacrash');
practiceMode = ClientPrefs.getGameplaySetting('practice');
cpuControlled = ClientPrefs.getGameplaySetting('botplay') || ffmpegMode;

Expand Down Expand Up @@ -1466,7 +1468,7 @@ class PlayState extends MusicBeatState
hpShowStr = numFormat(targetHealth, 4 - Std.string(Math.floor(targetHealth)).length, true) + (targetHealth >= 0.001 ? ' %' : '');

if (!cpuControlled) {
if (!instakillOnMiss) {
if (!instakillOnMiss && !instacrashOnMiss) {
if (!practiceMode) {
tempScoreStr = Language.getPhrase(
'score_text',
Expand Down Expand Up @@ -4529,56 +4531,17 @@ Average NPS in loading: ${numFormat(notes / takenNoteTime, 3)}');
if (note != null)
subtract = note.missHealth;

// GUITAR HERO SUSTAIN CHECK LOL!!!!
// if (guitarHeroSustains && note != null) {
// if (note.parent == null) {
// if (note.tail.length > 0)
// {
// note.alpha = 0.35;
// for (childNote in note.tail)
// {
// childNote.alpha = note.alpha;
// childNote.missed = true;
// childNote.canBeHit = false;
// childNote.ignoreNote = true;
// childNote.tooLate = true;
// }
// note.missed = true;
// note.canBeHit = false;

// // subtract += 0.385; // you take more damage if playing with this gameplay changer enabled.
// // i mean its fair :p -Crow
// subtract *= note.tail.length + 1;
// // i think it would be fair if damage multiplied based on how long the sustain is -Tahir
// }

// if (note.missed) return;
// } else if (note.isSustainNote) {
// if (note.missed) return;

// var parentNote:Note = note.parent;
// if (parentNote.wasGoodHit && parentNote.tail.length > 0)
// {
// for (child in parentNote.tail) {
// if (child != note) {
// child.missed = true;
// child.canBeHit = false;
// child.ignoreNote = true;
// child.tooLate = true;
// }
// }
// }
// parentNote = null;
// }
// }

if (instakillOnMiss)
{
if (bfVocal) vocals.volume = 0;
if (opVocal) opponentVocals.volume = 0;
doDeathCheck(true);
}

if (instacrashOnMiss) {
throw "You missed the NOTE! HAHAHA";
}

var lastCombo:Float = combo;
combo = 0;

Expand Down

0 comments on commit 56dd43b

Please sign in to comment.