From 421b7e9c8f2ba8aa9475352a06f612a8182520f4 Mon Sep 17 00:00:00 2001 From: tbgitoo Date: Sat, 2 Oct 2021 23:44:02 +0200 Subject: [PATCH] Song loading, editing, saving --- src/base/UFiles.pas | 5 +++++ src/screens/UScreenEditSub.pas | 23 +++++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/base/UFiles.pas b/src/base/UFiles.pas index 55ea526e5..2757b800a 100644 --- a/src/base/UFiles.pas +++ b/src/base/UFiles.pas @@ -174,6 +174,11 @@ function SaveSong(const Song: TSong; const Tracks: array of TLines; const Name: SongFile.WriteLine('#P2:' + EncodeToken(Song.DuetNames[1])); end; + if Song.RapBeat then + begin + SongFile.WriteLine('#RAP:BEAT'); + end; + // write custom header tags WriteCustomTags; diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index 46de0d098..386ef7972 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -292,6 +292,7 @@ TScreenEditSub = class(TMenu) PlayOnlyButtonID: Integer; PlayWithNoteButtonID: Integer; PlayNoteButtonID: Integer; + RapBeatModeButtonID: Integer; // background image & video preview BackgroundImageId: Integer; Empty: array of UTF8String; //temporary variable to initialize slide - todo change @@ -1623,7 +1624,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre TextEditMode := true; end; - if Interaction = 24 then // UndoButtonId + if Interaction = 29 then // UndoButtonId begin CopyFromUndo; GoldenRec.KillAll; @@ -1631,17 +1632,17 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre ShowInteractiveBackground; end; - if Interaction = 25 then // PreviousSeqButtonID + if Interaction = 30 then // PreviousSeqButtonID begin PreviousSentence; end; - if Interaction = 26 then // NextSeqButtonID + if Interaction = 31 then // NextSeqButtonID begin NextSentence; end; - if Interaction = 27 then // FreestyleButtonID + if Interaction = 25 then // FreestyleButtonID begin CopyToUndo; if (Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].NoteType = ntFreestyle) then @@ -1664,7 +1665,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre Exit; end; - if Interaction = 28 then // GoldButtonID + if Interaction = 26 then // GoldButtonID begin CopyToUndo; if (Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].NoteType = ntGolden) then @@ -1683,7 +1684,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre Exit; end; - if Interaction = 29 then // PlayOnlyButtonID + if Interaction = 28 then // PlayOnlyButtonID begin // Play Sentence Click := true; @@ -1704,7 +1705,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre Text[TextInfo].Text := Language.Translate('EDIT_INFO_PLAY_SENTENCE'); end; - if Interaction = 30 then // PlayWithNoteButtonID + if Interaction = 27 then // PlayWithNoteButtonID begin Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 1; CurrentNote[CurrentTrack] := 0; @@ -1726,7 +1727,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre Text[TextInfo].Text := Language.Translate('EDIT_INFO_PLAY_SENTENCE'); end; - if Interaction = 31 then // PlayNoteButtonID + if Interaction = 24 then // PlayNoteButtonID begin Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 1; CurrentNote[CurrentTrack] := 0; @@ -1741,6 +1742,11 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre Text[TextInfo].Text := Language.Translate('EDIT_INFO_PLAY_SENTENCE'); end; + if Interaction=32 then + begin + CurrentSong.RapBeat := not CurrentSong.RapBeat; + end; + for LineIndex := 0 to Tracks[CurrentTrack].High do begin if Interaction = InteractiveLineId[LineIndex] then @@ -4400,6 +4406,7 @@ constructor TScreenEditSub.Create; PlayOnlyButtonID := AddButton(Theme.EditSub.PlayOnly); PlayWithNoteButtonID := AddButton(Theme.EditSub.PlayWithNote); PlayNoteButtonID := AddButton(Theme.EditSub.PlayNote); + RapBeatModeButtonID := AddButton(Theme.EditSub.RapBeatMode); // current line TextSentence := AddButton(Theme.EditSub.ButtonCurrentLine);