aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Screens
diff options
context:
space:
mode:
Diffstat (limited to 'Game/Code/Screens')
-rw-r--r--Game/Code/Screens/UScreenCredits.pas4
-rw-r--r--Game/Code/Screens/UScreenEditConvert.pas1158
-rw-r--r--Game/Code/Screens/UScreenEditSub.pas2749
-rw-r--r--Game/Code/Screens/UScreenLoading.pas110
-rw-r--r--Game/Code/Screens/UScreenMain.pas572
-rw-r--r--Game/Code/Screens/UScreenPartyNewRound.pas842
-rw-r--r--Game/Code/Screens/UScreenPartyOptions.pas522
-rw-r--r--Game/Code/Screens/UScreenScore.pas4
-rw-r--r--Game/Code/Screens/UScreenSing.pas4
-rw-r--r--Game/Code/Screens/UScreenSingModi.pas4
-rw-r--r--Game/Code/Screens/UScreenSong.pas7
-rw-r--r--Game/Code/Screens/UScreenSongMenu.pas4
-rw-r--r--Game/Code/Screens/UScreenStatMain.pas4
-rw-r--r--Game/Code/Screens/UScreenTop5.pas4
14 files changed, 3022 insertions, 2966 deletions
diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas
index e60b9fb9..7147be2e 100644
--- a/Game/Code/Screens/UScreenCredits.pas
+++ b/Game/Code/Screens/UScreenCredits.pas
@@ -2,6 +2,10 @@ unit UScreenCredits;
interface
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+
{$I switches.inc}
diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas
index 0c8244ab..e370ad67 100644
--- a/Game/Code/Screens/UScreenEditConvert.pas
+++ b/Game/Code/Screens/UScreenEditConvert.pas
@@ -1,577 +1,581 @@
-unit UScreenEditConvert;
-
-interface
-
-{$I switches.inc}
-
-uses UMenu,
- SDL,
- {$IFDEF UseMIDIPort}
- MidiFile,
- MidiOut,
- {$ENDIF}
- ULog,
- USongs,
- UMusic,
- UThemes;
-
-type
- TNote = record
- Event: integer;
- EventType: integer;
- Channel: integer;
- Start: real;
- Len: real;
- Data1: integer;
- Data2: integer;
- Str: string;
- end;
-
- TTrack = record
- Note: array of TNote;
- Name: string;
- Hear: boolean;
- Status: byte; // 0 - none, 1 - notes, 2 - lyrics, 3 - notes + lyrics
- end;
-
- TNuta = record
- Start: integer;
- Len: integer;
- Tone: integer;
- Lyric: string;
- NewSentence: boolean;
- end;
-
- TArrayTrack = array of TTrack;
-
- TScreenEditConvert = class(TMenu)
- public
- ATrack: TArrayTrack; // actual track
-// Track: TArrayTrack;
- Channel: TArrayTrack;
- ColR: array[0..100] of real;
- ColG: array[0..100] of real;
- ColB: array[0..100] of real;
- Len: real;
- Sel: integer;
- Selected: boolean;
-// FileName: string;
-
- {$IFDEF UseMIDIPort}
- MidiFile: TMidiFile;
- MidiTrack: TMidiTrack;
- MidiEvent: pMidiEvent;
- MidiOut: TMidiOutput;
- {$ENDIF}
-
- Song: TSong;
- Czesc: TCzesci;
- BPM: real;
- Ticks: real;
- Nuta: array of TNuta;
-
- procedure AddLyric(Start: integer; Tekst: string);
- procedure Extract;
-
- {$IFDEF UseMIDIPort}
- procedure MidiFile1MidiEvent(event: PMidiEvent);
- {$ENDIF}
-
- function SelectedNumber: integer;
- constructor Create; override;
- procedure onShow; override;
- function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
- function Draw: boolean; override;
- procedure onHide; override;
- end;
-
-implementation
-uses UGraphic,
- SysUtils,
- UDrawTexture,
- TextGL,
- UFiles,
- UMain,
- UIni,
- OpenGL12,
- USkins;
-
-function TScreenEditConvert.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
-var
- T: integer;
-begin
- Result := true;
- If (PressedDown) Then
- begin // Key Down
- case PressedKey of
- SDLK_Q:
- begin
- Result := false;
- end;
-
-
- SDLK_ESCAPE,
- SDLK_BACKSPACE :
- begin
- {$IFDEF UseMIDIPort}
- MidiFile.StopPlaying;
- {$ENDIF}
- AudioPlayback.PlayBack;
- FadeTo(@ScreenEdit);
- end;
-
- SDLK_RETURN:
- begin
- if Interaction = 0 then
- begin
- AudioPlayback.PlayStart;
- ScreenOpen.BackScreen := @ScreenEditConvert;
- FadeTo(@ScreenOpen);
- end;
-
- if Interaction = 1 then
- begin
- Selected := false;
- {$IFDEF UseMIDIPort}
- MidiFile.OnMidiEvent := MidiFile1MidiEvent;
-// MidiFile.GoToTime(MidiFile.GetTrackLength div 2);
- MidiFile.StartPlaying;
- {$ENDIF}
- end;
-
- if Interaction = 2 then begin
- Selected := true;
- {$IFDEF UseMIDIPort}
- MidiFile.OnMidiEvent := nil;
- {$ENDIF}
- {for T := 0 to High(ATrack) do begin
- if ATrack[T].Hear then begin
- MidiTrack := MidiFile.GetTrack(T);
- MidiTrack.OnMidiEvent := MidiFile1MidiEvent;
- end;
- end;
- MidiFile.StartPlaying;//}
- end;
-
- if Interaction = 3 then begin
- if SelectedNumber > 0 then begin
- Extract;
- SaveSong(Song, Czesc, ChangeFileExt(FileName, '.txt'), false);
- end;
- end;
-
- end;
-
- SDLK_SPACE:
- begin
-// ATrack[Sel].Hear := not ATrack[Sel].Hear;
- ATrack[Sel].Status := (ATrack[Sel].Status + 1) mod 4;
-
-{ if Selected then begin
- MidiTrack := MidiFile.GetTrack(Sel);
- if Track[Sel].Hear then
- MidiTrack.OnMidiEvent := MidiFile1MidiEvent
- else
- MidiTrack.OnMidiEvent := nil;
- end;}
- end;
-
- SDLK_RIGHT:
- begin
- InteractNext;
- end;
-
- SDLK_LEFT:
- begin
- InteractPrev;
- end;
-
- SDLK_DOWN:
- begin
- Inc(Sel);
- if Sel > High(ATrack) then Sel := 0;
- end;
- SDLK_UP:
- begin
- Dec(Sel);
- if Sel < 0 then Sel := High(ATrack);
- end;
- end;
- end;
-end;
-
-procedure TScreenEditConvert.AddLyric(Start: integer; Tekst: string);
-var
- N: integer;
-begin
- for N := 0 to High(Nuta) do begin
- if Nuta[N].Start = Start then begin
- // check for new sentece
- if Copy(Tekst, 1, 1) = '\' then Delete(Tekst, 1, 1);
- if Copy(Tekst, 1, 1) = '/' then begin
- Delete(Tekst, 1, 1);
- Nuta[N].NewSentence := true;
- end;
-
- // overwrite lyric od append
- if Nuta[N].Lyric = '-' then
- Nuta[N].Lyric := Tekst
- else
- Nuta[N].Lyric := Nuta[N].Lyric + Tekst;
- end;
- end;
-end;
-
-procedure TScreenEditConvert.Extract;
-var
- T: integer;
- C: integer;
- N: integer;
- Nu: integer;
- NutaTemp: TNuta;
- Move: integer;
- Max, Min: integer;
-begin
- // song info
- Song.Title := '';
- Song.Artist := '';
- Song.Mp3 := '';
- Song.Resolution := 4;
- SetLength(Song.BPM, 1);
- Song.BPM[0].BPM := BPM*4;
-
- SetLength(Nuta, 0);
-
- // extract notes
- for T := 0 to High(ATrack) do begin
-// if ATrack[T].Hear then begin
- if ((ATrack[T].Status div 1) and 1) = 1 then begin
- for N := 0 to High(ATrack[T].Note) do begin
- if (ATrack[T].Note[N].EventType = 9) and (ATrack[T].Note[N].Data2 > 0) then begin
- Nu := Length(Nuta);
- SetLength(Nuta, Nu + 1);
- Nuta[Nu].Start := Round(ATrack[T].Note[N].Start / Ticks);
- Nuta[Nu].Len := Round(ATrack[T].Note[N].Len / Ticks);
- Nuta[Nu].Tone := ATrack[T].Note[N].Data1 - 12*5;
- Nuta[Nu].Lyric := '-';
- end;
- end;
- end;
- end;
-
- // extract lyrics
- for T := 0 to High(ATrack) do begin
-// if ATrack[T].Hear then begin
- if ((ATrack[T].Status div 2) and 1) = 1 then begin
- for N := 0 to High(ATrack[T].Note) do begin
- if (ATrack[T].Note[N].EventType = 15) then begin
-// Log.LogStatus('<' + Track[T].Note[N].Str + '>', 'MIDI');
- AddLyric(Round(ATrack[T].Note[N].Start / Ticks), ATrack[T].Note[N].Str);
- end;
- end;
- end;
- end;
-
- // sort notes
- for N := 0 to High(Nuta) do
- for Nu := 0 to High(Nuta)-1 do
- if Nuta[Nu].Start > Nuta[Nu+1].Start then begin
- NutaTemp := Nuta[Nu];
- Nuta[Nu] := Nuta[Nu+1];
- Nuta[Nu+1] := NutaTemp;
- end;
-
- // move to 0 at beginning
- Move := Nuta[0].Start;
- for N := 0 to High(Nuta) do
- Nuta[N].Start := Nuta[N].Start - Move;
-
- // copy notes
- SetLength(Czesc.Czesc, 1);
- Czesc.Ilosc := 1;
- Czesc.High := 0;
-
- C := 0;
- N := 0;
- Czesc.Czesc[C].IlNut := 0;
- Czesc.Czesc[C].HighNut := -1;
-
- for Nu := 0 to High(Nuta) do begin
- if Nuta[Nu].NewSentence then begin // nowa linijka
- SetLength(Czesc.Czesc, Length(Czesc.Czesc)+1);
- Czesc.Ilosc := Czesc.Ilosc + 1;
- Czesc.High := Czesc.High + 1;
- C := C + 1;
- N := 0;
- SetLength(Czesc.Czesc[C].Nuta, 0);
- Czesc.Czesc[C].IlNut := 0;
- Czesc.Czesc[C].HighNut := -1;
-
- //Calculate Start of the Last Sentence
- if (C > 0) and (Nu > 0) then
- begin
- Max := Nuta[Nu].Start;
- Min := Nuta[Nu-1].Start + Nuta[Nu-1].Len;
-
- case (Max - Min) of
- 0: Czesc.Czesc[C].Start := Max;
- 1: Czesc.Czesc[C].Start := Max;
- 2: Czesc.Czesc[C].Start := Max - 1;
- 3: Czesc.Czesc[C].Start := Max - 2;
- else
- if ((Max - Min) > 4) then
- Czesc.Czesc[C].Start := Min + 2
- else
- Czesc.Czesc[C].Start := Max;
-
- end; // case
-
- end;
- end;
-
- // tworzy miejsce na nowa nute
- SetLength(Czesc.Czesc[C].Nuta, Length(Czesc.Czesc[C].Nuta)+1);
- Czesc.Czesc[C].IlNut := Czesc.Czesc[C].IlNut + 1;
- Czesc.Czesc[C].HighNut := Czesc.Czesc[C].HighNut + 1;
-
- // dopisuje
- Czesc.Czesc[C].Nuta[N].Start := Nuta[Nu].Start;
- Czesc.Czesc[C].Nuta[N].Dlugosc := Nuta[Nu].Len;
- Czesc.Czesc[C].Nuta[N].Ton := Nuta[Nu].Tone;
- Czesc.Czesc[C].Nuta[N].Tekst := Nuta[Nu].Lyric;
- //All Notes are Freestyle when Converted Fix:
- Czesc.Czesc[C].Nuta[N].Wartosc := 1;
- Inc(N);
- end;
-end;
-
-function TScreenEditConvert.SelectedNumber: integer;
-var
- T: integer; // track
-begin
- Result := 0;
- for T := 0 to High(ATrack) do
-// if ATrack[T].Hear then Inc(Result);
- if ((ATrack[T].Status div 1) and 1) = 1 then Inc(Result);
-end;
-
-{$IFDEF UseMIDIPort}
-procedure TScreenEditConvert.MidiFile1MidiEvent(event: PMidiEvent);
-begin
-// Log.LogStatus(IntToStr(event.event), 'MIDI');
- MidiOut.PutShort(event.event, event.data1, event.data2);
-end;
-{$ENDIF}
-
-constructor TScreenEditConvert.Create;
-var
- P: integer;
-begin
- inherited Create;
- AddButton(40, 20, 100, 40, Skin.GetTextureFileName('ButtonF'));
- AddButtonText(15, 5, 0, 0, 0, 'Open');
-// Button[High(Button)].Text[0].Size := 11;
-
- AddButton(160, 20, 100, 40, Skin.GetTextureFileName('ButtonF'));
- AddButtonText(25, 5, 0, 0, 0, 'Play');
-
- AddButton(280, 20, 200, 40, Skin.GetTextureFileName('ButtonF'));
- AddButtonText(25, 5, 0, 0, 0, 'Play Selected');
-
- AddButton(500, 20, 100, 40, Skin.GetTextureFileName('ButtonF'));
- AddButtonText(20, 5, 0, 0, 0, 'Save');
-
-
-{ MidiOut := TMidiOutput.Create(nil);
-// MidiOut.Close;
-// MidiOut.DeviceID := 0;
- if Ini.Debug = 1 then
- MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table
- Log.LogStatus(MidiOut.ProductName, 'MIDI');
- MidiOut.Open;
-// MidiOut.SetVolume(100, 100); // temporary}
-
- FileName := GamePath + 'file.mid';
- {$IFDEF UseMIDIPort}
- MidiFile := TMidiFile.Create(nil);
- {$ENDIF}
-
- for P := 0 to 100 do begin
- ColR[P] := Random(10)/10;
- ColG[P] := Random(10)/10;
- ColB[P] := Random(10)/10;
- end;
-
-end;
-
-procedure TScreenEditConvert.onShow;
-var
- T: integer; // track
- N: integer; // note
- C: integer; // channel
- CN: integer; // channel note
-begin
-{$IFDEF UseMIDIPort}
- MidiOut := TMidiOutput.Create(nil);
- if Ini.Debug = 1 then
- MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table
- Log.LogStatus(MidiOut.ProductName, 'MIDI');
- MidiOut.Open;
-
-
- if FileExists(FileName) then
- begin
- MidiFile.Filename := FileName;
- MidiFile.ReadFile;
-
-
- Len := 0;
- Sel := 0;
- BPM := MidiFile.Bpm;
- Ticks := MidiFile.TicksPerQuarter / 4;
-
-{ for T := 0 to MidiFile.NumberOfTracks-1 do begin
- SetLength(Track, Length(Track)+1);
- MidiTrack := MidiFile.GetTrack(T);
- MidiTrack.OnMidiEvent := MidiFile1MidiEvent;
- Track[T].Name := MidiTrack.getName;
-
- for N := 0 to MidiTrack.getEventCount-1 do begin
- SetLength(Track[T].Note, Length(Track[T].Note)+1);
- MidiEvent := MidiTrack.GetEvent(N);
- Track[T].Note[N].Start := MidiEvent.time;
- Track[T].Note[N].Len := MidiEvent.len;
- Track[T].Note[N].Event := MidiEvent.event;
- Track[T].Note[N].EventType := MidiEvent.event div 16;
- Track[T].Note[N].Channel := MidiEvent.event and 15;
- Track[T].Note[N].Data1 := MidiEvent.data1;
- Track[T].Note[N].Data2 := MidiEvent.data2;
- Track[T].Note[N].Str := MidiEvent.str;
-
- if Track[T].Note[N].Start + Track[T].Note[N].Len > Len then
- Len := Track[T].Note[N].Start + Track[T].Note[N].Len;
- end;
- end;}
-
-
- SetLength(Channel, 16);
- for T := 0 to 15 do
- begin
- Channel[T].Name := IntToStr(T+1);
- SetLength(Channel[T].Note, 0);
- Channel[T].Status := 0;
- end;
-
- for T := 0 to MidiFile.NumberOfTracks-1 do begin
- MidiTrack := MidiFile.GetTrack(T);
- MidiTrack.OnMidiEvent := MidiFile1MidiEvent;
-
- for N := 0 to MidiTrack.getEventCount-1 do begin
- MidiEvent := MidiTrack.GetEvent(N);
- C := MidiEvent.event and 15;
-
- CN := Length(Channel[C].Note);
- SetLength(Channel[C].Note, CN+1);
-
- Channel[C].Note[CN].Start := MidiEvent.time;
- Channel[C].Note[CN].Len := MidiEvent.len;
- Channel[C].Note[CN].Event := MidiEvent.event;
- Channel[C].Note[CN].EventType := MidiEvent.event div 16;
- Channel[C].Note[CN].Channel := MidiEvent.event and 15;
- Channel[C].Note[CN].Data1 := MidiEvent.data1;
- Channel[C].Note[CN].Data2 := MidiEvent.data2;
- Channel[C].Note[CN].Str := MidiEvent.str;
-
- if Channel[C].Note[CN].Start + Channel[C].Note[CN].Len > Len then
- Len := Channel[C].Note[CN].Start + Channel[C].Note[CN].Len;
- end;
- end;
- ATrack := Channel;
-
- end;
-
- Interaction := 0;
-{$ENDIF}
-end;
-
-function TScreenEditConvert.Draw: boolean;
-var
- Pet: integer;
- Pet2: integer;
- Bottom: real;
- X: real;
- Y: real;
- H: real;
- YSkip: real;
-begin
- // draw static menu
- inherited Draw;
-
- Y := 100;
-
- H := Length(ATrack)*40;
- if H > 480 then H := 480;
- Bottom := Y + H;
-
- YSkip := H / Length(ATrack);
-
- // select
- DrawQuad(10, Y+Sel*YSkip, 780, YSkip, 0.8, 0.8, 0.8);
-
- // selected - now me use Status System
- for Pet := 0 to High(ATrack) do
- if ATrack[Pet].Hear then
- DrawQuad(10, Y+Pet*YSkip, 50, YSkip, 0.8, 0.3, 0.3);
- glColor3f(0, 0, 0);
- for Pet := 0 to High(ATrack) do begin
- if ((ATrack[Pet].Status div 1) and 1) = 1 then begin
- SetFontPos(25, Y + Pet*YSkip + 10);
- SetFontSize(5);
- glPrint('N');
- end;
- if ((ATrack[Pet].Status div 2) and 1) = 1 then begin
- SetFontPos(40, Y + Pet*YSkip + 10);
- SetFontSize(5);
- glPrint('L');
- end;
- end;
-
- DrawLine(10, Y, 10, Bottom, 0, 0, 0);
- DrawLine(60, Y, 60, Bottom, 0, 0, 0);
- DrawLine(790, Y, 790, Bottom, 0, 0, 0);
-
- for Pet := 0 to Length(ATrack) do
- DrawLine(10, Y+Pet*YSkip, 790, Y+Pet*YSkip, 0, 0, 0);
-
- for Pet := 0 to High(ATrack) do begin
- SetFontPos(11, Y + 10 + Pet*YSkip);
- SetFontSize(5);
- glPrint(pchar(ATrack[Pet].Name));
- end;
-
- for Pet := 0 to High(ATrack) do
- for Pet2 := 0 to High(ATrack[Pet].Note) do begin
- if ATrack[Pet].Note[Pet2].EventType = 9 then
- DrawQuad(60 + ATrack[Pet].Note[Pet2].Start/Len * 725, Y + (Pet+1)*YSkip - ATrack[Pet].Note[Pet2].Data1*35/127, 3, 3, ColR[Pet], ColG[Pet], ColB[Pet]);
- if ATrack[Pet].Note[Pet2].EventType = 15 then
- DrawLine(60 + ATrack[Pet].Note[Pet2].Start/Len * 725, Y + 0.75 * YSkip + Pet*YSkip, 60 + ATrack[Pet].Note[Pet2].Start/Len * 725, Y + YSkip + Pet*YSkip, ColR[Pet], ColG[Pet], ColB[Pet]);
- end;
-
- // playing line
- {$IFDEF UseMIDIPort}
- X := 60 + MidiFile.GetCurrentTime/MidiFile.GetTrackLength*730;
- {$ENDIF}
- DrawLine(X, Y, X, Bottom, 0.3, 0.3, 0.3);
-
-
-end;
-
-procedure TScreenEditConvert.onHide;
-begin
-{$IFDEF UseMIDIPort}
- MidiOut.Close;
- MidiOut.Free;
-{$ENDIF}
-end;
-
-end.
+unit UScreenEditConvert;
+
+interface
+
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+
+{$I switches.inc}
+
+uses UMenu,
+ SDL,
+ {$IFDEF UseMIDIPort}
+ MidiFile,
+ MidiOut,
+ {$ENDIF}
+ ULog,
+ USongs,
+ UMusic,
+ UThemes;
+
+type
+ TNote = record
+ Event: integer;
+ EventType: integer;
+ Channel: integer;
+ Start: real;
+ Len: real;
+ Data1: integer;
+ Data2: integer;
+ Str: string;
+ end;
+
+ TTrack = record
+ Note: array of TNote;
+ Name: string;
+ Hear: boolean;
+ Status: byte; // 0 - none, 1 - notes, 2 - lyrics, 3 - notes + lyrics
+ end;
+
+ TNuta = record
+ Start: integer;
+ Len: integer;
+ Tone: integer;
+ Lyric: string;
+ NewSentence: boolean;
+ end;
+
+ TArrayTrack = array of TTrack;
+
+ TScreenEditConvert = class(TMenu)
+ public
+ ATrack: TArrayTrack; // actual track
+// Track: TArrayTrack;
+ Channel: TArrayTrack;
+ ColR: array[0..100] of real;
+ ColG: array[0..100] of real;
+ ColB: array[0..100] of real;
+ Len: real;
+ Sel: integer;
+ Selected: boolean;
+// FileName: string;
+
+ {$IFDEF UseMIDIPort}
+ MidiFile: TMidiFile;
+ MidiTrack: TMidiTrack;
+ MidiEvent: pMidiEvent;
+ MidiOut: TMidiOutput;
+ {$ENDIF}
+
+ Song: TSong;
+ Czesc: TCzesci;
+ BPM: real;
+ Ticks: real;
+ Nuta: array of TNuta;
+
+ procedure AddLyric(Start: integer; Tekst: string);
+ procedure Extract;
+
+ {$IFDEF UseMIDIPort}
+ procedure MidiFile1MidiEvent(event: PMidiEvent);
+ {$ENDIF}
+
+ function SelectedNumber: integer;
+ constructor Create; override;
+ procedure onShow; override;
+ function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
+ function Draw: boolean; override;
+ procedure onHide; override;
+ end;
+
+implementation
+uses UGraphic,
+ SysUtils,
+ UDrawTexture,
+ TextGL,
+ UFiles,
+ UMain,
+ UIni,
+ OpenGL12,
+ USkins;
+
+function TScreenEditConvert.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+var
+ T: integer;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ {$IFDEF UseMIDIPort}
+ MidiFile.StopPlaying;
+ {$ENDIF}
+ AudioPlayback.PlayBack;
+ FadeTo(@ScreenEdit);
+ end;
+
+ SDLK_RETURN:
+ begin
+ if Interaction = 0 then
+ begin
+ AudioPlayback.PlayStart;
+ ScreenOpen.BackScreen := @ScreenEditConvert;
+ FadeTo(@ScreenOpen);
+ end;
+
+ if Interaction = 1 then
+ begin
+ Selected := false;
+ {$IFDEF UseMIDIPort}
+ MidiFile.OnMidiEvent := MidiFile1MidiEvent;
+// MidiFile.GoToTime(MidiFile.GetTrackLength div 2);
+ MidiFile.StartPlaying;
+ {$ENDIF}
+ end;
+
+ if Interaction = 2 then begin
+ Selected := true;
+ {$IFDEF UseMIDIPort}
+ MidiFile.OnMidiEvent := nil;
+ {$ENDIF}
+ {for T := 0 to High(ATrack) do begin
+ if ATrack[T].Hear then begin
+ MidiTrack := MidiFile.GetTrack(T);
+ MidiTrack.OnMidiEvent := MidiFile1MidiEvent;
+ end;
+ end;
+ MidiFile.StartPlaying;//}
+ end;
+
+ if Interaction = 3 then begin
+ if SelectedNumber > 0 then begin
+ Extract;
+ SaveSong(Song, Czesc, ChangeFileExt(FileName, '.txt'), false);
+ end;
+ end;
+
+ end;
+
+ SDLK_SPACE:
+ begin
+// ATrack[Sel].Hear := not ATrack[Sel].Hear;
+ ATrack[Sel].Status := (ATrack[Sel].Status + 1) mod 4;
+
+{ if Selected then begin
+ MidiTrack := MidiFile.GetTrack(Sel);
+ if Track[Sel].Hear then
+ MidiTrack.OnMidiEvent := MidiFile1MidiEvent
+ else
+ MidiTrack.OnMidiEvent := nil;
+ end;}
+ end;
+
+ SDLK_RIGHT:
+ begin
+ InteractNext;
+ end;
+
+ SDLK_LEFT:
+ begin
+ InteractPrev;
+ end;
+
+ SDLK_DOWN:
+ begin
+ Inc(Sel);
+ if Sel > High(ATrack) then Sel := 0;
+ end;
+ SDLK_UP:
+ begin
+ Dec(Sel);
+ if Sel < 0 then Sel := High(ATrack);
+ end;
+ end;
+ end;
+end;
+
+procedure TScreenEditConvert.AddLyric(Start: integer; Tekst: string);
+var
+ N: integer;
+begin
+ for N := 0 to High(Nuta) do begin
+ if Nuta[N].Start = Start then begin
+ // check for new sentece
+ if Copy(Tekst, 1, 1) = '\' then Delete(Tekst, 1, 1);
+ if Copy(Tekst, 1, 1) = '/' then begin
+ Delete(Tekst, 1, 1);
+ Nuta[N].NewSentence := true;
+ end;
+
+ // overwrite lyric od append
+ if Nuta[N].Lyric = '-' then
+ Nuta[N].Lyric := Tekst
+ else
+ Nuta[N].Lyric := Nuta[N].Lyric + Tekst;
+ end;
+ end;
+end;
+
+procedure TScreenEditConvert.Extract;
+var
+ T: integer;
+ C: integer;
+ N: integer;
+ Nu: integer;
+ NutaTemp: TNuta;
+ Move: integer;
+ Max, Min: integer;
+begin
+ // song info
+ Song.Title := '';
+ Song.Artist := '';
+ Song.Mp3 := '';
+ Song.Resolution := 4;
+ SetLength(Song.BPM, 1);
+ Song.BPM[0].BPM := BPM*4;
+
+ SetLength(Nuta, 0);
+
+ // extract notes
+ for T := 0 to High(ATrack) do begin
+// if ATrack[T].Hear then begin
+ if ((ATrack[T].Status div 1) and 1) = 1 then begin
+ for N := 0 to High(ATrack[T].Note) do begin
+ if (ATrack[T].Note[N].EventType = 9) and (ATrack[T].Note[N].Data2 > 0) then begin
+ Nu := Length(Nuta);
+ SetLength(Nuta, Nu + 1);
+ Nuta[Nu].Start := Round(ATrack[T].Note[N].Start / Ticks);
+ Nuta[Nu].Len := Round(ATrack[T].Note[N].Len / Ticks);
+ Nuta[Nu].Tone := ATrack[T].Note[N].Data1 - 12*5;
+ Nuta[Nu].Lyric := '-';
+ end;
+ end;
+ end;
+ end;
+
+ // extract lyrics
+ for T := 0 to High(ATrack) do begin
+// if ATrack[T].Hear then begin
+ if ((ATrack[T].Status div 2) and 1) = 1 then begin
+ for N := 0 to High(ATrack[T].Note) do begin
+ if (ATrack[T].Note[N].EventType = 15) then begin
+// Log.LogStatus('<' + Track[T].Note[N].Str + '>', 'MIDI');
+ AddLyric(Round(ATrack[T].Note[N].Start / Ticks), ATrack[T].Note[N].Str);
+ end;
+ end;
+ end;
+ end;
+
+ // sort notes
+ for N := 0 to High(Nuta) do
+ for Nu := 0 to High(Nuta)-1 do
+ if Nuta[Nu].Start > Nuta[Nu+1].Start then begin
+ NutaTemp := Nuta[Nu];
+ Nuta[Nu] := Nuta[Nu+1];
+ Nuta[Nu+1] := NutaTemp;
+ end;
+
+ // move to 0 at beginning
+ Move := Nuta[0].Start;
+ for N := 0 to High(Nuta) do
+ Nuta[N].Start := Nuta[N].Start - Move;
+
+ // copy notes
+ SetLength(Czesc.Czesc, 1);
+ Czesc.Ilosc := 1;
+ Czesc.High := 0;
+
+ C := 0;
+ N := 0;
+ Czesc.Czesc[C].IlNut := 0;
+ Czesc.Czesc[C].HighNut := -1;
+
+ for Nu := 0 to High(Nuta) do begin
+ if Nuta[Nu].NewSentence then begin // nowa linijka
+ SetLength(Czesc.Czesc, Length(Czesc.Czesc)+1);
+ Czesc.Ilosc := Czesc.Ilosc + 1;
+ Czesc.High := Czesc.High + 1;
+ C := C + 1;
+ N := 0;
+ SetLength(Czesc.Czesc[C].Nuta, 0);
+ Czesc.Czesc[C].IlNut := 0;
+ Czesc.Czesc[C].HighNut := -1;
+
+ //Calculate Start of the Last Sentence
+ if (C > 0) and (Nu > 0) then
+ begin
+ Max := Nuta[Nu].Start;
+ Min := Nuta[Nu-1].Start + Nuta[Nu-1].Len;
+
+ case (Max - Min) of
+ 0: Czesc.Czesc[C].Start := Max;
+ 1: Czesc.Czesc[C].Start := Max;
+ 2: Czesc.Czesc[C].Start := Max - 1;
+ 3: Czesc.Czesc[C].Start := Max - 2;
+ else
+ if ((Max - Min) > 4) then
+ Czesc.Czesc[C].Start := Min + 2
+ else
+ Czesc.Czesc[C].Start := Max;
+
+ end; // case
+
+ end;
+ end;
+
+ // tworzy miejsce na nowa nute
+ SetLength(Czesc.Czesc[C].Nuta, Length(Czesc.Czesc[C].Nuta)+1);
+ Czesc.Czesc[C].IlNut := Czesc.Czesc[C].IlNut + 1;
+ Czesc.Czesc[C].HighNut := Czesc.Czesc[C].HighNut + 1;
+
+ // dopisuje
+ Czesc.Czesc[C].Nuta[N].Start := Nuta[Nu].Start;
+ Czesc.Czesc[C].Nuta[N].Dlugosc := Nuta[Nu].Len;
+ Czesc.Czesc[C].Nuta[N].Ton := Nuta[Nu].Tone;
+ Czesc.Czesc[C].Nuta[N].Tekst := Nuta[Nu].Lyric;
+ //All Notes are Freestyle when Converted Fix:
+ Czesc.Czesc[C].Nuta[N].Wartosc := 1;
+ Inc(N);
+ end;
+end;
+
+function TScreenEditConvert.SelectedNumber: integer;
+var
+ T: integer; // track
+begin
+ Result := 0;
+ for T := 0 to High(ATrack) do
+// if ATrack[T].Hear then Inc(Result);
+ if ((ATrack[T].Status div 1) and 1) = 1 then Inc(Result);
+end;
+
+{$IFDEF UseMIDIPort}
+procedure TScreenEditConvert.MidiFile1MidiEvent(event: PMidiEvent);
+begin
+// Log.LogStatus(IntToStr(event.event), 'MIDI');
+ MidiOut.PutShort(event.event, event.data1, event.data2);
+end;
+{$ENDIF}
+
+constructor TScreenEditConvert.Create;
+var
+ P: integer;
+begin
+ inherited Create;
+ AddButton(40, 20, 100, 40, Skin.GetTextureFileName('ButtonF'));
+ AddButtonText(15, 5, 0, 0, 0, 'Open');
+// Button[High(Button)].Text[0].Size := 11;
+
+ AddButton(160, 20, 100, 40, Skin.GetTextureFileName('ButtonF'));
+ AddButtonText(25, 5, 0, 0, 0, 'Play');
+
+ AddButton(280, 20, 200, 40, Skin.GetTextureFileName('ButtonF'));
+ AddButtonText(25, 5, 0, 0, 0, 'Play Selected');
+
+ AddButton(500, 20, 100, 40, Skin.GetTextureFileName('ButtonF'));
+ AddButtonText(20, 5, 0, 0, 0, 'Save');
+
+
+{ MidiOut := TMidiOutput.Create(nil);
+// MidiOut.Close;
+// MidiOut.DeviceID := 0;
+ if Ini.Debug = 1 then
+ MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table
+ Log.LogStatus(MidiOut.ProductName, 'MIDI');
+ MidiOut.Open;
+// MidiOut.SetVolume(100, 100); // temporary}
+
+ FileName := GamePath + 'file.mid';
+ {$IFDEF UseMIDIPort}
+ MidiFile := TMidiFile.Create(nil);
+ {$ENDIF}
+
+ for P := 0 to 100 do begin
+ ColR[P] := Random(10)/10;
+ ColG[P] := Random(10)/10;
+ ColB[P] := Random(10)/10;
+ end;
+
+end;
+
+procedure TScreenEditConvert.onShow;
+var
+ T: integer; // track
+ N: integer; // note
+ C: integer; // channel
+ CN: integer; // channel note
+begin
+{$IFDEF UseMIDIPort}
+ MidiOut := TMidiOutput.Create(nil);
+ if Ini.Debug = 1 then
+ MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table
+ Log.LogStatus(MidiOut.ProductName, 'MIDI');
+ MidiOut.Open;
+
+
+ if FileExists(FileName) then
+ begin
+ MidiFile.Filename := FileName;
+ MidiFile.ReadFile;
+
+
+ Len := 0;
+ Sel := 0;
+ BPM := MidiFile.Bpm;
+ Ticks := MidiFile.TicksPerQuarter / 4;
+
+{ for T := 0 to MidiFile.NumberOfTracks-1 do begin
+ SetLength(Track, Length(Track)+1);
+ MidiTrack := MidiFile.GetTrack(T);
+ MidiTrack.OnMidiEvent := MidiFile1MidiEvent;
+ Track[T].Name := MidiTrack.getName;
+
+ for N := 0 to MidiTrack.getEventCount-1 do begin
+ SetLength(Track[T].Note, Length(Track[T].Note)+1);
+ MidiEvent := MidiTrack.GetEvent(N);
+ Track[T].Note[N].Start := MidiEvent.time;
+ Track[T].Note[N].Len := MidiEvent.len;
+ Track[T].Note[N].Event := MidiEvent.event;
+ Track[T].Note[N].EventType := MidiEvent.event div 16;
+ Track[T].Note[N].Channel := MidiEvent.event and 15;
+ Track[T].Note[N].Data1 := MidiEvent.data1;
+ Track[T].Note[N].Data2 := MidiEvent.data2;
+ Track[T].Note[N].Str := MidiEvent.str;
+
+ if Track[T].Note[N].Start + Track[T].Note[N].Len > Len then
+ Len := Track[T].Note[N].Start + Track[T].Note[N].Len;
+ end;
+ end;}
+
+
+ SetLength(Channel, 16);
+ for T := 0 to 15 do
+ begin
+ Channel[T].Name := IntToStr(T+1);
+ SetLength(Channel[T].Note, 0);
+ Channel[T].Status := 0;
+ end;
+
+ for T := 0 to MidiFile.NumberOfTracks-1 do begin
+ MidiTrack := MidiFile.GetTrack(T);
+ MidiTrack.OnMidiEvent := MidiFile1MidiEvent;
+
+ for N := 0 to MidiTrack.getEventCount-1 do begin
+ MidiEvent := MidiTrack.GetEvent(N);
+ C := MidiEvent.event and 15;
+
+ CN := Length(Channel[C].Note);
+ SetLength(Channel[C].Note, CN+1);
+
+ Channel[C].Note[CN].Start := MidiEvent.time;
+ Channel[C].Note[CN].Len := MidiEvent.len;
+ Channel[C].Note[CN].Event := MidiEvent.event;
+ Channel[C].Note[CN].EventType := MidiEvent.event div 16;
+ Channel[C].Note[CN].Channel := MidiEvent.event and 15;
+ Channel[C].Note[CN].Data1 := MidiEvent.data1;
+ Channel[C].Note[CN].Data2 := MidiEvent.data2;
+ Channel[C].Note[CN].Str := MidiEvent.str;
+
+ if Channel[C].Note[CN].Start + Channel[C].Note[CN].Len > Len then
+ Len := Channel[C].Note[CN].Start + Channel[C].Note[CN].Len;
+ end;
+ end;
+ ATrack := Channel;
+
+ end;
+
+ Interaction := 0;
+{$ENDIF}
+end;
+
+function TScreenEditConvert.Draw: boolean;
+var
+ Pet: integer;
+ Pet2: integer;
+ Bottom: real;
+ X: real;
+ Y: real;
+ H: real;
+ YSkip: real;
+begin
+ // draw static menu
+ inherited Draw;
+
+ Y := 100;
+
+ H := Length(ATrack)*40;
+ if H > 480 then H := 480;
+ Bottom := Y + H;
+
+ YSkip := H / Length(ATrack);
+
+ // select
+ DrawQuad(10, Y+Sel*YSkip, 780, YSkip, 0.8, 0.8, 0.8);
+
+ // selected - now me use Status System
+ for Pet := 0 to High(ATrack) do
+ if ATrack[Pet].Hear then
+ DrawQuad(10, Y+Pet*YSkip, 50, YSkip, 0.8, 0.3, 0.3);
+ glColor3f(0, 0, 0);
+ for Pet := 0 to High(ATrack) do begin
+ if ((ATrack[Pet].Status div 1) and 1) = 1 then begin
+ SetFontPos(25, Y + Pet*YSkip + 10);
+ SetFontSize(5);
+ glPrint('N');
+ end;
+ if ((ATrack[Pet].Status div 2) and 1) = 1 then begin
+ SetFontPos(40, Y + Pet*YSkip + 10);
+ SetFontSize(5);
+ glPrint('L');
+ end;
+ end;
+
+ DrawLine(10, Y, 10, Bottom, 0, 0, 0);
+ DrawLine(60, Y, 60, Bottom, 0, 0, 0);
+ DrawLine(790, Y, 790, Bottom, 0, 0, 0);
+
+ for Pet := 0 to Length(ATrack) do
+ DrawLine(10, Y+Pet*YSkip, 790, Y+Pet*YSkip, 0, 0, 0);
+
+ for Pet := 0 to High(ATrack) do begin
+ SetFontPos(11, Y + 10 + Pet*YSkip);
+ SetFontSize(5);
+ glPrint(pchar(ATrack[Pet].Name));
+ end;
+
+ for Pet := 0 to High(ATrack) do
+ for Pet2 := 0 to High(ATrack[Pet].Note) do begin
+ if ATrack[Pet].Note[Pet2].EventType = 9 then
+ DrawQuad(60 + ATrack[Pet].Note[Pet2].Start/Len * 725, Y + (Pet+1)*YSkip - ATrack[Pet].Note[Pet2].Data1*35/127, 3, 3, ColR[Pet], ColG[Pet], ColB[Pet]);
+ if ATrack[Pet].Note[Pet2].EventType = 15 then
+ DrawLine(60 + ATrack[Pet].Note[Pet2].Start/Len * 725, Y + 0.75 * YSkip + Pet*YSkip, 60 + ATrack[Pet].Note[Pet2].Start/Len * 725, Y + YSkip + Pet*YSkip, ColR[Pet], ColG[Pet], ColB[Pet]);
+ end;
+
+ // playing line
+ {$IFDEF UseMIDIPort}
+ X := 60 + MidiFile.GetCurrentTime/MidiFile.GetTrackLength*730;
+ {$ENDIF}
+ DrawLine(X, Y, X, Bottom, 0.3, 0.3, 0.3);
+
+
+end;
+
+procedure TScreenEditConvert.onHide;
+begin
+{$IFDEF UseMIDIPort}
+ MidiOut.Close;
+ MidiOut.Free;
+{$ENDIF}
+end;
+
+end.
diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas
index d24fdede..6dcb1f5f 100644
--- a/Game/Code/Screens/UScreenEditSub.pas
+++ b/Game/Code/Screens/UScreenEditSub.pas
@@ -1,1373 +1,1376 @@
-unit UScreenEditSub;
-
-interface
-
-{$I switches.inc}
-
-uses
- UMenu,
- UMusic,
- SDL,
- SysUtils,
- UFiles,
- UTime,
- USongs,
- UIni,
- ULog,
- UTexture,
- UMenuText,
- ULyrics_bak,
- Math,
- OpenGL12,
- {$IFDEF UseMIDIPort}
- MidiOut,
- {$ENDIF}
- UThemes;
-
-type
- TScreenEditSub = class(TMenu)
- private
- //Variable is True if no SOng is loaded
- Error: Boolean;
-
- TextNote: integer;
- TextSentence: integer;
- TextTitle: integer;
- TextArtist: integer;
- TextMp3: integer;
- TextBPM: integer;
- TextGAP: integer;
- TextDebug: integer;
- TextNStart: integer;
- TextNDlugosc: integer;
- TextNTon: integer;
- TextNText: integer;
- AktNuta: integer;
- PlaySentence: boolean;
- PlaySentenceMidi: boolean;
- PlayStopTime: real;
- LastClick: integer;
- Click: boolean;
- CopySrc: integer;
-
- {$IFDEF UseMIDIPort}
- MidiOut: TMidiOutput;
- {$endif}
-
- MidiStart: real;
- MidiStop: real;
- MidiTime: real;
- MidiPos: real;
- MidiLastNote: integer;
-
- TextEditMode: boolean;
-
- procedure NewBeat;
- procedure CzesciDivide;
- procedure CzesciMultiply;
- procedure LyricsCapitalize;
- procedure LyricsCorrectSpaces;
- procedure FixTimings;
- procedure DivideSentence;
- procedure JoinSentence;
- procedure DivideNote;
- procedure DeleteNote;
- procedure TransposeNote(Transpose: integer);
- procedure ChangeWholeTone(Tone: integer);
- procedure MoveAllToEnd(Move: integer);
- procedure MoveTextToRight;
- procedure MarkSrc;
- procedure PasteText;
- procedure CopySentence(Src, Dst: integer);
- procedure CopySentences(Src, Dst, Num: integer);
- //Note Name Mod
- function GetNoteName(Note: Integer): String;
- public
- Tex_Background: TTexture;
- FadeOut: boolean;
- Path: string;
- FileName: string;
- constructor Create; override;
- procedure onShow; override;
- function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
- function ParseInputEditText(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
- function Draw: boolean; override;
- procedure onHide; override;
- end;
-
-implementation
-uses UGraphic, UDraw, UMain, USkins, ULanguage;
-
-// Method for input parsing. If False is returned, GetNextWindow
-// should be checked to know the next window to load;
-function TScreenEditSub.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
-var
- SDL_ModState: Word;
- R: real;
-begin
- Result := true;
-
- if TextEditMode then begin
- Result := ParseInputEditText(PressedKey, ScanCode, PressedDown);
- end else begin
-
- SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT
- + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT {+ KMOD_CAPS});
-
- If (PressedDown) then begin // Key Down
- case PressedKey of
-
- SDLK_ESCAPE,
- SDLK_BACKSPACE :
- begin
- FadeTo(@ScreenSong);
- end;
-
- SDLK_Q:
- begin
- Result := false;
- end;
-
- SDLK_BACKQUOTE:
- begin
- // Increase Note Length (same as Alt + Right)
- Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc);
- if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then
- Inc(Czesci[0].Czesc[Czesci[0].Akt].Koniec);
- end;
-
- SDLK_EQUALS:
- begin
- // Increase BPM
- if SDL_ModState = 0 then
- AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 5) + 1) / 5; // (1/20)
- if SDL_ModState = KMOD_LSHIFT then
- AktSong.BPM[0].BPM := AktSong.BPM[0].BPM + 4; // (1/1)
- if SDL_ModState = KMOD_LCTRL then
- AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 25) + 1) / 25; // (1/100)
- end;
-
- SDLK_MINUS:
- begin
- // Decrease BPM
- if SDL_ModState = 0 then
- AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 5) - 1) / 5;
- if SDL_ModState = KMOD_LSHIFT then
- AktSong.BPM[0].BPM := AktSong.BPM[0].BPM - 4;
- if SDL_ModState = KMOD_LCTRL then
- AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 25) - 1) / 25;
- end;
-
- SDLK_0:
- begin
- // Increase GAP
- if SDL_ModState = 0 then
- AktSong.GAP := AktSong.GAP + 10;
- if SDL_ModState = KMOD_LSHIFT then
- AktSong.GAP := AktSong.GAP + 1000;
- end;
-
- SDLK_9:
- begin
- // Decrease GAP
- if SDL_ModState = 0 then
- AktSong.GAP := AktSong.GAP - 10;
- if SDL_ModState = KMOD_LSHIFT then
- AktSong.GAP := AktSong.GAP - 1000;
- end;
-
- SDLK_KP_PLUS:
- begin
- // Increase tone of all notes
- if SDL_ModState = 0 then
- ChangeWholeTone(1);
- if SDL_ModState = KMOD_LSHIFT then
- ChangeWholeTone(12);
- end;
-
- SDLK_KP_MINUS:
- begin
- // Decrease tone of all notes
- if SDL_ModState = 0 then
- ChangeWholeTone(-1);
- if SDL_ModState = KMOD_LSHIFT then
- ChangeWholeTone(-12);
- end;
-
- SDLK_SLASH:
- begin
- if SDL_ModState = 0 then begin
- // Insert start of sentece
- if AktNuta > 0 then
- DivideSentence;
- end;
-
- if SDL_ModState = KMOD_LSHIFT then begin
- // Join next sentence with current
- if Czesci[0].Akt < Czesci[0].High then
- JoinSentence;
- end;
-
- if SDL_ModState = KMOD_LCTRL then begin
- // divide note
- DivideNote;
- end;
-
- end;
-
- SDLK_S:
- begin
- // Save Song
- if SDL_ModState = KMOD_LSHIFT then
- SaveSong(AktSong, Czesci[0], Path + FileName, true)
- else
- SaveSong(AktSong, Czesci[0], Path + FileName, false);
-
- {if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL + KMOD_LALT then
- // Save Song
- SaveSongDebug(AktSong, Czesci[0], 'C:\song.asm', false);}
-
- end;
-
- SDLK_D:
- begin
- // Divide lengths by 2
- CzesciDivide;
- end;
-
- SDLK_M:
- begin
- // Multiply lengths by 2
- CzesciMultiply;
- end;
-
- SDLK_C:
- begin
- // Capitalize letter at the beginning of line
- if SDL_ModState = 0 then
- LyricsCapitalize;
-
- // Correct spaces
- if SDL_ModState = KMOD_LSHIFT then
- LyricsCorrectSpaces;
-
- // Copy sentence
- if SDL_ModState = KMOD_LCTRL then
- MarkSrc;
- end;
-
- SDLK_V:
- begin
- // Paste text
- if SDL_ModState = KMOD_LCTRL then begin
- if Czesci[0].Czesc[Czesci[0].Akt].IlNut >= Czesci[0].Czesc[CopySrc].IlNut then
- PasteText
- else
- beep;
- end;
-
- if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then begin
- CopySentence(CopySrc, Czesci[0].Akt);
- end;
- end;
-
- SDLK_4:
- begin
- if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then begin
- CopySentence(CopySrc, Czesci[0].Akt);
- CopySentence(CopySrc+1, Czesci[0].Akt+1);
- CopySentence(CopySrc+2, Czesci[0].Akt+2);
- CopySentence(CopySrc+3, Czesci[0].Akt+3);
- end;
-
- if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT + KMOD_LALT then begin
- CopySentences(CopySrc, Czesci[0].Akt, 4);
- end;
- end;
- SDLK_5:
- begin
- if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then begin
- CopySentence(CopySrc, Czesci[0].Akt);
- CopySentence(CopySrc+1, Czesci[0].Akt+1);
- CopySentence(CopySrc+2, Czesci[0].Akt+2);
- CopySentence(CopySrc+3, Czesci[0].Akt+3);
- CopySentence(CopySrc+4, Czesci[0].Akt+4);
- end;
-
- if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT + KMOD_LALT then begin
- CopySentences(CopySrc, Czesci[0].Akt, 5);
- end;
- end;
-
- SDLK_T:
- begin
- // Fixes timings between sentences
- FixTimings;
- end;
-
- SDLK_F4:
- begin
- // Enter Text Edit Mode
- TextEditMode := true;
- end;
-
- SDLK_P:
- begin
- if SDL_ModState = 0 then begin
- // Play Sentence
- Click := true;
- AudioPlayback.Stop;
- R := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote);
- if R <= AudioPlayback.Length then begin
- AudioPlayback.MoveTo(R);
- PlayStopTime := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec);
- PlaySentence := true;
- AudioPlayback.Play;
- LastClick := -100;
- end;
- end;
-
- if SDL_ModState = KMOD_LSHIFT then begin
- PlaySentenceMidi := true;
-
- MidiTime := USTime.GetTime;
- MidiStart := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote);
- MidiStop := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec);
-
- LastClick := -100;
- end;
- if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL then begin
- PlaySentenceMidi := true;
- MidiTime := USTime.GetTime;
- MidiStart := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote);
- MidiStop := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec);
- LastClick := -100;
-
- PlaySentence := true;
- Click := true;
- AudioPlayback.Stop;
- AudioPlayback.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote)+0{-0.10});
- PlayStopTime := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec)+0;
- AudioPlayback.Play;
- LastClick := -100;
- end;
- end;
-
- SDLK_SPACE:
- begin
- // Play Sentence
- PlaySentenceMidi := false; // stop midi
- PlaySentence := true;
- Click := false;
- AudioPlayback.Stop;
- AudioPlayback.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start));
- PlayStopTime := (GetTimeFromBeat(
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start +
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc));
- AudioPlayback.Play;
- LastClick := -100;
- end;
-
- SDLK_RETURN:
- begin
- end;
-
- SDLK_LCTRL:
- begin
- end;
-
- SDLK_DELETE:
- begin
- if SDL_ModState = KMOD_LCTRL then begin
- // moves text to right in current sentence
- DeleteNote;
- end;
- end;
-
- SDLK_PERIOD:
- begin
- // moves text to right in current sentence
- MoveTextToRight;
- end;
-
- SDLK_RIGHT:
- begin
- // right
- if SDL_ModState = 0 then begin
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0;
- Inc(AktNuta);
- if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].IlNut then AktNuta := 0;
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1;
- Lyric.Selected := AktNuta;
- end;
-
- // ctrl + right
- if SDL_ModState = KMOD_LCTRL then begin
- if Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc > 1 then begin
- Dec(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc);
- Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start);
- if AktNuta = 0 then begin
- Inc(Czesci[0].Czesc[Czesci[0].Akt].Start);
- Inc(Czesci[0].Czesc[Czesci[0].Akt].StartNote);
- end;
- end;
- end;
-
- // shift + right
- if SDL_ModState = KMOD_LSHIFT then begin
- Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start);
- if AktNuta = 0 then begin
- Inc(Czesci[0].Czesc[Czesci[0].Akt].Start);
- Inc(Czesci[0].Czesc[Czesci[0].Akt].StartNote);
- end;
- if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then
- Inc(Czesci[0].Czesc[Czesci[0].Akt].Koniec);
- end;
-
- // alt + right
- if SDL_ModState = KMOD_LALT then begin
- Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc);
- if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then
- Inc(Czesci[0].Czesc[Czesci[0].Akt].Koniec);
- end;
-
- // alt + ctrl + shift + right = move all from cursor to right
- if SDL_ModState = KMOD_LALT + KMOD_LCTRL + KMOD_LSHIFT then begin
- MoveAllToEnd(1);
- end;
-
- end;
-
- SDLK_LEFT:
- begin
- // left
- if SDL_ModState = 0 then begin
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0;
- Dec(AktNuta);
- if AktNuta = -1 then AktNuta := Czesci[0].Czesc[Czesci[0].Akt].HighNut;
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1;
- Lyric.Selected := AktNuta;
- end;
-
- // ctrl + left
- if SDL_ModState = KMOD_LCTRL then begin
- Dec(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start);
- Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc);
- if AktNuta = 0 then begin
- Dec(Czesci[0].Czesc[Czesci[0].Akt].Start);
- Dec(Czesci[0].Czesc[Czesci[0].Akt].StartNote);
- end;
- end;
-
- // shift + left
- if SDL_ModState = KMOD_LSHIFT then begin
- Dec(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start);
-
- // resizing sentences
- if AktNuta = 0 then begin
- Dec(Czesci[0].Czesc[Czesci[0].Akt].Start);
- Dec(Czesci[0].Czesc[Czesci[0].Akt].StartNote);
- end;
-
- if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then
- Dec(Czesci[0].Czesc[Czesci[0].Akt].Koniec);
-
- end;
-
- // alt + left
- if SDL_ModState = KMOD_LALT then begin
- if Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc > 1 then begin
- Dec(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc);
- if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then
- Dec(Czesci[0].Czesc[Czesci[0].Akt].Koniec);
- end;
- end;
-
- // alt + ctrl + shift + right = move all from cursor to left
- if SDL_ModState = KMOD_LALT + KMOD_LCTRL + KMOD_LSHIFT then begin
- MoveAllToEnd(-1);
- end;
-
- end;
-
- SDLK_DOWN:
- begin
- {$IFDEF UseMIDIPort}
- // skip to next sentence
- if SDL_ModState = 0 then begin
- MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127);
- PlaySentenceMidi := false;
-
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0;
- Inc(Czesci[0].Akt);
- AktNuta := 0;
- if Czesci[0].Akt > Czesci[0].High then Czesci[0].Akt := 0;
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1;
-
- Lyric.AddCzesc(Czesci[0].Akt);
- Lyric.Selected := 0;
- AudioPlayback.Stop;
- PlaySentence := false;
- end;
-
- // decrease tone
- if SDL_ModState = KMOD_LCTRL then begin
- TransposeNote(-1);
- end;
- {$endif}
-
- end;
-
- SDLK_UP:
- begin
- {$IFDEF UseMIDIPort}
- // skip to previous sentence
- if SDL_ModState = 0 then begin
- MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127);
- PlaySentenceMidi := false;
-
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0;
- Dec(Czesci[0].Akt);
- AktNuta := 0;
- if Czesci[0].Akt = -1 then Czesci[0].Akt := Czesci[0].High;
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1;
-
- Lyric.AddCzesc(Czesci[0].Akt);
- Lyric.Selected := 0;
- AudioPlayback.Stop;
- PlaySentence := false;
- end;
-
- // increase tone
- if SDL_ModState = KMOD_LCTRL then begin
- TransposeNote(1);
- end;
- {$endif}
- end;
-
- // Golden Note Patch
- SDLK_G:
- begin
- case Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc of
- 0: Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 2;
- 1: Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 2;
- 2: Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 1;
- end; // case
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Freestyle := False;
- end;
-
- // Freestyle Note Patch
- SDLK_F:
- begin
- case Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc of
- 0:
- begin;
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 1;
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Freestyle := False;
- end;
- 1,2:
- begin;
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 0;
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Freestyle := True;
- end;
- end; // case
-
- end;
-
-
- end;
- end;
- end; // if
-end;
-
-function TScreenEditSub.ParseInputEditText(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
-var
- SDL_ModState: Word;
-begin
- // used when in Text Edit Mode
- Result := true;
-
- SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT
- + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT {+ KMOD_CAPS});
-
- If (PressedDown) Then
- begin // Key Down
- case PressedKey of
-
- SDLK_ESCAPE:
- begin
- FadeTo(@ScreenSong);
- end;
- SDLK_F4, SDLK_RETURN:
- begin
- // Exit Text Edit Mode
- TextEditMode := false;
- end;
- SDLK_0..SDLK_9, SDLK_A..SDLK_Z, SDLK_SPACE, SDLK_MINUS, SDLK_EXCLAIM, SDLK_COMMA, SDLK_SLASH, SDLK_ASTERISK, SDLK_QUESTION, SDLK_QUOTE, SDLK_QUOTEDBL:
- begin
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst :=
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst + chr(ScanCode);
- end;
- SDLK_BACKSPACE:
- begin
- Delete(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst,
- Length(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst), 1);
- end;
- SDLK_RIGHT:
- begin
- // right
- if SDL_ModState = 0 then begin
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0;
- Inc(AktNuta);
- if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].IlNut then AktNuta := 0;
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1;
- Lyric.Selected := AktNuta;
- end;
- end;
- SDLK_LEFT:
- begin
- // left
- if SDL_ModState = 0 then begin
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0;
- Dec(AktNuta);
- if AktNuta = -1 then AktNuta := Czesci[0].Czesc[Czesci[0].Akt].HighNut;
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1;
- Lyric.Selected := AktNuta;
- end;
- end;
- end;
- end;
-end;
-
-procedure TScreenEditSub.NewBeat;
-begin
- // click
-{ for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do
- if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeat) then begin
- // old}
-// Music.PlayClick;
-end;
-
-procedure TScreenEditSub.CzesciDivide;
-var
- C: integer;
- N: integer;
-begin
- AktSong.BPM[0].BPM := AktSong.BPM[0].BPM / 2;
- for C := 0 to Czesci[0].High do begin
- Czesci[0].Czesc[C].Start := Czesci[0].Czesc[C].Start div 2;
- Czesci[0].Czesc[C].StartNote := Czesci[0].Czesc[C].StartNote div 2;
- Czesci[0].Czesc[C].Koniec := Czesci[0].Czesc[C].Koniec div 2;
- for N := 0 to Czesci[0].Czesc[C].HighNut do begin
- Czesci[0].Czesc[C].Nuta[N].Start := Czesci[0].Czesc[C].Nuta[N].Start div 2;
- Czesci[0].Czesc[C].Nuta[N].Dlugosc := Round(Czesci[0].Czesc[C].Nuta[N].Dlugosc / 2);
- end; // N
- end; // C
-end;
-
-procedure TScreenEditSub.CzesciMultiply;
-var
- C: integer;
- N: integer;
-begin
- AktSong.BPM[0].BPM := AktSong.BPM[0].BPM * 2;
- for C := 0 to Czesci[0].High do begin
- Czesci[0].Czesc[C].Start := Czesci[0].Czesc[C].Start * 2;
- Czesci[0].Czesc[C].StartNote := Czesci[0].Czesc[C].StartNote * 2;
- Czesci[0].Czesc[C].Koniec := Czesci[0].Czesc[C].Koniec * 2;
- for N := 0 to Czesci[0].Czesc[C].HighNut do begin
- Czesci[0].Czesc[C].Nuta[N].Start := Czesci[0].Czesc[C].Nuta[N].Start * 2;
- Czesci[0].Czesc[C].Nuta[N].Dlugosc := Czesci[0].Czesc[C].Nuta[N].Dlugosc * 2;
- end; // N
- end; // C
-end;
-
-procedure TScreenEditSub.LyricsCapitalize;
-var
- C: integer;
- N: integer; // temporary
- S: string;
-begin
- // temporary
-{ for C := 0 to Czesci[0].High do
- for N := 0 to Czesci[0].Czesc[C].HighNut do
- Czesci[0].Czesc[C].Nuta[N].Tekst := AnsiLowerCase(Czesci[0].Czesc[C].Nuta[N].Tekst);}
-
- for C := 0 to Czesci[0].High do begin
- S := AnsiUpperCase(Copy(Czesci[0].Czesc[C].Nuta[0].Tekst, 1, 1));
- S := S + Copy(Czesci[0].Czesc[C].Nuta[0].Tekst, 2, Length(Czesci[0].Czesc[C].Nuta[0].Tekst)-1);
- Czesci[0].Czesc[C].Nuta[0].Tekst := S;
- end; // C
-end;
-
-procedure TScreenEditSub.LyricsCorrectSpaces;
-var
- C: integer;
- N: integer;
-begin
- for C := 0 to Czesci[0].High do begin
- // correct starting spaces in the first word
- while Copy(Czesci[0].Czesc[C].Nuta[0].Tekst, 1, 1) = ' ' do
- Czesci[0].Czesc[C].Nuta[0].Tekst := Copy(Czesci[0].Czesc[C].Nuta[0].Tekst, 2, 100);
-
- // move spaces on the start to the end of the previous note
- for N := 1 to Czesci[0].Czesc[C].HighNut do begin
- while (Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, 1, 1) = ' ') do begin
- Czesci[0].Czesc[C].Nuta[N].Tekst := Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, 2, 100);
- Czesci[0].Czesc[C].Nuta[N-1].Tekst := Czesci[0].Czesc[C].Nuta[N-1].Tekst + ' ';
- end;
- end; // N
-
- // correct '-' to '- '
- for N := 0 to Czesci[0].Czesc[C].HighNut do begin
- if Czesci[0].Czesc[C].Nuta[N].Tekst = '-' then
- Czesci[0].Czesc[C].Nuta[N].Tekst := '- ';
- end; // N
-
- // add space to the previous note when the current word is '- '
- for N := 1 to Czesci[0].Czesc[C].HighNut do begin
- if Czesci[0].Czesc[C].Nuta[N].Tekst = '- ' then
- Czesci[0].Czesc[C].Nuta[N-1].Tekst := Czesci[0].Czesc[C].Nuta[N-1].Tekst + ' ';
- end; // N
-
- // correct too many spaces at the end of note
- for N := 0 to Czesci[0].Czesc[C].HighNut do begin
- while Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, Length(Czesci[0].Czesc[C].Nuta[N].Tekst)-1, 2) = ' ' do
- Czesci[0].Czesc[C].Nuta[N].Tekst := Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, 1, Length(Czesci[0].Czesc[C].Nuta[N].Tekst)-1);
- end; // N
-
- // and correct if there is no space at the end of sentence
- N := Czesci[0].Czesc[C].HighNut;
- if Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, Length(Czesci[0].Czesc[C].Nuta[N].Tekst), 1) <> ' ' then
- Czesci[0].Czesc[C].Nuta[N].Tekst := Czesci[0].Czesc[C].Nuta[N].Tekst + ' ';
-
- end; // C
-end;
-
-procedure TScreenEditSub.FixTimings;
-var
- C: integer;
- S: integer;
- Min: integer;
- Max: integer;
-begin
- for C := 1 to Czesci[0].High do begin
- with Czesci[0].Czesc[C-1] do begin
- Min := Nuta[HighNut].Start + Nuta[HighNut].Dlugosc;
- Max := Czesci[0].Czesc[C].StartNote;
- case (Max - Min) of
- 0: S := Max;
- 1: S := Max;
- 2: S := Max - 1;
- 3: S := Max - 2;
- else
- if ((Max - Min) > 4) then
- S := Min + 2
- else
- S := Max;
- end; // case
-
- Czesci[0].Czesc[C].Start := S;
- end; // with
- end; // for
-end;
-
-procedure TScreenEditSub.DivideSentence;
-var
- C: integer;
- CStart: integer;
- CNew: integer;
- CLen: integer;
- N: integer;
- NStart: integer;
- NHigh: integer;
- NNewL: integer;
-begin
- // increase sentence length by 1
- CLen := Length(Czesci[0].Czesc);
- SetLength(Czesci[0].Czesc, CLen + 1);
- Inc(Czesci[0].Ilosc);
- Inc(Czesci[0].High);
-
- // move needed sentences to one forward. newly has the copy of divided sentence
- CStart := Czesci[0].Akt;
- for C := CLen-1 downto CStart do
- Czesci[0].Czesc[C+1] := Czesci[0].Czesc[C];
-
- // clear and set new sentence
- CNew := CStart + 1;
- NStart := AktNuta;
- Czesci[0].Czesc[CNew].Start := Czesci[0].Czesc[CStart].Nuta[NStart].Start;
- Czesci[0].Czesc[CNew].StartNote := Czesci[0].Czesc[CStart].Nuta[NStart].Start;
- Czesci[0].Czesc[CNew].Lyric := '';
- Czesci[0].Czesc[CNew].LyricWidth := 0;
- Czesci[0].Czesc[CNew].Koniec := 0;
- Czesci[0].Czesc[CNew].BaseNote := 0; // 0.5.0: we modify it later in this procedure
- Czesci[0].Czesc[CNew].IlNut := 0;
- Czesci[0].Czesc[CNew].HighNut := -1;
- SetLength(Czesci[0].Czesc[CNew].Nuta, 0);
-
- // move right notes to new sentences
- NHigh := Czesci[0].Czesc[CStart].HighNut;
- for N := NStart to NHigh do begin
- NNewL := Czesci[0].Czesc[CNew].IlNut;
- SetLength(Czesci[0].Czesc[CNew].Nuta, NNewL + 1);
- Czesci[0].Czesc[CNew].Nuta[NNewL] := Czesci[0].Czesc[CStart].Nuta[N];
-
- // increase sentence counters
- Inc(Czesci[0].Czesc[CNew].IlNut);
- Inc(Czesci[0].Czesc[CNew].HighNut);
- Czesci[0].Czesc[CNew].Koniec := Czesci[0].Czesc[CNew].Nuta[NNewL].Start +
- Czesci[0].Czesc[CNew].Nuta[NNewL].Dlugosc;
- end;
-
- // clear old notes and set sentence counters
- Czesci[0].Czesc[CStart].HighNut := NStart - 1;
- Czesci[0].Czesc[CStart].IlNut := Czesci[0].Czesc[CStart].HighNut + 1;
- Czesci[0].Czesc[CStart].Koniec := Czesci[0].Czesc[CStart].Nuta[NStart-1].Start +
- Czesci[0].Czesc[CStart].Nuta[NStart-1].Dlugosc;
- SetLength(Czesci[0].Czesc[CStart].Nuta, Czesci[0].Czesc[CStart].IlNut);
-
- // 0.5.0: modify BaseNote
- Czesci[0].Czesc[CNew].BaseNote := 120;
- for N := 0 to Czesci[0].Czesc[CNew].IlNut do
- if Czesci[0].Czesc[CNew].Nuta[N].Ton < Czesci[0].Czesc[CNew].BaseNote then
- Czesci[0].Czesc[CNew].BaseNote := Czesci[0].Czesc[CNew].Nuta[N].Ton;
-
- Czesci[0].Akt := Czesci[0].Akt + 1;
- AktNuta := 0;
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1;
- Lyric.AddCzesc(Czesci[0].Akt);
-
-end;
-
-procedure TScreenEditSub.JoinSentence;
-var
- C: integer;
- N: integer;
- NStart: integer;
- NDst: integer;
-begin
- C := Czesci[0].Akt;
-
- // set new sentence
- NStart := Czesci[0].Czesc[C].IlNut;
- Czesci[0].Czesc[C].IlNut := Czesci[0].Czesc[C].IlNut + Czesci[0].Czesc[C+1].IlNut;
- Czesci[0].Czesc[C].HighNut := Czesci[0].Czesc[C].HighNut + Czesci[0].Czesc[C+1].IlNut;
- SetLength(Czesci[0].Czesc[C].Nuta, Czesci[0].Czesc[C].IlNut);
-
- // move right notes to new sentences
- for N := 0 to Czesci[0].Czesc[C+1].HighNut do begin
- NDst := NStart + N;
- Czesci[0].Czesc[C].Nuta[NDst] := Czesci[0].Czesc[C+1].Nuta[N];
- end;
-
- // increase sentence counters
- NDst := Czesci[0].Czesc[C].HighNut;
- Czesci[0].Czesc[C].Koniec := Czesci[0].Czesc[C].Nuta[NDst].Start +
- Czesci[0].Czesc[C].Nuta[NDst].Dlugosc;
-
- // move needed sentences to one backward.
- for C := Czesci[0].Akt + 1 to Czesci[0].High - 1 do
- Czesci[0].Czesc[C] := Czesci[0].Czesc[C+1];
-
- // increase sentence length by 1
- SetLength(Czesci[0].Czesc, Length(Czesci[0].Czesc) - 1);
- Dec(Czesci[0].Ilosc);
- Dec(Czesci[0].High);
-end;
-
-procedure TScreenEditSub.DivideNote;
-var
- C: integer;
- N: integer;
- NLen: integer;
-begin
- C := Czesci[0].Akt;
-
- NLen := Czesci[0].Czesc[C].IlNut + 1;
- SetLength(Czesci[0].Czesc[C].Nuta, NLen);
- Inc(Czesci[0].Czesc[C].HighNut);
- Inc(Czesci[0].Czesc[C].IlNut);
-
- // we copy all notes including selected one
- for N := Czesci[0].Czesc[C].HighNut downto AktNuta+1 do begin
- Czesci[0].Czesc[C].Nuta[N] := Czesci[0].Czesc[C].Nuta[N-1];
- end;
-
- // me slightly modify new note
- Czesci[0].Czesc[C].Nuta[AktNuta].Dlugosc := 1;
- Inc(Czesci[0].Czesc[C].Nuta[AktNuta+1].Start);
- Dec(Czesci[0].Czesc[C].Nuta[AktNuta+1].Dlugosc);
- Czesci[0].Czesc[C].Nuta[AktNuta+1].Tekst := '- ';
- Czesci[0].Czesc[C].Nuta[AktNuta+1].Color := 0;
-end;
-
-procedure TScreenEditSub.DeleteNote;
-var
- C: integer;
- N: integer;
- NLen: integer;
-begin
- C := Czesci[0].Akt;
-
- //Do Not delete Last Note
- if (Czesci[0].High > 0) OR (Czesci[0].Czesc[C].HighNut > 0) then
- begin
-
- // we copy all notes from the next to the selected one
- for N := AktNuta+1 to Czesci[0].Czesc[C].HighNut do begin
- Czesci[0].Czesc[C].Nuta[N-1] := Czesci[0].Czesc[C].Nuta[N];
- end;
-
- NLen := Czesci[0].Czesc[C].IlNut - 1;
-
- if (NLen > 0) then
- begin
- SetLength(Czesci[0].Czesc[C].Nuta, NLen);
- Dec(Czesci[0].Czesc[C].HighNut);
- Dec(Czesci[0].Czesc[C].IlNut);
-
-
- // me slightly modify new note
- if AktNuta > Czesci[0].Czesc[C].HighNut then Dec(AktNuta);
- Czesci[0].Czesc[C].Nuta[AktNuta].Color := 1;
- end
- //Last Note of current Sentence Deleted - > Delete Sentence
- else
- begin
- //Move all Sentences after the current to the Left
- for N := C+1 to Czesci[0].High do
- Czesci[0].Czesc[N-1] := Czesci[0].Czesc[N];
-
- //Delete Last Sentence
- SetLength(Czesci[0].Czesc, Czesci[0].High);
- Czesci[0].High := High(Czesci[0].Czesc);
- Czesci[0].Ilosc := Length(Czesci[0].Czesc);
-
- AktNuta := 0;
- if (C > 0) then
- Czesci[0].Akt := C - 1
- else
- Czesci[0].Akt := 0;
-
- Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1;
- end;
- end;
-end;
-
-procedure TScreenEditSub.TransposeNote(Transpose: integer);
-begin
- Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton, Transpose);
-end;
-
-procedure TScreenEditSub.ChangeWholeTone(Tone: integer);
-var
- C: integer;
- N: integer;
-begin
- for C := 0 to Czesci[0].High do begin
- Czesci[0].Czesc[C].BaseNote := Czesci[0].Czesc[C].BaseNote + Tone;
- for N := 0 to Czesci[0].Czesc[C].HighNut do
- Czesci[0].Czesc[C].Nuta[N].Ton := Czesci[0].Czesc[C].Nuta[N].Ton + Tone;
- end;
-end;
-
-procedure TScreenEditSub.MoveAllToEnd(Move: integer);
-var
- C: integer;
- N: integer;
- NStart: integer;
-begin
- for C := Czesci[0].Akt to Czesci[0].High do begin
- NStart := 0;
- if C = Czesci[0].Akt then NStart := AktNuta;
- for N := NStart to Czesci[0].Czesc[C].HighNut do begin
- Inc(Czesci[0].Czesc[C].Nuta[N].Start, Move); // move note start
-
- if N = 0 then begin // fix beginning
- Inc(Czesci[0].Czesc[C].Start, Move);
- Inc(Czesci[0].Czesc[C].StartNote, Move);
- end;
-
- if N = Czesci[0].Czesc[C].HighNut then // fix ending
- Inc(Czesci[0].Czesc[C].Koniec, Move);
-
- end; // for
- end; // for
-end;
-
-procedure TScreenEditSub.MoveTextToRight;
-var
- C: integer;
- N: integer;
- NHigh: integer;
-begin
-{ C := Czesci[0].Akt;
-
- for N := Czesci[0].Czesc[C].HighNut downto 1 do begin
- Czesci[0].Czesc[C].Nuta[N].Tekst := Czesci[0].Czesc[C].Nuta[N-1].Tekst;
- end; // for
-
- Czesci[0].Czesc[C].Nuta[0].Tekst := '- ';}
-
- C := Czesci[0].Akt;
- NHigh := Czesci[0].Czesc[C].HighNut;
-
- // last word
- Czesci[0].Czesc[C].Nuta[NHigh].Tekst := Czesci[0].Czesc[C].Nuta[NHigh-1].Tekst + Czesci[0].Czesc[C].Nuta[NHigh].Tekst;
-
- // other words
- for N := NHigh - 1 downto AktNuta + 1 do begin
- Czesci[0].Czesc[C].Nuta[N].Tekst := Czesci[0].Czesc[C].Nuta[N-1].Tekst;
- end; // for
- Czesci[0].Czesc[C].Nuta[AktNuta].Tekst := '- ';
-end;
-
-procedure TScreenEditSub.MarkSrc;
-begin
- CopySrc := Czesci[0].Akt;
-end;
-
-procedure TScreenEditSub.PasteText;
-var
- C: integer;
- N: integer;
-begin
- C := Czesci[0].Akt;
-
- for N := 0 to Czesci[0].Czesc[CopySrc].HighNut do
- Czesci[0].Czesc[C].Nuta[N].Tekst := Czesci[0].Czesc[CopySrc].Nuta[N].Tekst;
-end;
-
-procedure TScreenEditSub.CopySentence(Src, Dst: integer);
-var
- N: integer;
- Time1: integer;
- Time2: integer;
- TD: integer;
-begin
- Time1 := Czesci[0].Czesc[Src].Nuta[0].Start;
- Time2 := Czesci[0].Czesc[Dst].Nuta[0].Start;
- TD := Time2-Time1;
-
- SetLength(Czesci[0].Czesc[Dst].Nuta, Czesci[0].Czesc[Src].IlNut);
- Czesci[0].Czesc[Dst].IlNut := Czesci[0].Czesc[Src].IlNut;
- Czesci[0].Czesc[Dst].HighNut := Czesci[0].Czesc[Src].HighNut;
- for N := 0 to Czesci[0].Czesc[Src].HighNut do begin
- Czesci[0].Czesc[Dst].Nuta[N].Tekst := Czesci[0].Czesc[Src].Nuta[N].Tekst;
- Czesci[0].Czesc[Dst].Nuta[N].Dlugosc := Czesci[0].Czesc[Src].Nuta[N].Dlugosc;
- Czesci[0].Czesc[Dst].Nuta[N].Ton := Czesci[0].Czesc[Src].Nuta[N].Ton;
- Czesci[0].Czesc[Dst].Nuta[N].Start := Czesci[0].Czesc[Src].Nuta[N].Start + TD;
- end;
- N := Czesci[0].Czesc[Src].HighNut;
- Czesci[0].Czesc[Dst].Koniec := Czesci[0].Czesc[Dst].Nuta[N].Start + Czesci[0].Czesc[Dst].Nuta[N].Dlugosc;
-end;
-
-procedure TScreenEditSub.CopySentences(Src, Dst, Num: integer);
-var
- C: integer;
-begin
- Lyric := TLyric.Create;
- // create place for new sentences
- SetLength(Czesci[0].Czesc, Czesci[0].Ilosc + Num - 1);
-
- // moves sentences next to the destination
- for C := Czesci[0].High downto Dst + 1 do begin
- Czesci[0].Czesc[C + Num - 1] := Czesci[0].Czesc[C];
- end;
-
- // prepares new sentences: sets sentence start and create first note
- for C := 1 to Num-1 do begin
- Czesci[0].Czesc[Dst + C].Start := Czesci[0].Czesc[Dst + C - 1].StartNote +
- (Czesci[0].Czesc[Src + C].StartNote - Czesci[0].Czesc[Src + C - 1].StartNote);
- SetLength(Czesci[0].Czesc[Dst + C].Nuta, 1);
- Czesci[0].Czesc[Dst + C].IlNut := 1;
- Czesci[0].Czesc[Dst + C].HighNut := 0;
- Czesci[0].Czesc[Dst + C].Nuta[0].Start := Czesci[0].Czesc[Dst + C].Start;
- Czesci[0].Czesc[Dst + C].Nuta[0].Dlugosc := 1;
- Czesci[0].Czesc[Dst + C].StartNote := Czesci[0].Czesc[Dst + C].Start;
- Czesci[0].Czesc[Dst + C].Koniec := Czesci[0].Czesc[Dst + C].Start + 1;
- end;
-
- // increase counters
- Czesci[0].Ilosc := Czesci[0].Ilosc + Num - 1;
- Czesci[0].High := Czesci[0].High + Num - 1;
-
- for C := 0 to Num-1 do
- CopySentence(Src + C, Dst + C);
-end;
-
-
-constructor TScreenEditSub.Create;
-begin
- inherited Create;
- SetLength(Player, 1);
-
- // linijka
- AddStatic(20, 10, 80, 30, 0, 0, 0, Skin.GetTextureFileName('ButtonF'), 'JPG', 'Font Black');
- AddText(40, 17, 1, 6, 1, 1, 1, 'Line');
- TextSentence := AddText(120, 14, 1, 8, 0, 0, 0, '0 / 0');
-
- // nuta
- AddStatic(220, 10, 80, 30, 0, 0, 0, Skin.GetTextureFileName('ButtonF'), 'JPG', 'Font Black');
- AddText(242, 17, 1, 6, 1, 1, 1, 'Note');
- TextNote := AddText(320, 14, 1, 8, 0, 0, 0, '0 / 0');
-
- // file info
- AddStatic(150, 50, 500, 150, 0, 0, 0, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black');
- AddStatic(151, 52, 498, 146, 1, 1, 1, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black');
- AddText(180, 65, 0, 8, 0, 0, 0, 'Title:');
- AddText(180, 90, 0, 8, 0, 0, 0, 'Artist:');
- AddText(180, 115, 0, 8, 0, 0, 0, 'Mp3:');
- AddText(180, 140, 0, 8, 0, 0, 0, 'BPM:');
- AddText(180, 165, 0, 8, 0, 0, 0, 'GAP:');
-
- TextTitle := AddText(250, 65, 0, 8, 0, 0, 0, 'a');
- TextArtist := AddText(250, 90, 0, 8, 0, 0, 0, 'b');
- TextMp3 := AddText(250, 115, 0, 8, 0, 0, 0, 'c');
- TextBPM := AddText(250, 140, 0, 8, 0, 0, 0, 'd');
- TextGAP := AddText(250, 165, 0, 8, 0, 0, 0, 'e');
-
-{ AddInteraction(2, TextTitle);
- AddInteraction(2, TextArtist);
- AddInteraction(2, TextMp3);
- AddInteraction(2, TextBPM);
- AddInteraction(2, TextGAP);}
-
- // note info
- AddText(20, 190, 0, 8, 0, 0, 0, 'Start:');
- AddText(20, 215, 0, 8, 0, 0, 0, 'Duration:');
- AddText(20, 240, 0, 8, 0, 0, 0, 'Tone:');
- AddText(20, 265, 0, 8, 0, 0, 0, 'Text:');
-
- TextNStart := AddText(120, 190, 0, 8, 0, 0, 0, 'a');
- TextNDlugosc := AddText(120, 215, 0, 8, 0, 0, 0, 'b');
- TextNTon := AddText(120, 240, 0, 8, 0, 0, 0, 'c');
- TextNText := AddText(120, 265, 0, 8, 0, 0, 0, 'd');
-
- // debug
- TextDebug := AddText(30, 550, 0, 8, 0, 0, 0, '');
-
-end;
-
-procedure TScreenEditSub.onShow;
-begin
- Log.LogStatus('Initializing', 'TEditScreen.onShow');
-
- try
- ResetSingTemp;
- Error := not LoadSong(Path + FileName);
- except
- Error := True;
- end;
-
- if Error then
- begin
- //Error Loading Song -> Go back to Song Screen and Show some Error Message
- FadeTo(@ScreenSong);
- ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG'));
- Exit;
- end
- else begin
- {$IFDEF UseMIDIPort}
- MidiOut := TMidiOutput.Create(nil);
- if Ini.Debug = 1 then
- MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table
- MidiOut.Open;
- {$ENDIF}
- Text[TextTitle].Text := AktSong.Title;
- Text[TextArtist].Text := AktSong.Artist;
- Text[TextMp3].Text := AktSong.Mp3;
-
- Czesci[0].Akt := 0;
- AktNuta := 0;
- Czesci[0].Czesc[0].Nuta[0].Color := 1;
-
- AudioPlayback.Open(Path + AktSong.Mp3);
- //Set Down Music Volume for Better hearability of Midi Sounds
- //Music.SetVolume(40);
-
- Lyric.Clear;
- Lyric.X := 400;
- Lyric.Y := 500;
- Lyric.Align := 1;
- Lyric.Size := 14;
- Lyric.ColR := 0;
- Lyric.ColG := 0;
- Lyric.ColB := 0;
- Lyric.ColSR := Skin_FontHighlightR;
- Lyric.ColSG := Skin_FontHighlightG;
- Lyric.ColSB := Skin_FontHighlightB;
- Lyric.Style := 0;
- Lyric.AddCzesc(0);
- Lyric.Selected := 0;
-
- NotesH := 7;
- NotesW := 4;
-
- end;
-
-// Interaction := 0;
- TextEditMode := false;
-end;
-
-function TScreenEditSub.Draw: boolean;
-var
- Min: integer;
- Sec: integer;
- Tekst: string;
- Pet: integer;
- AktBeat: integer;
-begin
- glClearColor(1,1,1,1);
-
- // midi music
- if PlaySentenceMidi then begin
- MidiPos := USTime.GetTime - MidiTime + MidiStart;
-
- {$IFDEF UseMIDIPort}
- // stop the music
- if (MidiPos > MidiStop) then begin
- MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127);
- PlaySentenceMidi := false;
- end;
- {$ENDIF}
-
- // click
- AktBeat := Floor(GetMidBeat(MidiPos - AktSong.GAP / 1000));
- Text[TextDebug].Text := IntToStr(AktBeat);
-
- if AktBeat <> LastClick then begin
- for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do
- if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then
- begin
-
- {$IFDEF UseMIDIPort}
- LastClick := AktBeat;
- if Pet > 0 then
- MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet-1].Ton + 60, 127);
- MidiOut.PutShort($91, Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Ton + 60, 127);
- MidiLastNote := Pet;
- {$ENDIF}
-
- end;
- end;
- end; // if PlaySentenceMidi
-
- // mp3 music
- if PlaySentence then begin
- // stop the music
- if (AudioPlayback.Position > PlayStopTime) then
- begin
- AudioPlayback.Stop;
- PlaySentence := false;
- end;
-
- // click
- if (Click) and (PlaySentence) then begin
-// AktBeat := Floor(AktSong.BPM[0].BPM * (Music.Position - AktSong.GAP / 1000) / 60);
- AktBeat := Floor(GetMidBeat(AudioPlayback.Position - AktSong.GAP / 1000));
- Text[TextDebug].Text := IntToStr(AktBeat);
- if AktBeat <> LastClick then begin
- for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do
- if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then
- begin
- AudioPlayback.PlayClick;
- LastClick := AktBeat;
- end;
- end;
- end; // click
- end; // if PlaySentence
-
-
- Text[TextSentence].Text := IntToStr(Czesci[0].Akt + 1) + ' / ' + IntToStr(Czesci[0].Ilosc);
- Text[TextNote].Text := IntToStr(AktNuta + 1) + ' / ' + IntToStr(Czesci[0].Czesc[Czesci[0].Akt].IlNut);
-
- // Song info
- Text[TextBPM].Text := FloatToStr(AktSong.BPM[0].BPM / 4);
- Text[TextGAP].Text := FloatToStr(AktSong.GAP);
-
- //Error reading Variables when no Song is loaded
- if not Error then
- begin
- // Note info
- Text[TextNStart].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start);
- Text[TextNDlugosc].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc);
- Text[TextNTon].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton) + ' ( ' + GetNoteName(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton) + ' )';
- Text[TextNText].Text := Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst;
- end;
-
- // Text Edit Mode
- if TextEditMode then
- Text[TextNText].Text := Text[TextNText].Text + '|';
-
- // draw static menu
- inherited Draw;
-
- // draw notes
- SingDrawNoteLines(20, 300, 780, 15);
- //Error Drawing when no Song is loaded
- if not Error then
- begin
- SingDrawBeatDelimeters(40, 300, 760, 0);
- EditDrawCzesc(40, 405, 760, 0, 15);
- end;
-
- // draw text
- Lyric.Draw;
-
-end;
-
-procedure TScreenEditSub.onHide;
-begin
- {$IFDEF UseMIDIPort}
- MidiOut.Close;
- MidiOut.Free;
- {$ENDIF}
- //Music.SetVolume(100);
-end;
-
-function TScreenEditSub.GetNoteName(Note: Integer): String;
-var N1, N2: Integer;
-begin
- if (Note > 0) then
- begin
- N1 := Note mod 12;
- N2 := Note div 12;
- end
- else
- begin
- N1 := (Note + (-Trunc(Note/12)+1)*12) mod 12;
- N2 := -1;
- end;
-
-
-
- case N1 of
- 0: Result := 'c';
- 1: Result := 'c#';
- 2: Result := 'd';
- 3: Result := 'd#';
- 4: Result := 'e';
- 5: Result := 'f';
- 6: Result := 'f#';
- 7: Result := 'g';
- 8: Result := 'g#';
- 9: Result := 'a';
- 10: Result := 'b';
- 11: Result := 'h';
- end;
-
- case N2 of
- 0: Result := UpperCase(Result); //Normal Uppercase Note, 1: Normal lowercase Note
- 2: Result := Result + ''''; //One Striped
- 3: Result := Result + ''''''; //Two Striped
- 4: Result := Result + ''''''''; //etc.
- 5: Result := Result + '''''''''';
- 6: Result := Result + '''''''''''';
- 7: Result := Result + '''''''''''''';
- end;
-end;
-
-end.
+unit UScreenEditSub;
+
+interface
+
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+{$I switches.inc}
+
+uses
+ UMenu,
+ UMusic,
+ SDL,
+ SysUtils,
+ UFiles,
+ UTime,
+ USongs,
+ UIni,
+ ULog,
+ UTexture,
+ UMenuText,
+ ULyrics_bak,
+ Math,
+ OpenGL12,
+ {$IFDEF UseMIDIPort}
+ MidiOut,
+ {$ENDIF}
+ UThemes;
+
+type
+ TScreenEditSub = class(TMenu)
+ private
+ //Variable is True if no SOng is loaded
+ Error: Boolean;
+
+ TextNote: integer;
+ TextSentence: integer;
+ TextTitle: integer;
+ TextArtist: integer;
+ TextMp3: integer;
+ TextBPM: integer;
+ TextGAP: integer;
+ TextDebug: integer;
+ TextNStart: integer;
+ TextNDlugosc: integer;
+ TextNTon: integer;
+ TextNText: integer;
+ AktNuta: integer;
+ PlaySentence: boolean;
+ PlaySentenceMidi: boolean;
+ PlayStopTime: real;
+ LastClick: integer;
+ Click: boolean;
+ CopySrc: integer;
+
+ {$IFDEF UseMIDIPort}
+ MidiOut: TMidiOutput;
+ {$endif}
+
+ MidiStart: real;
+ MidiStop: real;
+ MidiTime: real;
+ MidiPos: real;
+ MidiLastNote: integer;
+
+ TextEditMode: boolean;
+
+ procedure NewBeat;
+ procedure CzesciDivide;
+ procedure CzesciMultiply;
+ procedure LyricsCapitalize;
+ procedure LyricsCorrectSpaces;
+ procedure FixTimings;
+ procedure DivideSentence;
+ procedure JoinSentence;
+ procedure DivideNote;
+ procedure DeleteNote;
+ procedure TransposeNote(Transpose: integer);
+ procedure ChangeWholeTone(Tone: integer);
+ procedure MoveAllToEnd(Move: integer);
+ procedure MoveTextToRight;
+ procedure MarkSrc;
+ procedure PasteText;
+ procedure CopySentence(Src, Dst: integer);
+ procedure CopySentences(Src, Dst, Num: integer);
+ //Note Name Mod
+ function GetNoteName(Note: Integer): String;
+ public
+ Tex_Background: TTexture;
+ FadeOut: boolean;
+ Path: string;
+ FileName: string;
+ constructor Create; override;
+ procedure onShow; override;
+ function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
+ function ParseInputEditText(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+ function Draw: boolean; override;
+ procedure onHide; override;
+ end;
+
+implementation
+uses UGraphic, UDraw, UMain, USkins, ULanguage;
+
+// Method for input parsing. If False is returned, GetNextWindow
+// should be checked to know the next window to load;
+function TScreenEditSub.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+var
+ SDL_ModState: Word;
+ R: real;
+begin
+ Result := true;
+
+ if TextEditMode then begin
+ Result := ParseInputEditText(PressedKey, ScanCode, PressedDown);
+ end else begin
+
+ SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT
+ + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT {+ KMOD_CAPS});
+
+ If (PressedDown) then begin // Key Down
+ case PressedKey of
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ FadeTo(@ScreenSong);
+ end;
+
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+
+ SDLK_BACKQUOTE:
+ begin
+ // Increase Note Length (same as Alt + Right)
+ Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc);
+ if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then
+ Inc(Czesci[0].Czesc[Czesci[0].Akt].Koniec);
+ end;
+
+ SDLK_EQUALS:
+ begin
+ // Increase BPM
+ if SDL_ModState = 0 then
+ AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 5) + 1) / 5; // (1/20)
+ if SDL_ModState = KMOD_LSHIFT then
+ AktSong.BPM[0].BPM := AktSong.BPM[0].BPM + 4; // (1/1)
+ if SDL_ModState = KMOD_LCTRL then
+ AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 25) + 1) / 25; // (1/100)
+ end;
+
+ SDLK_MINUS:
+ begin
+ // Decrease BPM
+ if SDL_ModState = 0 then
+ AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 5) - 1) / 5;
+ if SDL_ModState = KMOD_LSHIFT then
+ AktSong.BPM[0].BPM := AktSong.BPM[0].BPM - 4;
+ if SDL_ModState = KMOD_LCTRL then
+ AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 25) - 1) / 25;
+ end;
+
+ SDLK_0:
+ begin
+ // Increase GAP
+ if SDL_ModState = 0 then
+ AktSong.GAP := AktSong.GAP + 10;
+ if SDL_ModState = KMOD_LSHIFT then
+ AktSong.GAP := AktSong.GAP + 1000;
+ end;
+
+ SDLK_9:
+ begin
+ // Decrease GAP
+ if SDL_ModState = 0 then
+ AktSong.GAP := AktSong.GAP - 10;
+ if SDL_ModState = KMOD_LSHIFT then
+ AktSong.GAP := AktSong.GAP - 1000;
+ end;
+
+ SDLK_KP_PLUS:
+ begin
+ // Increase tone of all notes
+ if SDL_ModState = 0 then
+ ChangeWholeTone(1);
+ if SDL_ModState = KMOD_LSHIFT then
+ ChangeWholeTone(12);
+ end;
+
+ SDLK_KP_MINUS:
+ begin
+ // Decrease tone of all notes
+ if SDL_ModState = 0 then
+ ChangeWholeTone(-1);
+ if SDL_ModState = KMOD_LSHIFT then
+ ChangeWholeTone(-12);
+ end;
+
+ SDLK_SLASH:
+ begin
+ if SDL_ModState = 0 then begin
+ // Insert start of sentece
+ if AktNuta > 0 then
+ DivideSentence;
+ end;
+
+ if SDL_ModState = KMOD_LSHIFT then begin
+ // Join next sentence with current
+ if Czesci[0].Akt < Czesci[0].High then
+ JoinSentence;
+ end;
+
+ if SDL_ModState = KMOD_LCTRL then begin
+ // divide note
+ DivideNote;
+ end;
+
+ end;
+
+ SDLK_S:
+ begin
+ // Save Song
+ if SDL_ModState = KMOD_LSHIFT then
+ SaveSong(AktSong, Czesci[0], Path + FileName, true)
+ else
+ SaveSong(AktSong, Czesci[0], Path + FileName, false);
+
+ {if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL + KMOD_LALT then
+ // Save Song
+ SaveSongDebug(AktSong, Czesci[0], 'C:\song.asm', false);}
+
+ end;
+
+ SDLK_D:
+ begin
+ // Divide lengths by 2
+ CzesciDivide;
+ end;
+
+ SDLK_M:
+ begin
+ // Multiply lengths by 2
+ CzesciMultiply;
+ end;
+
+ SDLK_C:
+ begin
+ // Capitalize letter at the beginning of line
+ if SDL_ModState = 0 then
+ LyricsCapitalize;
+
+ // Correct spaces
+ if SDL_ModState = KMOD_LSHIFT then
+ LyricsCorrectSpaces;
+
+ // Copy sentence
+ if SDL_ModState = KMOD_LCTRL then
+ MarkSrc;
+ end;
+
+ SDLK_V:
+ begin
+ // Paste text
+ if SDL_ModState = KMOD_LCTRL then begin
+ if Czesci[0].Czesc[Czesci[0].Akt].IlNut >= Czesci[0].Czesc[CopySrc].IlNut then
+ PasteText
+ else
+ beep;
+ end;
+
+ if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then begin
+ CopySentence(CopySrc, Czesci[0].Akt);
+ end;
+ end;
+
+ SDLK_4:
+ begin
+ if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then begin
+ CopySentence(CopySrc, Czesci[0].Akt);
+ CopySentence(CopySrc+1, Czesci[0].Akt+1);
+ CopySentence(CopySrc+2, Czesci[0].Akt+2);
+ CopySentence(CopySrc+3, Czesci[0].Akt+3);
+ end;
+
+ if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT + KMOD_LALT then begin
+ CopySentences(CopySrc, Czesci[0].Akt, 4);
+ end;
+ end;
+ SDLK_5:
+ begin
+ if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then begin
+ CopySentence(CopySrc, Czesci[0].Akt);
+ CopySentence(CopySrc+1, Czesci[0].Akt+1);
+ CopySentence(CopySrc+2, Czesci[0].Akt+2);
+ CopySentence(CopySrc+3, Czesci[0].Akt+3);
+ CopySentence(CopySrc+4, Czesci[0].Akt+4);
+ end;
+
+ if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT + KMOD_LALT then begin
+ CopySentences(CopySrc, Czesci[0].Akt, 5);
+ end;
+ end;
+
+ SDLK_T:
+ begin
+ // Fixes timings between sentences
+ FixTimings;
+ end;
+
+ SDLK_F4:
+ begin
+ // Enter Text Edit Mode
+ TextEditMode := true;
+ end;
+
+ SDLK_P:
+ begin
+ if SDL_ModState = 0 then begin
+ // Play Sentence
+ Click := true;
+ AudioPlayback.Stop;
+ R := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote);
+ if R <= AudioPlayback.Length then begin
+ AudioPlayback.MoveTo(R);
+ PlayStopTime := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec);
+ PlaySentence := true;
+ AudioPlayback.Play;
+ LastClick := -100;
+ end;
+ end;
+
+ if SDL_ModState = KMOD_LSHIFT then begin
+ PlaySentenceMidi := true;
+
+ MidiTime := USTime.GetTime;
+ MidiStart := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote);
+ MidiStop := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec);
+
+ LastClick := -100;
+ end;
+ if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL then begin
+ PlaySentenceMidi := true;
+ MidiTime := USTime.GetTime;
+ MidiStart := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote);
+ MidiStop := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec);
+ LastClick := -100;
+
+ PlaySentence := true;
+ Click := true;
+ AudioPlayback.Stop;
+ AudioPlayback.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote)+0{-0.10});
+ PlayStopTime := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec)+0;
+ AudioPlayback.Play;
+ LastClick := -100;
+ end;
+ end;
+
+ SDLK_SPACE:
+ begin
+ // Play Sentence
+ PlaySentenceMidi := false; // stop midi
+ PlaySentence := true;
+ Click := false;
+ AudioPlayback.Stop;
+ AudioPlayback.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start));
+ PlayStopTime := (GetTimeFromBeat(
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start +
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc));
+ AudioPlayback.Play;
+ LastClick := -100;
+ end;
+
+ SDLK_RETURN:
+ begin
+ end;
+
+ SDLK_LCTRL:
+ begin
+ end;
+
+ SDLK_DELETE:
+ begin
+ if SDL_ModState = KMOD_LCTRL then begin
+ // moves text to right in current sentence
+ DeleteNote;
+ end;
+ end;
+
+ SDLK_PERIOD:
+ begin
+ // moves text to right in current sentence
+ MoveTextToRight;
+ end;
+
+ SDLK_RIGHT:
+ begin
+ // right
+ if SDL_ModState = 0 then begin
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0;
+ Inc(AktNuta);
+ if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].IlNut then AktNuta := 0;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1;
+ Lyric.Selected := AktNuta;
+ end;
+
+ // ctrl + right
+ if SDL_ModState = KMOD_LCTRL then begin
+ if Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc > 1 then begin
+ Dec(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc);
+ Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start);
+ if AktNuta = 0 then begin
+ Inc(Czesci[0].Czesc[Czesci[0].Akt].Start);
+ Inc(Czesci[0].Czesc[Czesci[0].Akt].StartNote);
+ end;
+ end;
+ end;
+
+ // shift + right
+ if SDL_ModState = KMOD_LSHIFT then begin
+ Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start);
+ if AktNuta = 0 then begin
+ Inc(Czesci[0].Czesc[Czesci[0].Akt].Start);
+ Inc(Czesci[0].Czesc[Czesci[0].Akt].StartNote);
+ end;
+ if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then
+ Inc(Czesci[0].Czesc[Czesci[0].Akt].Koniec);
+ end;
+
+ // alt + right
+ if SDL_ModState = KMOD_LALT then begin
+ Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc);
+ if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then
+ Inc(Czesci[0].Czesc[Czesci[0].Akt].Koniec);
+ end;
+
+ // alt + ctrl + shift + right = move all from cursor to right
+ if SDL_ModState = KMOD_LALT + KMOD_LCTRL + KMOD_LSHIFT then begin
+ MoveAllToEnd(1);
+ end;
+
+ end;
+
+ SDLK_LEFT:
+ begin
+ // left
+ if SDL_ModState = 0 then begin
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0;
+ Dec(AktNuta);
+ if AktNuta = -1 then AktNuta := Czesci[0].Czesc[Czesci[0].Akt].HighNut;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1;
+ Lyric.Selected := AktNuta;
+ end;
+
+ // ctrl + left
+ if SDL_ModState = KMOD_LCTRL then begin
+ Dec(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start);
+ Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc);
+ if AktNuta = 0 then begin
+ Dec(Czesci[0].Czesc[Czesci[0].Akt].Start);
+ Dec(Czesci[0].Czesc[Czesci[0].Akt].StartNote);
+ end;
+ end;
+
+ // shift + left
+ if SDL_ModState = KMOD_LSHIFT then begin
+ Dec(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start);
+
+ // resizing sentences
+ if AktNuta = 0 then begin
+ Dec(Czesci[0].Czesc[Czesci[0].Akt].Start);
+ Dec(Czesci[0].Czesc[Czesci[0].Akt].StartNote);
+ end;
+
+ if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then
+ Dec(Czesci[0].Czesc[Czesci[0].Akt].Koniec);
+
+ end;
+
+ // alt + left
+ if SDL_ModState = KMOD_LALT then begin
+ if Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc > 1 then begin
+ Dec(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc);
+ if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].HighNut then
+ Dec(Czesci[0].Czesc[Czesci[0].Akt].Koniec);
+ end;
+ end;
+
+ // alt + ctrl + shift + right = move all from cursor to left
+ if SDL_ModState = KMOD_LALT + KMOD_LCTRL + KMOD_LSHIFT then begin
+ MoveAllToEnd(-1);
+ end;
+
+ end;
+
+ SDLK_DOWN:
+ begin
+ {$IFDEF UseMIDIPort}
+ // skip to next sentence
+ if SDL_ModState = 0 then begin
+ MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127);
+ PlaySentenceMidi := false;
+
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0;
+ Inc(Czesci[0].Akt);
+ AktNuta := 0;
+ if Czesci[0].Akt > Czesci[0].High then Czesci[0].Akt := 0;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1;
+
+ Lyric.AddCzesc(Czesci[0].Akt);
+ Lyric.Selected := 0;
+ AudioPlayback.Stop;
+ PlaySentence := false;
+ end;
+
+ // decrease tone
+ if SDL_ModState = KMOD_LCTRL then begin
+ TransposeNote(-1);
+ end;
+ {$endif}
+
+ end;
+
+ SDLK_UP:
+ begin
+ {$IFDEF UseMIDIPort}
+ // skip to previous sentence
+ if SDL_ModState = 0 then begin
+ MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127);
+ PlaySentenceMidi := false;
+
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0;
+ Dec(Czesci[0].Akt);
+ AktNuta := 0;
+ if Czesci[0].Akt = -1 then Czesci[0].Akt := Czesci[0].High;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1;
+
+ Lyric.AddCzesc(Czesci[0].Akt);
+ Lyric.Selected := 0;
+ AudioPlayback.Stop;
+ PlaySentence := false;
+ end;
+
+ // increase tone
+ if SDL_ModState = KMOD_LCTRL then begin
+ TransposeNote(1);
+ end;
+ {$endif}
+ end;
+
+ // Golden Note Patch
+ SDLK_G:
+ begin
+ case Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc of
+ 0: Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 2;
+ 1: Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 2;
+ 2: Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 1;
+ end; // case
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Freestyle := False;
+ end;
+
+ // Freestyle Note Patch
+ SDLK_F:
+ begin
+ case Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc of
+ 0:
+ begin;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 1;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Freestyle := False;
+ end;
+ 1,2:
+ begin;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc := 0;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Freestyle := True;
+ end;
+ end; // case
+
+ end;
+
+
+ end;
+ end;
+ end; // if
+end;
+
+function TScreenEditSub.ParseInputEditText(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+var
+ SDL_ModState: Word;
+begin
+ // used when in Text Edit Mode
+ Result := true;
+
+ SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT
+ + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT {+ KMOD_CAPS});
+
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+
+ SDLK_ESCAPE:
+ begin
+ FadeTo(@ScreenSong);
+ end;
+ SDLK_F4, SDLK_RETURN:
+ begin
+ // Exit Text Edit Mode
+ TextEditMode := false;
+ end;
+ SDLK_0..SDLK_9, SDLK_A..SDLK_Z, SDLK_SPACE, SDLK_MINUS, SDLK_EXCLAIM, SDLK_COMMA, SDLK_SLASH, SDLK_ASTERISK, SDLK_QUESTION, SDLK_QUOTE, SDLK_QUOTEDBL:
+ begin
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst :=
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst + chr(ScanCode);
+ end;
+ SDLK_BACKSPACE:
+ begin
+ Delete(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst,
+ Length(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst), 1);
+ end;
+ SDLK_RIGHT:
+ begin
+ // right
+ if SDL_ModState = 0 then begin
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0;
+ Inc(AktNuta);
+ if AktNuta = Czesci[0].Czesc[Czesci[0].Akt].IlNut then AktNuta := 0;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1;
+ Lyric.Selected := AktNuta;
+ end;
+ end;
+ SDLK_LEFT:
+ begin
+ // left
+ if SDL_ModState = 0 then begin
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0;
+ Dec(AktNuta);
+ if AktNuta = -1 then AktNuta := Czesci[0].Czesc[Czesci[0].Akt].HighNut;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1;
+ Lyric.Selected := AktNuta;
+ end;
+ end;
+ end;
+ end;
+end;
+
+procedure TScreenEditSub.NewBeat;
+begin
+ // click
+{ for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do
+ if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = Czas.AktBeat) then begin
+ // old}
+// Music.PlayClick;
+end;
+
+procedure TScreenEditSub.CzesciDivide;
+var
+ C: integer;
+ N: integer;
+begin
+ AktSong.BPM[0].BPM := AktSong.BPM[0].BPM / 2;
+ for C := 0 to Czesci[0].High do begin
+ Czesci[0].Czesc[C].Start := Czesci[0].Czesc[C].Start div 2;
+ Czesci[0].Czesc[C].StartNote := Czesci[0].Czesc[C].StartNote div 2;
+ Czesci[0].Czesc[C].Koniec := Czesci[0].Czesc[C].Koniec div 2;
+ for N := 0 to Czesci[0].Czesc[C].HighNut do begin
+ Czesci[0].Czesc[C].Nuta[N].Start := Czesci[0].Czesc[C].Nuta[N].Start div 2;
+ Czesci[0].Czesc[C].Nuta[N].Dlugosc := Round(Czesci[0].Czesc[C].Nuta[N].Dlugosc / 2);
+ end; // N
+ end; // C
+end;
+
+procedure TScreenEditSub.CzesciMultiply;
+var
+ C: integer;
+ N: integer;
+begin
+ AktSong.BPM[0].BPM := AktSong.BPM[0].BPM * 2;
+ for C := 0 to Czesci[0].High do begin
+ Czesci[0].Czesc[C].Start := Czesci[0].Czesc[C].Start * 2;
+ Czesci[0].Czesc[C].StartNote := Czesci[0].Czesc[C].StartNote * 2;
+ Czesci[0].Czesc[C].Koniec := Czesci[0].Czesc[C].Koniec * 2;
+ for N := 0 to Czesci[0].Czesc[C].HighNut do begin
+ Czesci[0].Czesc[C].Nuta[N].Start := Czesci[0].Czesc[C].Nuta[N].Start * 2;
+ Czesci[0].Czesc[C].Nuta[N].Dlugosc := Czesci[0].Czesc[C].Nuta[N].Dlugosc * 2;
+ end; // N
+ end; // C
+end;
+
+procedure TScreenEditSub.LyricsCapitalize;
+var
+ C: integer;
+ N: integer; // temporary
+ S: string;
+begin
+ // temporary
+{ for C := 0 to Czesci[0].High do
+ for N := 0 to Czesci[0].Czesc[C].HighNut do
+ Czesci[0].Czesc[C].Nuta[N].Tekst := AnsiLowerCase(Czesci[0].Czesc[C].Nuta[N].Tekst);}
+
+ for C := 0 to Czesci[0].High do begin
+ S := AnsiUpperCase(Copy(Czesci[0].Czesc[C].Nuta[0].Tekst, 1, 1));
+ S := S + Copy(Czesci[0].Czesc[C].Nuta[0].Tekst, 2, Length(Czesci[0].Czesc[C].Nuta[0].Tekst)-1);
+ Czesci[0].Czesc[C].Nuta[0].Tekst := S;
+ end; // C
+end;
+
+procedure TScreenEditSub.LyricsCorrectSpaces;
+var
+ C: integer;
+ N: integer;
+begin
+ for C := 0 to Czesci[0].High do begin
+ // correct starting spaces in the first word
+ while Copy(Czesci[0].Czesc[C].Nuta[0].Tekst, 1, 1) = ' ' do
+ Czesci[0].Czesc[C].Nuta[0].Tekst := Copy(Czesci[0].Czesc[C].Nuta[0].Tekst, 2, 100);
+
+ // move spaces on the start to the end of the previous note
+ for N := 1 to Czesci[0].Czesc[C].HighNut do begin
+ while (Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, 1, 1) = ' ') do begin
+ Czesci[0].Czesc[C].Nuta[N].Tekst := Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, 2, 100);
+ Czesci[0].Czesc[C].Nuta[N-1].Tekst := Czesci[0].Czesc[C].Nuta[N-1].Tekst + ' ';
+ end;
+ end; // N
+
+ // correct '-' to '- '
+ for N := 0 to Czesci[0].Czesc[C].HighNut do begin
+ if Czesci[0].Czesc[C].Nuta[N].Tekst = '-' then
+ Czesci[0].Czesc[C].Nuta[N].Tekst := '- ';
+ end; // N
+
+ // add space to the previous note when the current word is '- '
+ for N := 1 to Czesci[0].Czesc[C].HighNut do begin
+ if Czesci[0].Czesc[C].Nuta[N].Tekst = '- ' then
+ Czesci[0].Czesc[C].Nuta[N-1].Tekst := Czesci[0].Czesc[C].Nuta[N-1].Tekst + ' ';
+ end; // N
+
+ // correct too many spaces at the end of note
+ for N := 0 to Czesci[0].Czesc[C].HighNut do begin
+ while Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, Length(Czesci[0].Czesc[C].Nuta[N].Tekst)-1, 2) = ' ' do
+ Czesci[0].Czesc[C].Nuta[N].Tekst := Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, 1, Length(Czesci[0].Czesc[C].Nuta[N].Tekst)-1);
+ end; // N
+
+ // and correct if there is no space at the end of sentence
+ N := Czesci[0].Czesc[C].HighNut;
+ if Copy(Czesci[0].Czesc[C].Nuta[N].Tekst, Length(Czesci[0].Czesc[C].Nuta[N].Tekst), 1) <> ' ' then
+ Czesci[0].Czesc[C].Nuta[N].Tekst := Czesci[0].Czesc[C].Nuta[N].Tekst + ' ';
+
+ end; // C
+end;
+
+procedure TScreenEditSub.FixTimings;
+var
+ C: integer;
+ S: integer;
+ Min: integer;
+ Max: integer;
+begin
+ for C := 1 to Czesci[0].High do begin
+ with Czesci[0].Czesc[C-1] do begin
+ Min := Nuta[HighNut].Start + Nuta[HighNut].Dlugosc;
+ Max := Czesci[0].Czesc[C].StartNote;
+ case (Max - Min) of
+ 0: S := Max;
+ 1: S := Max;
+ 2: S := Max - 1;
+ 3: S := Max - 2;
+ else
+ if ((Max - Min) > 4) then
+ S := Min + 2
+ else
+ S := Max;
+ end; // case
+
+ Czesci[0].Czesc[C].Start := S;
+ end; // with
+ end; // for
+end;
+
+procedure TScreenEditSub.DivideSentence;
+var
+ C: integer;
+ CStart: integer;
+ CNew: integer;
+ CLen: integer;
+ N: integer;
+ NStart: integer;
+ NHigh: integer;
+ NNewL: integer;
+begin
+ // increase sentence length by 1
+ CLen := Length(Czesci[0].Czesc);
+ SetLength(Czesci[0].Czesc, CLen + 1);
+ Inc(Czesci[0].Ilosc);
+ Inc(Czesci[0].High);
+
+ // move needed sentences to one forward. newly has the copy of divided sentence
+ CStart := Czesci[0].Akt;
+ for C := CLen-1 downto CStart do
+ Czesci[0].Czesc[C+1] := Czesci[0].Czesc[C];
+
+ // clear and set new sentence
+ CNew := CStart + 1;
+ NStart := AktNuta;
+ Czesci[0].Czesc[CNew].Start := Czesci[0].Czesc[CStart].Nuta[NStart].Start;
+ Czesci[0].Czesc[CNew].StartNote := Czesci[0].Czesc[CStart].Nuta[NStart].Start;
+ Czesci[0].Czesc[CNew].Lyric := '';
+ Czesci[0].Czesc[CNew].LyricWidth := 0;
+ Czesci[0].Czesc[CNew].Koniec := 0;
+ Czesci[0].Czesc[CNew].BaseNote := 0; // 0.5.0: we modify it later in this procedure
+ Czesci[0].Czesc[CNew].IlNut := 0;
+ Czesci[0].Czesc[CNew].HighNut := -1;
+ SetLength(Czesci[0].Czesc[CNew].Nuta, 0);
+
+ // move right notes to new sentences
+ NHigh := Czesci[0].Czesc[CStart].HighNut;
+ for N := NStart to NHigh do begin
+ NNewL := Czesci[0].Czesc[CNew].IlNut;
+ SetLength(Czesci[0].Czesc[CNew].Nuta, NNewL + 1);
+ Czesci[0].Czesc[CNew].Nuta[NNewL] := Czesci[0].Czesc[CStart].Nuta[N];
+
+ // increase sentence counters
+ Inc(Czesci[0].Czesc[CNew].IlNut);
+ Inc(Czesci[0].Czesc[CNew].HighNut);
+ Czesci[0].Czesc[CNew].Koniec := Czesci[0].Czesc[CNew].Nuta[NNewL].Start +
+ Czesci[0].Czesc[CNew].Nuta[NNewL].Dlugosc;
+ end;
+
+ // clear old notes and set sentence counters
+ Czesci[0].Czesc[CStart].HighNut := NStart - 1;
+ Czesci[0].Czesc[CStart].IlNut := Czesci[0].Czesc[CStart].HighNut + 1;
+ Czesci[0].Czesc[CStart].Koniec := Czesci[0].Czesc[CStart].Nuta[NStart-1].Start +
+ Czesci[0].Czesc[CStart].Nuta[NStart-1].Dlugosc;
+ SetLength(Czesci[0].Czesc[CStart].Nuta, Czesci[0].Czesc[CStart].IlNut);
+
+ // 0.5.0: modify BaseNote
+ Czesci[0].Czesc[CNew].BaseNote := 120;
+ for N := 0 to Czesci[0].Czesc[CNew].IlNut do
+ if Czesci[0].Czesc[CNew].Nuta[N].Ton < Czesci[0].Czesc[CNew].BaseNote then
+ Czesci[0].Czesc[CNew].BaseNote := Czesci[0].Czesc[CNew].Nuta[N].Ton;
+
+ Czesci[0].Akt := Czesci[0].Akt + 1;
+ AktNuta := 0;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1;
+ Lyric.AddCzesc(Czesci[0].Akt);
+
+end;
+
+procedure TScreenEditSub.JoinSentence;
+var
+ C: integer;
+ N: integer;
+ NStart: integer;
+ NDst: integer;
+begin
+ C := Czesci[0].Akt;
+
+ // set new sentence
+ NStart := Czesci[0].Czesc[C].IlNut;
+ Czesci[0].Czesc[C].IlNut := Czesci[0].Czesc[C].IlNut + Czesci[0].Czesc[C+1].IlNut;
+ Czesci[0].Czesc[C].HighNut := Czesci[0].Czesc[C].HighNut + Czesci[0].Czesc[C+1].IlNut;
+ SetLength(Czesci[0].Czesc[C].Nuta, Czesci[0].Czesc[C].IlNut);
+
+ // move right notes to new sentences
+ for N := 0 to Czesci[0].Czesc[C+1].HighNut do begin
+ NDst := NStart + N;
+ Czesci[0].Czesc[C].Nuta[NDst] := Czesci[0].Czesc[C+1].Nuta[N];
+ end;
+
+ // increase sentence counters
+ NDst := Czesci[0].Czesc[C].HighNut;
+ Czesci[0].Czesc[C].Koniec := Czesci[0].Czesc[C].Nuta[NDst].Start +
+ Czesci[0].Czesc[C].Nuta[NDst].Dlugosc;
+
+ // move needed sentences to one backward.
+ for C := Czesci[0].Akt + 1 to Czesci[0].High - 1 do
+ Czesci[0].Czesc[C] := Czesci[0].Czesc[C+1];
+
+ // increase sentence length by 1
+ SetLength(Czesci[0].Czesc, Length(Czesci[0].Czesc) - 1);
+ Dec(Czesci[0].Ilosc);
+ Dec(Czesci[0].High);
+end;
+
+procedure TScreenEditSub.DivideNote;
+var
+ C: integer;
+ N: integer;
+ NLen: integer;
+begin
+ C := Czesci[0].Akt;
+
+ NLen := Czesci[0].Czesc[C].IlNut + 1;
+ SetLength(Czesci[0].Czesc[C].Nuta, NLen);
+ Inc(Czesci[0].Czesc[C].HighNut);
+ Inc(Czesci[0].Czesc[C].IlNut);
+
+ // we copy all notes including selected one
+ for N := Czesci[0].Czesc[C].HighNut downto AktNuta+1 do begin
+ Czesci[0].Czesc[C].Nuta[N] := Czesci[0].Czesc[C].Nuta[N-1];
+ end;
+
+ // me slightly modify new note
+ Czesci[0].Czesc[C].Nuta[AktNuta].Dlugosc := 1;
+ Inc(Czesci[0].Czesc[C].Nuta[AktNuta+1].Start);
+ Dec(Czesci[0].Czesc[C].Nuta[AktNuta+1].Dlugosc);
+ Czesci[0].Czesc[C].Nuta[AktNuta+1].Tekst := '- ';
+ Czesci[0].Czesc[C].Nuta[AktNuta+1].Color := 0;
+end;
+
+procedure TScreenEditSub.DeleteNote;
+var
+ C: integer;
+ N: integer;
+ NLen: integer;
+begin
+ C := Czesci[0].Akt;
+
+ //Do Not delete Last Note
+ if (Czesci[0].High > 0) OR (Czesci[0].Czesc[C].HighNut > 0) then
+ begin
+
+ // we copy all notes from the next to the selected one
+ for N := AktNuta+1 to Czesci[0].Czesc[C].HighNut do begin
+ Czesci[0].Czesc[C].Nuta[N-1] := Czesci[0].Czesc[C].Nuta[N];
+ end;
+
+ NLen := Czesci[0].Czesc[C].IlNut - 1;
+
+ if (NLen > 0) then
+ begin
+ SetLength(Czesci[0].Czesc[C].Nuta, NLen);
+ Dec(Czesci[0].Czesc[C].HighNut);
+ Dec(Czesci[0].Czesc[C].IlNut);
+
+
+ // me slightly modify new note
+ if AktNuta > Czesci[0].Czesc[C].HighNut then Dec(AktNuta);
+ Czesci[0].Czesc[C].Nuta[AktNuta].Color := 1;
+ end
+ //Last Note of current Sentence Deleted - > Delete Sentence
+ else
+ begin
+ //Move all Sentences after the current to the Left
+ for N := C+1 to Czesci[0].High do
+ Czesci[0].Czesc[N-1] := Czesci[0].Czesc[N];
+
+ //Delete Last Sentence
+ SetLength(Czesci[0].Czesc, Czesci[0].High);
+ Czesci[0].High := High(Czesci[0].Czesc);
+ Czesci[0].Ilosc := Length(Czesci[0].Czesc);
+
+ AktNuta := 0;
+ if (C > 0) then
+ Czesci[0].Akt := C - 1
+ else
+ Czesci[0].Akt := 0;
+
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1;
+ end;
+ end;
+end;
+
+procedure TScreenEditSub.TransposeNote(Transpose: integer);
+begin
+ Inc(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton, Transpose);
+end;
+
+procedure TScreenEditSub.ChangeWholeTone(Tone: integer);
+var
+ C: integer;
+ N: integer;
+begin
+ for C := 0 to Czesci[0].High do begin
+ Czesci[0].Czesc[C].BaseNote := Czesci[0].Czesc[C].BaseNote + Tone;
+ for N := 0 to Czesci[0].Czesc[C].HighNut do
+ Czesci[0].Czesc[C].Nuta[N].Ton := Czesci[0].Czesc[C].Nuta[N].Ton + Tone;
+ end;
+end;
+
+procedure TScreenEditSub.MoveAllToEnd(Move: integer);
+var
+ C: integer;
+ N: integer;
+ NStart: integer;
+begin
+ for C := Czesci[0].Akt to Czesci[0].High do begin
+ NStart := 0;
+ if C = Czesci[0].Akt then NStart := AktNuta;
+ for N := NStart to Czesci[0].Czesc[C].HighNut do begin
+ Inc(Czesci[0].Czesc[C].Nuta[N].Start, Move); // move note start
+
+ if N = 0 then begin // fix beginning
+ Inc(Czesci[0].Czesc[C].Start, Move);
+ Inc(Czesci[0].Czesc[C].StartNote, Move);
+ end;
+
+ if N = Czesci[0].Czesc[C].HighNut then // fix ending
+ Inc(Czesci[0].Czesc[C].Koniec, Move);
+
+ end; // for
+ end; // for
+end;
+
+procedure TScreenEditSub.MoveTextToRight;
+var
+ C: integer;
+ N: integer;
+ NHigh: integer;
+begin
+{ C := Czesci[0].Akt;
+
+ for N := Czesci[0].Czesc[C].HighNut downto 1 do begin
+ Czesci[0].Czesc[C].Nuta[N].Tekst := Czesci[0].Czesc[C].Nuta[N-1].Tekst;
+ end; // for
+
+ Czesci[0].Czesc[C].Nuta[0].Tekst := '- ';}
+
+ C := Czesci[0].Akt;
+ NHigh := Czesci[0].Czesc[C].HighNut;
+
+ // last word
+ Czesci[0].Czesc[C].Nuta[NHigh].Tekst := Czesci[0].Czesc[C].Nuta[NHigh-1].Tekst + Czesci[0].Czesc[C].Nuta[NHigh].Tekst;
+
+ // other words
+ for N := NHigh - 1 downto AktNuta + 1 do begin
+ Czesci[0].Czesc[C].Nuta[N].Tekst := Czesci[0].Czesc[C].Nuta[N-1].Tekst;
+ end; // for
+ Czesci[0].Czesc[C].Nuta[AktNuta].Tekst := '- ';
+end;
+
+procedure TScreenEditSub.MarkSrc;
+begin
+ CopySrc := Czesci[0].Akt;
+end;
+
+procedure TScreenEditSub.PasteText;
+var
+ C: integer;
+ N: integer;
+begin
+ C := Czesci[0].Akt;
+
+ for N := 0 to Czesci[0].Czesc[CopySrc].HighNut do
+ Czesci[0].Czesc[C].Nuta[N].Tekst := Czesci[0].Czesc[CopySrc].Nuta[N].Tekst;
+end;
+
+procedure TScreenEditSub.CopySentence(Src, Dst: integer);
+var
+ N: integer;
+ Time1: integer;
+ Time2: integer;
+ TD: integer;
+begin
+ Time1 := Czesci[0].Czesc[Src].Nuta[0].Start;
+ Time2 := Czesci[0].Czesc[Dst].Nuta[0].Start;
+ TD := Time2-Time1;
+
+ SetLength(Czesci[0].Czesc[Dst].Nuta, Czesci[0].Czesc[Src].IlNut);
+ Czesci[0].Czesc[Dst].IlNut := Czesci[0].Czesc[Src].IlNut;
+ Czesci[0].Czesc[Dst].HighNut := Czesci[0].Czesc[Src].HighNut;
+ for N := 0 to Czesci[0].Czesc[Src].HighNut do begin
+ Czesci[0].Czesc[Dst].Nuta[N].Tekst := Czesci[0].Czesc[Src].Nuta[N].Tekst;
+ Czesci[0].Czesc[Dst].Nuta[N].Dlugosc := Czesci[0].Czesc[Src].Nuta[N].Dlugosc;
+ Czesci[0].Czesc[Dst].Nuta[N].Ton := Czesci[0].Czesc[Src].Nuta[N].Ton;
+ Czesci[0].Czesc[Dst].Nuta[N].Start := Czesci[0].Czesc[Src].Nuta[N].Start + TD;
+ end;
+ N := Czesci[0].Czesc[Src].HighNut;
+ Czesci[0].Czesc[Dst].Koniec := Czesci[0].Czesc[Dst].Nuta[N].Start + Czesci[0].Czesc[Dst].Nuta[N].Dlugosc;
+end;
+
+procedure TScreenEditSub.CopySentences(Src, Dst, Num: integer);
+var
+ C: integer;
+begin
+ Lyric := TLyric.Create;
+ // create place for new sentences
+ SetLength(Czesci[0].Czesc, Czesci[0].Ilosc + Num - 1);
+
+ // moves sentences next to the destination
+ for C := Czesci[0].High downto Dst + 1 do begin
+ Czesci[0].Czesc[C + Num - 1] := Czesci[0].Czesc[C];
+ end;
+
+ // prepares new sentences: sets sentence start and create first note
+ for C := 1 to Num-1 do begin
+ Czesci[0].Czesc[Dst + C].Start := Czesci[0].Czesc[Dst + C - 1].StartNote +
+ (Czesci[0].Czesc[Src + C].StartNote - Czesci[0].Czesc[Src + C - 1].StartNote);
+ SetLength(Czesci[0].Czesc[Dst + C].Nuta, 1);
+ Czesci[0].Czesc[Dst + C].IlNut := 1;
+ Czesci[0].Czesc[Dst + C].HighNut := 0;
+ Czesci[0].Czesc[Dst + C].Nuta[0].Start := Czesci[0].Czesc[Dst + C].Start;
+ Czesci[0].Czesc[Dst + C].Nuta[0].Dlugosc := 1;
+ Czesci[0].Czesc[Dst + C].StartNote := Czesci[0].Czesc[Dst + C].Start;
+ Czesci[0].Czesc[Dst + C].Koniec := Czesci[0].Czesc[Dst + C].Start + 1;
+ end;
+
+ // increase counters
+ Czesci[0].Ilosc := Czesci[0].Ilosc + Num - 1;
+ Czesci[0].High := Czesci[0].High + Num - 1;
+
+ for C := 0 to Num-1 do
+ CopySentence(Src + C, Dst + C);
+end;
+
+
+constructor TScreenEditSub.Create;
+begin
+ inherited Create;
+ SetLength(Player, 1);
+
+ // linijka
+ AddStatic(20, 10, 80, 30, 0, 0, 0, Skin.GetTextureFileName('ButtonF'), 'JPG', 'Font Black');
+ AddText(40, 17, 1, 6, 1, 1, 1, 'Line');
+ TextSentence := AddText(120, 14, 1, 8, 0, 0, 0, '0 / 0');
+
+ // nuta
+ AddStatic(220, 10, 80, 30, 0, 0, 0, Skin.GetTextureFileName('ButtonF'), 'JPG', 'Font Black');
+ AddText(242, 17, 1, 6, 1, 1, 1, 'Note');
+ TextNote := AddText(320, 14, 1, 8, 0, 0, 0, '0 / 0');
+
+ // file info
+ AddStatic(150, 50, 500, 150, 0, 0, 0, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black');
+ AddStatic(151, 52, 498, 146, 1, 1, 1, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black');
+ AddText(180, 65, 0, 8, 0, 0, 0, 'Title:');
+ AddText(180, 90, 0, 8, 0, 0, 0, 'Artist:');
+ AddText(180, 115, 0, 8, 0, 0, 0, 'Mp3:');
+ AddText(180, 140, 0, 8, 0, 0, 0, 'BPM:');
+ AddText(180, 165, 0, 8, 0, 0, 0, 'GAP:');
+
+ TextTitle := AddText(250, 65, 0, 8, 0, 0, 0, 'a');
+ TextArtist := AddText(250, 90, 0, 8, 0, 0, 0, 'b');
+ TextMp3 := AddText(250, 115, 0, 8, 0, 0, 0, 'c');
+ TextBPM := AddText(250, 140, 0, 8, 0, 0, 0, 'd');
+ TextGAP := AddText(250, 165, 0, 8, 0, 0, 0, 'e');
+
+{ AddInteraction(2, TextTitle);
+ AddInteraction(2, TextArtist);
+ AddInteraction(2, TextMp3);
+ AddInteraction(2, TextBPM);
+ AddInteraction(2, TextGAP);}
+
+ // note info
+ AddText(20, 190, 0, 8, 0, 0, 0, 'Start:');
+ AddText(20, 215, 0, 8, 0, 0, 0, 'Duration:');
+ AddText(20, 240, 0, 8, 0, 0, 0, 'Tone:');
+ AddText(20, 265, 0, 8, 0, 0, 0, 'Text:');
+
+ TextNStart := AddText(120, 190, 0, 8, 0, 0, 0, 'a');
+ TextNDlugosc := AddText(120, 215, 0, 8, 0, 0, 0, 'b');
+ TextNTon := AddText(120, 240, 0, 8, 0, 0, 0, 'c');
+ TextNText := AddText(120, 265, 0, 8, 0, 0, 0, 'd');
+
+ // debug
+ TextDebug := AddText(30, 550, 0, 8, 0, 0, 0, '');
+
+end;
+
+procedure TScreenEditSub.onShow;
+begin
+ Log.LogStatus('Initializing', 'TEditScreen.onShow');
+
+ try
+ ResetSingTemp;
+ Error := not LoadSong(Path + FileName);
+ except
+ Error := True;
+ end;
+
+ if Error then
+ begin
+ //Error Loading Song -> Go back to Song Screen and Show some Error Message
+ FadeTo(@ScreenSong);
+ ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG'));
+ Exit;
+ end
+ else begin
+ {$IFDEF UseMIDIPort}
+ MidiOut := TMidiOutput.Create(nil);
+ if Ini.Debug = 1 then
+ MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table
+ MidiOut.Open;
+ {$ENDIF}
+ Text[TextTitle].Text := AktSong.Title;
+ Text[TextArtist].Text := AktSong.Artist;
+ Text[TextMp3].Text := AktSong.Mp3;
+
+ Czesci[0].Akt := 0;
+ AktNuta := 0;
+ Czesci[0].Czesc[0].Nuta[0].Color := 1;
+
+ AudioPlayback.Open(Path + AktSong.Mp3);
+ //Set Down Music Volume for Better hearability of Midi Sounds
+ //Music.SetVolume(40);
+
+ Lyric.Clear;
+ Lyric.X := 400;
+ Lyric.Y := 500;
+ Lyric.Align := 1;
+ Lyric.Size := 14;
+ Lyric.ColR := 0;
+ Lyric.ColG := 0;
+ Lyric.ColB := 0;
+ Lyric.ColSR := Skin_FontHighlightR;
+ Lyric.ColSG := Skin_FontHighlightG;
+ Lyric.ColSB := Skin_FontHighlightB;
+ Lyric.Style := 0;
+ Lyric.AddCzesc(0);
+ Lyric.Selected := 0;
+
+ NotesH := 7;
+ NotesW := 4;
+
+ end;
+
+// Interaction := 0;
+ TextEditMode := false;
+end;
+
+function TScreenEditSub.Draw: boolean;
+var
+ Min: integer;
+ Sec: integer;
+ Tekst: string;
+ Pet: integer;
+ AktBeat: integer;
+begin
+ glClearColor(1,1,1,1);
+
+ // midi music
+ if PlaySentenceMidi then begin
+ MidiPos := USTime.GetTime - MidiTime + MidiStart;
+
+ {$IFDEF UseMIDIPort}
+ // stop the music
+ if (MidiPos > MidiStop) then begin
+ MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127);
+ PlaySentenceMidi := false;
+ end;
+ {$ENDIF}
+
+ // click
+ AktBeat := Floor(GetMidBeat(MidiPos - AktSong.GAP / 1000));
+ Text[TextDebug].Text := IntToStr(AktBeat);
+
+ if AktBeat <> LastClick then begin
+ for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do
+ if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then
+ begin
+
+ {$IFDEF UseMIDIPort}
+ LastClick := AktBeat;
+ if Pet > 0 then
+ MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet-1].Ton + 60, 127);
+ MidiOut.PutShort($91, Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Ton + 60, 127);
+ MidiLastNote := Pet;
+ {$ENDIF}
+
+ end;
+ end;
+ end; // if PlaySentenceMidi
+
+ // mp3 music
+ if PlaySentence then begin
+ // stop the music
+ if (AudioPlayback.Position > PlayStopTime) then
+ begin
+ AudioPlayback.Stop;
+ PlaySentence := false;
+ end;
+
+ // click
+ if (Click) and (PlaySentence) then begin
+// AktBeat := Floor(AktSong.BPM[0].BPM * (Music.Position - AktSong.GAP / 1000) / 60);
+ AktBeat := Floor(GetMidBeat(AudioPlayback.Position - AktSong.GAP / 1000));
+ Text[TextDebug].Text := IntToStr(AktBeat);
+ if AktBeat <> LastClick then begin
+ for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do
+ if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then
+ begin
+ AudioPlayback.PlayClick;
+ LastClick := AktBeat;
+ end;
+ end;
+ end; // click
+ end; // if PlaySentence
+
+
+ Text[TextSentence].Text := IntToStr(Czesci[0].Akt + 1) + ' / ' + IntToStr(Czesci[0].Ilosc);
+ Text[TextNote].Text := IntToStr(AktNuta + 1) + ' / ' + IntToStr(Czesci[0].Czesc[Czesci[0].Akt].IlNut);
+
+ // Song info
+ Text[TextBPM].Text := FloatToStr(AktSong.BPM[0].BPM / 4);
+ Text[TextGAP].Text := FloatToStr(AktSong.GAP);
+
+ //Error reading Variables when no Song is loaded
+ if not Error then
+ begin
+ // Note info
+ Text[TextNStart].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start);
+ Text[TextNDlugosc].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc);
+ Text[TextNTon].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton) + ' ( ' + GetNoteName(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton) + ' )';
+ Text[TextNText].Text := Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst;
+ end;
+
+ // Text Edit Mode
+ if TextEditMode then
+ Text[TextNText].Text := Text[TextNText].Text + '|';
+
+ // draw static menu
+ inherited Draw;
+
+ // draw notes
+ SingDrawNoteLines(20, 300, 780, 15);
+ //Error Drawing when no Song is loaded
+ if not Error then
+ begin
+ SingDrawBeatDelimeters(40, 300, 760, 0);
+ EditDrawCzesc(40, 405, 760, 0, 15);
+ end;
+
+ // draw text
+ Lyric.Draw;
+
+end;
+
+procedure TScreenEditSub.onHide;
+begin
+ {$IFDEF UseMIDIPort}
+ MidiOut.Close;
+ MidiOut.Free;
+ {$ENDIF}
+ //Music.SetVolume(100);
+end;
+
+function TScreenEditSub.GetNoteName(Note: Integer): String;
+var N1, N2: Integer;
+begin
+ if (Note > 0) then
+ begin
+ N1 := Note mod 12;
+ N2 := Note div 12;
+ end
+ else
+ begin
+ N1 := (Note + (-Trunc(Note/12)+1)*12) mod 12;
+ N2 := -1;
+ end;
+
+
+
+ case N1 of
+ 0: Result := 'c';
+ 1: Result := 'c#';
+ 2: Result := 'd';
+ 3: Result := 'd#';
+ 4: Result := 'e';
+ 5: Result := 'f';
+ 6: Result := 'f#';
+ 7: Result := 'g';
+ 8: Result := 'g#';
+ 9: Result := 'a';
+ 10: Result := 'b';
+ 11: Result := 'h';
+ end;
+
+ case N2 of
+ 0: Result := UpperCase(Result); //Normal Uppercase Note, 1: Normal lowercase Note
+ 2: Result := Result + ''''; //One Striped
+ 3: Result := Result + ''''''; //Two Striped
+ 4: Result := Result + ''''''''; //etc.
+ 5: Result := Result + '''''''''';
+ 6: Result := Result + '''''''''''';
+ 7: Result := Result + '''''''''''''';
+ end;
+end;
+
+end.
diff --git a/Game/Code/Screens/UScreenLoading.pas b/Game/Code/Screens/UScreenLoading.pas
index 989461f2..63b25d2c 100644
--- a/Game/Code/Screens/UScreenLoading.pas
+++ b/Game/Code/Screens/UScreenLoading.pas
@@ -1,53 +1,57 @@
-unit UScreenLoading;
-
-interface
-
-{$I switches.inc}
-
-uses
- UMenu,
- SDL,
- SysUtils,
- UThemes,
- OpenGL12;
-
-type
- TScreenLoading = class(TMenu)
- public
- Fadeout: boolean;
- constructor Create; override;
- procedure onShow; override;
- function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
- function GetBGTexNum: GLUInt;
- end;
-
-implementation
-
-uses UGraphic,
- UTime;
-
-function TScreenLoading.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
-begin
- Result := true;
-end;
-
-constructor TScreenLoading.Create;
-begin
- inherited Create;
-
- LoadFromTheme(Theme.Loading);
-
- Fadeout := false;
-end;
-
-procedure TScreenLoading.onShow;
-begin
-// nothing
-end;
-
-function TScreenLoading.GetBGTexNum: GLUInt;
-begin
- Result := Self.BackImg.TexNum;
-end;
-
-end.
+unit UScreenLoading;
+
+interface
+
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+
+{$I switches.inc}
+
+uses
+ UMenu,
+ SDL,
+ SysUtils,
+ UThemes,
+ OpenGL12;
+
+type
+ TScreenLoading = class(TMenu)
+ public
+ Fadeout: boolean;
+ constructor Create; override;
+ procedure onShow; override;
+ function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
+ function GetBGTexNum: GLUInt;
+ end;
+
+implementation
+
+uses UGraphic,
+ UTime;
+
+function TScreenLoading.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+end;
+
+constructor TScreenLoading.Create;
+begin
+ inherited Create;
+
+ LoadFromTheme(Theme.Loading);
+
+ Fadeout := false;
+end;
+
+procedure TScreenLoading.onShow;
+begin
+// nothing
+end;
+
+function TScreenLoading.GetBGTexNum: GLUInt;
+begin
+ Result := Self.BackImg.TexNum;
+end;
+
+end.
diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas
index 38f58bf1..5f7a0461 100644
--- a/Game/Code/Screens/UScreenMain.pas
+++ b/Game/Code/Screens/UScreenMain.pas
@@ -1,284 +1,288 @@
-unit UScreenMain;
-
-interface
-
-{$I switches.inc}
-
-uses
- UMenu,
- SDL,
- UDisplay,
- UMusic,
- UFiles,
- SysUtils,
- UThemes,
- ULCD,
- ULight;
-
-type
- TScreenMain = class(TMenu)
- public
- TextDescription: integer;
- TextDescriptionLong: integer;
-
- constructor Create; override;
- function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
- procedure onShow; override;
- procedure InteractNext; override;
- procedure InteractPrev; override;
- procedure InteractInc; override;
- procedure InteractDec; override;
- procedure UpdateLCD;
- procedure SetAnimationProgress(Progress: real); override;
- //function Draw: boolean; override;
- end;
-
-implementation
-
-uses {$IFDEF win32}
- windows,
- {$ENDIF}
- UGraphic,
- UMain,
- UIni,
- UTexture,
- USongs,
- Textgl,
-// opengl,
- ULanguage,
- UParty,
- UDLLManager,
- UScreenCredits,
- USkins;
-
-
-function TScreenMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
-var
-I: Integer;
-SDL_ModState: Word;
-begin
- Result := true;
-
- SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT
- + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT);
-
- //Deactivate Credits when Key is pressed
-// if Credits_Visible then
-// begin
-// Credits_Visible := False;
-// exit;
-// end;
-
- If (PressedDown) Then
- begin // Key Down
- case PressedKey of
- SDLK_Q:
- begin
- Result := false;
- end;
-
- SDLK_ESCAPE,
- SDLK_BACKSPACE :
- begin
- Result := False;
- end;
-
- SDLK_C:
- begin
- if (SDL_ModState = KMOD_LALT) then
- begin
- //Credits_Y := 600;
- //Credits_Alpha := 0;
- //Credits_Visible := True;
- AudioPlayback.PlayStart;
- FadeTo(@ScreenCredits);
- end;
- end;
- SDLK_M:
- begin
- if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then
- begin
- AudioPlayback.PlayStart;
- FadeTo(@ScreenPartyOptions);
- end;
- end;
-
- SDLK_S:
- begin
- AudioPlayback.PlayStart;
- FadeTo(@ScreenStatMain);
- end;
-
- SDLK_E:
- begin
- AudioPlayback.PlayStart;
- FadeTo(@ScreenEdit);
- end;
-
- SDLK_RETURN:
- begin
- //Solo
- if (Interaction = 0) then
- begin
- if (Length(Songs.Song) >= 1) then
- begin
- AudioPlayback.PlayStart;
- if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1;
- if (Ini.Players = 4) then PlayersPlay := 6;
-
- ScreenName.Goto_SingScreen := False;
- FadeTo(@ScreenName);
- end
- else //show error message
- ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS'));
- end;
-
- //Multi
- if Interaction = 1 then begin
- if (Length(Songs.Song) >= 1) then
- begin
- if (Length(DLLMan.Plugins)>=1) then
- begin
- AudioPlayback.PlayStart;
- FadeTo(@ScreenPartyOptions);
- end
- else //show error message, No Plugins Loaded
- ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS'));
- end
- else //show error message, No Songs Loaded
- ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS'));
- end;
-
- //Stats
- if Interaction = 2 then
- begin
- AudioPlayback.PlayStart;
- FadeTo(@ScreenStatMain);
- end;
-
- //Editor
- if Interaction = 3 then
- begin
- AudioPlayback.PlayStart;
- FadeTo(@ScreenEdit);
- end;
-
- //Options
- if Interaction = 4 then
- begin
- AudioPlayback.PlayStart;
- FadeTo(@ScreenOptions);
- end;
-
- //Exit
- if Interaction = 5 then
- begin
- Result := false;
- end;
- end;
- // Up and Down could be done at the same time,
- // but I don't want to declare variables inside
- // functions like this one, called so many times
- SDLK_DOWN: InteractInc;
- SDLK_UP: InteractDec;
- SDLK_RIGHT: InteractNext;
- SDLK_LEFT: InteractPrev;
- end;
- end
- else // Key Up
- case PressedKey of
- SDLK_RETURN :
- begin
- end;
- end;
-end;
-
-constructor TScreenMain.Create;
-var
- I: integer;
-begin
- inherited Create;
-
- //----------------
- //Attention ^^:
- //New Creation Order needed because of LoadFromTheme
- //and Button Collections.
- //At First Custom Texts and Statics
- //Then LoadFromTheme
- //after LoadFromTheme the Buttons and Selects
- //----------------
-
-
- TextDescription := AddText(Theme.Main.TextDescription);
- TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong);
-
- LoadFromTheme(Theme.Main);
-
- AddButton(Theme.Main.ButtonSolo);
- AddButton(Theme.Main.ButtonMulti);
- AddButton(Theme.Main.ButtonStat);
- AddButton(Theme.Main.ButtonEditor);
- AddButton(Theme.Main.ButtonOptions);
- AddButton(Theme.Main.ButtonExit);
-
- Interaction := 0;
-end;
-
-procedure TScreenMain.onShow;
-begin
- LCD.WriteText(1, ' Choose mode: ');
- UpdateLCD;
-end;
-
-procedure TScreenMain.InteractNext;
-begin
- inherited InteractNext;
- Text[TextDescription].Text := Theme.Main.Description[Interaction];
- Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction];
- UpdateLCD;
- Light.LightOne(1, 200);
-end;
-
-procedure TScreenMain.InteractPrev;
-begin
- inherited InteractPrev;
- Text[TextDescription].Text := Theme.Main.Description[Interaction];
- Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction];
- UpdateLCD;
- Light.LightOne(0, 200);
-end;
-
-procedure TScreenMain.InteractDec;
-begin
- inherited InteractDec;
- Text[TextDescription].Text := Theme.Main.Description[Interaction];
- Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction];
- UpdateLCD;
- Light.LightOne(0, 200);
-end;
-
-procedure TScreenMain.InteractInc;
-begin
- inherited InteractInc;
- Text[TextDescription].Text := Theme.Main.Description[Interaction];
- Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction];
- UpdateLCD;
- Light.LightOne(1, 200);
-end;
-
-procedure TScreenMain.UpdateLCD;
-begin
- case Interaction of
- 0: LCD.WriteText(2, ' sing ');
- 1: LCD.WriteText(2, ' editor ');
- 2: LCD.WriteText(2, ' options ');
- 3: LCD.WriteText(2, ' exit ');
- end
-end;
-
-procedure TScreenMain.SetAnimationProgress(Progress: real);
-begin
- Static[0].Texture.ScaleW := Progress;
- Static[0].Texture.ScaleH := Progress;
-end;
-end.
+unit UScreenMain;
+
+interface
+
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+
+{$I switches.inc}
+
+uses
+ UMenu,
+ SDL,
+ UDisplay,
+ UMusic,
+ UFiles,
+ SysUtils,
+ UThemes,
+ ULCD,
+ ULight;
+
+type
+ TScreenMain = class(TMenu)
+ public
+ TextDescription: integer;
+ TextDescriptionLong: integer;
+
+ constructor Create; override;
+ function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
+ procedure onShow; override;
+ procedure InteractNext; override;
+ procedure InteractPrev; override;
+ procedure InteractInc; override;
+ procedure InteractDec; override;
+ procedure UpdateLCD;
+ procedure SetAnimationProgress(Progress: real); override;
+ //function Draw: boolean; override;
+ end;
+
+implementation
+
+uses {$IFDEF win32}
+ windows,
+ {$ENDIF}
+ UGraphic,
+ UMain,
+ UIni,
+ UTexture,
+ USongs,
+ Textgl,
+// opengl,
+ ULanguage,
+ UParty,
+ UDLLManager,
+ UScreenCredits,
+ USkins;
+
+
+function TScreenMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+var
+I: Integer;
+SDL_ModState: Word;
+begin
+ Result := true;
+
+ SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT
+ + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT);
+
+ //Deactivate Credits when Key is pressed
+// if Credits_Visible then
+// begin
+// Credits_Visible := False;
+// exit;
+// end;
+
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ Result := False;
+ end;
+
+ SDLK_C:
+ begin
+ if (SDL_ModState = KMOD_LALT) then
+ begin
+ //Credits_Y := 600;
+ //Credits_Alpha := 0;
+ //Credits_Visible := True;
+ AudioPlayback.PlayStart;
+ FadeTo(@ScreenCredits);
+ end;
+ end;
+ SDLK_M:
+ begin
+ if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then
+ begin
+ AudioPlayback.PlayStart;
+ FadeTo(@ScreenPartyOptions);
+ end;
+ end;
+
+ SDLK_S:
+ begin
+ AudioPlayback.PlayStart;
+ FadeTo(@ScreenStatMain);
+ end;
+
+ SDLK_E:
+ begin
+ AudioPlayback.PlayStart;
+ FadeTo(@ScreenEdit);
+ end;
+
+ SDLK_RETURN:
+ begin
+ //Solo
+ if (Interaction = 0) then
+ begin
+ if (Length(Songs.Song) >= 1) then
+ begin
+ AudioPlayback.PlayStart;
+ if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1;
+ if (Ini.Players = 4) then PlayersPlay := 6;
+
+ ScreenName.Goto_SingScreen := False;
+ FadeTo(@ScreenName);
+ end
+ else //show error message
+ ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS'));
+ end;
+
+ //Multi
+ if Interaction = 1 then begin
+ if (Length(Songs.Song) >= 1) then
+ begin
+ if (Length(DLLMan.Plugins)>=1) then
+ begin
+ AudioPlayback.PlayStart;
+ FadeTo(@ScreenPartyOptions);
+ end
+ else //show error message, No Plugins Loaded
+ ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS'));
+ end
+ else //show error message, No Songs Loaded
+ ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS'));
+ end;
+
+ //Stats
+ if Interaction = 2 then
+ begin
+ AudioPlayback.PlayStart;
+ FadeTo(@ScreenStatMain);
+ end;
+
+ //Editor
+ if Interaction = 3 then
+ begin
+ AudioPlayback.PlayStart;
+ FadeTo(@ScreenEdit);
+ end;
+
+ //Options
+ if Interaction = 4 then
+ begin
+ AudioPlayback.PlayStart;
+ FadeTo(@ScreenOptions);
+ end;
+
+ //Exit
+ if Interaction = 5 then
+ begin
+ Result := false;
+ end;
+ end;
+ // Up and Down could be done at the same time,
+ // but I don't want to declare variables inside
+ // functions like this one, called so many times
+ SDLK_DOWN: InteractInc;
+ SDLK_UP: InteractDec;
+ SDLK_RIGHT: InteractNext;
+ SDLK_LEFT: InteractPrev;
+ end;
+ end
+ else // Key Up
+ case PressedKey of
+ SDLK_RETURN :
+ begin
+ end;
+ end;
+end;
+
+constructor TScreenMain.Create;
+var
+ I: integer;
+begin
+ inherited Create;
+
+ //----------------
+ //Attention ^^:
+ //New Creation Order needed because of LoadFromTheme
+ //and Button Collections.
+ //At First Custom Texts and Statics
+ //Then LoadFromTheme
+ //after LoadFromTheme the Buttons and Selects
+ //----------------
+
+
+ TextDescription := AddText(Theme.Main.TextDescription);
+ TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong);
+
+ LoadFromTheme(Theme.Main);
+
+ AddButton(Theme.Main.ButtonSolo);
+ AddButton(Theme.Main.ButtonMulti);
+ AddButton(Theme.Main.ButtonStat);
+ AddButton(Theme.Main.ButtonEditor);
+ AddButton(Theme.Main.ButtonOptions);
+ AddButton(Theme.Main.ButtonExit);
+
+ Interaction := 0;
+end;
+
+procedure TScreenMain.onShow;
+begin
+ LCD.WriteText(1, ' Choose mode: ');
+ UpdateLCD;
+end;
+
+procedure TScreenMain.InteractNext;
+begin
+ inherited InteractNext;
+ Text[TextDescription].Text := Theme.Main.Description[Interaction];
+ Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction];
+ UpdateLCD;
+ Light.LightOne(1, 200);
+end;
+
+procedure TScreenMain.InteractPrev;
+begin
+ inherited InteractPrev;
+ Text[TextDescription].Text := Theme.Main.Description[Interaction];
+ Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction];
+ UpdateLCD;
+ Light.LightOne(0, 200);
+end;
+
+procedure TScreenMain.InteractDec;
+begin
+ inherited InteractDec;
+ Text[TextDescription].Text := Theme.Main.Description[Interaction];
+ Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction];
+ UpdateLCD;
+ Light.LightOne(0, 200);
+end;
+
+procedure TScreenMain.InteractInc;
+begin
+ inherited InteractInc;
+ Text[TextDescription].Text := Theme.Main.Description[Interaction];
+ Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction];
+ UpdateLCD;
+ Light.LightOne(1, 200);
+end;
+
+procedure TScreenMain.UpdateLCD;
+begin
+ case Interaction of
+ 0: LCD.WriteText(2, ' sing ');
+ 1: LCD.WriteText(2, ' editor ');
+ 2: LCD.WriteText(2, ' options ');
+ 3: LCD.WriteText(2, ' exit ');
+ end
+end;
+
+procedure TScreenMain.SetAnimationProgress(Progress: real);
+begin
+ Static[0].Texture.ScaleW := Progress;
+ Static[0].Texture.ScaleH := Progress;
+end;
+end.
diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas
index 17f3b2b5..33543211 100644
--- a/Game/Code/Screens/UScreenPartyNewRound.pas
+++ b/Game/Code/Screens/UScreenPartyNewRound.pas
@@ -1,419 +1,423 @@
-unit UScreenPartyNewRound;
-
-interface
-
-{$I switches.inc}
-
-uses
- UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes;
-
-type
- TScreenPartyNewRound = class(TMenu)
- public
- //Texts:
- TextRound1: Cardinal;
- TextRound2: Cardinal;
- TextRound3: Cardinal;
- TextRound4: Cardinal;
- TextRound5: Cardinal;
- TextRound6: Cardinal;
- TextRound7: Cardinal;
-
- TextWinner1: Cardinal;
- TextWinner2: Cardinal;
- TextWinner3: Cardinal;
- TextWinner4: Cardinal;
- TextWinner5: Cardinal;
- TextWinner6: Cardinal;
- TextWinner7: Cardinal;
-
- TextNextRound: Cardinal;
- TextNextRoundNo: Cardinal;
- TextNextPlayer1: Cardinal;
- TextNextPlayer2: Cardinal;
- TextNextPlayer3: Cardinal;
-
- //Statics
- StaticRound1: Cardinal;
- StaticRound2: Cardinal;
- StaticRound3: Cardinal;
- StaticRound4: Cardinal;
- StaticRound5: Cardinal;
- StaticRound6: Cardinal;
- StaticRound7: Cardinal;
-
- //Scores
- TextScoreTeam1: Cardinal;
- TextScoreTeam2: Cardinal;
- TextScoreTeam3: Cardinal;
- TextNameTeam1: Cardinal;
- TextNameTeam2: Cardinal;
- TextNameTeam3: Cardinal;
-
- TextTeam1Players: Cardinal;
- TextTeam2Players: Cardinal;
- TextTeam3Players: Cardinal;
-
- StaticTeam1: Cardinal;
- StaticTeam2: Cardinal;
- StaticTeam3: Cardinal;
- StaticNextPlayer1: Cardinal;
- StaticNextPlayer2: Cardinal;
- StaticNextPlayer3: Cardinal;
-
-
-
-
- constructor Create; override;
- function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
- procedure onShow; override;
- procedure SetAnimationProgress(Progress: real); override;
- end;
-
-implementation
-
-uses UGraphic, UMain, UIni, UTexture, UParty, UDLLManager, ULanguage, ULog;
-
-function TScreenPartyNewRound.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
-begin
- Result := true;
- If (PressedDown) Then
- begin // Key Down
- case PressedKey of
- SDLK_Q:
- begin
- Result := false;
- end;
-
-
- SDLK_ESCAPE,
- SDLK_BACKSPACE :
- begin
- AudioPlayback.PlayBack;
- CheckFadeTo(@ScreenMain,'MSG_END_PARTY');
- end;
-
- SDLK_RETURN:
- begin
- AudioPlayback.PlayStart;
- if DLLMan.Selected.LoadSong then
- begin
- //Select PartyMode ScreenSong
- ScreenSong.Mode := 1;
- FadeTo(@ScreenSong);
- end
- else
- begin
- FadeTo(@ScreenSingModi);
- end;
- end;
- end;
- end;
-end;
-
-constructor TScreenPartyNewRound.Create;
-var
- I: integer;
-begin
- inherited Create;
-
- TextRound1 := AddText (Theme.PartyNewRound.TextRound1);
- TextRound2 := AddText (Theme.PartyNewRound.TextRound2);
- TextRound3 := AddText (Theme.PartyNewRound.TextRound3);
- TextRound4 := AddText (Theme.PartyNewRound.TextRound4);
- TextRound5 := AddText (Theme.PartyNewRound.TextRound5);
- TextRound6 := AddText (Theme.PartyNewRound.TextRound6);
- TextRound7 := AddText (Theme.PartyNewRound.TextRound7);
-
- TextWinner1 := AddText (Theme.PartyNewRound.TextWinner1);
- TextWinner2 := AddText (Theme.PartyNewRound.TextWinner2);
- TextWinner3 := AddText (Theme.PartyNewRound.TextWinner3);
- TextWinner4 := AddText (Theme.PartyNewRound.TextWinner4);
- TextWinner5 := AddText (Theme.PartyNewRound.TextWinner5);
- TextWinner6 := AddText (Theme.PartyNewRound.TextWinner6);
- TextWinner7 := AddText (Theme.PartyNewRound.TextWinner7);
-
- TextNextRound := AddText (Theme.PartyNewRound.TextNextRound);
- TextNextRoundNo := AddText (Theme.PartyNewRound.TextNextRoundNo);
- TextNextPlayer1 := AddText (Theme.PartyNewRound.TextNextPlayer1);
- TextNextPlayer2 := AddText (Theme.PartyNewRound.TextNextPlayer2);
- TextNextPlayer3 := AddText (Theme.PartyNewRound.TextNextPlayer3);
-
- StaticRound1 := AddStatic (Theme.PartyNewRound.StaticRound1);
- StaticRound2 := AddStatic (Theme.PartyNewRound.StaticRound2);
- StaticRound3 := AddStatic (Theme.PartyNewRound.StaticRound3);
- StaticRound4 := AddStatic (Theme.PartyNewRound.StaticRound4);
- StaticRound5 := AddStatic (Theme.PartyNewRound.StaticRound5);
- StaticRound6 := AddStatic (Theme.PartyNewRound.StaticRound6);
- StaticRound7 := AddStatic (Theme.PartyNewRound.StaticRound7);
-
- //Scores
- TextScoreTeam1 := AddText (Theme.PartyNewRound.TextScoreTeam1);
- TextScoreTeam2 := AddText (Theme.PartyNewRound.TextScoreTeam2);
- TextScoreTeam3 := AddText (Theme.PartyNewRound.TextScoreTeam3);
- TextNameTeam1 := AddText (Theme.PartyNewRound.TextNameTeam1);
- TextNameTeam2 := AddText (Theme.PartyNewRound.TextNameTeam2);
- TextNameTeam3 := AddText (Theme.PartyNewRound.TextNameTeam3);
-
- //Players
- TextTeam1Players := AddText (Theme.PartyNewRound.TextTeam1Players);
- TextTeam2Players := AddText (Theme.PartyNewRound.TextTeam2Players);
- TextTeam3Players := AddText (Theme.PartyNewRound.TextTeam3Players);
-
- StaticTeam1 := AddStatic (Theme.PartyNewRound.StaticTeam1);
- StaticTeam2 := AddStatic (Theme.PartyNewRound.StaticTeam2);
- StaticTeam3 := AddStatic (Theme.PartyNewRound.StaticTeam3);
- StaticNextPlayer1 := AddStatic (Theme.PartyNewRound.StaticNextPlayer1);
- StaticNextPlayer2 := AddStatic (Theme.PartyNewRound.StaticNextPlayer2);
- StaticNextPlayer3 := AddStatic (Theme.PartyNewRound.StaticNextPlayer3);
-
- LoadFromTheme(Theme.PartyNewRound);
-end;
-
-procedure TScreenPartyNewRound.onShow;
-var
- I: Integer;
- function GetTeamPlayers(const Num: Byte): String;
- var
- Players: Array of String;
- J: Byte;
- begin
- if (Num-1 >= PartySession.Teams.NumTeams) then
- exit;
-
- //Create Players Array
- SetLength(Players, PartySession.Teams.TeamInfo[Num-1].NumPlayers);
- For J := 0 to PartySession.Teams.TeamInfo[Num-1].NumPlayers-1 do
- Players[J] := String(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name);
-
- //Implode and Return
- Result := Language.Implode(Players);
- end;
-begin
- PartySession.StartRound;
-
- //Set Visibility of Round Infos
- I := Length(PartySession.Rounds);
- if (I >= 1) then
- begin
- Static[StaticRound1].Visible := True;
- Text[TextRound1].Visible := True;
- Text[TextWinner1].Visible := True;
-
- //Texts:
- Text[TextRound1].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[0].Plugin].Name);
- Text[TextWinner1].Text := PartySession.GetWinnerString(0);
- end
- else
- begin
- Static[StaticRound1].Visible := False;
- Text[TextRound1].Visible := False;
- Text[TextWinner1].Visible := False;
- end;
-
- if (I >= 2) then
- begin
- Static[StaticRound2].Visible := True;
- Text[TextRound2].Visible := True;
- Text[TextWinner2].Visible := True;
-
- //Texts:
- Text[TextRound2].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[1].Plugin].Name);
- Text[TextWinner2].Text := PartySession.GetWinnerString(1);
- end
- else
- begin
- Static[StaticRound2].Visible := False;
- Text[TextRound2].Visible := False;
- Text[TextWinner2].Visible := False;
- end;
-
- if (I >= 3) then
- begin
- Static[StaticRound3].Visible := True;
- Text[TextRound3].Visible := True;
- Text[TextWinner3].Visible := True;
-
- //Texts:
- Text[TextRound3].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[2].Plugin].Name);
- Text[TextWinner3].Text := PartySession.GetWinnerString(2);
- end
- else
- begin
- Static[StaticRound3].Visible := False;
- Text[TextRound3].Visible := False;
- Text[TextWinner3].Visible := False;
- end;
-
- if (I >= 4) then
- begin
- Static[StaticRound4].Visible := True;
- Text[TextRound4].Visible := True;
- Text[TextWinner4].Visible := True;
-
- //Texts:
- Text[TextRound4].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[3].Plugin].Name);
- Text[TextWinner4].Text := PartySession.GetWinnerString(3);
- end
- else
- begin
- Static[StaticRound4].Visible := False;
- Text[TextRound4].Visible := False;
- Text[TextWinner4].Visible := False;
- end;
-
- if (I >= 5) then
- begin
- Static[StaticRound5].Visible := True;
- Text[TextRound5].Visible := True;
- Text[TextWinner5].Visible := True;
-
- //Texts:
- Text[TextRound5].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[4].Plugin].Name);
- Text[TextWinner5].Text := PartySession.GetWinnerString(4);
- end
- else
- begin
- Static[StaticRound5].Visible := False;
- Text[TextRound5].Visible := False;
- Text[TextWinner5].Visible := False;
- end;
-
- if (I >= 6) then
- begin
- Static[StaticRound6].Visible := True;
- Text[TextRound6].Visible := True;
- Text[TextWinner6].Visible := True;
-
- //Texts:
- Text[TextRound6].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[5].Plugin].Name);
- Text[TextWinner6].Text := PartySession.GetWinnerString(5);
- end
- else
- begin
- Static[StaticRound6].Visible := False;
- Text[TextRound6].Visible := False;
- Text[TextWinner6].Visible := False;
- end;
-
- if (I >= 7) then
- begin
- Static[StaticRound7].Visible := True;
- Text[TextRound7].Visible := True;
- Text[TextWinner7].Visible := True;
-
- //Texts:
- Text[TextRound7].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[6].Plugin].Name);
- Text[TextWinner7].Text := PartySession.GetWinnerString(6);
- end
- else
- begin
- Static[StaticRound7].Visible := False;
- Text[TextRound7].Visible := False;
- Text[TextWinner7].Visible := False;
- end;
-
- //Display Scores
- if (PartySession.Teams.NumTeams >= 1) then
- begin
- Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[0].Score);
- Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[0].Name);
- Text[TextTeam1Players].Text := GetTeamPlayers(1);
-
- Text[TextScoreTeam1].Visible := True;
- Text[TextNameTeam1].Visible := True;
- Text[TextTeam1Players].Visible := True;
- Static[StaticTeam1].Visible := True;
- Static[StaticNextPlayer1].Visible := True;
- end
- else
- begin
- Text[TextScoreTeam1].Visible := False;
- Text[TextNameTeam1].Visible := False;
- Text[TextTeam1Players].Visible := False;
- Static[StaticTeam1].Visible := False;
- Static[StaticNextPlayer1].Visible := False;
- end;
-
- if (PartySession.Teams.NumTeams >= 2) then
- begin
- Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[1].Score);
- Text[TextNameTeam2].Text := String(PartySession.Teams.TeamInfo[1].Name);
- Text[TextTeam2Players].Text := GetTeamPlayers(2);
-
- Text[TextScoreTeam2].Visible := True;
- Text[TextNameTeam2].Visible := True;
- Text[TextTeam2Players].Visible := True;
- Static[StaticTeam2].Visible := True;
- Static[StaticNextPlayer2].Visible := True;
- end
- else
- begin
- Text[TextScoreTeam2].Visible := False;
- Text[TextNameTeam2].Visible := False;
- Text[TextTeam2Players].Visible := False;
- Static[StaticTeam2].Visible := False;
- Static[StaticNextPlayer2].Visible := False;
- end;
-
- if (PartySession.Teams.NumTeams >= 3) then
- begin
- Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[2].Score);
- Text[TextNameTeam3].Text := String(PartySession.Teams.TeamInfo[2].Name);
- Text[TextTeam3Players].Text := GetTeamPlayers(3);
-
- Text[TextScoreTeam3].Visible := True;
- Text[TextNameTeam3].Visible := True;
- Text[TextTeam3Players].Visible := True;
- Static[StaticTeam3].Visible := True;
- Static[StaticNextPlayer3].Visible := True;
- end
- else
- begin
- Text[TextScoreTeam3].Visible := False;
- Text[TextNameTeam3].Visible := False;
- Text[TextTeam3Players].Visible := False;
- Static[StaticTeam3].Visible := False;
- Static[StaticNextPlayer3].Visible := False;
- end;
-
- //nextRound Texts
- Text[TextNextRound].Text := Language.Translate(DllMan.Selected.PluginDesc);
- Text[TextNextRoundNo].Text := InttoStr(PartySession.CurRound + 1);
- if (PartySession.Teams.NumTeams >= 1) then
- begin
- Text[TextNextPlayer1].Text := PartySession.Teams.Teaminfo[0].Playerinfo[PartySession.Teams.Teaminfo[0].CurPlayer].Name;
- Text[TextNextPlayer1].Visible := True;
- end
- else
- Text[TextNextPlayer1].Visible := False;
-
- if (PartySession.Teams.NumTeams >= 2) then
- begin
- Text[TextNextPlayer2].Text := PartySession.Teams.Teaminfo[1].Playerinfo[PartySession.Teams.Teaminfo[1].CurPlayer].Name;
- Text[TextNextPlayer2].Visible := True;
- end
- else
- Text[TextNextPlayer2].Visible := False;
-
- if (PartySession.Teams.NumTeams >= 3) then
- begin
- Text[TextNextPlayer3].Text := PartySession.Teams.Teaminfo[2].Playerinfo[PartySession.Teams.Teaminfo[2].CurPlayer].Name;
- Text[TextNextPlayer3].Visible := True;
- end
- else
- Text[TextNextPlayer3].Visible := False;
-
-
-// LCD.WriteText(1, ' Choose mode: ');
-// UpdateLCD;
-end;
-
-procedure TScreenPartyNewRound.SetAnimationProgress(Progress: real);
-begin
- {Button[0].Texture.ScaleW := Progress;
- Button[1].Texture.ScaleW := Progress;
- Button[2].Texture.ScaleW := Progress; }
-end;
-
-end.
+unit UScreenPartyNewRound;
+
+interface
+
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+
+{$I switches.inc}
+
+uses
+ UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes;
+
+type
+ TScreenPartyNewRound = class(TMenu)
+ public
+ //Texts:
+ TextRound1: Cardinal;
+ TextRound2: Cardinal;
+ TextRound3: Cardinal;
+ TextRound4: Cardinal;
+ TextRound5: Cardinal;
+ TextRound6: Cardinal;
+ TextRound7: Cardinal;
+
+ TextWinner1: Cardinal;
+ TextWinner2: Cardinal;
+ TextWinner3: Cardinal;
+ TextWinner4: Cardinal;
+ TextWinner5: Cardinal;
+ TextWinner6: Cardinal;
+ TextWinner7: Cardinal;
+
+ TextNextRound: Cardinal;
+ TextNextRoundNo: Cardinal;
+ TextNextPlayer1: Cardinal;
+ TextNextPlayer2: Cardinal;
+ TextNextPlayer3: Cardinal;
+
+ //Statics
+ StaticRound1: Cardinal;
+ StaticRound2: Cardinal;
+ StaticRound3: Cardinal;
+ StaticRound4: Cardinal;
+ StaticRound5: Cardinal;
+ StaticRound6: Cardinal;
+ StaticRound7: Cardinal;
+
+ //Scores
+ TextScoreTeam1: Cardinal;
+ TextScoreTeam2: Cardinal;
+ TextScoreTeam3: Cardinal;
+ TextNameTeam1: Cardinal;
+ TextNameTeam2: Cardinal;
+ TextNameTeam3: Cardinal;
+
+ TextTeam1Players: Cardinal;
+ TextTeam2Players: Cardinal;
+ TextTeam3Players: Cardinal;
+
+ StaticTeam1: Cardinal;
+ StaticTeam2: Cardinal;
+ StaticTeam3: Cardinal;
+ StaticNextPlayer1: Cardinal;
+ StaticNextPlayer2: Cardinal;
+ StaticNextPlayer3: Cardinal;
+
+
+
+
+ constructor Create; override;
+ function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
+ procedure onShow; override;
+ procedure SetAnimationProgress(Progress: real); override;
+ end;
+
+implementation
+
+uses UGraphic, UMain, UIni, UTexture, UParty, UDLLManager, ULanguage, ULog;
+
+function TScreenPartyNewRound.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ AudioPlayback.PlayBack;
+ CheckFadeTo(@ScreenMain,'MSG_END_PARTY');
+ end;
+
+ SDLK_RETURN:
+ begin
+ AudioPlayback.PlayStart;
+ if DLLMan.Selected.LoadSong then
+ begin
+ //Select PartyMode ScreenSong
+ ScreenSong.Mode := 1;
+ FadeTo(@ScreenSong);
+ end
+ else
+ begin
+ FadeTo(@ScreenSingModi);
+ end;
+ end;
+ end;
+ end;
+end;
+
+constructor TScreenPartyNewRound.Create;
+var
+ I: integer;
+begin
+ inherited Create;
+
+ TextRound1 := AddText (Theme.PartyNewRound.TextRound1);
+ TextRound2 := AddText (Theme.PartyNewRound.TextRound2);
+ TextRound3 := AddText (Theme.PartyNewRound.TextRound3);
+ TextRound4 := AddText (Theme.PartyNewRound.TextRound4);
+ TextRound5 := AddText (Theme.PartyNewRound.TextRound5);
+ TextRound6 := AddText (Theme.PartyNewRound.TextRound6);
+ TextRound7 := AddText (Theme.PartyNewRound.TextRound7);
+
+ TextWinner1 := AddText (Theme.PartyNewRound.TextWinner1);
+ TextWinner2 := AddText (Theme.PartyNewRound.TextWinner2);
+ TextWinner3 := AddText (Theme.PartyNewRound.TextWinner3);
+ TextWinner4 := AddText (Theme.PartyNewRound.TextWinner4);
+ TextWinner5 := AddText (Theme.PartyNewRound.TextWinner5);
+ TextWinner6 := AddText (Theme.PartyNewRound.TextWinner6);
+ TextWinner7 := AddText (Theme.PartyNewRound.TextWinner7);
+
+ TextNextRound := AddText (Theme.PartyNewRound.TextNextRound);
+ TextNextRoundNo := AddText (Theme.PartyNewRound.TextNextRoundNo);
+ TextNextPlayer1 := AddText (Theme.PartyNewRound.TextNextPlayer1);
+ TextNextPlayer2 := AddText (Theme.PartyNewRound.TextNextPlayer2);
+ TextNextPlayer3 := AddText (Theme.PartyNewRound.TextNextPlayer3);
+
+ StaticRound1 := AddStatic (Theme.PartyNewRound.StaticRound1);
+ StaticRound2 := AddStatic (Theme.PartyNewRound.StaticRound2);
+ StaticRound3 := AddStatic (Theme.PartyNewRound.StaticRound3);
+ StaticRound4 := AddStatic (Theme.PartyNewRound.StaticRound4);
+ StaticRound5 := AddStatic (Theme.PartyNewRound.StaticRound5);
+ StaticRound6 := AddStatic (Theme.PartyNewRound.StaticRound6);
+ StaticRound7 := AddStatic (Theme.PartyNewRound.StaticRound7);
+
+ //Scores
+ TextScoreTeam1 := AddText (Theme.PartyNewRound.TextScoreTeam1);
+ TextScoreTeam2 := AddText (Theme.PartyNewRound.TextScoreTeam2);
+ TextScoreTeam3 := AddText (Theme.PartyNewRound.TextScoreTeam3);
+ TextNameTeam1 := AddText (Theme.PartyNewRound.TextNameTeam1);
+ TextNameTeam2 := AddText (Theme.PartyNewRound.TextNameTeam2);
+ TextNameTeam3 := AddText (Theme.PartyNewRound.TextNameTeam3);
+
+ //Players
+ TextTeam1Players := AddText (Theme.PartyNewRound.TextTeam1Players);
+ TextTeam2Players := AddText (Theme.PartyNewRound.TextTeam2Players);
+ TextTeam3Players := AddText (Theme.PartyNewRound.TextTeam3Players);
+
+ StaticTeam1 := AddStatic (Theme.PartyNewRound.StaticTeam1);
+ StaticTeam2 := AddStatic (Theme.PartyNewRound.StaticTeam2);
+ StaticTeam3 := AddStatic (Theme.PartyNewRound.StaticTeam3);
+ StaticNextPlayer1 := AddStatic (Theme.PartyNewRound.StaticNextPlayer1);
+ StaticNextPlayer2 := AddStatic (Theme.PartyNewRound.StaticNextPlayer2);
+ StaticNextPlayer3 := AddStatic (Theme.PartyNewRound.StaticNextPlayer3);
+
+ LoadFromTheme(Theme.PartyNewRound);
+end;
+
+procedure TScreenPartyNewRound.onShow;
+var
+ I: Integer;
+ function GetTeamPlayers(const Num: Byte): String;
+ var
+ Players: Array of String;
+ J: Byte;
+ begin
+ if (Num-1 >= PartySession.Teams.NumTeams) then
+ exit;
+
+ //Create Players Array
+ SetLength(Players, PartySession.Teams.TeamInfo[Num-1].NumPlayers);
+ For J := 0 to PartySession.Teams.TeamInfo[Num-1].NumPlayers-1 do
+ Players[J] := String(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name);
+
+ //Implode and Return
+ Result := Language.Implode(Players);
+ end;
+begin
+ PartySession.StartRound;
+
+ //Set Visibility of Round Infos
+ I := Length(PartySession.Rounds);
+ if (I >= 1) then
+ begin
+ Static[StaticRound1].Visible := True;
+ Text[TextRound1].Visible := True;
+ Text[TextWinner1].Visible := True;
+
+ //Texts:
+ Text[TextRound1].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[0].Plugin].Name);
+ Text[TextWinner1].Text := PartySession.GetWinnerString(0);
+ end
+ else
+ begin
+ Static[StaticRound1].Visible := False;
+ Text[TextRound1].Visible := False;
+ Text[TextWinner1].Visible := False;
+ end;
+
+ if (I >= 2) then
+ begin
+ Static[StaticRound2].Visible := True;
+ Text[TextRound2].Visible := True;
+ Text[TextWinner2].Visible := True;
+
+ //Texts:
+ Text[TextRound2].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[1].Plugin].Name);
+ Text[TextWinner2].Text := PartySession.GetWinnerString(1);
+ end
+ else
+ begin
+ Static[StaticRound2].Visible := False;
+ Text[TextRound2].Visible := False;
+ Text[TextWinner2].Visible := False;
+ end;
+
+ if (I >= 3) then
+ begin
+ Static[StaticRound3].Visible := True;
+ Text[TextRound3].Visible := True;
+ Text[TextWinner3].Visible := True;
+
+ //Texts:
+ Text[TextRound3].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[2].Plugin].Name);
+ Text[TextWinner3].Text := PartySession.GetWinnerString(2);
+ end
+ else
+ begin
+ Static[StaticRound3].Visible := False;
+ Text[TextRound3].Visible := False;
+ Text[TextWinner3].Visible := False;
+ end;
+
+ if (I >= 4) then
+ begin
+ Static[StaticRound4].Visible := True;
+ Text[TextRound4].Visible := True;
+ Text[TextWinner4].Visible := True;
+
+ //Texts:
+ Text[TextRound4].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[3].Plugin].Name);
+ Text[TextWinner4].Text := PartySession.GetWinnerString(3);
+ end
+ else
+ begin
+ Static[StaticRound4].Visible := False;
+ Text[TextRound4].Visible := False;
+ Text[TextWinner4].Visible := False;
+ end;
+
+ if (I >= 5) then
+ begin
+ Static[StaticRound5].Visible := True;
+ Text[TextRound5].Visible := True;
+ Text[TextWinner5].Visible := True;
+
+ //Texts:
+ Text[TextRound5].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[4].Plugin].Name);
+ Text[TextWinner5].Text := PartySession.GetWinnerString(4);
+ end
+ else
+ begin
+ Static[StaticRound5].Visible := False;
+ Text[TextRound5].Visible := False;
+ Text[TextWinner5].Visible := False;
+ end;
+
+ if (I >= 6) then
+ begin
+ Static[StaticRound6].Visible := True;
+ Text[TextRound6].Visible := True;
+ Text[TextWinner6].Visible := True;
+
+ //Texts:
+ Text[TextRound6].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[5].Plugin].Name);
+ Text[TextWinner6].Text := PartySession.GetWinnerString(5);
+ end
+ else
+ begin
+ Static[StaticRound6].Visible := False;
+ Text[TextRound6].Visible := False;
+ Text[TextWinner6].Visible := False;
+ end;
+
+ if (I >= 7) then
+ begin
+ Static[StaticRound7].Visible := True;
+ Text[TextRound7].Visible := True;
+ Text[TextWinner7].Visible := True;
+
+ //Texts:
+ Text[TextRound7].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[6].Plugin].Name);
+ Text[TextWinner7].Text := PartySession.GetWinnerString(6);
+ end
+ else
+ begin
+ Static[StaticRound7].Visible := False;
+ Text[TextRound7].Visible := False;
+ Text[TextWinner7].Visible := False;
+ end;
+
+ //Display Scores
+ if (PartySession.Teams.NumTeams >= 1) then
+ begin
+ Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[0].Score);
+ Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[0].Name);
+ Text[TextTeam1Players].Text := GetTeamPlayers(1);
+
+ Text[TextScoreTeam1].Visible := True;
+ Text[TextNameTeam1].Visible := True;
+ Text[TextTeam1Players].Visible := True;
+ Static[StaticTeam1].Visible := True;
+ Static[StaticNextPlayer1].Visible := True;
+ end
+ else
+ begin
+ Text[TextScoreTeam1].Visible := False;
+ Text[TextNameTeam1].Visible := False;
+ Text[TextTeam1Players].Visible := False;
+ Static[StaticTeam1].Visible := False;
+ Static[StaticNextPlayer1].Visible := False;
+ end;
+
+ if (PartySession.Teams.NumTeams >= 2) then
+ begin
+ Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[1].Score);
+ Text[TextNameTeam2].Text := String(PartySession.Teams.TeamInfo[1].Name);
+ Text[TextTeam2Players].Text := GetTeamPlayers(2);
+
+ Text[TextScoreTeam2].Visible := True;
+ Text[TextNameTeam2].Visible := True;
+ Text[TextTeam2Players].Visible := True;
+ Static[StaticTeam2].Visible := True;
+ Static[StaticNextPlayer2].Visible := True;
+ end
+ else
+ begin
+ Text[TextScoreTeam2].Visible := False;
+ Text[TextNameTeam2].Visible := False;
+ Text[TextTeam2Players].Visible := False;
+ Static[StaticTeam2].Visible := False;
+ Static[StaticNextPlayer2].Visible := False;
+ end;
+
+ if (PartySession.Teams.NumTeams >= 3) then
+ begin
+ Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[2].Score);
+ Text[TextNameTeam3].Text := String(PartySession.Teams.TeamInfo[2].Name);
+ Text[TextTeam3Players].Text := GetTeamPlayers(3);
+
+ Text[TextScoreTeam3].Visible := True;
+ Text[TextNameTeam3].Visible := True;
+ Text[TextTeam3Players].Visible := True;
+ Static[StaticTeam3].Visible := True;
+ Static[StaticNextPlayer3].Visible := True;
+ end
+ else
+ begin
+ Text[TextScoreTeam3].Visible := False;
+ Text[TextNameTeam3].Visible := False;
+ Text[TextTeam3Players].Visible := False;
+ Static[StaticTeam3].Visible := False;
+ Static[StaticNextPlayer3].Visible := False;
+ end;
+
+ //nextRound Texts
+ Text[TextNextRound].Text := Language.Translate(DllMan.Selected.PluginDesc);
+ Text[TextNextRoundNo].Text := InttoStr(PartySession.CurRound + 1);
+ if (PartySession.Teams.NumTeams >= 1) then
+ begin
+ Text[TextNextPlayer1].Text := PartySession.Teams.Teaminfo[0].Playerinfo[PartySession.Teams.Teaminfo[0].CurPlayer].Name;
+ Text[TextNextPlayer1].Visible := True;
+ end
+ else
+ Text[TextNextPlayer1].Visible := False;
+
+ if (PartySession.Teams.NumTeams >= 2) then
+ begin
+ Text[TextNextPlayer2].Text := PartySession.Teams.Teaminfo[1].Playerinfo[PartySession.Teams.Teaminfo[1].CurPlayer].Name;
+ Text[TextNextPlayer2].Visible := True;
+ end
+ else
+ Text[TextNextPlayer2].Visible := False;
+
+ if (PartySession.Teams.NumTeams >= 3) then
+ begin
+ Text[TextNextPlayer3].Text := PartySession.Teams.Teaminfo[2].Playerinfo[PartySession.Teams.Teaminfo[2].CurPlayer].Name;
+ Text[TextNextPlayer3].Visible := True;
+ end
+ else
+ Text[TextNextPlayer3].Visible := False;
+
+
+// LCD.WriteText(1, ' Choose mode: ');
+// UpdateLCD;
+end;
+
+procedure TScreenPartyNewRound.SetAnimationProgress(Progress: real);
+begin
+ {Button[0].Texture.ScaleW := Progress;
+ Button[1].Texture.ScaleW := Progress;
+ Button[2].Texture.ScaleW := Progress; }
+end;
+
+end.
diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas
index 7be4d1c0..1c5e8461 100644
--- a/Game/Code/Screens/UScreenPartyOptions.pas
+++ b/Game/Code/Screens/UScreenPartyOptions.pas
@@ -1,259 +1,263 @@
-unit UScreenPartyOptions;
-
-interface
-
-{$I switches.inc}
-
-uses
- UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes;
-
-type
- TScreenPartyOptions = class(TMenu)
- public
- SelectLevel: Cardinal;
- SelectPlayList: Cardinal;
- SelectPlayList2: Cardinal;
- SelectRounds: Cardinal;
- SelectTeams: Cardinal;
- SelectPlayers1: Cardinal;
- SelectPlayers2: Cardinal;
- SelectPlayers3: Cardinal;
-
- PlayList: Integer;
- PlayList2: Integer;
- Rounds: Integer;
- NumTeams: Integer;
- NumPlayer1, NumPlayer2, NumPlayer3: Integer;
-
- constructor Create; override;
- function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
- procedure onShow; override;
- procedure SetAnimationProgress(Progress: real); override;
- procedure SetPlaylist2;
- end;
-
-var
- IPlaylist: array[0..2] of String;
- IPlaylist2: array of String;
-const
- ITeams: array[0..1] of String =('2', '3');
- IPlayers: array[0..3] of String =('1', '2', '3', '4');
- IRounds: array[0..5] of String = ('2', '3', '4', '5', '6', '7');
-
-implementation
-
-uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UDLLManager, UPlaylist, USongs;
-
-function TScreenPartyOptions.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
- var
- I, J: Integer;
-begin
- Result := true;
- If (PressedDown) Then
- begin // Key Down
- case PressedKey of
- SDLK_Q:
- begin
- Result := false;
- end;
-
-
- SDLK_ESCAPE,
- SDLK_BACKSPACE :
- begin
- AudioPlayback.PlayBack;
- FadeTo(@ScreenMain);
- end;
-
- SDLK_RETURN:
- begin
- //Don'T start when Playlist is Selected and there are no Playlists
- If (Playlist = 2) and (Length(PlaylistMan.Playlists) = 0) then
- Exit;
-
- //Save Difficulty
- Ini.Difficulty := SelectsS[SelectLevel].SelectedOption;
- Ini.SaveLevel;
-
-
- //Save Num Teams:
- PartySession.Teams.NumTeams := NumTeams + 2;
- PartySession.Teams.Teaminfo[0].NumPlayers := NumPlayer1+1;
- PartySession.Teams.Teaminfo[1].NumPlayers := NumPlayer2+1;
- PartySession.Teams.Teaminfo[2].NumPlayers := NumPlayer3+1;
-
- //Save Playlist
- PlaylistMan.Mode := Playlist;
- PlaylistMan.CurPlayList := High(Cardinal);
- //If Category Selected Search Category ID
- if Playlist = 1 then
- begin
- J := -1;
- For I := 0 to high(CatSongs.Song) do
- begin
- if CatSongs.Song[I].Main then
- Inc(J);
-
- if J = Playlist2 then
- begin
- PlaylistMan.CurPlayList := I;
- Break;
- end;
- end;
-
- //No Categorys or Invalid Entry
- If PlaylistMan.CurPlayList = High(Cardinal) then
- Exit;
- end
- else
- PlaylistMan.CurPlayList := Playlist2;
-
- //Start Party
- PartySession.StartNewParty(Rounds + 2);
-
- AudioPlayback.PlayStart;
- //Go to Player Screen
- FadeTo(@ScreenPartyPlayer);
- end;
-
- // Up and Down could be done at the same time,
- // but I don't want to declare variables inside
- // functions like this one, called so many times
- SDLK_DOWN: InteractNext;
- SDLK_UP: InteractPrev;
- SDLK_RIGHT:
- begin
- AudioPlayback.PlayOption;
- InteractInc;
-
- //Change Playlist2 if Playlist is Changed
- If (Interaction = 1) then
- begin
- SetPlaylist2;
- end //Change Team3 Players visibility
- Else If (Interaction = 4) then
- begin
- SelectsS[7].Visible := (NumTeams = 1);
- end;
- end;
- SDLK_LEFT:
- begin
- AudioPlayback.PlayOption;
- InteractDec;
-
- //Change Playlist2 if Playlist is Changed
- If (Interaction = 1) then
- begin
- SetPlaylist2;
- end //Change Team3 Players visibility
- Else If (Interaction = 4) then
- begin
- SelectsS[7].Visible := (NumTeams = 1);
- end;
- end;
- end;
- end;
-end;
-
-constructor TScreenPartyOptions.Create;
-var
- I: integer;
-begin
- inherited Create;
- //Fill IPlaylist
- IPlaylist[0] := Language.Translate('PARTY_PLAYLIST_ALL');
- IPlaylist[1] := Language.Translate('PARTY_PLAYLIST_CATEGORY');
- IPlaylist[2] := Language.Translate('PARTY_PLAYLIST_PLAYLIST');
-
- //Fill IPlaylist2
- SetLength(IPlaylist2, 1);
- IPlaylist2[0] := '---';
-
- //Clear all Selects
- NumTeams := 0;
- NumPlayer1 := 0;
- NumPlayer2 := 0;
- NumPlayer3 := 0;
- Rounds := 5;
- PlayList := 0;
- PlayList2 := 0;
-
- //Load Screen From Theme
- LoadFromTheme(Theme.PartyOptions);
-
- SelectLevel := AddSelectSlide (Theme.PartyOptions.SelectLevel, Ini.Difficulty, Theme.ILevel);
- SelectPlayList := AddSelectSlide (Theme.PartyOptions.SelectPlayList, PlayList, IPlaylist);
- SelectPlayList2 := AddSelectSlide (Theme.PartyOptions.SelectPlayList2, PlayList2, IPlaylist2);
- SelectRounds := AddSelectSlide (Theme.PartyOptions.SelectRounds, Rounds, IRounds);
- SelectTeams := AddSelectSlide (Theme.PartyOptions.SelectTeams, NumTeams, ITeams);
- SelectPlayers1 := AddSelectSlide (Theme.PartyOptions.SelectPlayers1, NumPlayer1, IPlayers);
- SelectPlayers2 := AddSelectSlide (Theme.PartyOptions.SelectPlayers2, NumPlayer2, IPlayers);
- SelectPlayers3 := AddSelectSlide (Theme.PartyOptions.SelectPlayers3, NumPlayer3, IPlayers);
-
- Interaction := 0;
-
- //Hide Team3 Players
- SelectsS[7].Visible := False;
-end;
-
-procedure TScreenPartyOptions.SetPlaylist2;
-var I: Integer;
-begin
- Case Playlist of
- 0:
- begin
- SetLength(IPlaylist2, 1);
- IPlaylist2[0] := '---';
- end;
- 1:
- begin
- SetLength(IPlaylist2, 0);
- For I := 0 to high(CatSongs.Song) do
- begin
- If (CatSongs.Song[I].Main) then
- begin
- SetLength(IPlaylist2, Length(IPlaylist2) + 1);
- IPlaylist2[high(IPlaylist2)] := CatSongs.Song[I].Artist;
- end;
- end;
-
- If (Length(IPlaylist2) = 0) then
- begin
- SetLength(IPlaylist2, 1);
- IPlaylist2[0] := 'No Categories found';
- end;
- end;
- 2:
- begin
- if (Length(PlaylistMan.Playlists) > 0) then
- begin
- SetLength(IPlaylist2, Length(PlaylistMan.Playlists));
- PlaylistMan.GetNames(IPlaylist2);
- end
- else
- begin
- SetLength(IPlaylist2, 1);
- IPlaylist2[0] := 'No Playlists found';
- end;
- end;
- end;
-
- Playlist2 := 0;
- UpdateSelectSlideOptions(Theme.PartyOptions.SelectPlayList2, 2, IPlaylist2, Playlist2);
-end;
-
-procedure TScreenPartyOptions.onShow;
-begin
- Randomize;
-
-// LCD.WriteText(1, ' Choose mode: ');
-// UpdateLCD;
-end;
-
-procedure TScreenPartyOptions.SetAnimationProgress(Progress: real);
-begin
- {for I := 0 to 6 do
- SelectS[I].Texture.ScaleW := Progress;}
-end;
-
-end.
+unit UScreenPartyOptions;
+
+interface
+
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+
+{$I switches.inc}
+
+uses
+ UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes;
+
+type
+ TScreenPartyOptions = class(TMenu)
+ public
+ SelectLevel: Cardinal;
+ SelectPlayList: Cardinal;
+ SelectPlayList2: Cardinal;
+ SelectRounds: Cardinal;
+ SelectTeams: Cardinal;
+ SelectPlayers1: Cardinal;
+ SelectPlayers2: Cardinal;
+ SelectPlayers3: Cardinal;
+
+ PlayList: Integer;
+ PlayList2: Integer;
+ Rounds: Integer;
+ NumTeams: Integer;
+ NumPlayer1, NumPlayer2, NumPlayer3: Integer;
+
+ constructor Create; override;
+ function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
+ procedure onShow; override;
+ procedure SetAnimationProgress(Progress: real); override;
+ procedure SetPlaylist2;
+ end;
+
+var
+ IPlaylist: array[0..2] of String;
+ IPlaylist2: array of String;
+const
+ ITeams: array[0..1] of String =('2', '3');
+ IPlayers: array[0..3] of String =('1', '2', '3', '4');
+ IRounds: array[0..5] of String = ('2', '3', '4', '5', '6', '7');
+
+implementation
+
+uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UDLLManager, UPlaylist, USongs;
+
+function TScreenPartyOptions.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+ var
+ I, J: Integer;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ AudioPlayback.PlayBack;
+ FadeTo(@ScreenMain);
+ end;
+
+ SDLK_RETURN:
+ begin
+ //Don'T start when Playlist is Selected and there are no Playlists
+ If (Playlist = 2) and (Length(PlaylistMan.Playlists) = 0) then
+ Exit;
+
+ //Save Difficulty
+ Ini.Difficulty := SelectsS[SelectLevel].SelectedOption;
+ Ini.SaveLevel;
+
+
+ //Save Num Teams:
+ PartySession.Teams.NumTeams := NumTeams + 2;
+ PartySession.Teams.Teaminfo[0].NumPlayers := NumPlayer1+1;
+ PartySession.Teams.Teaminfo[1].NumPlayers := NumPlayer2+1;
+ PartySession.Teams.Teaminfo[2].NumPlayers := NumPlayer3+1;
+
+ //Save Playlist
+ PlaylistMan.Mode := Playlist;
+ PlaylistMan.CurPlayList := High(Cardinal);
+ //If Category Selected Search Category ID
+ if Playlist = 1 then
+ begin
+ J := -1;
+ For I := 0 to high(CatSongs.Song) do
+ begin
+ if CatSongs.Song[I].Main then
+ Inc(J);
+
+ if J = Playlist2 then
+ begin
+ PlaylistMan.CurPlayList := I;
+ Break;
+ end;
+ end;
+
+ //No Categorys or Invalid Entry
+ If PlaylistMan.CurPlayList = High(Cardinal) then
+ Exit;
+ end
+ else
+ PlaylistMan.CurPlayList := Playlist2;
+
+ //Start Party
+ PartySession.StartNewParty(Rounds + 2);
+
+ AudioPlayback.PlayStart;
+ //Go to Player Screen
+ FadeTo(@ScreenPartyPlayer);
+ end;
+
+ // Up and Down could be done at the same time,
+ // but I don't want to declare variables inside
+ // functions like this one, called so many times
+ SDLK_DOWN: InteractNext;
+ SDLK_UP: InteractPrev;
+ SDLK_RIGHT:
+ begin
+ AudioPlayback.PlayOption;
+ InteractInc;
+
+ //Change Playlist2 if Playlist is Changed
+ If (Interaction = 1) then
+ begin
+ SetPlaylist2;
+ end //Change Team3 Players visibility
+ Else If (Interaction = 4) then
+ begin
+ SelectsS[7].Visible := (NumTeams = 1);
+ end;
+ end;
+ SDLK_LEFT:
+ begin
+ AudioPlayback.PlayOption;
+ InteractDec;
+
+ //Change Playlist2 if Playlist is Changed
+ If (Interaction = 1) then
+ begin
+ SetPlaylist2;
+ end //Change Team3 Players visibility
+ Else If (Interaction = 4) then
+ begin
+ SelectsS[7].Visible := (NumTeams = 1);
+ end;
+ end;
+ end;
+ end;
+end;
+
+constructor TScreenPartyOptions.Create;
+var
+ I: integer;
+begin
+ inherited Create;
+ //Fill IPlaylist
+ IPlaylist[0] := Language.Translate('PARTY_PLAYLIST_ALL');
+ IPlaylist[1] := Language.Translate('PARTY_PLAYLIST_CATEGORY');
+ IPlaylist[2] := Language.Translate('PARTY_PLAYLIST_PLAYLIST');
+
+ //Fill IPlaylist2
+ SetLength(IPlaylist2, 1);
+ IPlaylist2[0] := '---';
+
+ //Clear all Selects
+ NumTeams := 0;
+ NumPlayer1 := 0;
+ NumPlayer2 := 0;
+ NumPlayer3 := 0;
+ Rounds := 5;
+ PlayList := 0;
+ PlayList2 := 0;
+
+ //Load Screen From Theme
+ LoadFromTheme(Theme.PartyOptions);
+
+ SelectLevel := AddSelectSlide (Theme.PartyOptions.SelectLevel, Ini.Difficulty, Theme.ILevel);
+ SelectPlayList := AddSelectSlide (Theme.PartyOptions.SelectPlayList, PlayList, IPlaylist);
+ SelectPlayList2 := AddSelectSlide (Theme.PartyOptions.SelectPlayList2, PlayList2, IPlaylist2);
+ SelectRounds := AddSelectSlide (Theme.PartyOptions.SelectRounds, Rounds, IRounds);
+ SelectTeams := AddSelectSlide (Theme.PartyOptions.SelectTeams, NumTeams, ITeams);
+ SelectPlayers1 := AddSelectSlide (Theme.PartyOptions.SelectPlayers1, NumPlayer1, IPlayers);
+ SelectPlayers2 := AddSelectSlide (Theme.PartyOptions.SelectPlayers2, NumPlayer2, IPlayers);
+ SelectPlayers3 := AddSelectSlide (Theme.PartyOptions.SelectPlayers3, NumPlayer3, IPlayers);
+
+ Interaction := 0;
+
+ //Hide Team3 Players
+ SelectsS[7].Visible := False;
+end;
+
+procedure TScreenPartyOptions.SetPlaylist2;
+var I: Integer;
+begin
+ Case Playlist of
+ 0:
+ begin
+ SetLength(IPlaylist2, 1);
+ IPlaylist2[0] := '---';
+ end;
+ 1:
+ begin
+ SetLength(IPlaylist2, 0);
+ For I := 0 to high(CatSongs.Song) do
+ begin
+ If (CatSongs.Song[I].Main) then
+ begin
+ SetLength(IPlaylist2, Length(IPlaylist2) + 1);
+ IPlaylist2[high(IPlaylist2)] := CatSongs.Song[I].Artist;
+ end;
+ end;
+
+ If (Length(IPlaylist2) = 0) then
+ begin
+ SetLength(IPlaylist2, 1);
+ IPlaylist2[0] := 'No Categories found';
+ end;
+ end;
+ 2:
+ begin
+ if (Length(PlaylistMan.Playlists) > 0) then
+ begin
+ SetLength(IPlaylist2, Length(PlaylistMan.Playlists));
+ PlaylistMan.GetNames(IPlaylist2);
+ end
+ else
+ begin
+ SetLength(IPlaylist2, 1);
+ IPlaylist2[0] := 'No Playlists found';
+ end;
+ end;
+ end;
+
+ Playlist2 := 0;
+ UpdateSelectSlideOptions(Theme.PartyOptions.SelectPlayList2, 2, IPlaylist2, Playlist2);
+end;
+
+procedure TScreenPartyOptions.onShow;
+begin
+ Randomize;
+
+// LCD.WriteText(1, ' Choose mode: ');
+// UpdateLCD;
+end;
+
+procedure TScreenPartyOptions.SetAnimationProgress(Progress: real);
+begin
+ {for I := 0 to 6 do
+ SelectS[I].Texture.ScaleW := Progress;}
+end;
+
+end.
diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas
index 36e3b43b..3537a26d 100644
--- a/Game/Code/Screens/UScreenScore.pas
+++ b/Game/Code/Screens/UScreenScore.pas
@@ -2,6 +2,10 @@ unit UScreenScore;
interface
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+
{$I switches.inc}
uses
diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas
index 60cab0a4..dd11ee07 100644
--- a/Game/Code/Screens/UScreenSing.pas
+++ b/Game/Code/Screens/UScreenSing.pas
@@ -2,6 +2,10 @@ unit UScreenSing;
interface
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+
{$I switches.inc}
diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas
index 7f692af5..5e9d94ec 100644
--- a/Game/Code/Screens/UScreenSingModi.pas
+++ b/Game/Code/Screens/UScreenSingModi.pas
@@ -2,6 +2,10 @@ unit UScreenSingModi;
interface
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+
{$I switches.inc}
diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas
index 3f2f5d58..85c38c26 100644
--- a/Game/Code/Screens/UScreenSong.pas
+++ b/Game/Code/Screens/UScreenSong.pas
@@ -2,6 +2,10 @@ unit UScreenSong;
interface
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+
{$I switches.inc}
@@ -1719,7 +1723,7 @@ begin
if (not AudioPlayback.Finished) AND (Theme.Song.Equalizer.Length > 0) then
begin
-
+ {$ifdef win32}
A := GetTickCount div 44;
if (A <> EqualizerTime) then
@@ -1794,6 +1798,7 @@ begin
else
EqualizerBands[B] := 1;
end;
+ {$endif}
//Draw every Channel
glColor4f(Theme.Song.Equalizer.ColR, Theme.Song.Equalizer.ColG, Theme.Song.Equalizer.ColB, Theme.Song.Equalizer.Alpha); //Set Color
diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas
index 6f9b0c53..90e56a54 100644
--- a/Game/Code/Screens/UScreenSongMenu.pas
+++ b/Game/Code/Screens/UScreenSongMenu.pas
@@ -2,6 +2,10 @@ unit UScreenSongMenu;
interface
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+
{$I switches.inc}
uses
diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas
index 02209dd7..7e5c7d91 100644
--- a/Game/Code/Screens/UScreenStatMain.pas
+++ b/Game/Code/Screens/UScreenStatMain.pas
@@ -2,6 +2,10 @@ unit UScreenStatMain;
interface
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+
{$I switches.inc}
uses
diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas
index 83ba2bb0..bf19fed2 100644
--- a/Game/Code/Screens/UScreenTop5.pas
+++ b/Game/Code/Screens/UScreenTop5.pas
@@ -2,6 +2,10 @@ unit UScreenTop5;
interface
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+
{$I switches.inc}
uses