Skip to content

Commit

Permalink
Some fixes related to sounds and allow right click to place notes wit…
Browse files Browse the repository at this point in the history
…hout removing existing ones
  • Loading branch information
superpowers04 committed Jul 15, 2024
1 parent c11dbc4 commit aee0e0a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
4 changes: 2 additions & 2 deletions source/Character.hx
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,8 @@ class CharAnimController extends FlxAnimationController{
var selAssets = -10;
for (i => charFile in charProperties.asset_files) {
if (charFile.char_side != null && charFile.char_side != 3 && charFile.char_side == charType){continue;} // This if statement hurts my brain
if (charFile.stage != "" && charFile.stage != null){if(PlayState.curStage.toLowerCase() != charFile.stage.toLowerCase()){continue;}} // Check if charFiletion specifies stage, skip if it doesn't match PlayState's stage
if (charFile.song != "" && charFile.song != null){if(PlayState.SONG.song.toLowerCase() != charFile.song.toLowerCase()){continue;}} // Check if charFiletion specifies song, skip if it doesn't match PlayState's song
if (charFile.stage != "" && charFile.stage != null && PlayState.curStage.toLowerCase() != charFile.stage.toLowerCase()){continue;} // Check if charFiletion specifies stage, skip if it doesn't match PlayState's stage
if (charFile.song != "" && charFile.song != null && PlayState.SONG.song.toLowerCase() != charFile.song.toLowerCase()){continue;} // Check if charFiletion specifies song, skip if it doesn't match PlayState's song
var tagsMatched = 0;
if (charFile.tags != null && charFile.tags[0] != null && PlayState.stageTags != null){
for (i in charFile.tags) {if (PlayState.stageTags.contains(i)) tagsMatched++;}
Expand Down
21 changes: 15 additions & 6 deletions source/ChartingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ class ChartingState extends ScriptMusicBeatState
var chartType = "FNF";
static var snapSound:Sound;
static var clapSound:Sound;
static var noteKeyCharting:Bool = false;
public static function playSnap(){
if(snapSound == null) snapSound= SELoader.loadSound('./assets/shared/sounds/SNAP.ogg',true);
snapSound.play(new openfl.media.SoundTransform(SESave.data.hitVol));
Expand Down Expand Up @@ -574,6 +575,11 @@ class ChartingState extends ScriptMusicBeatState
stepperBPM.value = Conductor.bpm;
stepperBPM.name = 'song_bpm';

var check_noteKeys = new FlxUICheckBox(0,0, null, null, "Note key charting", 100);
check_noteKeys.checked = noteKeyCharting;
check_noteKeys.callback = function() {
noteKeyCharting = checked;
};
// var stepperBPMOffsetLabel = new FlxText(74,80,'BPM Offset');
// var stepperBPMOffset:FlxUINumericStepper = new FlxUINumericStepper(10, 80, 0, 1, -9999, 9999, 0);
// stepperBPMOffset.value = Conductor.offset;
Expand Down Expand Up @@ -747,6 +753,7 @@ class ChartingState extends ScriptMusicBeatState
// uiMap['hurtnotescoreapply'] = hurtnotescoreapply;
uiMap['hurtnotehealthtxt'] = hurtnotehealthtxt;
uiMap['hurtnotehealth'] = hurtnotehealth;
uiMap['noteKeyCharting'] = check_noteKeys;
// uiMap['hurtnotehealthapply'] = hurtnotehealthapply;


Expand Down Expand Up @@ -820,7 +827,7 @@ class ChartingState extends ScriptMusicBeatState
[stepperSongVol,stepperSongVolLabel],
null,
[waveformEnabled,waveformUseInstrumental],
[hitsounds],
[check_noteKeys,hitsounds],
[check_voices,hurtnotescore,hurtnotescoretxt],
[beatcheck,hurtnotehealth,hurtnotehealthtxt],
null,
Expand Down Expand Up @@ -1446,12 +1453,14 @@ class ChartingState extends ScriptMusicBeatState
FlxG.mouse.y);
}
var justAdded = false;
if (FlxG.mouse.justPressed){
if (FlxG.mouse.justPressed || FlxG.mouse.justPressedRight){
justAdded = true;
var overlaps = false;
for(note in curRenderedNotes.members){
if (FlxG.mouse.overlaps(note)){
overlaps = true;
if(!FlxG.mouse.justPressedRight){

for(note in curRenderedNotes.members){
if (FlxG.mouse.overlaps(note)){
overlaps = true;
if (FlxG.keys.pressed.CONTROL) {
selectNote(note);
if(FlxG.keys.pressed.SHIFT){
Expand Down Expand Up @@ -1487,7 +1496,7 @@ class ChartingState extends ScriptMusicBeatState
}

}
if(FlxG.mouse.pressed){
if(FlxG.mouse.pressed || FlxG.mouse.pressedRight){
if (curSelectedNote != null && !modifyingNote && !justAdded && Math.floor(FlxG.mouse.x / GRID_SIZE) == (curSelectedNote[1] + 1)){
replaceNoteSustain(getStrumTime(dummyArrow.y) + sectionStartTime(curSection));
dummyArrow.visible = false;
Expand Down
5 changes: 3 additions & 2 deletions source/se/objects/SEJoinedSound.hx
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,19 @@ import flixel.FlxBasic;
if(sound.playing) s.play();
else s.pause();
}
if(s.playing && syncTime && Math.abs(s.time-sound.time) > maxTimeDifference) s.time = sound.time;
if(s.playing && syncTime && sound.time <= s.length && Math.abs(s.time-sound.time) > maxTimeDifference) s.time = sound.time;

}
}
function syncToSound(sound:FlxSound){
final s = this.sound;
if(s == null) return;
if(syncVolume) s.volume = sound.volume;
if(syncPlaying && s.playing != sound.playing){
if(sound.playing) s.play();
else s.pause();
}
if(s.playing && syncTime && Math.abs(s.time-sound.time) > maxTimeDifference) s.time = sound.time;
if(s.playing && syncTime && sound.time <= s.length && Math.abs(s.time-sound.time) > maxTimeDifference) s.time = sound.time;
sync();
}
function load(path:String):FlxSound{
Expand Down
2 changes: 1 addition & 1 deletion version.downloadMe
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
24.07.09.2112;
24.07.15.0004;
* Better Psych character support(Still kinda experimental but should be more stable)
* Fix some small errors
* Fix characters not loading due to using ID instead of folderName
Expand Down

0 comments on commit aee0e0a

Please sign in to comment.