Skip to content

Commit

Permalink
Song loading, editing, saving
Browse files Browse the repository at this point in the history
  • Loading branch information
sbbmaerklin committed Oct 5, 2021
1 parent f14ac84 commit 421b7e9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
5 changes: 5 additions & 0 deletions src/base/UFiles.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
23 changes: 15 additions & 8 deletions src/screens/UScreenEditSub.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1623,25 +1624,25 @@ 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;
Text[TextInfo].Text := Language.Translate('EDIT_INFO_UNDO');
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
Expand All @@ -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
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 421b7e9

Please sign in to comment.