From 5ed6620bad808381fce94f2cd67ee911b4d45bff Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 21 Mar 2007 19:19:04 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEdit.dcu | Bin 0 -> 2915 bytes Game/Code/Screens/UScreenEdit.pas | 104 ++ Game/Code/Screens/UScreenEditConvert.dcu | Bin 0 -> 13604 bytes Game/Code/Screens/UScreenEditConvert.pas | 500 ++++++++ Game/Code/Screens/UScreenEditHeader.dcu | Bin 0 -> 9398 bytes Game/Code/Screens/UScreenEditHeader.pas | 362 ++++++ Game/Code/Screens/UScreenEditSub.dcu | Bin 0 -> 29283 bytes Game/Code/Screens/UScreenEditSub.pas | 1236 +++++++++++++++++++ Game/Code/Screens/UScreenLevel.dcu | Bin 0 -> 3407 bytes Game/Code/Screens/UScreenLevel.pas | 101 ++ Game/Code/Screens/UScreenLoading.dcu | Bin 0 -> 2525 bytes Game/Code/Screens/UScreenLoading.pas | 48 + Game/Code/Screens/UScreenMain.dcu | Bin 0 -> 9661 bytes Game/Code/Screens/UScreenMain.pas | 384 ++++++ Game/Code/Screens/UScreenName.dcu | Bin 0 -> 4199 bytes Game/Code/Screens/UScreenName.pas | 114 ++ Game/Code/Screens/UScreenOpen.dcu | Bin 0 -> 4756 bytes Game/Code/Screens/UScreenOpen.pas | 151 +++ Game/Code/Screens/UScreenOptions.dcu | Bin 0 -> 4834 bytes Game/Code/Screens/UScreenOptions.pas | 221 ++++ Game/Code/Screens/UScreenOptionsGame.dcu | Bin 0 -> 4049 bytes Game/Code/Screens/UScreenOptionsGame.pas | 107 ++ Game/Code/Screens/UScreenOptionsGraphics.dcu | Bin 0 -> 3911 bytes Game/Code/Screens/UScreenOptionsGraphics.pas | 101 ++ Game/Code/Screens/UScreenOptionsLyrics.dcu | Bin 0 -> 3566 bytes Game/Code/Screens/UScreenOptionsLyrics.pas | 91 ++ Game/Code/Screens/UScreenOptionsRecord.dcu | Bin 0 -> 4885 bytes Game/Code/Screens/UScreenOptionsRecord.pas | 136 +++ Game/Code/Screens/UScreenOptionsSound.dcu | Bin 0 -> 3629 bytes Game/Code/Screens/UScreenOptionsSound.pas | 93 ++ Game/Code/Screens/UScreenOptionsThemes.dcu | Bin 0 -> 4188 bytes Game/Code/Screens/UScreenOptionsThemes.pas | 118 ++ Game/Code/Screens/UScreenPartyNewRound.dcu | Bin 0 -> 9085 bytes Game/Code/Screens/UScreenPartyNewRound.pas | 397 ++++++ Game/Code/Screens/UScreenPartyOptions.dcu | Bin 0 -> 5884 bytes Game/Code/Screens/UScreenPartyOptions.pas | 164 +++ Game/Code/Screens/UScreenPartyPlayer.dcu | Bin 0 -> 6068 bytes Game/Code/Screens/UScreenPartyPlayer.pas | 210 ++++ Game/Code/Screens/UScreenPartyScore.dcu | Bin 0 -> 5605 bytes Game/Code/Screens/UScreenPartyScore.pas | 183 +++ Game/Code/Screens/UScreenPartyWin.dcu | Bin 0 -> 4642 bytes Game/Code/Screens/UScreenPartyWin.pas | 157 +++ Game/Code/Screens/UScreenScore.dcu | Bin 0 -> 10273 bytes Game/Code/Screens/UScreenScore.pas | 586 +++++++++ Game/Code/Screens/UScreenSing.dcu | Bin 0 -> 23327 bytes Game/Code/Screens/UScreenSing.pas | 1121 +++++++++++++++++ Game/Code/Screens/UScreenSingModi.dcu | Bin 0 -> 15109 bytes Game/Code/Screens/UScreenSingModi.pas | 1088 +++++++++++++++++ Game/Code/Screens/UScreenSong.dcu | Bin 0 -> 29384 bytes Game/Code/Screens/UScreenSong.pas | 1690 ++++++++++++++++++++++++++ Game/Code/Screens/UScreenSongMenu.dcu | Bin 0 -> 7346 bytes Game/Code/Screens/UScreenSongMenu.pas | 355 ++++++ Game/Code/Screens/UScreenTop5.dcu | Bin 0 -> 4531 bytes Game/Code/Screens/UScreenTop5.pas | 166 +++ Game/Code/Screens/UScreenWelcome.dcu | Bin 0 -> 3228 bytes Game/Code/Screens/UScreenWelcome.pas | 117 ++ 56 files changed, 10101 insertions(+) create mode 100644 Game/Code/Screens/UScreenEdit.dcu create mode 100644 Game/Code/Screens/UScreenEdit.pas create mode 100644 Game/Code/Screens/UScreenEditConvert.dcu create mode 100644 Game/Code/Screens/UScreenEditConvert.pas create mode 100644 Game/Code/Screens/UScreenEditHeader.dcu create mode 100644 Game/Code/Screens/UScreenEditHeader.pas create mode 100644 Game/Code/Screens/UScreenEditSub.dcu create mode 100644 Game/Code/Screens/UScreenEditSub.pas create mode 100644 Game/Code/Screens/UScreenLevel.dcu create mode 100644 Game/Code/Screens/UScreenLevel.pas create mode 100644 Game/Code/Screens/UScreenLoading.dcu create mode 100644 Game/Code/Screens/UScreenLoading.pas create mode 100644 Game/Code/Screens/UScreenMain.dcu create mode 100644 Game/Code/Screens/UScreenMain.pas create mode 100644 Game/Code/Screens/UScreenName.dcu create mode 100644 Game/Code/Screens/UScreenName.pas create mode 100644 Game/Code/Screens/UScreenOpen.dcu create mode 100644 Game/Code/Screens/UScreenOpen.pas create mode 100644 Game/Code/Screens/UScreenOptions.dcu create mode 100644 Game/Code/Screens/UScreenOptions.pas create mode 100644 Game/Code/Screens/UScreenOptionsGame.dcu create mode 100644 Game/Code/Screens/UScreenOptionsGame.pas create mode 100644 Game/Code/Screens/UScreenOptionsGraphics.dcu create mode 100644 Game/Code/Screens/UScreenOptionsGraphics.pas create mode 100644 Game/Code/Screens/UScreenOptionsLyrics.dcu create mode 100644 Game/Code/Screens/UScreenOptionsLyrics.pas create mode 100644 Game/Code/Screens/UScreenOptionsRecord.dcu create mode 100644 Game/Code/Screens/UScreenOptionsRecord.pas create mode 100644 Game/Code/Screens/UScreenOptionsSound.dcu create mode 100644 Game/Code/Screens/UScreenOptionsSound.pas create mode 100644 Game/Code/Screens/UScreenOptionsThemes.dcu create mode 100644 Game/Code/Screens/UScreenOptionsThemes.pas create mode 100644 Game/Code/Screens/UScreenPartyNewRound.dcu create mode 100644 Game/Code/Screens/UScreenPartyNewRound.pas create mode 100644 Game/Code/Screens/UScreenPartyOptions.dcu create mode 100644 Game/Code/Screens/UScreenPartyOptions.pas create mode 100644 Game/Code/Screens/UScreenPartyPlayer.dcu create mode 100644 Game/Code/Screens/UScreenPartyPlayer.pas create mode 100644 Game/Code/Screens/UScreenPartyScore.dcu create mode 100644 Game/Code/Screens/UScreenPartyScore.pas create mode 100644 Game/Code/Screens/UScreenPartyWin.dcu create mode 100644 Game/Code/Screens/UScreenPartyWin.pas create mode 100644 Game/Code/Screens/UScreenScore.dcu create mode 100644 Game/Code/Screens/UScreenScore.pas create mode 100644 Game/Code/Screens/UScreenSing.dcu create mode 100644 Game/Code/Screens/UScreenSing.pas create mode 100644 Game/Code/Screens/UScreenSingModi.dcu create mode 100644 Game/Code/Screens/UScreenSingModi.pas create mode 100644 Game/Code/Screens/UScreenSong.dcu create mode 100644 Game/Code/Screens/UScreenSong.pas create mode 100644 Game/Code/Screens/UScreenSongMenu.dcu create mode 100644 Game/Code/Screens/UScreenSongMenu.pas create mode 100644 Game/Code/Screens/UScreenTop5.dcu create mode 100644 Game/Code/Screens/UScreenTop5.pas create mode 100644 Game/Code/Screens/UScreenWelcome.dcu create mode 100644 Game/Code/Screens/UScreenWelcome.pas (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenEdit.dcu b/Game/Code/Screens/UScreenEdit.dcu new file mode 100644 index 00000000..1b9c7bb9 Binary files /dev/null and b/Game/Code/Screens/UScreenEdit.dcu differ diff --git a/Game/Code/Screens/UScreenEdit.pas b/Game/Code/Screens/UScreenEdit.pas new file mode 100644 index 00000000..aa3301a7 --- /dev/null +++ b/Game/Code/Screens/UScreenEdit.pas @@ -0,0 +1,104 @@ +unit UScreenEdit; + +interface + +uses UMenu, SDL, UThemes; + +type + TScreenEdit = class(TMenu) + public +{ Tex_Background: TTexture; + FadeOut: boolean; + Path: string; + FileName: string;} + constructor Create(Back: String); override; + procedure onShow; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; +{ function Draw: boolean; override; + procedure Finish;} + end; + +implementation + +uses UGraphic, UMusic, USkins; + +function TScreenEdit.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_ESCAPE : + begin + Music.PlayBack; + FadeTo(@ScreenMain); +// Result := false; + end; + SDLK_RETURN: + begin + if Interaction = 0 then begin + Music.PlayStart; + FadeTo(@ScreenEditConvert); + end; +// if Interaction = 1 then begin +// Music.PlayStart; +// FadeTo(@ScreenEditHeader); +// end; + + if Interaction = 1 then begin + Music.PlayBack; + FadeTo(@ScreenMain); + end; + end; + + SDLK_DOWN: + begin + InteractNext; + end; + SDLK_UP: + begin + InteractPrev; + end; + end; + end; +end; + +constructor TScreenEdit.Create(Back: String); +begin + inherited Create(Back); + AddButton(400-200, 100 + 0*70, 400, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(10, 5, 0, 0, 0, 'Convert Midi to Txt'); +// Button[High(Button)].Text[0].Size := 11; + +// AddButton(400-200, 100 + 1*60, 400, 40, 'ButtonF'); +// AddButtonText(10, 5, 0, 0, 0, 'Edit Headers'); + +// AddButton(400-200, 100 + 2*60, 400, 40, 'ButtonF'); +// AddButtonText(10, 5, 0, 0, 0, 'Set GAP'); + + AddButton(400-200, 100 + 3*60, 400, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(10, 5, 0, 0, 0, 'Exit'); + +end; + +procedure TScreenEdit.onShow; +begin +// Interaction := 0; +end; + +(*function TScreenEdit.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + Pet: integer; + AktBeat: integer; +begin +end; + +procedure TScreenEdit.Finish; +begin +// +end;*) + +end. diff --git a/Game/Code/Screens/UScreenEditConvert.dcu b/Game/Code/Screens/UScreenEditConvert.dcu new file mode 100644 index 00000000..1839ad6b Binary files /dev/null and b/Game/Code/Screens/UScreenEditConvert.dcu differ diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas new file mode 100644 index 00000000..68742535 --- /dev/null +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -0,0 +1,500 @@ +unit UScreenEditConvert; + +interface + +uses UMenu, SDL, MidiFile, MidiOut, 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; + MidiFile: TMidiFile; + MidiTrack: TMidiTrack; + MidiEvent: pMidiEvent; + MidiOut: TMidiOutput; + Song: TSong; + Czesc: TCzesci; + BPM: real; + Ticks: real; + Nuta: array of TNuta; + procedure AddLyric(Start: integer; Tekst: string); + procedure Extract; + procedure MidiFile1MidiEvent(event: PMidiEvent); + function SelectedNumber: integer; + constructor Create(Back: String); 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, UPliki, UMain, UIni, OpenGL, 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: + begin + MidiFile.StopPlaying; + Music.PlayBack; + FadeTo(@ScreenEdit); + end; + + SDLK_RETURN: + begin + if Interaction = 0 then begin + Music.PlayStart; + ScreenOpen.BackScreen := @ScreenEditConvert; + FadeTo(@ScreenOpen); + end; + + if Interaction = 1 then begin + Selected := false; + MidiFile.OnMidiEvent := MidiFile1MidiEvent; +// MidiFile.GoToTime(MidiFile.GetTrackLength div 2); + MidiFile.StartPlaying; + end; + + if Interaction = 2 then begin + Selected := true; + MidiFile.OnMidiEvent := nil; + {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; +begin + // song info + Song.Title := ''; + Song.Artist := ''; + Song.Mp3 := ''; + Song.Resolution := 4; + SetLength(Song.BPM, 1); + Song.BPM[0].BPM := BPM*4; + + // 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; + 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; + +procedure TScreenEditConvert.MidiFile1MidiEvent(event: PMidiEvent); +begin +// Log.LogStatus(IntToStr(event.event), 'MIDI'); + MidiOut.PutShort(event.event, event.data1, event.data2); +end; + +constructor TScreenEditConvert.Create(Back: String); +var + P: integer; +begin + inherited Create(Back); + 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'; + MidiFile := TMidiFile.Create(nil); + + 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 + 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 + Channel[T].Name := IntToStr(T+1); + + 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; +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 + X := 60+MidiFile.GetCurrentTime/MidiFile.GetTrackLength*730; + DrawLine(X, Y, X, Bottom, 0.3, 0.3, 0.3); + + +end; + +procedure TScreenEditConvert.onHide; +begin + MidiOut.Close; + MidiOut.Free; +end; + +end. diff --git a/Game/Code/Screens/UScreenEditHeader.dcu b/Game/Code/Screens/UScreenEditHeader.dcu new file mode 100644 index 00000000..9508e841 Binary files /dev/null and b/Game/Code/Screens/UScreenEditHeader.dcu differ diff --git a/Game/Code/Screens/UScreenEditHeader.pas b/Game/Code/Screens/UScreenEditHeader.pas new file mode 100644 index 00000000..65f39e44 --- /dev/null +++ b/Game/Code/Screens/UScreenEditHeader.pas @@ -0,0 +1,362 @@ +unit UScreenEditHeader; + +interface + +uses UMenu, SDL, USongs, UThemes; + +type + TScreenEditHeader = class(TMenu) + public + AktSong: TSong; + TextTitle: integer; + TextArtist: integer; + TextMp3: integer; + TextBackground: integer; + TextVideo: integer; + TextVideoGAP: integer; + TextRelative: integer; + TextResolution: integer; + TextNotesGAP: integer; + TextStart: integer; + TextGAP: integer; + TextBPM: integer; + StaticTitle: integer; + StaticArtist: integer; + StaticMp3: integer; + StaticBackground: integer; + StaticVideo: integer; + StaticVideoGAP: integer; + StaticRelative: integer; + StaticResolution: integer; + StaticNotesGAP: integer; + StaticStart: integer; + StaticGAP: integer; + StaticBPM: integer; + Sel: array[0..11] of boolean; + procedure SetRoundButtons; + + constructor Create(Back: String); override; + procedure onShow; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; +{ function Draw: boolean; override; + procedure Finish;} + end; + +implementation + +uses UGraphic, UMusic, SysUtils, UPliki, USkins; + +function TScreenEditHeader.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var + T: integer; +begin + Result := true; + If (PressedDown) Then begin // Key Down + case PressedKey of + SDLK_ESCAPE : + begin +// Music.PlayBack; +// FadeTo(@MainScreen); + Result := false; + end; + + SDLK_RETURN: + begin + if Interaction = 1 then begin +// Save; + end; + end; + + SDLK_RIGHT: + begin + case Interaction of + 0..0: InteractNext; + 1: Interaction := 0; + end; + end; + + SDLK_LEFT: + begin + case Interaction of + 0: Interaction := 1; + 1..1: InteractPrev; + end; + end; + + SDLK_DOWN: + begin + case Interaction of + 0..1: Interaction := 2; + 2..12: InteractNext; + 13: Interaction := 0; + end; + end; + + SDLK_UP: + begin + case Interaction of + 0..1: Interaction := 13; + 2: Interaction := 0; + 3..13: InteractPrev; + end; + end; + + SDLK_BACKSPACE: + begin + T := Interaction - 2 + TextTitle; + if (Interaction >= 2) and (Interaction <= 13) and (Length(Text[T].Text) >= 1) then begin + Delete(Text[T].Text, Length(Text[T].Text), 1); + SetRoundButtons; + end; + end; + + end; + case ScanCode of + 32..255: + begin + if (Interaction >= 2) and (Interaction <= 13) then begin + Text[Interaction - 2 + TextTitle].Text := + Text[Interaction - 2 + TextTitle].Text + chr(ScanCode); + SetRoundButtons; + end; + end; + end; + end; +end; + +constructor TScreenEditHeader.Create(Back: String); +begin + inherited Create(Back); + + AddButton(40, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(15, 5, 'Open'); + + AddButton(160, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(20, 5, 'Save'); + + AddBox(80, 60, 640, 550); + + AddText(160, 110 + 0*30, 0, 10, 0, 0, 0, 'Title:'); + AddText(160, 110 + 1*30, 0, 10, 0, 0, 0, 'Artist:'); + AddText(160, 110 + 2*30, 0, 10, 0, 0, 0, 'MP3:'); + + AddText(160, 110 + 4*30, 0, 10, 0, 0, 0, 'Background:'); + AddText(160, 110 + 5*30, 0, 10, 0, 0, 0, 'Video:'); + AddText(160, 110 + 6*30, 0, 10, 0, 0, 0, 'VideoGAP:'); + + AddText(160, 110 + 8*30, 0, 10, 0, 0, 0, 'Relative:'); + AddText(160, 110 + 9*30, 0, 10, 0, 0, 0, 'Resolution:'); + AddText(160, 110 + 10*30, 0, 10, 0, 0, 0, 'NotesGAP:'); + + AddText(160, 110 + 12*30, 0, 10, 0, 0, 0, 'Start:'); + AddText(160, 110 + 13*30, 0, 10, 0, 0, 0, 'GAP:'); + AddText(160, 110 + 14*30, 0, 10, 0, 0, 0, 'BPM:'); + + TextTitle := AddText(340, 110 + 0*30, 0, 10, 0, 0, 0, ''); + TextArtist := AddText(340, 110 + 1*30, 0, 10, 0, 0, 0, ''); + TextMp3 := AddText(340, 110 + 2*30, 0, 10, 0, 0, 0, ''); + + TextBackground := AddText(340, 110 + 4*30, 0, 10, 0, 0, 0, ''); + TextVideo := AddText(340, 110 + 5*30, 0, 10, 0, 0, 0, ''); + TextVideoGAP := AddText(340, 110 + 6*30, 0, 10, 0, 0, 0, ''); + + TextRelative := AddText(340, 110 + 8*30, 0, 10, 0, 0, 0, ''); + TextResolution := AddText(340, 110 + 9*30, 0, 10, 0, 0, 0, ''); + TextNotesGAP := AddText(340, 110 + 10*30, 0, 10, 0, 0, 0, ''); + + TextStart := AddText(340, 110 + 12*30, 0, 10, 0, 0, 0, ''); + TextGAP := AddText(340, 110 + 13*30, 0, 10, 0, 0, 0, ''); + TextBPM := AddText(340, 110 + 14*30, 0, 10, 0, 0, 0, ''); + + StaticTitle := AddStatic(130, 115 + 0*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticArtist := AddStatic(130, 115 + 1*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticMp3 := AddStatic(130, 115 + 2*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticBackground := AddStatic(130, 115 + 4*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticVideo := AddStatic(130, 115 + 5*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticVideoGAP := AddStatic(130, 115 + 6*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticRelative := AddStatic(130, 115 + 8*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticResolution := AddStatic(130, 115 + 9*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticNotesGAP := AddStatic(130, 115 + 10*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticStart := AddStatic(130, 115 + 12*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticGAP := AddStatic(130, 115 + 13*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticBPM := AddStatic(130, 115 + 14*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + + AddInteraction(iText, TextTitle); + AddInteraction(iText, TextArtist); + AddInteraction(iText, TextMp3); + AddInteraction(iText, TextBackground); + AddInteraction(iText, TextVideo); + AddInteraction(iText, TextVideoGAP); + AddInteraction(iText, TextRelative); + AddInteraction(iText, TextResolution); + AddInteraction(iText, TextNotesGAP); + AddInteraction(iText, TextStart); + AddInteraction(iText, TextGAP); + AddInteraction(iText, TextBPM); +end; + +procedure TScreenEditHeader.onShow; +begin +{ if FileExists(FileName) then begin // load file + AktSong.FileName := FileName; + SkanujPlik(AktSong); + + SetLength(TrueBoolStrs, 1); + TrueBoolStrs[0] := 'yes'; + SetLength(FalseBoolStrs, 1); + FalseBoolStrs[0] := 'no'; + + Text[TextTitle].Text := AktSong.Title; + Text[TextArtist].Text := AktSong.Artist; + Text[TextMP3].Text := AktSong.Mp3; + Text[TextBackground].Text := AktSong.Background; + Text[TextVideo].Text := AktSong.Video; + Text[TextVideoGAP].Text := FloatToStr(AktSong.VideoGAP); + Text[TextRelative].Text := BoolToStr(AktSong.Relative, true); + Text[TextResolution].Text := IntToStr(AktSong.Resolution); + Text[TextNotesGAP].Text := IntToStr(AktSong.NotesGAP); + Text[TextStart].Text := FloatToStr(AktSong.Start); + Text[TextGAP].Text := FloatToStr(AktSong.GAP); + Text[TextBPM].Text := FloatToStr(AktSong.BPM[0].BPM); + SetRoundButtons; + end;} + + Interaction := 0; +end; + +(*function TScreenEdit.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + Pet: integer; + AktBeat: integer; +begin +{ glClearColor(1,1,1,1); + + // control music + if PlaySentence then begin + // stop the music + if (Music.Position > PlayStopTime) then begin + Music.Stop; + PlaySentence := false; + end; + + // click + if (Click) and (PlaySentence) then begin + AktBeat := Floor(AktSong.BPM[0].BPM * (Music.Position - AktSong.GAP / 1000) / 60); + 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 + Music.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); + + // 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); + Text[TextNText].Text := Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst; + + // draw static menu + inherited Draw; + + // draw notes + SingDrawNoteLines(20, 300, 780, 15); + SingDrawBeatDelimeters(40, 300, 760, 0); + SingDrawCzesc(40, 405, 760, 0); + + // draw text + Lyric.Draw;} + +end;*) + +procedure TScreenEditHeader.SetRoundButtons; +begin + if Length(Text[TextTitle].Text) > 0 then Static[StaticTitle].Visible := true + else Static[StaticTitle].Visible := false; + + if Length(Text[TextArtist].Text) > 0 then Static[StaticArtist].Visible := true + else Static[StaticArtist].Visible := false; + + if Length(Text[TextMp3].Text) > 0 then Static[StaticMp3].Visible := true + else Static[StaticMp3].Visible := false; + + if Length(Text[TextBackground].Text) > 0 then Static[StaticBackground].Visible := true + else Static[StaticBackground].Visible := false; + + if Length(Text[TextVideo].Text) > 0 then Static[StaticVideo].Visible := true + else Static[StaticVideo].Visible := false; + + try + StrToFloat(Text[TextVideoGAP].Text); + if StrToFloat(Text[TextVideoGAP].Text)<> 0 then Static[StaticVideoGAP].Visible := true + else Static[StaticVideoGAP].Visible := false; + except + Static[StaticVideoGAP].Visible := false; + end; + + if LowerCase(Text[TextRelative].Text) = 'yes' then Static[StaticRelative].Visible := true + else Static[StaticRelative].Visible := false; + + try + StrToInt(Text[TextResolution].Text); + if (StrToInt(Text[TextResolution].Text) <> 0) and (StrToInt(Text[TextResolution].Text) >= 1) + then Static[StaticResolution].Visible := true + else Static[StaticResolution].Visible := false; + except + Static[StaticResolution].Visible := false; + end; + + try + StrToInt(Text[TextNotesGAP].Text); + Static[StaticNotesGAP].Visible := true; + except + Static[StaticNotesGAP].Visible := false; + end; + + // start + try + StrToFloat(Text[TextStart].Text); + if (StrToFloat(Text[TextStart].Text) > 0) then Static[StaticStart].Visible := true + else Static[StaticStart].Visible := false; + except + Static[StaticStart].Visible := false; + end; + + // GAP + try + StrToFloat(Text[TextGAP].Text); + Static[StaticGAP].Visible := true; + except + Static[StaticGAP].Visible := false; + end; + + // BPM + try + StrToFloat(Text[TextBPM].Text); + if (StrToFloat(Text[TextBPM].Text) > 0) then Static[StaticBPM].Visible := true + else Static[StaticBPM].Visible := false; + except + Static[StaticBPM].Visible := false; + end; + +end; + +(*procedure TScreenEdit.Finish; +begin +// +end;*) + +end. diff --git a/Game/Code/Screens/UScreenEditSub.dcu b/Game/Code/Screens/UScreenEditSub.dcu new file mode 100644 index 00000000..6b6b6e35 Binary files /dev/null and b/Game/Code/Screens/UScreenEditSub.dcu differ diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas new file mode 100644 index 00000000..7bdbac0d --- /dev/null +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -0,0 +1,1236 @@ +unit UScreenEditSub; + +interface + +uses UMenu, UMusic, SDL, SysUtils, UPliki, UTime, USongs, UIni, ULog, USmpeg, UTexture, UMenuText, + ULyrics, Math, OpenGL12, UThemes, MidiOut; + +type + TScreenEditSub = class(TMenu) + private + 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; + + MidiOut: TMidiOutput; + 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); + public + Tex_Background: TTexture; + FadeOut: boolean; + Path: string; + FileName: string; + constructor Create(Back: String); 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; + +// 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: + 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 + if SDL_ModState = 0 then + // Save Song + SaveSong(AktSong, Czesci[0], Path + FileName, false); + + if SDL_ModState = KMOD_LSHIFT then + // Save Song + SaveSong(AktSong, Czesci[0], Path + FileName, true); + + 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; + Music.Stop; + R := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote); + if R <= Music.Length then begin + Music.MoveTo(R); + PlayStopTime := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec); + PlaySentence := true; + Music.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; + Music.Stop; + Music.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote)+0{-0.10}); + PlayStopTime := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec)+0; + Music.Play; + LastClick := -100; + end; + end; + + SDLK_SPACE: + begin + // Play Sentence + PlaySentenceMidi := false; // stop midi + PlaySentence := true; + Click := false; + Music.Stop; + Music.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)); + Music.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 + // 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; + Music.Stop; + PlaySentence := false; + end; + + // decrease tone + if SDL_ModState = KMOD_LCTRL then begin + TransposeNote(-1); + end; + + end; + + SDLK_UP: + begin + // 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; + Music.Stop; + PlaySentence := false; + end; + + // increase tone + if SDL_ModState = KMOD_LCTRL then begin + TransposeNote(1); + end; + 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..3: S := Max - 2; + 4..10000: S := Min + 2; // poczatek + 2 + 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; + + // 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; + 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; + +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 + // 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(Back: String); +begin + inherited Create(Back); + 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'); + + MidiOut := TMidiOutput.Create(nil); + if Ini.Debug = 1 then + MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table + MidiOut.Open; + + + + CzyscNuty; + if WczytajCzesci(Path + FileName) = false then +// if WczytajCzesci(SongPath + 'Zapis.txt') = false then + Text[TextTitle].Text := 'Error loading file' + else begin + 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; + + Music.Open(Path + AktSong.Mp3); + + 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; + + // 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; + + // 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 + + 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; + + end; + end; + end; // if PlaySentenceMidi + + // mp3 music + if PlaySentence then begin + // stop the music + if (Music.Position > PlayStopTime) then begin + Music.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(Music.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 + Music.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); + + // 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); + Text[TextNText].Text := Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst; + + // Text Edit Mode + if TextEditMode then + Text[TextNText].Text := Text[TextNText].Text + '|'; + + // draw static menu + inherited Draw; + + // draw notes + SingDrawNoteLines(20, 300, 780, 15); + SingDrawBeatDelimeters(40, 300, 760, 0); + EditDrawCzesc(40, 405, 760, 0, 15); + + // draw text + Lyric.Draw; + +end; + +procedure TScreenEditSub.onHide; +begin + MidiOut.Close; + MidiOut.Free; +end; + +end. diff --git a/Game/Code/Screens/UScreenLevel.dcu b/Game/Code/Screens/UScreenLevel.dcu new file mode 100644 index 00000000..95cb3267 Binary files /dev/null and b/Game/Code/Screens/UScreenLevel.dcu differ diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas new file mode 100644 index 00000000..28aa40ea --- /dev/null +++ b/Game/Code/Screens/UScreenLevel.pas @@ -0,0 +1,101 @@ +unit UScreenLevel; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + +type + TScreenLevel = class(TMenu) + public + 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; + +function TScreenLevel.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 : + begin + Music.PlayBack; + FadeTo(@ScreenName); + end; + + SDLK_RETURN: + begin + Ini.Difficulty := Interaction; + Ini.SaveLevel; + Music.PlayStart; + //Set Standard Mode + ScreenSong.Mode := 0; + FadeTo(@ScreenSong); + 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: InteractNext; + SDLK_LEFT: InteractPrev; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN : + begin + end; + end; +end; + +constructor TScreenLevel.Create; +var + I: integer; +begin + inherited Create; + + AddBackground(Theme.Level.Background.Tex); + + AddButton(Theme.Level.ButtonEasy); + AddButton(Theme.Level.ButtonMedium); + AddButton(Theme.Level.ButtonHard); + + for I := 0 to High(Theme.Level.Static) do + AddStatic(Theme.Level.Static[I]); + + for I := 0 to High(Theme.Level.Text) do + AddText(Theme.Level.Text[I]); + + Interaction := 0; +end; + +procedure TScreenLevel.onShow; +begin + Interaction := Ini.Difficulty; + +// LCD.WriteText(1, ' Choose mode: '); +// UpdateLCD; +end; + +procedure TScreenLevel.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/UScreenLoading.dcu b/Game/Code/Screens/UScreenLoading.dcu new file mode 100644 index 00000000..e0eb1cfe Binary files /dev/null and b/Game/Code/Screens/UScreenLoading.dcu differ diff --git a/Game/Code/Screens/UScreenLoading.pas b/Game/Code/Screens/UScreenLoading.pas new file mode 100644 index 00000000..05b308ac --- /dev/null +++ b/Game/Code/Screens/UScreenLoading.pas @@ -0,0 +1,48 @@ +unit UScreenLoading; + +interface + +uses + UMenu, SDL, SysUtils, UThemes; + +type + TScreenLoading = class(TMenu) + public + Fadeout: boolean; + constructor Create(Back: String); override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + end; + +implementation + +uses UGraphic, UTime; + +function TScreenLoading.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; +end; + +constructor TScreenLoading.Create(Back: String); +var + I: integer; +begin + inherited Create(Back); + + AddBackground(Theme.Loading.Background.Tex); + + for I := 0 to High(Theme.Loading.Static) do + AddStatic(Theme.Loading.Static[I]); + + for I := 0 to High(Theme.Loading.Text) do + AddText(Theme.Loading.Text[I]); + + Fadeout := false; +end; + +procedure TScreenLoading.onShow; +begin +// nothing +end; + +end. diff --git a/Game/Code/Screens/UScreenMain.dcu b/Game/Code/Screens/UScreenMain.dcu new file mode 100644 index 00000000..22bb4883 Binary files /dev/null and b/Game/Code/Screens/UScreenMain.dcu differ diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas new file mode 100644 index 00000000..dcd7db26 --- /dev/null +++ b/Game/Code/Screens/UScreenMain.pas @@ -0,0 +1,384 @@ +unit UScreenMain; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes, ULCD, ULight; + +type + TScreenMain = class(TMenu) + public + TextDescription: integer; + TextDescriptionLong: integer; + + //Credits Mod + Credits_Visible: Boolean; + Credits_Y: Real; + Credits_Time: Cardinal; + Credits_Alpha: Cardinal; + procedure DrawCredits; + //Credits Mod End + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure InteractNext; override; + procedure InteractPrev; override; + procedure UpdateLCD; + procedure SetAnimationProgress(Progress: real); override; + function Draw: boolean; override; + end; + +const Credits_Text: Array[0..46] of PChar = ( + ':SPACE:', + 'Main Idea: Corvus 5', + 'Thank you very much for this great Game', + ':SPACE:', + 'The Ultrastar Deluxe Team:', + ':SPACE:', + 'commandi00:', + 'Beta Testing', + ':SPACE:', + 'Crazy Joker:', + 'Graphics', + ':SPACE:', + 'DennistheMenace:', + 'Beta Testing and great Support in "the Board"', + ':SPACE:', + 'Moq/Moguhguh:', + 'Programming', + ':SPACE:', + 'Mota:', + 'Programming, Idea of creating this Mod, Team Leading', + ':SPACE:', + 'Sawyer:', + 'Web Master, Programming', + ':SPACE:', + 'Whiteshark:', + 'Programming, Creating Release', + ':SPACE:', + ':SPACE:', + 'Thanks to', + ':SPACE:', + 'Blind Guard', + 'for supporting us and administrate this great Board', + ':SPACE:', + 'The whole Community from www.ultra-star.dl.am', + 'for supporting us, supporting the newbies', + 'and remembering us to continue work', + ':SPACE:', + 'You', + 'for using Ultrastar Deluxe', + ':SPACE:', + ':SPACE:', + 'Visit us at:', + 'http://www.UltraStar-Deluxe.de.vu', + 'http://www.USD.de.vu', + 'http://www.Ultra-Star.dl.am ("The Board" by Blind Guard)', + 'Please write Bug Reports and Feature Requests', + 'to help making this a better Game'); + + +implementation + +uses Windows, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl, ULanguage, UParty; + + +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 : + begin + Result := False; + end; + + SDLK_C: + begin + if (SDL_ModState = KMOD_LALT) then + begin + Credits_Y := 600; + Credits_Alpha := 0; + Credits_Visible := True; + end; + end; + SDLK_M: + begin + if (SDL_ModState = KMOD_LALT) then + begin + //Create Teams: + PartySession.Teams.NumTeams := 3; + //Team 1 + PartySession.Teams.Teaminfo[0].Name := 'Team 1'; + PartySession.Teams.Teaminfo[0].Score:= 0; + PartySession.Teams.Teaminfo[0].Joker := 3; + PartySession.Teams.Teaminfo[0].CurPlayer := 0; + PartySession.Teams.Teaminfo[0].NumPlayers := 2; + PartySession.Teams.Teaminfo[0].Playerinfo[0].Name := 'Player 1'; + PartySession.Teams.Teaminfo[0].Playerinfo[0].TimesPlayed := 0; + PartySession.Teams.Teaminfo[0].Playerinfo[1].Name := 'Player 2'; + PartySession.Teams.Teaminfo[0].Playerinfo[1].TimesPlayed := 0; + + //Team 2 + PartySession.Teams.Teaminfo[1].Name := 'Team 2'; + PartySession.Teams.Teaminfo[1].Score:= 0; + PartySession.Teams.Teaminfo[1].Joker := 3; + PartySession.Teams.Teaminfo[1].CurPlayer := 0; + PartySession.Teams.Teaminfo[1].NumPlayers := 2; + PartySession.Teams.Teaminfo[1].Playerinfo[0].Name := 'Player 3'; + PartySession.Teams.Teaminfo[1].Playerinfo[0].TimesPlayed := 0; + PartySession.Teams.Teaminfo[1].Playerinfo[1].Name := 'Player 4'; + PartySession.Teams.Teaminfo[1].Playerinfo[1].TimesPlayed := 0; + + //Team 3 + PartySession.Teams.Teaminfo[2].Name := 'Team 3'; + PartySession.Teams.Teaminfo[2].Score:= 0; + PartySession.Teams.Teaminfo[2].Joker := 3; + PartySession.Teams.Teaminfo[2].CurPlayer := 0; + PartySession.Teams.Teaminfo[2].NumPlayers := 2; + PartySession.Teams.Teaminfo[2].Playerinfo[0].Name := 'Player 5'; + PartySession.Teams.Teaminfo[2].Playerinfo[0].TimesPlayed := 0; + PartySession.Teams.Teaminfo[2].Playerinfo[1].Name := 'Player 6'; + PartySession.Teams.Teaminfo[2].Playerinfo[1].TimesPlayed := 0; + + //Rounds: + SetLength (PartySession.Rounds, 3); + PartySession.Rounds[0].Plugin := 1; + PartySession.Rounds[0].Winner := 0; + PartySession.Rounds[1].Plugin := 0; + PartySession.Rounds[1].Winner := 0; + PartySession.Rounds[2].Plugin := 0; + PartySession.Rounds[2].Winner := 0; + + //Start Party + PartySession.StartNewParty; + //Change Screen + Music.PlayStart; + FadeTo(@ScreenPartyNewRound); + + end + else + begin + Music.PlayStart; + FadeTo(@ScreenPartyOptions); + end; + + end; + + SDLK_RETURN: + begin + if (Interaction = 0) and (Length(Songs.Song) >= 1) then begin + Music.PlayStart; + if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1; + if (Ini.Players = 4) then PlayersPlay := 6; + FadeTo(@ScreenName); + end; + if Interaction = 1 then begin + Music.PlayStart; + FadeTo(@ScreenEdit); + end; + if Interaction = 2 then begin + Music.PlayStart; + FadeTo(@ScreenOptions); +// SDL_SetVideoMode(800, 600, 32, SDL_OPENGL);// or SDL_FULLSCREEN); +// LoadTextures; + end; + if Interaction = 3 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: InteractNext; + SDLK_UP: InteractPrev; + 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; + +// AddButton(400-200, 320, 400, 60, Skin.GameStart); +// AddButton(400-200, 390, 400, 60, Skin.Editor); +// AddButton(400-200, 460, 400, 60, Skin.Options); +// AddButton(400-200, 530, 400, 60, Skin.Exit); + + AddBackground(Theme.Main.Background.Tex); + + AddButton(Theme.Main.ButtonSolo); + AddButton(Theme.Main.ButtonEditor); + AddButton(Theme.Main.ButtonOptions); + AddButton(Theme.Main.ButtonExit); + + for I := 0 to High(Theme.Main.Static) do + AddStatic(Theme.Main.Static[I]); + + for I := 0 to High(Theme.Main.Text) do + AddText(Theme.Main.Text[I]); + + TextDescription := AddText(Theme.Main.TextDescription); + TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong); + + 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.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; + +function TScreenMain.Draw: boolean; +begin +Result := True; +if Credits_Visible then + DrawCredits +else + Result := inherited Draw; +end; + +procedure TScreenMain.DrawCredits; +var + T, I: Cardinal; + Y: Real; + Ver: PChar; +begin + T := GetTickCount div 33; + if T <> Credits_Time then + begin + Credits_Time := T; + //Change Position + Credits_Y := Credits_Y - 1; + //Change Alpha + Inc (Credits_Alpha, 3); + end; + + //Draw BackGround + DrawBG; + + + //Draw pulsing Credits Text + //Set Font + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (460, 570); + glColor4f(1, 0, 0, 0.2 + Abs((Credits_Alpha mod 150)/100 - 0.75)); + glPrint ('Credits! Press any Key to Continue'); + + //Set Font Size for Credits + SetFontSize(12); + //Draw Version + if (Credits_Y>-35) then + begin + Ver := PChar(Language.Translate('US_VERSION')); + glColor4f(1, 0.6, 0.08, 0.8); + SetFontPos (400 - glTextWidth(Ver)/2, Credits_Y); + glprint(Ver); + end; + + //Set Color + Start Pos + glColor4f(0.8, 0.8, 1, 0.8); + Y := Credits_Y + 50; + + //Search upper Position + For I := 0 to high(Credits_Text) do + begin + if (Credits_Text[I]=':SPACE:') then //Spacer + Y := Y + 55 + else + Y := Y + 30; + + if Y > -35 then + break; + end; + + //Draw Text + For T := I+1 to high(Credits_Text) do + begin + if (Credits_Text[T]=':SPACE:') then //Spacer + Y := Y + 55 + else + begin + SetFontPos (400 - glTextWidth(Credits_Text[T])/2, Y); + glprint(Credits_Text[T]); + Y := Y + 30; + end; + + if Y > 600 then + break; + end; + + //If lower Position is outside the Screen-> Show MainMenu + if (Y <= 0) then + Credits_Visible := False; +end; + +end. diff --git a/Game/Code/Screens/UScreenName.dcu b/Game/Code/Screens/UScreenName.dcu new file mode 100644 index 00000000..d14b4296 Binary files /dev/null and b/Game/Code/Screens/UScreenName.dcu differ diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas new file mode 100644 index 00000000..99f5d40a --- /dev/null +++ b/Game/Code/Screens/UScreenName.pas @@ -0,0 +1,114 @@ +unit UScreenName; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + +type + TScreenName = class(TMenu) + public + 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; + +function TScreenName.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var + I: integer; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + 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 + Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + chr(ScanCode); + end; + + SDLK_BACKSPACE: + begin + Delete(Button[Interaction].Text[0].Text, + Length(Button[Interaction].Text[0].Text), 1); + end; + + SDLK_ESCAPE : + begin + Ini.SaveNames; + Music.PlayBack; + FadeTo(@ScreenMain); + end; + + SDLK_RETURN: + begin + for I := 1 to 6 do + Ini.Name[I-1] := Button[I-1].Text[0].Text; + Ini.SaveNames; + Music.PlayStart; + FadeTo(@ScreenLevel); + 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: InteractNext; + SDLK_LEFT: InteractPrev; + end; + end; +end; + +constructor TScreenName.Create; +var + I: integer; +begin + inherited Create; + + AddBackground(Theme.Name.Background.Tex); + + for I := 1 to 6 do + AddButton(Theme.Name.ButtonPlayer[I]); + + for I := 0 to High(Theme.Name.Static) do + AddStatic(Theme.Name.Static[I]); + + for I := 0 to High(Theme.Name.Text) do + AddText(Theme.Name.Text[I]); + + Interaction := 0; +end; + +procedure TScreenName.onShow; +var + I: integer; +begin + for I := 1 to 6 do + Button[I-1].Text[0].Text := Ini.Name[I-1]; + + for I := 1 to PlayersPlay do begin + Button[I-1].Visible := true; + Button[I-1].Selectable := true; + end; + + for I := PlayersPlay+1 to 6 do begin + Button[I-1].Visible := false; + Button[I-1].Selectable := false; + end; + +end; + +procedure TScreenName.SetAnimationProgress(Progress: real); +var + I: integer; +begin + for I := 1 to 6 do + Button[I-1].Texture.ScaleW := Progress; +end; + +end. diff --git a/Game/Code/Screens/UScreenOpen.dcu b/Game/Code/Screens/UScreenOpen.dcu new file mode 100644 index 00000000..c59986f9 Binary files /dev/null and b/Game/Code/Screens/UScreenOpen.dcu differ diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas new file mode 100644 index 00000000..723f299f --- /dev/null +++ b/Game/Code/Screens/UScreenOpen.pas @@ -0,0 +1,151 @@ +unit UScreenOpen; + +interface + +uses UMenu, UMusic, SDL, SysUtils, UPliki, UTime, USongs, UIni, ULog, USmpeg, UTexture, UMenuText, + ULyrics, Math, OpenGL12, UThemes; + +type + TScreenOpen = class(TMenu) + private + TextF: array[0..1] of integer; + TextN: integer; + public + Tex_Background: TTexture; + FadeOut: boolean; + Path: string; + BackScreen: pointer; + procedure AddBox(X, Y, W, H: real); + constructor Create(Back: String); override; + procedure onShow; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; +// function Draw: boolean; override; +// procedure Finish; + end; + +implementation +uses UGraphic, UDraw, UMain, USkins; + +function TScreenOpen.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + if (PressedDown) then begin // Key Down + case ScanCode of + ord('a')..ord('z'), ord('A')..ord('Z'), ord('0')..ord('9'), 32, ord('-'), ord('.'), ord(':'), ord('\'): + begin + if Interaction = 0 then begin + Text[TextN].Text := Text[TextN].Text + chr(ScanCode); + FileName := Text[TextN].Text; + end; + end; + end; + + case PressedKey of + 8: // del + begin + if Interaction = 0 then + if Length(Text[TextN].Text) >= 1 then begin + Delete(Text[TextN].Text, Length(Text[TextN].Text), 1); + FileName := Text[TextN].Text; + end; + end; + + SDLK_ESCAPE: + begin + result := false; + end; + + SDLK_RETURN: + begin + if Interaction = 2 then begin + Music.PlayBack; + FadeTo(BackScreen); + end; + end; + + SDLK_LEFT: + begin + InteractPrev; + end; + + SDLK_RIGHT: + begin + InteractNext; + end; + + SDLK_DOWN: + begin + end; + + SDLK_UP: + begin + end; + end; + end; +end; + +procedure TScreenOpen.AddBox(X, Y, W, H: real); +begin + AddStatic(X, Y, W, H, 0, 0, 0, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); + AddStatic(X+2, Y+2, W-4, H-4, 1, 1, 1, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); +end; + +constructor TScreenOpen.Create(Back: String); +begin + inherited Create(Back); + + // linijka +{ AddStatic(20, 10, 80, 30, 0, 0, 0, 'Bar', 'JPG', 'Font Black'); + AddText(35, 17, 1, 6, 1, 1, 1, 'Linijka'); + TextSentence := AddText(120, 14, 1, 8, 0, 0, 0, '0 / 0');} + + // file list +// AddBox(400, 100, 350, 450); + +// TextF[0] := AddText(430, 155, 0, 8, 0, 0, 0, 'a'); +// TextF[1] := AddText(430, 180, 0, 8, 0, 0, 0, 'a'); + + // file name + AddBox(20, 540, 500, 40); + TextN := AddText(50, 548, 0, 8, 0, 0, 0, FileName); + AddInteraction(iText, TextN); + + // buttons + {AddButton(540, 540, 100, 40, Skin.SkinPath + Skin.ButtonF); + AddButtonText(10, 5, 0, 0, 0, 'Cancel'); + + AddButton(670, 540, 100, 40, Skin.SkinPath + Skin.ButtonF); + AddButtonText(30, 5, 0, 0, 0, 'OK');} + // buttons + AddButton(540, 540, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(10, 5, 0, 0, 0, 'Cancel'); + + AddButton(670, 540, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(30, 5, 0, 0, 0, 'OK'); + + +end; + +procedure TScreenOpen.onShow; +begin + Interaction := 0; +end; + +(*function TScreenEditSub.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + Pet: integer; + AktBeat: integer; +begin + +end; + +procedure TScreenEditSub.Finish; +begin +// +end;*) + +end. + diff --git a/Game/Code/Screens/UScreenOptions.dcu b/Game/Code/Screens/UScreenOptions.dcu new file mode 100644 index 00000000..e5d17c3b Binary files /dev/null and b/Game/Code/Screens/UScreenOptions.dcu differ diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas new file mode 100644 index 00000000..76ff2adc --- /dev/null +++ b/Game/Code/Screens/UScreenOptions.pas @@ -0,0 +1,221 @@ +unit UScreenOptions; + +interface + +uses + UMenu, SDL, SysUtils, UDisplay, UMusic, UPliki, UIni, UThemes; + +type + TScreenOptions = class(TMenu) + public + TextDescription: integer; + constructor Create(Back: String); override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure InteractNext; override; + procedure InteractPrev; override; + procedure SetAnimationProgress(Progress: real); override; + end; + +implementation + +uses UGraphic; + +function TScreenOptions.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: + begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenMain); + end; + SDLK_RETURN: + begin + if SelInteraction = 0 then begin + Music.PlayStart; + FadeTo(@ScreenOptionsGame); + end; + + if SelInteraction = 1 then begin + Music.PlayStart; + FadeTo(@ScreenOptionsGraphics); + end; + + if SelInteraction = 2 then begin + Music.PlayStart; + FadeTo(@ScreenOptionsSound); + end; + + if SelInteraction = 3 then begin + Music.PlayStart; + FadeTo(@ScreenOptionsLyrics); + end; + + if SelInteraction = 4 then begin + Music.PlayStart; + FadeTo(@ScreenOptionsThemes); + end; + + if SelInteraction = 5 then begin + Music.PlayStart; + FadeTo(@ScreenOptionsRecord); + end; + + if SelInteraction = 6 then begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenMain); + end; + end; + SDLK_LEFT: + begin + {case SelInteraction of + 0: InteractCustom(+2); + 1: InteractCustom(-1); + 2: InteractCustom(-1); + 3: InteractCustom(+2); + 4: InteractCustom(-1); + 5: InteractCustom(-1); + end;} + InteractPrev; + end; + SDLK_RIGHT: + begin + {case SelInteraction of + 0: InteractCustom(+1); + 1: InteractCustom(+1); + 2: InteractCustom(-2); + 3: InteractCustom(+1); + 4: InteractCustom(+1); + 5: InteractCustom(-2); + end;} + InteractNext; + end; + SDLK_UP: + begin + InteractPrev; + {case SelInteraction of + 0: InteractCustom(+3); + 1: InteractCustom(+3); + 2: InteractCustom(+3); + 3: InteractCustom(-3); + 4: InteractCustom(-3); + 5: InteractCustom(-3); + end; } + end; + SDLK_DOWN: + begin + {case SelInteraction of + 0: InteractCustom(+3); + 1: InteractCustom(+3); + 2: InteractCustom(+3); + 3: InteractCustom(-3); + 4: InteractCustom(-3); + 5: InteractCustom(-3); + end; } + InteractNext; + end; + end; + end; +end; + +constructor TScreenOptions.Create(Back: String); +var + I: integer; +begin + inherited Create(Back); + + // Game +{ AddButton(225, 100 + 0*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); + AddButtonText(11, 10, 'Game');} + + // Graphics +{ AddButton(225, 100 + 1*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); + AddButtonText(11, 10, 'Graphics'); + + // Sound + AddButton(225, 100 + 2*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); + AddButtonText(11, 10, 'Sound'); + + // Lyrics + AddButton(225, 100 + 3*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); + AddButtonText(11, 10, 'Lyrics'); + + // Themes + AddButton(225, 100 + 4*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); + AddButtonText(11, 10, 'Themes'); + + // Exit + AddButton(225, 100 + 6*60, 350, 50, Skin.Exit);} + + AddBackground(Theme.Options.Background.Tex); + + AddButton(Theme.Options.ButtonGame); + AddButtonText(14, 20, Theme.Options.Description[0]); + + AddButton(Theme.Options.ButtonGraphics); + AddButtonText(14, 20, Theme.Options.Description[1]); + + AddButton(Theme.Options.ButtonSound); + AddButtonText(14, 20, Theme.Options.Description[2]); + + AddButton(Theme.Options.ButtonLyrics); + AddButtonText(14, 20, Theme.Options.Description[3]); + + AddButton(Theme.Options.ButtonThemes); + AddButtonText(14, 20, Theme.Options.Description[4]); + + AddButton(Theme.Options.ButtonRecord); + AddButtonText(14, 20, Theme.Options.Description[5]); + + AddButton(Theme.Options.ButtonExit); + AddButtonText(14, 20, Theme.Options.Description[6]); + + for I := 0 to High(Theme.Options.Static) do + AddStatic(Theme.Options.Static[I]); + + for I := 0 to High(Theme.Options.Text) do + AddText(Theme.Options.Text[I]); + + TextDescription := AddText(Theme.Options.TextDescription); + + Interaction := 0; +end; + +procedure TScreenOptions.onShow; +begin +// +end; + +procedure TScreenOptions.InteractNext; +begin + inherited InteractNext; + Text[TextDescription].Text := Theme.Options.Description[Interaction]; +end; + +procedure TScreenOptions.InteractPrev; +begin + inherited InteractPrev; + Text[TextDescription].Text := Theme.Options.Description[Interaction]; +end; + + +procedure TScreenOptions.SetAnimationProgress(Progress: real); +begin + Button[0].Texture.ScaleW := Progress; + Button[1].Texture.ScaleW := Progress; + Button[2].Texture.ScaleW := Progress; + Button[3].Texture.ScaleW := Progress; + Button[4].Texture.ScaleW := Progress; + Button[5].Texture.ScaleW := Progress; +end; + +end. diff --git a/Game/Code/Screens/UScreenOptionsGame.dcu b/Game/Code/Screens/UScreenOptionsGame.dcu new file mode 100644 index 00000000..3fd70913 Binary files /dev/null and b/Game/Code/Screens/UScreenOptionsGame.dcu differ diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas new file mode 100644 index 00000000..6f49bd19 --- /dev/null +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -0,0 +1,107 @@ +unit UScreenOptionsGame; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes, USongs; + +type + TScreenOptionsGame = class(TMenu) + public + old_Tabs, old_Sorting: integer; + constructor Create(Back: String); override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure RefreshSongs; + end; + +implementation + +uses UGraphic; + +function TScreenOptionsGame.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_ESCAPE : + begin + Music.PlayBack; + RefreshSongs; + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 6 then begin + Music.PlayBack; + RefreshSongs; + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + Music.PlayOption; + InteractInc; + end; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + Music.PlayOption; + InteractDec; + end; + end; + end; + end; +end; + +constructor TScreenOptionsGame.Create(Back: String); +var + I: integer; +begin + inherited Create(Back); + + AddBackground(Theme.OptionsGame.Background.Tex); + + for I := 0 to High(Theme.OptionsGame.Static) do + AddStatic(Theme.OptionsGame.Static[I]); + + for I := 0 to High(Theme.OptionsGame.Text) do + AddText(Theme.OptionsGame.Text[I]); + + //Refresh Songs Patch + old_Sorting := Ini.Sorting; + old_Tabs := Ini.Tabs; + + AddSelect(Theme.OptionsGame.SelectPlayers, Ini.Players, IPlayers); + AddSelect(Theme.OptionsGame.SelectDifficulty, Ini.Difficulty, IDifficulty); + AddSelectSlide(Theme.OptionsGame.SelectLanguage, Ini.Language, ILanguage); + AddSelect(Theme.OptionsGame.SelectTabs, Ini.Tabs, ITabs); + AddSelectSlide(Theme.OptionsGame.SelectSorting, Ini.Sorting, ISorting); + AddSelect(Theme.OptionsGame.SelectDebug, Ini.Debug, IDebug); + + + AddButton(Theme.OptionsGame.ButtonExit); + AddButtonText(14, 20, 'Exit'); + +end; + +//Refresh Songs Patch +procedure TScreenOptionsGame.RefreshSongs; +begin +if (ini.Sorting <> old_Sorting) or (ini.Tabs <> old_Tabs) then + ScreenSong.Refresh; +end; + +procedure TScreenOptionsGame.onShow; +begin +// Interaction := 0; +end; + +end. diff --git a/Game/Code/Screens/UScreenOptionsGraphics.dcu b/Game/Code/Screens/UScreenOptionsGraphics.dcu new file mode 100644 index 00000000..3eddc010 Binary files /dev/null and b/Game/Code/Screens/UScreenOptionsGraphics.dcu differ diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas new file mode 100644 index 00000000..1f30f9b5 --- /dev/null +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -0,0 +1,101 @@ +unit UScreenOptionsGraphics; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + +type + TScreenOptionsGraphics = class(TMenu) + public + constructor Create(Back: String); override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + end; + +implementation + +uses UGraphic, UMain; + +function TScreenOptionsGraphics.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: + begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin +{ if SelInteraction <= 1 then begin + Restart := true; + end;} + if SelInteraction = 6 then begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + Music.PlayOption; + InteractInc; + end; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + Music.PlayOption; + InteractDec; + end; + end; + end; + end; +end; + +constructor TScreenOptionsGraphics.Create(Back: String); +var + I: integer; +begin + inherited Create(Back); + + AddBackground(Theme.OptionsGraphics.Background.Tex); + + for I := 0 to High(Theme.OptionsGraphics.Static) do + AddStatic(Theme.OptionsGraphics.Static[I]); + + for I := 0 to High(Theme.OptionsGraphics.Text) do + AddText(Theme.OptionsGraphics.Text[I]); + + AddSelectSlide(Theme.OptionsGraphics.SelectSlideResolution, Ini.Resolution, IResolution); + AddSelect(Theme.OptionsGraphics.SelectFullscreen, Ini.Fullscreen, IFullscreen); + AddSelect(Theme.OptionsGraphics.SelectDepth, Ini.Depth, IDepth); + AddSelect(Theme.OptionsGraphics.SelectOscilloscope, Ini.Oscilloscope, IOscilloscope); + AddSelect(Theme.OptionsGraphics.SelectLineBonus, Ini.LineBonus, ILineBonus); + AddSelect(Theme.OptionsGraphics.SelectMovieSize, Ini.MovieSize, IMovieSize); + + + AddButton(Theme.OptionsGraphics.ButtonExit); + AddButtonText(14, 20, 'Exit'); + +end; + +procedure TScreenOptionsGraphics.onShow; +begin + Interaction := 0; +end; + +end. diff --git a/Game/Code/Screens/UScreenOptionsLyrics.dcu b/Game/Code/Screens/UScreenOptionsLyrics.dcu new file mode 100644 index 00000000..1fcfca9d Binary files /dev/null and b/Game/Code/Screens/UScreenOptionsLyrics.dcu differ diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas new file mode 100644 index 00000000..21a33998 --- /dev/null +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -0,0 +1,91 @@ +unit UScreenOptionsLyrics; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + +type + TScreenOptionsLyrics = class(TMenu) + public + constructor Create(Back: String); override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + end; + +implementation + +uses UGraphic; + +function TScreenOptionsLyrics.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_ESCAPE : + begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 3 then begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 2) then begin + Music.PlayOption; + InteractInc; + end; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 2) then begin + Music.PlayOption; + InteractDec; + end; + end; + end; + end; +end; + +constructor TScreenOptionsLyrics.Create(Back: String); +var + I: integer; +begin + inherited Create(Back); + + AddBackground(Theme.OptionsLyrics.Background.Tex); + + for I := 0 to High(Theme.OptionsLyrics.Static) do + AddStatic(Theme.OptionsLyrics.Static[I]); + + for I := 0 to High(Theme.OptionsLyrics.Text) do + AddText(Theme.OptionsLyrics.Text[I]); + + AddSelect(Theme.OptionsLyrics.SelectLyricsFont, Ini.LyricsFont, ILyricsFont); + AddSelect(Theme.OptionsLyrics.SelectLyricsEffect, Ini.LyricsEffect, ILyricsEffect); + AddSelect(Theme.OptionsLyrics.SelectSolmization, Ini.Solmization, ISolmization); + + + AddButton(Theme.OptionsLyrics.ButtonExit); + AddButtonText(14, 20, 'Exit'); + +end; + +procedure TScreenOptionsLyrics.onShow; +begin + Interaction := 0; +end; + +end. diff --git a/Game/Code/Screens/UScreenOptionsRecord.dcu b/Game/Code/Screens/UScreenOptionsRecord.dcu new file mode 100644 index 00000000..36a04d50 Binary files /dev/null and b/Game/Code/Screens/UScreenOptionsRecord.dcu differ diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas new file mode 100644 index 00000000..c27ec02a --- /dev/null +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -0,0 +1,136 @@ +unit UScreenOptionsRecord; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + +type + TScreenOptionsRecord = class(TMenu) + private + SelectSlideInput: integer; + SelectSlideChannelL: integer; + SelectSlideChannelR: integer; + public + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure UpdateCard; + end; + +implementation + +uses SysUtils, UGraphic, URecord, ULog; + +function TScreenOptionsRecord.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_ESCAPE, SDLK_BACKSPACE: + begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 4 then begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + Music.PlayOption; + InteractInc; + end; + if SelInteraction = 0 then UpdateCard; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + Music.PlayOption; + InteractDec; + end; + if SelInteraction = 0 then UpdateCard; + end; + end; + end; +end; + +constructor TScreenOptionsRecord.Create; +var + I: integer; + SC: integer; + SCI: integer; +begin + AddBackground(Theme.OptionsRecord.Background.Tex); + for I := 0 to High(Theme.OptionsRecord.Static) do + AddStatic(Theme.OptionsRecord.Static[I]); + + for I := 0 to High(Theme.OptionsRecord.Text) do + AddText(Theme.OptionsRecord.Text[I]); + +// SetLength(ICard, 0); +// ICard[0] := 'karta'; + +// SetLength(IInput, 0); +// IInput[0] := 'wejscie'; + +// if Length(Recording.SoundCard) > 0 then begin + SetLength(ICard, Length(Recording.SoundCard)); + for SC := 0 to High(Recording.SoundCard) do + ICard[SC] := Recording.SoundCard[SC].Description; +// end; + +// if Length(Recording.SoundCard[Ini.Card].Input) > 0 then begin + SetLength(IInput, Length(Recording.SoundCard[Ini.Card].Input)); + for SCI := 0 to High(Recording.SoundCard[Ini.Card].Input) do + IInput[SCI] := Recording.SoundCard[Ini.Card].Input[SCI].Name; +// end; + + + AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, Ini.Card, ICard); + SelectSlideInput := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, Ini.CardList[0].Input, IInput); + SelectSlideChannelL := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelL, Ini.CardList[0].ChannelL, IChannel); + SelectSlideChannelR := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelR, Ini.CardList[0].ChannelR, IChannel); + + AddButton(Theme.OptionsRecord.ButtonExit); + AddButtonText(14, 20, 'Exit'); + + Interaction := 0; +end; + +procedure TScreenOptionsRecord.onShow; +begin + Interaction := 0; +end; + +procedure TScreenOptionsRecord.UpdateCard; +var + SC: integer; + SCI: integer; +begin + SC := Ini.Card; +// if SC = 1 then beep; + + SetLength(IInput, Length(Recording.SoundCard[SC].Input)); + for SCI := 0 to High(Recording.SoundCard[SC].Input) do begin + IInput[SCI] := Recording.SoundCard[SC].Input[SCI].Name; +// Log.LogError(IInput[SCI]); + end; + + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideInput, SelectSlideInput, IInput, Ini.CardList[SC].Input); + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelL, SelectSlideChannelL, IChannel, Ini.CardList[SC].ChannelL); + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelR, SelectSlideChannelR, IChannel, Ini.CardList[SC].ChannelR); +end; + +end. \ No newline at end of file diff --git a/Game/Code/Screens/UScreenOptionsSound.dcu b/Game/Code/Screens/UScreenOptionsSound.dcu new file mode 100644 index 00000000..26c07fe1 Binary files /dev/null and b/Game/Code/Screens/UScreenOptionsSound.dcu differ diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas new file mode 100644 index 00000000..a99ae86d --- /dev/null +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -0,0 +1,93 @@ +unit UScreenOptionsSound; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + +type + TScreenOptionsSound = class(TMenu) + public + constructor Create(Back: String); override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + end; + +implementation + +uses UGraphic; + +function TScreenOptionsSound.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_ESCAPE : + begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 4 then begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + Music.PlayOption; + InteractInc; + end; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + Music.PlayOption; + InteractDec; + end; + end; + end; + end; +end; + +constructor TScreenOptionsSound.Create(Back: String); +var + I: integer; +begin + inherited Create(Back); + + AddBackground(Theme.OptionsSound.Background.Tex); + + for I := 0 to High(Theme.OptionsSound.Static) do + AddStatic(Theme.OptionsSound.Static[I]); + + for I := 0 to High(Theme.OptionsSound.Text) do + AddText(Theme.OptionsSound.Text[I]); + + AddSelect(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost); + AddSelect(Theme.OptionsSound.SelectClickAssist, Ini.ClickAssist, IClickAssist); + AddSelect(Theme.OptionsSound.SelectBeatClick, Ini.BeatClick, IBeatClick); + AddSelect(Theme.OptionsSound.SelectThreshold, Ini.Threshold, IThreshold); + //AddSelect(Theme.OptionsSound.SelectTwoPlayerMode, Ini.TwoPlayerMode, ITwoPlayerMode); + + AddButton(Theme.OptionsSound.ButtonExit); + AddButtonText(14, 20, 'Exit'); + + Interaction := 0; +end; + +procedure TScreenOptionsSound.onShow; +begin + Interaction := 0; +end; + +end. diff --git a/Game/Code/Screens/UScreenOptionsThemes.dcu b/Game/Code/Screens/UScreenOptionsThemes.dcu new file mode 100644 index 00000000..98bec8a2 Binary files /dev/null and b/Game/Code/Screens/UScreenOptionsThemes.dcu differ diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas new file mode 100644 index 00000000..b7d18fa5 --- /dev/null +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -0,0 +1,118 @@ +unit UScreenOptionsThemes; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + +type + TScreenOptionsThemes = class(TMenu) + public + SkinSelect: Integer; + constructor Create(Back: String); override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure InteractInc; override; + procedure InteractDec; override; + end; + +implementation + +uses UGraphic, USkins; + +function TScreenOptionsThemes.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_ESCAPE : + begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 3 then begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 2) then begin + Music.PlayOption; + InteractInc; + end; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 2) then begin + Music.PlayOption; + InteractDec; + end; + end; + end; + end; +end; + +procedure TScreenOptionsThemes.InteractInc; +begin + inherited InteractInc; + //Update Skins + if (SelInteraction = 0) then + begin + Skin.OnThemeChange; + UpdateSelectSlideOptions (Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); + end; +end; + +procedure TScreenOptionsThemes.InteractDec; +begin + inherited InteractDec; + //Update Skins + if (SelInteraction = 0) then + begin + Skin.OnThemeChange; + UpdateSelectSlideOptions (Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); + end; +end; + +constructor TScreenOptionsThemes.Create(Back: String); +var + I: integer; +begin + inherited Create(Back); + + AddBackground(Theme.OptionsThemes.Background.Tex); + + for I := 0 to High(Theme.OptionsThemes.Static) do + AddStatic(Theme.OptionsThemes.Static[I]); + + for I := 0 to High(Theme.OptionsThemes.Text) do + AddText(Theme.OptionsThemes.Text[I]); + + AddSelectSlide(Theme.OptionsThemes.SelectTheme, Ini.Theme, ITheme); + //SelectsS[High(SelectsS)].SetSelectOpt(Ini.Theme); + + SkinSelect := AddSelectSlide(Theme.OptionsThemes.SelectSkin, Ini.SkinNo, ISkin); + + //AddSelectSlideOption('SingStar'); + AddSelectSlide(Theme.OptionsThemes.SelectColor, Ini.Color, IColor); + + AddButton(Theme.OptionsThemes.ButtonExit); + AddButtonText(14, 20, 'Exit'); +end; + +procedure TScreenOptionsThemes.onShow; +begin + Interaction := 0; +end; + +end. diff --git a/Game/Code/Screens/UScreenPartyNewRound.dcu b/Game/Code/Screens/UScreenPartyNewRound.dcu new file mode 100644 index 00000000..24b6953e Binary files /dev/null and b/Game/Code/Screens/UScreenPartyNewRound.dcu differ diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas new file mode 100644 index 00000000..1e9be1f5 --- /dev/null +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -0,0 +1,397 @@ +unit UScreenPartyNewRound; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, 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; + + StaticTeam1: Cardinal; + StaticTeam2: Cardinal; + StaticTeam3: 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 : + begin + Music.PlayBack; + FadeTo(@ScreenMain); + end; + + SDLK_RETURN: + begin + Music.PlayStart; + if DLLMan.Selected.LoadSong then + begin + //Select PartyMode ScreenSong + ScreenSong.Mode := 1; + FadeTo(@ScreenSong); + end + else + begin + FadeTo(@ScreenSingModi); + 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: InteractNext; + SDLK_UP: InteractPrev; + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN : + begin + end; + end; +end; + +constructor TScreenPartyNewRound.Create; +var + I: integer; +begin + inherited Create; + + AddBackground(Theme.PartyNewRound.Background.Tex); + Log.LogError(Theme.PartyNewRound.Background.Tex); + + 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); + + StaticTeam1 := AddStatic (Theme.PartyNewRound.StaticTeam1); + StaticTeam2 := AddStatic (Theme.PartyNewRound.StaticTeam2); + StaticTeam3 := AddStatic (Theme.PartyNewRound.StaticTeam3); + + AddButton (Theme.PartyNewRound.ButtonNext); + + for I := 0 to High(Theme.PartyNewRound.Static) do + AddStatic(Theme.PartyNewRound.Static[I]); + + for I := 0 to High(Theme.PartyNewRound.Text) do + AddText(Theme.PartyNewRound.Text[I]); + + Interaction := 0; +end; + +procedure TScreenPartyNewRound.onShow; +var + I: Integer; +begin + //If not First Round, End Last Round + if (PartySession.CurRound <> 255) then + PartySession.EndRound; + + PartySession.StartRound; + Log.LogError(InttoStr(Length(DllMan.Plugins))); + + //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[TextScoreTeam1].Visible := True; + Text[TextNameTeam1].Visible := True; + Static[StaticTeam1].Visible := True; + end + else + begin + Text[TextScoreTeam1].Visible := False; + Text[TextNameTeam1].Visible := False; + Static[StaticTeam1].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[TextScoreTeam2].Visible := True; + Text[TextNameTeam2].Visible := True; + Static[StaticTeam2].Visible := True; + end + else + begin + Text[TextScoreTeam2].Visible := False; + Text[TextNameTeam2].Visible := False; + Static[StaticTeam2].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[TextScoreTeam3].Visible := True; + Text[TextNameTeam3].Visible := True; + Static[StaticTeam3].Visible := True; + end + else + begin + Text[TextScoreTeam3].Visible := False; + Text[TextNameTeam3].Visible := False; + Static[StaticTeam3].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; + + Log.LogError('Plugin Selected: ' + InttoStr(PartySession.Rounds[0].Plugin)); + + +// 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.dcu b/Game/Code/Screens/UScreenPartyOptions.dcu new file mode 100644 index 00000000..8f0bbf3d Binary files /dev/null and b/Game/Code/Screens/UScreenPartyOptions.dcu differ diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas new file mode 100644 index 00000000..148289e8 --- /dev/null +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -0,0 +1,164 @@ +unit UScreenPartyOptions; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, 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; + end; + +var + ILevel: array[0..2] 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; + +function TScreenPartyOptions.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var I: Integer; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE : + begin + Music.PlayBack; + FadeTo(@ScreenMain); + end; + + SDLK_RETURN: + begin + + //Save Difficulty + Ini.Difficulty := SelectsS[SelectLevel].SelectedOption; + Ini.SaveLevel; + //Save PlayList + //(Todo) + //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 Rounds + Random + SetLength (PartySession.Rounds, Rounds + 2); + For I := 0 to high (PartySession.Rounds) do + begin + PartySession.Rounds[I].Plugin := Random (Length(DLLMan.Plugins)); + PartySession.Rounds[I].Winner := 0; + end; + Music.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 + Music.PlayOption; + InteractInc; + end; + SDLK_LEFT: + begin + Music.PlayOption; + InteractDec; + end; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN : + begin + end; + end; +end; + +constructor TScreenPartyOptions.Create; +var + I: integer; +begin + inherited Create; + + //Fill ILevel + ILevel[0] := Language.Translate('SING_EASY'); + ILevel[1] := Language.Translate('SING_MEDIUM'); + ILevel[2] := Language.Translate('SING_HARD'); + + NumTeams := 0; + NumPlayer1 := 0; + NumPlayer2 := 0; + NumPlayer3 := 0; + Rounds := 5; + PlayList := 0; + PlayList2 := 0; + + AddBackground(Theme.PartyOptions.Background.Tex); + + SelectLevel := AddSelectSlide (Theme.PartyOptions.SelectLevel, Ini.Difficulty, ILevel); + SelectPlayList := AddSelectSlide (Theme.PartyOptions.SelectPlayList, PlayList, ITeams); + SelectPlayList2 := AddSelectSlide (Theme.PartyOptions.SelectPlayList2, PlayList2, ITeams); + 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); + + for I := 0 to High(Theme.PartyOptions.Static) do + AddStatic(Theme.PartyOptions.Static[I]); + + for I := 0 to High(Theme.PartyOptions.Text) do + AddText(Theme.PartyOptions.Text[I]); + + Interaction := 0; +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/UScreenPartyPlayer.dcu b/Game/Code/Screens/UScreenPartyPlayer.dcu new file mode 100644 index 00000000..1afeac79 Binary files /dev/null and b/Game/Code/Screens/UScreenPartyPlayer.dcu differ diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas new file mode 100644 index 00000000..b954212a --- /dev/null +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -0,0 +1,210 @@ +unit UScreenPartyPlayer; + +Interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + +type + TScreenPartyPlayer = class(TMenu) + public + Team1Name: Cardinal; + Player1Name: Cardinal; + Player2Name: Cardinal; + Player3Name: Cardinal; + Player4Name: Cardinal; + + Team2Name: Cardinal; + Player5Name: Cardinal; + Player6Name: Cardinal; + Player7Name: Cardinal; + Player8Name: Cardinal; + + Team3Name: Cardinal; + Player9Name: Cardinal; + Player10Name: Cardinal; + Player11Name: Cardinal; + Player12Name: 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; + +function TScreenPartyPlayer.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var + I, J: integer; + procedure IntNext; + begin + repeat + InteractNext; + until Button[Interaction].Visible; + end; + procedure IntPrev; + begin + repeat + InteractPrev; + until Button[Interaction].Visible; + end; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + 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 + Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + chr(ScanCode); + end; + + SDLK_BACKSPACE: + begin + Delete(Button[Interaction].Text[0].Text, + Length(Button[Interaction].Text[0].Text), 1); + end; + + SDLK_ESCAPE : + begin + Ini.SaveNames; + Music.PlayBack; + FadeTo(@ScreenPartyOptions); + end; + + SDLK_RETURN: + begin + + for I := 0 to PartySession.Teams.NumTeams-1 do + begin + PartySession.Teams.Teaminfo[I].Name := PChar(Button[I*5].Text[0].Text); + for J := 0 to PartySession.Teams.Teaminfo[I].NumPlayers-1 do + begin + PartySession.Teams.Teaminfo[I].Playerinfo[J].Name := PChar(Button[I*5 + J+1].Text[0].Text); + PartySession.Teams.Teaminfo[I].Playerinfo[J].TimesPlayed := 0; + end; + PartySession.Teams.Teaminfo[I].Joker := Round (Length(PartySession.Rounds) * 0.85); + end; + + + //Start Party + PartySession.StartNewParty; + + Music.PlayStart; + FadeTo(@ScreenPartyNewRound); + 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: IntNext; + SDLK_UP: IntPrev; + SDLK_RIGHT: IntNext; + SDLK_LEFT: IntPrev; + end; + end; +end; + +constructor TScreenPartyPlayer.Create; +var + I: integer; +begin + inherited Create; + + AddBackground(Theme.PartyPlayer.Background.Tex); + + Team1Name := AddButton(Theme.PartyPlayer.Team1Name); + AddButton(Theme.PartyPlayer.Player1Name); + AddButton(Theme.PartyPlayer.Player2Name); + AddButton(Theme.PartyPlayer.Player3Name); + AddButton(Theme.PartyPlayer.Player4Name); + + Team2Name := AddButton(Theme.PartyPlayer.Team2Name); + AddButton(Theme.PartyPlayer.Player5Name); + AddButton(Theme.PartyPlayer.Player6Name); + AddButton(Theme.PartyPlayer.Player7Name); + AddButton(Theme.PartyPlayer.Player8Name); + + Team3Name := AddButton(Theme.PartyPlayer.Team3Name); + AddButton(Theme.PartyPlayer.Player9Name); + AddButton(Theme.PartyPlayer.Player10Name); + AddButton(Theme.PartyPlayer.Player11Name); + AddButton(Theme.PartyPlayer.Player12Name); + + for I := 0 to High(Theme.PartyPlayer.Static) do + AddStatic(Theme.PartyPlayer.Static[I]); + + for I := 0 to High(Theme.PartyPlayer.Text) do + AddText(Theme.PartyPlayer.Text[I]); + + Interaction := 0; +end; + +procedure TScreenPartyPlayer.onShow; +var + I: integer; +begin + If (PartySession.Teams.NumTeams>=1) then + begin + Button[0].Visible := True; + Button[1].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=1); + Button[2].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=2); + Button[3].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=3); + Button[4].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=4); + end + else + begin + Button[0].Visible := False; + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := False; + Button[4].Visible := False; + end; + + If (PartySession.Teams.NumTeams>=2) then + begin + Button[5].Visible := True; + Button[6].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=1); + Button[7].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=2); + Button[8].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=3); + Button[9].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=4); + end + else + begin + Button[5].Visible := False; + Button[6].Visible := False; + Button[7].Visible := False; + Button[8].Visible := False; + Button[9].Visible := False; + end; + + If (PartySession.Teams.NumTeams>=3) then + begin + Button[10].Visible := True; + Button[11].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=1); + Button[12].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=2); + Button[13].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=3); + Button[14].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=4); + end + else + begin + Button[10].Visible := False; + Button[11].Visible := False; + Button[12].Visible := False; + Button[13].Visible := False; + Button[14].Visible := False; + end; + +end; + +procedure TScreenPartyPlayer.SetAnimationProgress(Progress: real); +var + I: integer; +begin + for I := 0 to high(Button) do + Button[I].Texture.ScaleW := Progress; +end; + +end. diff --git a/Game/Code/Screens/UScreenPartyScore.dcu b/Game/Code/Screens/UScreenPartyScore.dcu new file mode 100644 index 00000000..9dffe2e5 Binary files /dev/null and b/Game/Code/Screens/UScreenPartyScore.dcu differ diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas new file mode 100644 index 00000000..9cbeb5d5 --- /dev/null +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -0,0 +1,183 @@ +unit UScreenPartyScore; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, SysUtils, UThemes; + +type + TScreenPartyScore = class(TMenu) + public + TextScoreTeam1: Cardinal; + TextScoreTeam2: Cardinal; + TextScoreTeam3: Cardinal; + TextNameTeam1: Cardinal; + TextNameTeam2: Cardinal; + TextNameTeam3: Cardinal; + StaticTeam1: Cardinal; + StaticTeam2: Cardinal; + StaticTeam3: Cardinal; + TextWinner: Cardinal; + + MaxScore: Word; + + 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, UParty, UScreenSingModi, ULanguage; + +function TScreenPartyScore.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 : + begin + Music.PlayStart; + if (PartySession.CurRound <= High(PartySession.Rounds)) then + FadeTo(@ScreenPartyNewRound) + else + begin + PartySession.EndRound; + FadeTo(@ScreenPartyWin); + end; + end; + + SDLK_RETURN: + begin + Music.PlayStart; + if (PartySession.CurRound <= High(PartySession.Rounds)) then + FadeTo(@ScreenPartyNewRound) + else + begin + PartySession.EndRound; + FadeTo(@ScreenPartyWin); + end; + end; + end; + end; +end; + +constructor TScreenPartyScore.Create; +var + I: integer; +begin + inherited Create; + + AddBackground(Theme.PartyScore.Background.Tex); + + TextScoreTeam1 := AddText (Theme.PartyScore.TextScoreTeam1); + TextScoreTeam2 := AddText (Theme.PartyScore.TextScoreTeam2); + TextScoreTeam3 := AddText (Theme.PartyScore.TextScoreTeam3); + TextNameTeam1 := AddText (Theme.PartyScore.TextNameTeam1); + TextNameTeam2 := AddText (Theme.PartyScore.TextNameTeam2); + TextNameTeam3 := AddText (Theme.PartyScore.TextNameTeam3); + + StaticTeam1 := AddStatic (Theme.PartyScore.StaticTeam1); + StaticTeam2 := AddStatic (Theme.PartyScore.StaticTeam2); + StaticTeam3 := AddStatic (Theme.PartyScore.StaticTeam3); + + TextWinner := AddText (Theme.PartyScore.TextWinner); + + for I := 0 to High(Theme.PartyScore.Static) do + AddStatic(Theme.PartyScore.Static[I]); + + for I := 0 to High(Theme.PartyScore.Text) do + AddText(Theme.PartyScore.Text[I]); +end; + +procedure TScreenPartyScore.onShow; +var + I: Integer; +begin + //Get Maxscore + MaxScore := 0; + for I := 0 to ScreenSingModi.PlayerInfo.NumPlayers - 1 do + begin + if (ScreenSingModi.PlayerInfo.Playerinfo[I].Score > MaxScore) then + MaxScore := ScreenSingModi.PlayerInfo.Playerinfo[I].Score; + end; + + //Set Static Length + Static[StaticTeam1].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[0].Percentage / 100; + Static[StaticTeam2].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100; + Static[StaticTeam3].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[2].Percentage / 100; + + //Set Winnertext + Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.GetWinnerString(PartySession.CurRound)]); + + if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then + begin + Text[TextScoreTeam1].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[0].Score); + Text[TextNameTeam1].Text := String(ScreenSingModi.TeamInfo.Teaminfo[0].Name); + + Text[TextScoreTeam1].Visible := True; + Text[TextNameTeam1].Visible := True; + Static[StaticTeam1].Visible := True; + end + else + begin + Text[TextScoreTeam1].Visible := False; + Text[TextNameTeam1].Visible := False; + Static[StaticTeam1].Visible := False; + end; + + if (ScreenSingModi.PlayerInfo.NumPlayers >= 2) then + begin + Text[TextScoreTeam2].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[1].Score); + Text[TextNameTeam2].Text := String(ScreenSingModi.TeamInfo.Teaminfo[1].Name); + + Text[TextScoreTeam2].Visible := True; + Text[TextNameTeam2].Visible := True; + Static[StaticTeam2].Visible := True; + end + else + begin + Text[TextScoreTeam2].Visible := False; + Text[TextNameTeam2].Visible := False; + Static[StaticTeam2].Visible := False; + end; + + if (ScreenSingModi.PlayerInfo.NumPlayers >= 3) then + begin + Text[TextScoreTeam3].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[2].Score); + Text[TextNameTeam3].Text := String(ScreenSingModi.TeamInfo.Teaminfo[2].Name); + + Text[TextScoreTeam3].Visible := True; + Text[TextNameTeam3].Visible := True; + Static[StaticTeam3].Visible := True; + end + else + begin + Text[TextScoreTeam3].Visible := False; + Text[TextNameTeam3].Visible := False; + Static[StaticTeam3].Visible := False; + end; + + +// LCD.WriteText(1, ' Choose mode: '); +// UpdateLCD; +end; + +procedure TScreenPartyScore.SetAnimationProgress(Progress: real); +begin + if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then + Static[StaticTeam1].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[0].Percentage / 100; + if (ScreenSingModi.PlayerInfo.NumPlayers >= 2) then + Static[StaticTeam2].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100; + if (ScreenSingModi.PlayerInfo.NumPlayers >= 3) then + Static[StaticTeam3].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[2].Percentage / 100; +end; + +end. diff --git a/Game/Code/Screens/UScreenPartyWin.dcu b/Game/Code/Screens/UScreenPartyWin.dcu new file mode 100644 index 00000000..d55c0809 Binary files /dev/null and b/Game/Code/Screens/UScreenPartyWin.dcu differ diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas new file mode 100644 index 00000000..ac5f38d9 --- /dev/null +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -0,0 +1,157 @@ +unit UScreenPartyWin; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, SysUtils, UThemes; + +type + TScreenPartyWin = class(TMenu) + public + TextScoreTeam1: Cardinal; + TextScoreTeam2: Cardinal; + TextScoreTeam3: Cardinal; + TextNameTeam1: Cardinal; + TextNameTeam2: Cardinal; + TextNameTeam3: Cardinal; + StaticTeam1: Cardinal; + StaticTeam2: Cardinal; + StaticTeam3: Cardinal; + TextWinner: 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, UParty, UScreenSingModi, ULanguage; + +function TScreenPartyWin.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 : + begin + Music.PlayStart; + FadeTo(@ScreenMain); + end; + + SDLK_RETURN: + begin + Music.PlayStart; + FadeTo(@ScreenMain); + end; + end; + end; +end; + +constructor TScreenPartyWin.Create; +var + I: integer; +begin + inherited Create; + + AddBackground(Theme.PartyWin.Background.Tex); + + TextScoreTeam1 := AddText (Theme.PartyWin.TextScoreTeam1); + TextScoreTeam2 := AddText (Theme.PartyWin.TextScoreTeam2); + TextScoreTeam3 := AddText (Theme.PartyWin.TextScoreTeam3); + TextNameTeam1 := AddText (Theme.PartyWin.TextNameTeam1); + TextNameTeam2 := AddText (Theme.PartyWin.TextNameTeam2); + TextNameTeam3 := AddText (Theme.PartyWin.TextNameTeam3); + + StaticTeam1 := AddStatic (Theme.PartyWin.StaticTeam1); + StaticTeam2 := AddStatic (Theme.PartyWin.StaticTeam2); + StaticTeam3 := AddStatic (Theme.PartyWin.StaticTeam3); + + TextWinner := AddText (Theme.PartyWin.TextWinner); + + for I := 0 to High(Theme.PartyWin.Static) do + AddStatic(Theme.PartyWin.Static[I]); + + for I := 0 to High(Theme.PartyWin.Text) do + AddText(Theme.PartyWin.Text[I]); +end; + +procedure TScreenPartyWin.onShow; +var + I: Integer; +begin + + //Set Winnertext + Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.GetWinnerString(255)]); + + 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[TextScoreTeam1].Visible := True; + Text[TextNameTeam1].Visible := True; + Static[StaticTeam1].Visible := True; + end + else + begin + Text[TextScoreTeam1].Visible := False; + Text[TextNameTeam1].Visible := False; + Static[StaticTeam1].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[TextScoreTeam2].Visible := True; + Text[TextNameTeam2].Visible := True; + Static[StaticTeam2].Visible := True; + end + else + begin + Text[TextScoreTeam2].Visible := False; + Text[TextNameTeam2].Visible := False; + Static[StaticTeam2].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[TextScoreTeam3].Visible := True; + Text[TextNameTeam3].Visible := True; + Static[StaticTeam3].Visible := True; + end + else + begin + Text[TextScoreTeam3].Visible := False; + Text[TextNameTeam3].Visible := False; + Static[StaticTeam3].Visible := False; + end; + + +// LCD.WriteText(1, ' Choose mode: '); +// UpdateLCD; +end; + +procedure TScreenPartyWin.SetAnimationProgress(Progress: real); +begin + {if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then + Static[StaticTeam1].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[0].Score / maxScore; + if (ScreenSingModi.PlayerInfo.NumPlayers >= 2) then + Static[StaticTeam2].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[1].Score / maxScore; + if (ScreenSingModi.PlayerInfo.NumPlayers >= 3) then + Static[StaticTeam3].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[2].Score / maxScore;} +end; + +end. diff --git a/Game/Code/Screens/UScreenScore.dcu b/Game/Code/Screens/UScreenScore.dcu new file mode 100644 index 00000000..eee72fd0 Binary files /dev/null and b/Game/Code/Screens/UScreenScore.dcu differ diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas new file mode 100644 index 00000000..2e509a6f --- /dev/null +++ b/Game/Code/Screens/UScreenScore.pas @@ -0,0 +1,586 @@ +unit UScreenScore; + +interface + +uses + UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes, ULCD, OpenGL; + +type + TScreenScore = class(TMenu) + public + TextArtist: integer; + TextTitle: integer; + + TextName: array[1..6] of integer; + TextScore: array[1..6] of integer; + + TextNotes: array[1..6] of integer; + TextNotesScore: array[1..6] of integer; + TextLineBonus: array[1..6] of integer; + TextLineBonusScore: array[1..6] of integer; + TextGoldenNotes: array[1..6] of integer; + TextGoldenNotesScore: array[1..6] of integer; + TextTotal: array[1..6] of integer; + TextTotalScore: array[1..6] of integer; + + PlayerStatic: array[1..6] of array of integer; + + StaticBoxLightest: array[1..6] of integer; + StaticBoxLight: array[1..6] of integer; + StaticBoxDark: array[1..6] of integer; + + StaticBackLevel: array[1..6] of integer; + StaticBackLevelRound: array[1..6] of integer; + StaticLevel: array[1..6] of integer; + StaticLevelRound: array[1..6] of integer; + + Animation: real; + Fadeout: boolean; + constructor Create(Back: String); override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + function Draw: boolean; override; + procedure FillPlayer(Item, P: integer); + end; + +implementation + +{$IFDEF TRANSLATE} +uses UGraphic, UScreenSong, UMenuStatic, UTime, UMain, UIni, ULanguage; +{$ELSE} +uses UGraphic, UScreenSong, UMenuStatic, UTime, UMain, UIni; +{$ENDIF} +function TScreenScore.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then begin + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE : + begin + if (not Fadeout) then begin +// Music.StopShuffle; + FadeTo(@ScreenTop5); + Fadeout := true; + end; + end; + SDLK_RETURN: + begin + if (not Fadeout) then begin +// Music.StopShuffle; + FadeTo(@ScreenTop5); + Fadeout := true; + end; + end; +{ SDLK_SYSREQ: + begin + beep; + end;} + SDLK_SYSREQ: + begin + Display.PrintScreen; + end; + end; + end; +end; + +constructor TScreenScore.Create(Back: String); +var + P: integer; + I: integer; +begin + inherited Create(Back); + + // background arrows sorted from farthest to nearest +{ AddStatic(-2000 + 400, 100, 360, 60, 1, 1, 1, Skin.Arrow2, 'JPG', 'Arrow'); + AddStatic(-2000 + -50, 200, 420, 70, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); + AddStatic(-2000 + 90, 30, 500, 90, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); + AddStatic(-2000 + -250, 100, 800, 150, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); + + Static[0].Texture.Rot := 100 * pi/180; + Static[1].Texture.Rot := 7 * pi/180; + Static[2].Texture.Rot := 35 * pi/180; + + + // main arrow with text + AddStatic(0, 340, 1000, 180, 1, 1, 1, Skin.Arrow2, 'JPG', 'Arrow'); +// AddText(450, 409, 4, 15, 1, 1, 1, 'Smile'); + AddText(450, 409, 4, 15, 1, 1, 1, 'Let''s see the results'); + Text[0].Y := 401; + + Static[4].Texture.Rot := -3 * pi/180; + + + // two mid arrows + AddStatic(-2000 + -250, 100, 800, 150, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); + AddStatic(-2000 + -250, 100, 800, 150, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); + + + // last arrow + AddStatic(-2000, 340, 1100, 180, 1, 1, 1, Skin.Arrow2, 'JPG', 'Arrow'); +// AddText(-2000, 407, 4, 17, 1, 1, 1, 'SHUFFLE !'); + AddText(-2000, 407, 4, 15, 1, 1, 1, 'SHUFFLE !'); + + Static[7].Texture.Rot := 184 * pi/180; + + // score text + AddText(-2000, 407, 4, 17, 1, 1, 1, '10010 points'); + AddText(-2000, 407, 4, 17, 1, 1, 1, 'Cheater'); + + Fadeout := false;} + + + // Singstar Theme + AddBackground(Theme.Score.Background.Tex); + + for I := 0 to High(Theme.Score.Static) do + AddStatic(Theme.Score.Static[I]); + + for I := 0 to High(Theme.Score.Text) do + AddText(Theme.Score.Text[I]); + + TextArtist := AddText(Theme.Score.TextArtist); + TextTitle := AddText(Theme.Score.TextTitle); + + for P := 1 to 6 do begin + TextName[P] := AddText(Theme.Score.TextName[P]); + TextScore[P] := AddText(Theme.Score.TextScore[P]); + + TextNotes[P] := AddText(Theme.Score.TextNotes[P]); + TextNotesScore[P] := AddText(Theme.Score.TextNotesScore[P]); + TextLineBonus[P] := AddText(Theme.Score.TextLineBonus[P]); + TextLineBonusScore[P] := AddText(Theme.Score.TextLineBonusScore[P]); + TextGoldenNotes[P] := AddText(Theme.Score.TextGoldenNotes[P]); + TextGoldenNotesScore[P] := AddText(Theme.Score.TextGoldenNotesScore[P]); + TextTotal[P] := AddText(Theme.Score.TextTotal[P]); + TextTotalScore[P] := AddText(Theme.Score.TextTotalScore[P]); + + SetLength(PlayerStatic[P], Length(Theme.Score.PlayerStatic[P])); + for I := 0 to High(Theme.Score.PlayerStatic[P]) do + PlayerStatic[P, I] := AddStatic(Theme.Score.PlayerStatic[P, I]); + + StaticBoxLightest[P] := AddStatic(Theme.Score.StaticBoxLightest[P]); + StaticBoxLight[P] := AddStatic(Theme.Score.StaticBoxLight[P]); + StaticBoxDark[P] := AddStatic(Theme.Score.StaticBoxDark[P]); + + StaticBackLevel[P] := AddStatic(Theme.Score.StaticBackLevel[P]); + StaticBackLevelRound[P] := AddStatic(Theme.Score.StaticBackLevelRound[P]); + StaticLevel[P] := AddStatic(Theme.Score.StaticLevel[P]); + StaticLevelRound[P] := AddStatic(Theme.Score.StaticLevelRound[P]); + end; +end; + +procedure TScreenScore.onShow; +var + P: integer; // player + PP: integer; // another player variable + S: string; + I: integer; + Lev: real; + Skip: integer; + V: array[1..6] of boolean; // visibility array + MaxH: real; // maximum height of score bar + Wsp: real; +begin +{ CountSkipTimeSet; + + Animation := 0; + Fadeout := false; + + Text[1].Text := AktSong.Artist + ' - ' + AktSong.Title; + Text[2].Text := ' ' + IntToStr((Round(Gracz[0].Punkty) div 10) * 10) + ' points'; + + Static[0].Texture.X := -2000; + Static[1].Texture.X := -2000; + Static[2].Texture.X := -2000; + Static[3].Texture.X := -2000; + Static[4].Texture.X := -2000; + Static[5].Texture.X := -2000; + Static[6].Texture.X := -2000; + Static[7].Texture.X := -2000; + + Text[0].X := -2000; + Text[1].X := -2000; + Text[2].X := -2000; + Text[3].X := -2000; + + + case (Round(Gracz[0].Punkty) div 10) * 10 of + 0..1000: Text[3].Text := ' Tone Deaf'; + 2010..4000: Text[3].Text := ' Amateur'; + 4010..6000: Text[3].Text := ' Rising Star'; + 6010..8000: Text[3].Text := ' Lead Singer'; + 8010..9000: Text[3].Text := ' Hit Artist'; + 9010..10000: Text[3].Text := ' Superstar'; + end; + + Music.PlayShuffle;} + + // Singstar + Fadeout := false; + + Text[TextArtist].Text := AktSong.Artist; + Text[TextTitle].Text := AktSong.Title; + + // set visibility + case PlayersPlay of + 1: begin + V[1] := true; + V[2] := false; + V[3] := false; + V[4] := false; + V[5] := false; + V[6] := false; + end; + 2, 4: begin + V[1] := false; + V[2] := true; + V[3] := true; + V[4] := false; + V[5] := false; + V[6] := false; + end; + 3, 6: begin + V[1] := false; + V[2] := false; + V[3] := false; + V[4] := true; + V[5] := true; + V[6] := true; + end; + end; + + for P := 1 to 6 do begin + Text[TextName[P]].Visible := V[P]; + Text[TextScore[P]].Visible := V[P]; + + Text[TextNotes[P]].Visible := V[P]; + Text[TextNotesScore[P]].Visible := V[P]; + Text[TextLineBonus[P]].Visible := V[P]; + Text[TextLineBonusScore[P]].Visible := V[P]; + Text[TextGoldenNotes[P]].Visible := V[P]; + Text[TextGoldenNotesScore[P]].Visible := V[P]; + Text[TextTotal[P]].Visible := V[P]; + Text[TextTotalScore[P]].Visible := V[P]; + + for I := 0 to high(PlayerStatic[P]) do + Static[PlayerStatic[P, I]].Visible := V[P]; + + Static[StaticBoxLightest[P]].Visible := V[P]; + Static[StaticBoxLight[P]].Visible := V[P]; + Static[StaticBoxDark[P]].Visible := V[P]; + + Static[StaticBackLevel[P]].Visible := V[P]; + Static[StaticBackLevelRound[P]].Visible := V[P]; + Static[StaticLevel[P]].Visible := V[P]; + Static[StaticLevelRound[P]].Visible := V[P]; + end; + + if PlayersPlay <= 3 then begin // only for 1 screen mode + for P := 0 to PlayersPlay-1 do begin + case PlayersPlay of + 1: PP := 1; + 2: PP := P + 2; + 3: PP := P + 4; + end; + //PP := 1; + + Text[TextName[PP]].Text := Ini.Name[P]; + + {$IFDEF TRANSLATE} + case (Player[P].ScoreTotalI) of + 0..2000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_TONE_DEAF'); + 2010..4000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_AMATEUR'); + 4010..6000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_RISING_STAR'); + 6010..8000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_LEAD_SINGER'); + 8010..9000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_HIT_ARTIST'); + 9010..9800: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_SUPERSTAR'); + 9810..10000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_ULTRASTAR'); + end; + {$ELSE} + case (Player[P].ScoreTotalI) of + 0..2000: Text[TextScore[PP]].Text := 'Tone Deaf'; + 2010..4000: Text[TextScore[PP]].Text := 'Amateur'; + 4010..6000: Text[TextScore[PP]].Text := 'Rising Star'; + 6010..8000: Text[TextScore[PP]].Text := 'Lead Singer'; + 8010..9000: Text[TextScore[PP]].Text := 'Hit Artist'; + 9010..9800: Text[TextScore[PP]].Text := 'Superstar'; + 9810..10000: Text[TextScore[PP]].Text := 'Ultrastar'; + end; + {$ENDIF} + + S := IntToStr(Player[P].ScoreI); + while (Length(S)<4) do S := '0' + S; + Text[TextNotesScore[PP]].Text := S; + + S := IntToStr(Player[P].ScoreLineI); + while (Length(S)<4) do S := '0' + S; + Text[TextLineBonusScore[PP]].Text := S; + + S := IntToStr(Player[P].ScoreGoldenI); + while (Length(S)<4) do S := '0' + S; + Text[TextGoldenNotesScore[PP]].Text := S; + + S := IntToStr(Player[P].ScoreTotalI); + while (Length(S)<5) do S := '0' + S; + Text[TextTotalScore[PP]].Text := S; + + // Level bar length +{ Lev := ((Round(Player[P].Punkty) div 10) * 10) / 10000; + Static[StaticLevel[PP]].Texture.H := Round(Static[StaticBackLevel[PP]].Texture.H * Lev); + Static[StaticLevel[PP]].Texture.Y := Static[StaticBackLevel[PP]].Texture.Y + Static[StaticBackLevel[PP]].Texture.H - Static[StaticLevel[PP]].Texture.H; + Static[StaticLevelRound[PP]].Texture.Y := Static[StaticLevel[PP]].Texture.Y - Static[StaticLevelRound[PP]].Texture.H;} + // doesn't align too much... (to fix) + // hint: play with wrapping textures + // resolution: setting TexY1 and TexY2 to 0.1 and 0.9 + + Lev := Player[P].ScoreTotalI / 10000; + MaxH := Static[StaticBackLevel[PP]].Texture.H + Static[StaticBackLevelRound[PP]].Texture.H / 2; + + // developer note (Polish): + // w sumie np. 120 pix + // ten static moze miec 100 pix + // wlacza sie od 20 pix i rosnie do 120 pix + // wiec wysokosc = wyznaczona ilosc - 20 + // nie moze byc mniejsze od 0 + // Lev * MaxH = total number of pixels to draw + Static[StaticLevel[PP]].Visible := true; + Static[StaticLevel[PP]].Texture.H := Lev * MaxH - Static[StaticBackLevelRound[PP]].Texture.H / 2; + if Static[StaticLevel[PP]].Texture.H < 0 then Static[StaticLevel[PP]].Visible := false; + + // Y doesn't change and depend on the back texture coordinate + Static[StaticLevel[PP]].Texture.Y := Static[StaticBackLevel[PP]].Texture.Y + Static[StaticBackLevel[PP]].Texture.H - Static[StaticLevel[PP]].Texture.H; + + // we modify LevelRound texture by changing it's Y. TexY1 and TexY2 change when the height to draw is lower than 20 + if Lev * MaxH < Static[StaticBackLevelRound[PP]].Texture.H / 2 then begin + // when it's lower than 20 => we move TexY1 and TexY2 higher to show only part of this texture + Static[StaticLevelRound[PP]].Texture.Y := Static[StaticBackLevel[PP]].Texture.Y + Static[StaticBackLevel[PP]].Texture.H - Static[StaticBackLevelRound[PP]].Texture.H; + // - 0.25 when points = 0 + // - 0 wnen there are more points + // if Lev * MaxH = Static[StaticBackLevelRound[PP]].Texture.H / 2) then we do not change it + // if Lev * MaxH = 0 then we substract 0.25 + // we substract (0.25 - 0.25 * (Lev * MaxH)/Static[StaticBackLevelRound[PP]].Texture.H / 2) + Wsp := Lev * MaxH / (Static[StaticBackLevelRound[PP]].Texture.H / 2); + Static[StaticLevelRound[PP]].Texture.TexY1 := Static[StaticBackLevelRound[PP]].Texture.TexY1 - 0.25 + 0.25 * Wsp; + Static[StaticLevelRound[PP]].Texture.TexY2 := Static[StaticBackLevelRound[PP]].Texture.TexY2 - 0.25 + 0.25 * Wsp; + end else begin + // when it's higher or equal 20 => full texture is being shown + Static[StaticLevelRound[PP]].Texture.TexY1 := Static[StaticBackLevelRound[PP]].Texture.TexY1; + Static[StaticLevelRound[PP]].Texture.TexY2 := Static[StaticBackLevelRound[PP]].Texture.TexY2; + Static[StaticLevelRound[PP]].Texture.Y := Static[StaticLevel[PP]].Texture.Y - Static[StaticBackLevelRound[PP]].Texture.H; + end; + + end; // for + end; // if + + LCD.HideCursor; + LCD.Clear; + LCD.WriteText(1, Ini.Name[0]); + LCD.WriteText(2, 'Score: ' + Text[TextTotalScore[1]].Text); + +end; + +function TScreenScore.Draw: boolean; +var +{ Min: real; + Max: real; + Wsp: real; + Wsp2: real; + Pet: integer;} + + Item: integer; + P: integer; + C: integer; +begin + // star animation +{ Animation := Animation + TimeSkip*1000; + + // move right + Min := 0; Max := 500; + if (Animation >= Min) and (Animation < Max) then begin + Wsp := (Animation - Min) / (Max - Min); + Wsp2 := 1 - Wsp; + + Static[0].Texture.X := 400 + Wsp2 * 50; // prawa mala + Static[0].Texture.Y := 150 - Wsp2 * 500; + Static[1].Texture.X := -50 - Wsp2 * 500; // lewa mala + Static[1].Texture.Y := 200 + Wsp2 * 50; + Static[2].Texture.X := 100 - Wsp2 * 200; // gorna w prawo + Static[2].Texture.Y := 80 - Wsp2 * 200; + Static[3].Texture.X := -280 - Wsp2 * 1000; // lewa wieksza gorna + Static[3].Texture.Y := 90; + + + Static[4].Texture.X := -1200 + Wsp * 1000; + Text[0].X := Static[4].Texture.X + 430; + end; + + // slowly move right + Min := 500; Max := 4100; + if (Animation >= Min) and (Animation < Max) then begin + Wsp := (Animation - Min) / (Max - Min); + + Static[0].Texture.X := 400 - Wsp * 10; // prawa mala + Static[0].Texture.Y := 150 + Wsp * 50; + Static[1].Texture.X := -50 + Wsp * 50; // lewa mala + Static[1].Texture.Y := 200; + Static[2].Texture.X := 100 + Wsp * 50; // gorna w prawo + Static[2].Texture.Y := 80 + Wsp * 30; + Static[3].Texture.X := -280 + Wsp * 200; // lewa wieksza gorna + Static[3].Texture.Y := 90; + + Static[4].Texture.X := -200 + Wsp * 150; // duza glowna + Text[0].X := Static[4].Texture.X + 430; + end; + + // fast move right + Min := 4100; Max := 4400; + if (Animation >= Min) and (Animation < Max) then begin + Wsp := (Animation - Min) / (Max - Min); + Wsp2 := 1 - Wsp; + + Static[0].Texture.X := 390 - Wsp * 200; // prawa mala + Static[0].Texture.Y := 200 + Wsp * 1000; + Static[1].Texture.X := 0 + Wsp * 1000; // lewa mala + Static[1].Texture.Y := 200; + Static[2].Texture.X := 150 + Wsp * 1000; // gorna w prawo + Static[2].Texture.Y := 110 + Wsp * 600; + Static[3].Texture.X := -80 + Wsp * 2000; // lewa wieksza gorna + Static[3].Texture.Y := 90; + + Static[4].Texture.X := -50 + Wsp * 2000; + Text[0].X := Static[4].Texture.X + 430; + + Static[7].Texture.X := 100 + Wsp2 * 3000; + Text[1].X := Static[7].Texture.X + 230; // 300 + Text[1].Y := Static[7].Texture.Y + 140; // 120 Sh + + Text[2].X := Static[7].Texture.X + 250; + Text[2].Y := Static[7].Texture.Y - 250; + Text[3].X := Static[7].Texture.X + 250; + Text[3].Y := Static[7].Texture.Y - 200; + end; + + // last arrow + Min := 4400; Max := 8000; + if (Animation >= Min) and (Animation < Max) then begin + Wsp := (Animation - Min) / (Max - Min); + + Static[7].Texture.X := 100 - Wsp * 100; + Text[1].X := Static[7].Texture.X + 230; // 300 + Text[1].Y := Static[7].Texture.Y + 140; // 120 + + Text[2].X := Static[7].Texture.X + 250; + Text[2].Y := Static[7].Texture.Y - 250; + Text[3].X := Static[7].Texture.X + 250; + Text[3].Y := Static[7].Texture.Y - 200; + end; + + // fade last arrow to left + Min := 8000; Max := 8300; + if (Animation >= Min) and (Animation < Max) then begin + Wsp := (Animation - Min) / (Max - Min); + + Static[7].Texture.X := 0 - Wsp * 3000; + Static[7].Texture.Y := 340 - Wsp * 50; + Text[1].X := Static[7].Texture.X + 230; // 300 Sh + Text[1].Y := Static[7].Texture.Y + 140; // 120 Sh + + Text[2].X := Static[7].Texture.X + 250; + Text[2].Y := Static[7].Texture.Y - 250; + Text[3].X := Static[7].Texture.X + 250; + Text[3].Y := Static[7].Texture.Y - 200; + end; + + Min := 8300; + if (Animation >= Min) and (not Fadeout) then begin + Music.StopShuffle; + FadeTo(@ScreenSong); + Fadeout := true; + end;} + + + // 0.5.0: try also use 4 players screen with nicks + if PlayersPlay = 4 then begin + for Item := 2 to 3 do begin + if ScreenAct = 1 then P := Item-2; + if ScreenAct = 2 then P := Item; + + FillPlayer(Item, P); + end; + end; + + + // Singstar - let it be...... with 6 statics + if PlayersPlay = 6 then begin + for Item := 4 to 6 do begin + if ScreenAct = 1 then P := Item-4; + if ScreenAct = 2 then P := Item-1; + + FillPlayer(Item, P); + +{ if ScreenAct = 1 then begin + LoadColor( + Static[StaticBoxLightest[Item]].Texture.ColR, + Static[StaticBoxLightest[Item]].Texture.ColG, + Static[StaticBoxLightest[Item]].Texture.ColB, + 'P1Dark'); + end; + + if ScreenAct = 2 then begin + LoadColor( + Static[StaticBoxLightest[Item]].Texture.ColR, + Static[StaticBoxLightest[Item]].Texture.ColG, + Static[StaticBoxLightest[Item]].Texture.ColB, + 'P4Dark'); + end;} + + end; + end; + + inherited Draw; +end; + +procedure TScreenScore.FillPlayer(Item, P: integer); +var + S: string; +begin + Text[TextName[Item]].Text := Ini.Name[P]; + + S := IntToStr((Round(Player[P].Score) div 10) * 10); + while (Length(S)<4) do S := '0' + S; + Text[TextNotesScore[Item]].Text := S; + + while (Length(S)<5) do S := '0' + S; + Text[TextTotalScore[Item]].Text := S; + + LoadColor( + Text[TextName[Item]].ColR, + Text[TextName[Item]].ColG, + Text[TextName[Item]].ColB, + 'P' + IntToStr(P+1) + 'Dark'); + + LoadColor( + Static[StaticBoxLightest[Item]].Texture.ColR, + Static[StaticBoxLightest[Item]].Texture.ColG, + Static[StaticBoxLightest[Item]].Texture.ColB, + 'P' + IntToStr(P+1) + 'Lightest'); + + LoadColor( + Static[StaticBoxLight[Item]].Texture.ColR, + Static[StaticBoxLight[Item]].Texture.ColG, + Static[StaticBoxLight[Item]].Texture.ColB, + 'P' + IntToStr(P+1) + 'Light'); + + LoadColor( + Static[StaticBoxDark[Item]].Texture.ColR, + Static[StaticBoxDark[Item]].Texture.ColG, + Static[StaticBoxDark[Item]].Texture.ColB, + 'P' + IntToStr(P+1) + 'Dark'); +end; + +end. diff --git a/Game/Code/Screens/UScreenSing.dcu b/Game/Code/Screens/UScreenSing.dcu new file mode 100644 index 00000000..0e227a17 Binary files /dev/null and b/Game/Code/Screens/UScreenSing.dcu differ diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas new file mode 100644 index 00000000..2a97482d --- /dev/null +++ b/Game/Code/Screens/UScreenSing.pas @@ -0,0 +1,1121 @@ +unit UScreenSing; + +interface + +uses UMenu, UMusic, SDL, SysUtils, UPliki, UTime, USongs, UIni, ULog, USmpeg, UTexture, ULyrics, + TextGL, OpenGL12, BASS, UThemes, ULCD; + +type + TScreenSing = class(TMenu) + protected + paused: boolean; //Pause Mod + PauseTime: Real; + NumEmptySentences: integer; + public + TextTime: integer; + + StaticP1: integer; + StaticP1ScoreBG: integer; + TextP1: integer; + TextP1Score: integer; + + StaticP2R: integer; + StaticP2RScoreBG: integer; + TextP2R: integer; + TextP2RScore: integer; + + StaticP2M: integer; + StaticP2MScoreBG: integer; + TextP2M: integer; + TextP2MScore: integer; + + StaticP3R: integer; + StaticP3RScoreBG: integer; + TextP3R: integer; + TextP3RScore: integer; + + Tex_Background: TTexture; + FadeOut: boolean; + LyricMain: TLyric; + LyricSub: TLyric; + + constructor Create; override; + procedure onShow; override; + procedure onShowFinish; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure Finish; virtual; + procedure UpdateLCD; + procedure Pause; //Pause Mod(Toggles Pause) + + //OnSentenceEnd for LineBonus + Singbar + procedure onSentenceEnd(S: Cardinal); + end; + +implementation +uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math; + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenSing.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_ESCAPE : + begin + //Record Sound Hack: + //Sound[0].BufferLong + + Finish; + Music.PlayBack; + FadeTo(@ScreenScore); + end; + + SDLK_Q: + begin + Finish; + Result := false; + end; + + SDLK_P://Pause Mod + begin + Pause; + end; + + SDLK_RETURN: + begin + 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 : + begin + end; + SDLK_UP : + begin + end; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN : + begin + end; + end; +end; + +//Pause Mod +procedure TScreenSing.Pause; +begin + if not paused then //Pause einschalten + begin + PauseTime := Czas.Teraz; + Paused := true; + //stop Music + Music.Pause; + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then //Video + PauseSmpeg; //Video + end + else //Pause ausschalten + begin + Czas.Teraz := PauseTime; //Position of Notes + Music.MoveTo (PauseTime);//Position of Music + Music.Play; //Play Music + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then //Video + PlaySmpeg; + //SkipSmpeg(PauseTime); + Paused := false; + end; +end; +//Pause Mod End + +constructor TScreenSing.Create; +var + I: integer; + P: integer; +begin + inherited Create; + + AddBackground(Theme.Sing.Background.Tex); + + for I := 0 to High(Theme.Sing.Static) do + AddStatic(Theme.Sing.Static[I]); + + for I := 0 to High(Theme.Sing.Text) do + AddText(Theme.Sing.Text[I]); + + // time + TextTime := AddText(75, 14, 1, 8, 0.25, 0.25, 0.25, '00:00'); + + StaticP1 := AddStatic(Theme.Sing.StaticP1); + StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); + TextP1 := AddText(Theme.Sing.TextP1); + TextP1Score := AddText(Theme.Sing.TextP1Score); + + StaticP2R := AddStatic(Theme.Sing.StaticP2R); + StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); + TextP2R := AddText(Theme.Sing.TextP2R); + TextP2RScore := AddText(Theme.Sing.TextP2RScore); + + StaticP2M := AddStatic(Theme.Sing.StaticP2M); + StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG); + TextP2M := AddText(Theme.Sing.TextP2M); + TextP2MScore := AddText(Theme.Sing.TextP2MScore); + + StaticP3R := AddStatic(Theme.Sing.StaticP3R); + StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG); + TextP3R := AddText(Theme.Sing.TextP3R); + TextP3RScore := AddText(Theme.Sing.TextP3RScore); + + LyricMain := TLyric.Create; + LyricSub := TLyric.Create; +end; + +procedure TScreenSing.onShow; +var + P: integer; + V1: boolean; + V2R: boolean; + V2M: boolean; + V3R: boolean; + NR: TRecR; //Line Bonus Mod +begin + Log.LogStatus('Begin', 'onShow'); + FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented + + // prepare players + SetLength(Player, PlayersPlay); +// Player[0].ScoreTotalI := 0; + + + case PlayersPlay of + 1: begin + V1 := true; + V2R := false; + V2M := false; + V3R := false; + end; + 2: begin + V1 := true; + V2R := true; + V2M := false; + V3R := false; + end; + 3: begin + V1 := true; + V2R := false; + V2M := true; + V3R := true; + end; + 4: begin // double screen + V1 := true; + V2R := true; + V2M := false; + V3R := false; + end; + 6: begin // double screen + V1 := true; + V2R := false; + V2M := true; + V3R := true; + end; + + end; + + + + Static[StaticP2R].Visible := V2R; + Static[StaticP2RScoreBG].Visible := V2R; + Text[TextP2R].Visible := V2R; + Text[TextP2RScore].Visible := V2R; + + Static[StaticP2M].Visible := V2M; + Static[StaticP2MScoreBG].Visible := V2M; + Text[TextP2M].Visible := V2M; + Text[TextP2MScore].Visible := V2M; + + Static[StaticP3R].Visible := V3R; + Static[StaticP3RScoreBG].Visible := V3R; + Text[TextP3R].Visible := V3R; + Text[TextP3RScore].Visible := V3R; + + // load notes + CzyscNuty; +// Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); + AktSong := CatSongs.Song[CatSongs.Selected]; + + WczytajCzesci(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName); + AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; +// AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed + + // set movie + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin + OpenSmpeg(AktSong.Path + AktSong.Video); + SkipSmpeg(AktSong.VideoGAP + AktSong.Start); + AktSong.VideoLoaded := true; + end; + + // set background + if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then + Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background) + else + Tex_Background.TexNum := -1; + + + + // play music (I) + Music.CaptureStart; + Music.MoveTo(AktSong.Start); +// Music.Play; + + // prepare timer (I) +// CountSkipTimeSet; + Czas.Teraz := AktSong.Start; + Czas.Razem := Music.Length; + if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000; + Czas.OldBeat := -1; + for P := 0 to High(Player) do + ClearScores(P); + + // main text + LyricMain.Clear; + LyricMain.X := 400; + LyricMain.Y := Skin_LyricsT; + LyricMain.Scale := 1.4; //1.4 + LyricMain.Align := 1; + + // sub text + LyricSub.Clear; + LyricSub.X := 400; + LyricSub.Y := Skin_LyricsT + 42; //40 + LyricSub.Align := 1; + + // set custom options + case Ini.LyricsFont of + 0: + begin + LyricMain.FontStyle := 0; + LyricSub.FontStyle := 0; + LyricMain.Size := 14; // 13 + LyricSub.Size := 14; // 13 + LyricMain.ColR := Skin_FontR; + LyricMain.ColG := Skin_FontG; + LyricMain.ColB := Skin_FontB; //Change für Crazy Joker + {LyricMain.ColSR := Skin_FontHighlightR; + LyricMain.ColSG := Skin_FontHighlightG; + LyricMain.ColSB := Skin_FontHighlightB;1aa5dc} + LyricMain.ColSR := 26/255; + LyricMain.ColSG := 165/255; + LyricMain.ColSB := 220/255; + + LyricSub.ColR := 0.6; + LyricSub.ColG := 0.6; + LyricSub.ColB := 0.6; + end; + 1: + begin + LyricMain.FontStyle := 2; + LyricSub.FontStyle := 2; + LyricMain.Size := 14; + LyricSub.Size := 14; + LyricMain.ColR := 0.75; + LyricMain.ColG := 0.75; + LyricMain.ColB := 1; + LyricMain.ColSR := 0.5; + LyricMain.ColSG := 0.5; + LyricMain.ColSB := 1; + LyricSub.ColR := 0.8; + LyricSub.ColG := 0.8; + LyricSub.ColB := 0.8; + end; + 2: + begin + LyricMain.FontStyle := 3; + LyricSub.FontStyle := 3; + LyricMain.Size := 12; + LyricSub.Size := 12; + LyricMain.ColR := 0.75; + LyricMain.ColG := 0.75; + LyricMain.ColB := 1; + LyricMain.ColSR := 0.5; + LyricMain.ColSG := 0.5; + LyricMain.ColSB := 1; + LyricSub.ColR := 0.8; + LyricSub.ColG := 0.8; + LyricSub.ColB := 0.8; + end; + end; // case + + case Ini.LyricsEffect of + 0: LyricMain.Style := 1; // 0 - one selected, 1 - selected all to the current + 1: LyricMain.Style := 2; + 2: LyricMain.Style := 3; + 3: LyricMain.Style := 4; + end; // case + + // fill texts + LyricMain.AddCzesc(0); + LyricMain.Selected := -1; + LyricSub.AddCzesc(1); + LyricSub.Selected := -1; + + UpdateLCD; + + //Deactivate Pause + Paused := False; + + {Static[StaticP2R].Visible := V2R; + Static[StaticP2RScoreBG].Visible := V2R; + Text[TextP2R].Visible := V2R; + Text[TextP2RScore].Visible := V2R; + + Static[StaticP2M].Visible := V2M; + Static[StaticP2MScoreBG].Visible := V2M; + Text[TextP2M].Visible := V2M; + Text[TextP2MScore].Visible := V2M; + + Static[StaticP3R].Visible := V3R; + Static[StaticP3RScoreBG].Visible := V3R; + Text[TextP3R].Visible := V3R; + Text[TextP3RScore].Visible := V3R;} + + //Set Position of Line Bonus - PhrasenBonus + if (Ini.LineBonus = 1) then //Show Line Bonus at Scores + begin + Case PlayersPlay of + 1: begin + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + end; + + 2: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.X; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.X; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.X; + Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + end; + + 3: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + end; + + 4: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P4 + Player[3].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; + Player[3].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[3].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; + Player[3].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + end; + + 6: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + + //P4 + Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[3].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[3].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[3].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P5 + Player[4].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[4].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[4].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[4].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P6 + Player[5].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[5].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[5].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[5].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + end; + end; + end + else if (Ini.LineBonus = 2) then //Show Line Bonus at Notes + begin + //SingDrawNoteLines(Nr.Left + 10*ScreenX, 120, Nr.Right + 10*ScreenX, 12); + //SingDrawNoteLines(Nr.Left + 10*ScreenX, 245, Nr.Right + 10*ScreenX, 12); + //SingDrawNoteLines(Nr.Left + 10*ScreenX, 370, Nr.Right + 10*ScreenX, 12); + + // positions + if Ini.SingWindow = 0 then begin + NR.Left := 120; + end else begin + NR.Left := 20; + end; + NR.Right := 780; + + NR.Width := NR.Right - NR.Left; + NR.WMid := NR.Width / 2; + NR.Mid := NR.Left + NR.WMid; + + Case PlayersPlay of + 1: begin + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartY := Skin_P2_NotesB - 105; + end; + + 2: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + end; + + 3: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetY := 120 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartY := 120 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetY := 245 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartY := 245 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_TargetY := 370 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_StartY := 370 + 28; + end; + + 4: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P4 + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + end; + + 6: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetY := 120 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartY := 120 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetY := 245 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartY := 245 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_TargetY := 370 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_StartY := 370 + 28; + + //P4 + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_TargetY := 120 - 65 + 28; + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_StartY := 120 + 28; + + //P5 + Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[4].LineBonus_TargetY := 245 - 65 + 28; + Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[4].LineBonus_StartY := 245 + 28; + + //P6 + Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[5].LineBonus_TargetY := 370 - 65 + 28; + Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[5].LineBonus_StartY := 370 + 28; + end; + end; + end; + //Set Position of Line Bonus - PhrasenBonus End + //Set Num of Empty Sentences for Phrasen Bonus + NumEmptySentences := 0; + for P := low(Czesci[0].Czesc) to high(Czesci[0].Czesc) do + if Czesci[0].Czesc[P].TotalNotes = 0 then Inc(NumEmptySentences); + + Log.LogStatus('End', 'onShow'); +end; + +procedure TScreenSing.onShowFinish; +begin + // play movie (II) + if AktSong.VideoLoaded then PlaySmpeg; + + // play music (II) + Music.Play; + + // prepare timer (II) + CountSkipTimeSet; +end; + +function TScreenSing.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + Flash: real; + S: integer; + T: integer; +begin + + + + //ScoreBG Mod + // set player colors + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + Static[StaticP1].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + + + + LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, + Static[StaticP1ScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + Static[StaticP1].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P4Dark'); + + + + LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, + Static[StaticP1ScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); + + + + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + Static[StaticP1].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P3Dark'); + + + + LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, + Static[StaticP1ScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + Static[StaticP1].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P6Dark'); + + + + + LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, + Static[StaticP1ScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); + + + + + end; + end; + +//Original 0.5.0 +{ // set player colors + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + //LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + //Static[StaticP1].Texture.ColB, 'P1Dark'); +// LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + // Static[StaticP2R].Texture.ColB, 'P2Dark'); + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + Static[StaticP1].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P4Dark'); + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + Static[StaticP1].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P3Dark'); + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + Static[StaticP1].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P6Dark'); + end; + end; } + //end ScoreBG Mod + + + + // set player names (for 2 screens and only Singstar skin) + if ScreenAct = 1 then begin + Text[TextP1].Text := 'P1'; + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; + end; + + if ScreenAct = 2 then begin + case PlayersPlay of +{ 1: begin + Text[TextP1].Text := 'P2'; + end; + 2: begin + Text[TextP1].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 3: begin + Text[TextP1].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end;} + + 4: begin + Text[TextP1].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 6: begin + Text[TextP1].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end; + end; // case + end; // if + + // stereo + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; + + + + + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + + + + + + Text[TextP1].X := Text[TextP1].X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; + + + + Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + + + + + Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; + + for S := 1 to 1 do + Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X + 10*ScreenX; + + // update static menu with time ... + Min := Round(Czas.Teraz) div 60; + Sec := Round(Czas.Teraz) mod 60; + Text[TextTime].Text := ''; + if Min < 10 then Text[TextTime].Text := '0'; + Text[TextTime].Text := Text[TextTime].Text + IntToStr(Min) + ':'; + if Sec < 10 then Text[TextTime].Text := Text[TextTime].Text + '0'; + Text[TextTime].Text := Text[TextTime].Text + IntToStr(Sec); + + // .. and scores + if PlayersPlay = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + end; + + if PlayersPlay = 2 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + + if PlayersPlay = 3 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[4].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[5].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + end; + + + // beat flash +{ Flash := 1 - (Czas.MidBeat - Czas.AktBeat); + if (Czas.AktBeat + AktSong.NotesGAP) mod AktSong.Resolution = 0 then Flash := 1 + else Flash := 0; + if Czas.AktBeat < 0 then Flash := 0; + glClearColor(Flash, Flash, Flash, 1);} + + // beat sound +// if (Ini.BeatClick = 1) and (Flash = 1) and (Czas.AktBeat <> Czas.OldBeat) then Music.PlayClick; + + // draw static menu (BG) + DrawBG; + //Draw Background + SingDrawBackground; + // update and draw movie + if ShowFinish and AktSong.VideoLoaded then begin + UpdateSmpeg; // this only draws + end; + + // draw static menu (FG) + DrawFG; + + // check for music finish +// Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(AktSong.Finish)); + if ShowFinish then begin + if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + //Pause Mod: + if not Paused then + Sing(Self); // analyze song + end else begin +// Log.LogError('End'); + if not FadeOut then begin +// Log.LogError('End2'); + Finish; + FadeOut := true; + FadeTo(@ScreenScore); + end; + end; + end; + + // draw custom items + SingDraw; // always draw + + + // back stereo + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; + + + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; + + + + Text[TextP1].X := Text[TextP1].X - 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; + + + + Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; + + + + Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; + + for S := 1 to 1 do + Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X - 10*ScreenX; + +end; + +procedure TScreenSing.Finish; +begin + Music.CaptureStop; + Music.Stop; + + if Ini.SavePlayback = 1 then begin + Log.BenchmarkStart(0); + Log.LogVoice(0); + Log.LogVoice(1); + Log.LogVoice(2); + Log.BenchmarkEnd(0); + Log.LogBenchmark('Creating files', 0); + end; + + if AktSong.VideoLoaded then begin + CloseSmpeg; + AktSong.VideoLoaded := false; // to prevent drawing closed video + end; +end; + +procedure TScreenSing.UpdateLCD; +var + T: string; +begin + LCD.HideCursor; + LCD.Clear; + + T := LyricMain.Text; + if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; + LCD.AddTextBR(T); + + T := LyricSub.Text; + if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; + LCD.AddTextBR(T); +end; + +procedure TScreenSing.onSentenceEnd(S: Cardinal); +var +I: Integer; +A: Real; +B: integer; //Max Points for Notes +begin + +//Check for Empty Sentence +if (Czesci[0].Czesc[S].TotalNotes<=0) then + exit; + +//Set Max Note Points +if (Ini.LineBonus > 0) then + B := 9000 +else + B := 10000; + +for I := 0 to High(Player) do begin + A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2; + + //SingBar Mod + If ({(Ini.Oscilloscope = 2) and }(Czesci[0].Czesc[S].TotalNotes>0)) then + begin + Player[I].ScorePercentTarget := Player[I].ScorePercentTarget + floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 40 - 26); + if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0; + if Player[I].ScorePercentTarget > 99 then Player[I].ScorePercentTarget := 99; + + //end Singbar Mod + end; + + //PhrasenBonus - Line Bonus Mod + + If (Ini.LineBonus > 0) then + begin + + //Generate Steps 0 to 8 + A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); + if A >= 8 then + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_PERFECT') + else if (A = 6) or (A = 7) then + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_BETTER') + else if A = 5 then + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_GOOD') + else if (A = 3) or (A = 4) then + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_NORMAL') + else if A = 2 then + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_BAD') + else + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_WORST'); + + //PhrasenBonus give Points + Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8); + Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10; + //Update Total Score + Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; + + //Color + Player[I].LineBonus_Color.B := 0; + Player[I].LineBonus_Color.R := (8-A)/8; + Player[I].LineBonus_Color.G := A/10; + + Player[I].LineBonus_PosX := Player[I].LineBonus_StartX; + Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; + Player[I].LineBonus_Alpha := 0.92; + Player[I].LineBonus_Visible := True; + + + + end; + +//Refresh LastScore +Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; + +end; +//PhrasenBonus - Line Bonus Mod End// } + +end; + +end. diff --git a/Game/Code/Screens/UScreenSingModi.dcu b/Game/Code/Screens/UScreenSingModi.dcu new file mode 100644 index 00000000..4f806afe Binary files /dev/null and b/Game/Code/Screens/UScreenSingModi.dcu differ diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas new file mode 100644 index 00000000..88034f61 --- /dev/null +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -0,0 +1,1088 @@ +unit UScreenSingModi; + +interface + +uses UMenu, UMusic, SDL, SysUtils, UPliki, UTime, USongs, UIni, ULog, USmpeg, UTexture, ULyrics, + TextGL, OpenGL12, BASS, UThemes, ULCD, UScreenSing, ModiSDK; + +type + TScreenSingModi = class(TScreenSing) + protected + //paused: boolean; //Pause Mod + //PauseTime: Real; + //NumEmptySentences: integer; + public + //TextTime: integer; + + //StaticP1: integer; + //StaticP1ScoreBG: integer; + //TextP1: integer; + //TextP1Score: integer; + + //StaticP2R: integer; + //StaticP2RScoreBG: integer; + //TextP2R: integer; + //TextP2RScore: integer; + + //StaticP2M: integer; + //StaticP2MScoreBG: integer; + //TextP2M: integer; + //TextP2MScore: integer; + + //StaticP3R: integer; + //StaticP3RScoreBG: integer; + //TextP3R: integer; + //TextP3RScore: integer; + + //Tex_Background: TTexture; + //FadeOut: boolean; + //LyricMain: TLyric; + //LyricSub: TLyric; + Winner: Byte; //Who Wins + PlayerInfo: TPlayerInfo; + TeamInfo: TTeamInfo; + + constructor Create; override; + procedure onShow; override; + //procedure onShowFinish; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure Finish; override; + //procedure UpdateLCD; + //procedure Pause; //Pause Mod(Toggles Pause) + end; + +//Procedured for Plugin +function LoadTex (const Name, Typ: PChar): TsmallTexture; stdcall; +//function Translate (const Name: PChar): PChar; stdcall; +procedure Print (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text +function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound +procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound + +//Utilys +function ToSentences(Const Czeski: TCzesci): TSentences; + +implementation +uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math, UDLLManager, USkins; + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenSingModi.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_ESCAPE : + begin + Finish; + Music.PlayBack; + FadeTo(@ScreenPartyScore); + end; + + else + Result := inherited ParseInput(PressedKey, ScanCode, PressedDown); + end; + end; +end; + +constructor TScreenSingModi.Create; +begin + inherited Create; + +end; + +function ToSentences(Const Czeski: TCzesci): TSentences; +var + I, J: Integer; +begin + Result.Akt := Czeski.Akt; + Result.High := Czeski.High; + Result.Ilosc := Czeski.Ilosc; + Result.Resolution := Czeski.Resolution; + Result.NotesGAP := Czeski.NotesGAP; + Result.TotalLength := Czeski.Wartosc; + + SetLength(Result.Sentence, Length(Czeski.Czesc)); + for I := low(Result.Sentence) to high(Result.Sentence) do + begin + Result.Sentence[I].Start := Czeski.Czesc[I].Start; + Result.Sentence[I].StartNote := Czeski.Czesc[I].StartNote; + Result.Sentence[I].Lyric := Czeski.Czesc[I].Lyric; + Result.Sentence[I].LyricWidth := Czeski.Czesc[I].LyricWidth; + Result.Sentence[I].Koniec := Czeski.Czesc[I].Koniec; + Result.Sentence[I].BaseNote := Czeski.Czesc[I].BaseNote; + Result.Sentence[I].HighNote := Czeski.Czesc[I].HighNut; + Result.Sentence[I].IlNut := Czeski.Czesc[I].IlNut; + Result.Sentence[I].TotalNotes := Czeski.Czesc[I].TotalNotes; + + SetLength(Result.Sentence[I].Note, Length(Czeski.Czesc[I].Nuta)); + for J := low(Result.Sentence[I].Note) to high(Result.Sentence[I].Note) do + begin + Result.Sentence[I].Note[J].Color := Czeski.Czesc[I].Nuta[J].Color; + Result.Sentence[I].Note[J].Start := Czeski.Czesc[I].Nuta[J].Start; + Result.Sentence[I].Note[J].Length := Czeski.Czesc[I].Nuta[J].Dlugosc; + Result.Sentence[I].Note[J].Ton := Czeski.Czesc[I].Nuta[J].Ton; + Result.Sentence[I].Note[J].TonGamy := Czeski.Czesc[I].Nuta[J].TonGamy; + //Result.Sentence[I].Note[J].Text := Czeski.Czesc[I].Nuta[J].Tekst; + Result.Sentence[I].Note[J].FreeStyle := Czeski.Czesc[I].Nuta[J].FreeStyle; + Result.Sentence[I].Note[J].Typ := Czeski.Czesc[I].Nuta[J].Wartosc; + end; + end; +end; + +procedure TScreenSingModi.onShow; +{var + P: integer; + V1: boolean; + V2R: boolean; + V2M: boolean; + V3R: boolean; + NR: TRecR; //Line Bonus Mod } +var + I: Integer; +begin + + { Log.LogStatus('Begin', 'onShow'); + FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented + + // prepare players + SetLength(Player, PlayersPlay); +// Player[0].ScoreTotalI := 0; + + + case PlayersPlay of + 1: begin + V1 := true; + V2R := false; + V2M := false; + V3R := false; + end; + 2: begin + V1 := true; + V2R := true; + V2M := false; + V3R := false; + end; + 3: begin + V1 := true; + V2R := false; + V2M := true; + V3R := true; + end; + 4: begin // double screen + V1 := true; + V2R := true; + V2M := false; + V3R := false; + end; + 6: begin // double screen + V1 := true; + V2R := false; + V2M := true; + V3R := true; + end; + + end; + + + + Static[StaticP2R].Visible := V2R; + Static[StaticP2RScoreBG].Visible := V2R; + Text[TextP2R].Visible := V2R; + Text[TextP2RScore].Visible := V2R; + + Static[StaticP2M].Visible := V2M; + Static[StaticP2MScoreBG].Visible := V2M; + Text[TextP2M].Visible := V2M; + Text[TextP2MScore].Visible := V2M; + + Static[StaticP3R].Visible := V3R; + Static[StaticP3RScoreBG].Visible := V3R; + Text[TextP3R].Visible := V3R; + Text[TextP3RScore].Visible := V3R; + + + + // load notes + CzyscNuty; +// Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); + AktSong := CatSongs.Song[CatSongs.Selected]; + + WczytajCzesci(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName); + AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; +// AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer}{ + 20 {microphone}{ + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed + + // set movie + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin + OpenSmpeg(AktSong.Path + AktSong.Video); + SkipSmpeg(AktSong.VideoGAP + AktSong.Start); + AktSong.VideoLoaded := true; + end; + + // set background + if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then + Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background) + else + Tex_Background.TexNum := -1; + + // play music (I) + //Music.CaptureStart; + Music.MoveTo(AktSong.Start); +// Music.Play; + + // prepare timer (I) +// CountSkipTimeSet; + Czas.Teraz := AktSong.Start; + Czas.Razem := Music.Length; + if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000; + Czas.OldBeat := -1; + for P := 0 to High(Player) do + ClearScores(P); + + // main text + LyricMain.Clear; + LyricMain.X := 400; + LyricMain.Y := Skin_LyricsT; + LyricMain.Scale := 1.4; //1.4 + LyricMain.Align := 1; + + // sub text + LyricSub.Clear; + LyricSub.X := 400; + LyricSub.Y := Skin_LyricsT + 42; //40 + LyricSub.Align := 1; + + // set custom options + case Ini.LyricsFont of + 0: + begin + LyricMain.FontStyle := 0; + LyricSub.FontStyle := 0; + LyricMain.Size := 14; // 13 + LyricSub.Size := 14; // 13 + LyricMain.ColR := Skin_FontR; + LyricMain.ColG := Skin_FontG; + LyricMain.ColB := Skin_FontB; //Change für Crazy Joker + {LyricMain.ColSR := Skin_FontHighlightR; + LyricMain.ColSG := Skin_FontHighlightG; + LyricMain.ColSB := Skin_FontHighlightB;1aa5dc} { + LyricMain.ColSR := 26/255; + LyricMain.ColSG := 165/255; + LyricMain.ColSB := 220/255; + + LyricSub.ColR := 0.6; + LyricSub.ColG := 0.6; + LyricSub.ColB := 0.6; + end; + 1: + begin + LyricMain.FontStyle := 2; + LyricSub.FontStyle := 2; + LyricMain.Size := 14; + LyricSub.Size := 14; + LyricMain.ColR := 0.75; + LyricMain.ColG := 0.75; + LyricMain.ColB := 1; + LyricMain.ColSR := 0.5; + LyricMain.ColSG := 0.5; + LyricMain.ColSB := 1; + LyricSub.ColR := 0.8; + LyricSub.ColG := 0.8; + LyricSub.ColB := 0.8; + end; + 2: + begin + LyricMain.FontStyle := 3; + LyricSub.FontStyle := 3; + LyricMain.Size := 12; + LyricSub.Size := 12; + LyricMain.ColR := 0.75; + LyricMain.ColG := 0.75; + LyricMain.ColB := 1; + LyricMain.ColSR := 0.5; + LyricMain.ColSG := 0.5; + LyricMain.ColSB := 1; + LyricSub.ColR := 0.8; + LyricSub.ColG := 0.8; + LyricSub.ColB := 0.8; + end; + end; // case + + case Ini.LyricsEffect of + 0: LyricMain.Style := 1; // 0 - one selected, 1 - selected all to the current + 1: LyricMain.Style := 2; + 2: LyricMain.Style := 3; + 3: LyricMain.Style := 4; + end; // case + + // fill texts + LyricMain.AddCzesc(0); + LyricMain.Selected := -1; + LyricSub.AddCzesc(1); + LyricSub.Selected := -1; + + UpdateLCD; + + //Deactivate Pause + Paused := False; + + {Static[StaticP2R].Visible := V2R; + Static[StaticP2RScoreBG].Visible := V2R; + Text[TextP2R].Visible := V2R; + Text[TextP2RScore].Visible := V2R; + + Static[StaticP2M].Visible := V2M; + Static[StaticP2MScoreBG].Visible := V2M; + Text[TextP2M].Visible := V2M; + Text[TextP2MScore].Visible := V2M; + + Static[StaticP3R].Visible := V3R; + Static[StaticP3RScoreBG].Visible := V3R; + Text[TextP3R].Visible := V3R; + Text[TextP3RScore].Visible := V3R;} { + + //Set Position of Line Bonus - PhrasenBonus + if (Ini.LineBonus = 1) then //Show Line Bonus at Scores + begin + Case PlayersPlay of + 1: begin + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + end; + + 2: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.X; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.X; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.X; + Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + end; + + 3: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + end; + + 4: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P4 + Player[3].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; + Player[3].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[3].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; + Player[3].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + end; + + 6: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + + //P4 + Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[3].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[3].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[3].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + + //P5 + Player[4].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[4].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[4].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[4].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P6 + Player[5].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[5].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[5].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[5].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + end; + end; + end + else if (Ini.LineBonus = 2) then //Show Line Bonus at Notes + begin + //SingDrawNoteLines(Nr.Left + 10*ScreenX, 120, Nr.Right + 10*ScreenX, 12); + //SingDrawNoteLines(Nr.Left + 10*ScreenX, 245, Nr.Right + 10*ScreenX, 12); + //SingDrawNoteLines(Nr.Left + 10*ScreenX, 370, Nr.Right + 10*ScreenX, 12); + + // positions + if Ini.SingWindow = 0 then begin + NR.Left := 120; + end else begin + NR.Left := 20; + end; + NR.Right := 780; + + NR.Width := NR.Right - NR.Left; + NR.WMid := NR.Width / 2; + NR.Mid := NR.Left + NR.WMid; + + Case PlayersPlay of + 1: begin + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartY := Skin_P2_NotesB - 105; + end; + + 2: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + end; + + 3: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetY := 120 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartY := 120 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetY := 245 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartY := 245 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_TargetY := 370 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_StartY := 370 + 28; + end; + + 4: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P4 + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + end; + + 6: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetY := 120 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartY := 120 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetY := 245 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartY := 245 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_TargetY := 370 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_StartY := 370 + 28; + + //P4 + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_TargetY := 120 - 65 + 28; + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_StartY := 120 + 28; + + //P5 + Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[4].LineBonus_TargetY := 245 - 65 + 28; + Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[4].LineBonus_StartY := 245 + 28; + + //P6 + Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[5].LineBonus_TargetY := 370 - 65 + 28; + Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[5].LineBonus_StartY := 370 + 28; + end; + end; + end; + //Set Position of Line Bonus - PhrasenBonus End + //Set Num of Empty Sentences for Phrasen Bonus + NumEmptySentences := 0; + for P := low(Czesci[0].Czesc) to high(Czesci[0].Czesc) do + if Czesci[0].Czesc[P].TotalNotes = 0 then Inc(NumEmptySentences); + + Log.LogStatus('End', 'onShow'); } + +PlayersPlay := TeamInfo.NumTeams; + +if DLLMan.Selected.LoadSong then //Start with Song +begin + inherited; +end +else //Start Without Song +begin + Music.CaptureStart; +end; + +//Set Playerinfo + PlayerInfo.NumPlayers := PlayersPlay; + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); + PlayerInfo.Playerinfo[I].Score:= 0; + PlayerInfo.Playerinfo[I].Bar := 50; + PlayerInfo.Playerinfo[I].Enabled := True; + end; + + for I := PlayerInfo.NumPlayers to high(PlayerInfo.Playerinfo) do + begin + PlayerInfo.Playerinfo[I].Score:= 0; + PlayerInfo.Playerinfo[I].Bar := 0; + PlayerInfo.Playerinfo[I].Enabled := False; + end; + + Case PlayersPlay of + 1: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; + end; + 2,4: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; + PlayerInfo.Playerinfo[2].PosX := Static[StaticP1ScoreBG].Texture.X; + PlayerInfo.Playerinfo[2].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; + PlayerInfo.Playerinfo[1].PosX := Static[StaticP2RScoreBG].Texture.X; + PlayerInfo.Playerinfo[1].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; + PlayerInfo.Playerinfo[3].PosX := Static[StaticP2RScoreBG].Texture.X; + PlayerInfo.Playerinfo[3].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; + end; + 3,6: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; + PlayerInfo.Playerinfo[3].PosX := Static[StaticP1ScoreBG].Texture.X; + PlayerInfo.Playerinfo[3].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; + PlayerInfo.Playerinfo[1].PosX := Static[StaticP2MScoreBG].Texture.X; + PlayerInfo.Playerinfo[1].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; + PlayerInfo.Playerinfo[4].PosX := Static[StaticP2MScoreBG].Texture.X; + PlayerInfo.Playerinfo[4].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; + PlayerInfo.Playerinfo[2].PosX := Static[StaticP3RScoreBG].Texture.X; + PlayerInfo.Playerinfo[2].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; + PlayerInfo.Playerinfo[5].PosX := Static[StaticP3RScoreBG].Texture.X; + PlayerInfo.Playerinfo[5].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; + end; + end; + + // play music (I) + //Music.CaptureStart; + //Music.MoveTo(AktSong.Start); + +//Init Plugin +if not DLLMan.PluginInit(TeamInfo, PlayerInfo, ToSentences(Czesci[0]), LoadTex, Print, LoadSound, PlaySound) then +begin +//Fehler +Log.LogError('Could not Init Plugin'); +Halt; +end; + +Winner := 0; +//Set Score Visibility + if PlayersPlay = 1 then begin + Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; + end; + + if (PlayersPlay = 2) OR (PlayersPlay = 4) then begin + Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP2RScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP2RScoreBG].Visible := DLLMan.Selected.ShowScore; + end; + + if (PlayersPlay = 3) OR (PlayersPlay = 6) then begin + Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP2MScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP2MScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP3RScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP3RScoreBG].Visible := DLLMan.Selected.ShowScore; + end; +end; + +function TScreenSingModi.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + S, I: integer; + T: integer; +begin +//Set Playerinfo + PlayerInfo.NumPlayers := PlayersPlay; + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + PlayerInfo.Playerinfo[I].Name := PChar(Player[I].Name); + if PlayerInfo.Playerinfo[I].Enabled then + begin + if (Player[I].ScoreTotalI<=10000) then + PlayerInfo.Playerinfo[I].Score:= Player[I].ScoreTotalI; + PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; + end; + end; + +//Show Score +if DLLMan.Selected.ShowScore then +begin + //ScoreBG Mod + // set player colors + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + Static[StaticP1].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + + + + LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, + Static[StaticP1ScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + Static[StaticP1].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P4Dark'); + + + + LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, + Static[StaticP1ScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); + + + + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + Static[StaticP1].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P3Dark'); + + + + LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, + Static[StaticP1ScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, + Static[StaticP1].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P6Dark'); + + + + + LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, + Static[StaticP1ScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); + + + + + end; + end; + //end ScoreBG Mod + +// set player names (for 2 screens and only Singstar skin) + if ScreenAct = 1 then begin + Text[TextP1].Text := 'P1'; + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; + end; + + if ScreenAct = 2 then begin + case PlayersPlay of + 4: begin + Text[TextP1].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 6: begin + Text[TextP1].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end; + end; // case + end; // if + + + // stereo + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + + Text[TextP1].X := Text[TextP1].X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; + Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + + Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; + + // .. and scores + if PlayersPlay = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + end; + + if PlayersPlay = 2 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + + if PlayersPlay = 3 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + + Tekst := IntToStr(Player[4].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[5].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + end; + +end; //ShowScore + + for S := 1 to 1 do + Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X + 10*ScreenX; + +if DLLMan.Selected.LoadSong then +begin + // update static menu with time ... + Min := Round(Czas.Teraz) div 60; + Sec := Round(Czas.Teraz) mod 60; + Text[TextTime].Text := ''; + if Min < 10 then Text[TextTime].Text := '0'; + Text[TextTime].Text := Text[TextTime].Text + IntToStr(Min) + ':'; + if Sec < 10 then Text[TextTime].Text := Text[TextTime].Text + '0'; + Text[TextTime].Text := Text[TextTime].Text + IntToStr(Sec); +end; + + // draw static menu (BG) + DrawBG; + + //Draw Background + if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) then + SingDrawBackground; + + // update and draw movie + if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin + UpdateSmpeg; // this only draws + end; + + // draw static menu (FG) + DrawFG; + + if ShowFinish then begin + if DllMan.Selected.LoadSong then + begin + if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + //Pause Mod: + if not Paused then + Sing(Self); // analyze song + end else begin + if not FadeOut then begin + Finish; + FadeOut := true; + FadeTo(@ScreenPartyScore); + end; + end; + end; + end; + + // draw custom items + SingModiDraw(PlayerInfo); // always draw + + //Update PlayerInfo + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + if PlayerInfo.Playerinfo[I].Enabled then + begin + PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; + PlayerInfo.Playerinfo[I].Score := Player[I].ScoreTotalI; + end; + end; + + if ((ShowFinish) AND (NOT Paused)) then + begin + if not DLLMan.PluginDraw(Playerinfo, Czesci[0].Akt) then + begin + if not FadeOut then begin + Finish; + FadeOut := true; + FadeTo(@ScreenPartyScore); + end; + end; + end; + + //Change PlayerInfo/Changeables + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + if (Player[I].ScoreTotalI <> PlayerInfo.Playerinfo[I].Score) then + begin + //Player[I].ScoreTotal := Player[I].ScoreTotal + (PlayerInfo.Playerinfo[I].Score - Player[I].ScoreTotalI); + Player[I].ScoreTotalI := PlayerInfo.Playerinfo[I].Score; + end; + if (PlayerInfo.Playerinfo[I].Bar <> Player[I].ScorePercent) then + Player[I].ScorePercentTarget := PlayerInfo.Playerinfo[I].Bar; + end; + + // back stereo + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; + + + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; + + + + Text[TextP1].X := Text[TextP1].X - 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; + + + + Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; + + + + Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; + + for S := 1 to 1 do + Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X - 10*ScreenX; + + +end; + +procedure TScreenSingModi.Finish; +begin +inherited Finish; + +Winner := DllMan.PluginFinish(PlayerInfo); + +//Log.LogError('Winner: ' + InttoStr(Winner)); + +//DLLMan.UnLoadPlugin; +end; + +function LoadTex (const Name, Typ: PChar): TsmallTexture; stdcall; +var + Texname, EXT: String; + Tex: TTexture; +begin + //Get texture Name + TexName := Skin.GetTextureFileName(String(Name)); + //Get File Typ + Ext := ExtractFileExt(TexName); + if (uppercase(Ext) = '.JPG') then + Ext := 'JPG' + else + Ext := 'BMP'; + + Tex := Texture.LoadTexture(PChar(TexName), PChar(Ext), Typ, 0); + + Result.TexNum := Tex.TexNum; + Result.W := Tex.W; + Result.H := Tex.H; + Result.ScaleW := Tex.ScaleW; + Result.ScaleH := Tex.ScaleH; +end; +{ +function Translate (const Name: PChar): PChar; stdcall; +begin + Result := PChar(Language.Translate(String(Name))); +end; } + +procedure Print (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text +begin + SetFontItalic ((Style and 128) = 128); + SetFontStyle(Style and 7); + SetFontSize(Size); + SetFontPos (X, Y); + glPrint (PChar(Language.Translate(String(Text)))); +end; + +function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound +begin + Result := Music.LoadCustomSound(String(Name)); +end; + +procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound +begin + Music.PlayCustomSound(Index); +end; + +end. diff --git a/Game/Code/Screens/UScreenSong.dcu b/Game/Code/Screens/UScreenSong.dcu new file mode 100644 index 00000000..abc9cc4f Binary files /dev/null and b/Game/Code/Screens/UScreenSong.dcu differ diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas new file mode 100644 index 00000000..0d7860a7 --- /dev/null +++ b/Game/Code/Screens/UScreenSong.pas @@ -0,0 +1,1690 @@ +unit UScreenSong; + +interface + +uses + UMenu, SDL, UMusic, UPliki, UTime, UDisplay, USongs, SysUtils, ULog, UThemes, UTexture, ULanguage, + ULCD, ULight, UIni; + +type + TScreenSong = class(TMenu) + public + TextArtist: integer; + TextTitle: integer; + TextNumber: integer; + + TextCat: integer; + StaticCat: integer; + + SongCurrent: real; + SongTarget: real; + + HighSpeed: boolean; + CoverFull: boolean; + CoverTime: real; + CoverX: integer; + CoverY: integer; + CoverW: integer; + is_jump: boolean; // Jump to Song Mod + is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title + + EqualizerBands: array of Byte; + EqualizerTime: Cardinal; + EqualizerTime2: Byte; + + //Party Mod + Mode: Byte; //0 = Standard, 1= Go to PartyMode after Selection + Change to Random Song at Show + //party Statics (Joker) + StaticTeam1Joker1: Cardinal; + StaticTeam1Joker2: Cardinal; + StaticTeam1Joker3: Cardinal; + StaticTeam1Joker4: Cardinal; + StaticTeam1Joker5: Cardinal; + + StaticTeam2Joker1: Cardinal; + StaticTeam2Joker2: Cardinal; + StaticTeam2Joker3: Cardinal; + StaticTeam2Joker4: Cardinal; + StaticTeam2Joker5: Cardinal; + + StaticTeam3Joker1: Cardinal; + StaticTeam3Joker2: Cardinal; + StaticTeam3Joker3: Cardinal; + StaticTeam3Joker4: Cardinal; + StaticTeam3Joker5: Cardinal; + + constructor Create; override; + procedure SetScroll; + procedure SetScroll1; + procedure SetScroll2; + procedure SetScroll3; + procedure SetScroll4; + procedure SetScroll5; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onShow; override; + procedure SelectNext; + procedure SelectPrev; + procedure UpdateLCD; + procedure SkipTo(Target: integer); + procedure FixSelected; //Show Wrong Song when Tabs on Fix + procedure FixSelected2; //Show Wrong Song when Tabs on Fix + procedure ShowCatTL(Cat: Integer);// Show Cat in Tob left + procedure HideCatTL;// Show Cat in Tob left + procedure Refresh; //Refresh Song Sorting + procedure DrawEqualizer; + //Party Mode + procedure SelectRandomSong; + procedure SetJoker; + + //procedures for Menu + procedure StartSong; + procedure OpenEditor; + procedure DoJoker(Team: Byte); + end; + +implementation +uses UGraphic, UMain, UCovers, math, OpenGL12, Windows, USkins, UDLLManager, UParty, UScreenSongMenu; + +// ***** Public methods ****** // + +//Show Wrong Song when Tabs on Fix +procedure TScreenSong.FixSelected; +var I, I2: Integer; + begin + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); + + if I = Interaction - 1 then + break; + end; + + SongCurrent := I2; + SongTarget := I2; + end; + +procedure TScreenSong.FixSelected2; +var I, I2: Integer; + begin + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); + + if I = Interaction - 1 then + break; + end; + + SongTarget := I2; + end; +//Show Wrong Song when Tabs on Fix End + + //Show Cat in Top Left Mod + procedure TScreenSong.ShowCatTL(Cat: Integer); + begin + //Change + Text[TextCat].Text := CatSongs.Song[Cat].Artist; + //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover); + //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); + + Static[StaticCat].Texture := Texture.GetTexture(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover, 'Plain', true); + //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false); + //Button[Cat]. + //Cover + + + //Show + Text[TextCat].Visible := true; + Static[StaticCat].Visible := True; + end; + procedure TScreenSong.HideCatTL; + begin + //Hide + Text[TextCat].Visible := false; + Static[StaticCat].Visible := false; + end; + //Show Cat in Top Left Mod End + + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenSong.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var + I: integer; + I2: integer; + HS: integer; + SDL_ModState: Word; + Letter: Char; +begin + Result := true; + + //Song Menu + if (ScreenSongMenu.Visible) then + begin + Result := ScreenSongMenu.ParseInput(PressedKey, ScanCode, PressedDown); + Exit; + end; + + If (PressedDown) Then + begin // Key Down + +// HS := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT); +{ if (not HighSpeed) and (HS > 0) then begin + HighSpeed := true; + SDL_EnableKeyRepeat(50, 50); + end; + if (HighSpeed) and (HS = 0) then begin + HighSpeed := false; + SDL_EnableKeyRepeat(125, 125); + end;} + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + + // Jump to Key Mod + if (SDL_ModState = KMOD_LALT) AND (Mode = 0) then //Jump to Key + begin + //get Letter + case PressedKey of + SDLK_A : Letter := 'A'; + SDLK_B : Letter := 'B'; + SDLK_C : Letter := 'C'; + SDLK_D : Letter := 'D'; + SDLK_E : Letter := 'E'; + SDLK_F : Letter := 'F'; + SDLK_G : Letter := 'G'; + SDLK_H : Letter := 'H'; + SDLK_I : Letter := 'I'; + SDLK_J : Letter := 'J'; + SDLK_K : Letter := 'K'; + SDLK_L : Letter := 'L'; + SDLK_M : Letter := 'M'; + SDLK_N : Letter := 'N'; + SDLK_O : Letter := 'O'; + SDLK_P : Letter := 'P'; + SDLK_Q : Letter := 'Q'; + SDLK_R : Letter := 'R'; + SDLK_S : Letter := 'S'; + SDLK_T : Letter := 'T'; + SDLK_U : Letter := 'U'; + SDLK_V : Letter := 'V'; + SDLK_W : Letter := 'W'; + SDLK_X : Letter := 'X'; + SDLK_Y : Letter := 'Y'; + SDLK_Z : Letter := 'Z'; + SDLK_1 : Letter := '1'; + SDLK_2 : Letter := '2'; + SDLK_3 : Letter := '3'; + SDLK_4 : Letter := '4'; + SDLK_5 : Letter := '5'; + SDLK_6 : Letter := '6'; + SDLK_7 : Letter := '7'; + SDLK_8 : Letter := '8'; + SDLK_9 : Letter := '9'; + SDLK_0 : Letter := '0'; + else exit; + end; + + {//Search Letter + for I := Interaction + 1 to high(CatSongs.Song) do + begin + if CatSongs.Song[I].Visible and (Letter = Uppercase(CatSongs.Song[I].Artist)[1]) then + break; //Found Song + if I = Interaction then //went through complete array but nothing Found + break; + if I = high(CatSongs.Song) then //At the end of the array->Go to beginning + for I2 := low(CatSongs.Song) to Interaction do + if CatSongs.Song[I].Visible and (Letter = Uppercase(CatSongs.Song[I].Artist)[1]) then + break; //Found Song + end; } + + for I := 0 to High(CatSongs.Song) do begin + if (CatSongs.Song[I].Visible) AND (UpperCase(CatSongs.Song[I].Artist[1]) = Letter) then + begin + //Select Song + Interaction := I; + SkipTo(Interaction); + break; + end; + end; + + //Don't do other Functions + exit; + end; + + if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then //Jump to Key + begin + //get Letter + case PressedKey of + SDLK_a..SDLK_z : Letter := Chr(Ord('a')+PressedKey-97); + SDLK_1 : Letter := '1'; + SDLK_2 : Letter := '2'; + SDLK_3 : Letter := '3'; + SDLK_4 : Letter := '4'; + SDLK_5 : Letter := '5'; + SDLK_6 : Letter := '6'; + SDLK_7 : Letter := '7'; + SDLK_8 : Letter := '8'; + SDLK_9 : Letter := '9'; + SDLK_0 : Letter := '0'; + else exit; + end; + + {//Search Letter + for I := Interaction + 1 to high(CatSongs.Song) do + begin + if CatSongs.Song[I].Visible and (Letter = Uppercase(CatSongs.Song[I].Artist)[1]) then + break; //Found Song + if I = Interaction then //went through complete array but nothing Found + break; + if I = high(CatSongs.Song) then //At the end of the array->Go to beginning + for I2 := low(CatSongs.Song) to Interaction do + if CatSongs.Song[I].Visible and (Letter = Uppercase(CatSongs.Song[I].Artist)[1]) then + break; //Found Song + end; } + + {for I := 0 to High(CatSongs.Song) do begin + if (CatSongs.Song[I].Visible) AND (UpperCase(CatSongs.Song[I].Artist[1]) = Letter) then} + + for I := Interaction + 1 to high(CatSongs.Song) + 1 do + begin + if (I > high(CatSongs.Song)) then + begin + for I2 := low(CatSongs.Song) to Interaction do + begin + if CatSongs.Song[I2].Visible and (Letter = lowercase(CatSongs.Song[I2].Artist[1])) then + begin + Interaction := I2; + break; //Found Song + end; + end; + break; + end + else if CatSongs.Song[I].Visible and (Letter = lowercase(CatSongs.Song[I].Artist[1])) then + begin + Interaction := I; + break; //Found Song + end; + end; + + + //Select Song + SkipTo(Interaction); + + //Don't do other Functions + exit; + end; + + + case PressedKey of + SDLK_ESCAPE : + begin + if (Mode = 0) then + begin + //On Escape goto Cat-List Hack + if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then + begin + //Find Category + I := Interaction; + while not catsongs.Song[I].Main do + begin + Dec (I); + if (I < low(catsongs.Song)) then + break; + end; + if (I<= 1) then + Interaction := high(catsongs.Song) + else + Interaction := I - 1; + + //Stop Music + Music.Stop; + + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + HideCatTL; + + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + //SelectPrev; + //CatSongs.Song[0].Visible := False; + end + else + begin + //On Escape goto Cat-List Hack End + Music.Stop; + Music.PlayBack; +// FadeTo(@ScreenLevel); + FadeTo(@ScreenMain); + +// Music.Open(Skin.SkinPath + 'Menu Music 3.mp3'); +// Music.Play; + end; + end; + end; + SDLK_RETURN: + begin + if Length(Songs.Song) > 0 then begin +// PortWriteB($378, 0); + if CatSongs.Song[Interaction].Main then begin // clicked on Category Button + + //Show Cat in Top Left Mod + ShowCatTL (Interaction); + + //I := CatSongs.VisibleIndex(Interaction); + CatSongs.ClickCategoryButton(Interaction); + {I2 := CatSongs.VisibleIndex(Interaction); + SongCurrent := SongCurrent - I + I2; + SongTarget := SongTarget - I + I2; } + +// if I<>I2 then beep; + // SetScroll4; + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + + //Play Music: + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + Music.Play; + end; + + end else begin // clicked on song + if (Mode = 0) then //Normal Mode -> Start Song + begin + StartSong; + + end + else if (Mode = 1) then //PartyMode -> Show Menu + begin + ScreenSongMenu.Visible := True; + ScreenSongMenu.MenuShow(SM_Party_Main); + end; + end; + end; + end; + + SDLK_M: //Show SongMenu + begin + if Length(Songs.Song) > 0 then begin + if not CatSongs.Song[Interaction].Main then begin // clicked on Song + ScreenSongMenu.Visible := True; + ScreenSongMenu.MenuShow(SM_Main); + end; + end; + end; + + SDLK_DOWN: + begin + if (Mode = 0) then + begin +{ if Length(Songs.Song) > 0 then begin + Music.PlayChange; + InteractNext; + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then Music.Play; + SetScroll; + end;} + + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then + begin + I := Interaction; + if I <= 0 then I := 1; + + while not catsongs.Song[I].Main do + begin + Inc (I); + if (I > high(catsongs.Song)) then + I := low(catsongs.Song); + end; + + Interaction := I; + + //Show Cat in Top Left Mod + ShowCatTL (Interaction); + + CatSongs.ClickCategoryButton(Interaction); + SelectNext; + FixSelected; + + //Play Music: + Music.PlayChange; + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + Music.Play; + end; + + end; + + // + //Cat Change Hack End} + end; + end; + SDLK_UP: + begin + if (Mode = 0) then + begin +{ if Length(Songs.Song) > 0 then begin + Music.PlayChange; + InteractPrev; + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then Music.Play; + SetScroll; + end;} + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then + begin + I := Interaction; + I2 := 0; + if I <= 0 then I := 1; + + while not catsongs.Song[I].Main or (I2 = 0) do + begin + if catsongs.Song[I].Main then + Inc(I2); + Dec (I); + if (I < low(catsongs.Song)) then + I := high(catsongs.Song); + end; + + Interaction := I; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + + //Play Music: + Music.PlayChange; + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + Music.Play; + end; + + end; + + // + //Cat Change Hack End} + end; + end; + + SDLK_RIGHT: + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + Music.PlayChange; + SelectNext; +// InteractNext; +// SongTarget := Interaction; + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + Music.Play; + end; + SetScroll4; + UpdateLCD; + Light.LightOne(1, 200); + end; + end; + + SDLK_LEFT: + begin + if (Length(Songs.Song) > 0)AND (Mode = 0) then begin + Music.PlayChange; + SelectPrev; + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + Music.Play; + end; + SetScroll4; + UpdateLCD; + Light.LightOne(0, 200); + end; + end; + + SDLK_E: + begin + OpenEditor; + end; + + SDLK_R: + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + + if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category + begin + I2 := 0; //Count Cats + for I:= low(CatSongs.Song) to high (CatSongs.Song) do + if CatSongs.Song[I].Main then Inc(I2); + + I2 := Random (I2)+1; //Zufall + + //Find Cat: + for I:= low(CatSongs.Song) to high (CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + Dec(I2); + if (I2<=0) then + begin + //Show Cat in Top Left Mod + ShowCatTL (I); + + Interaction := I; + + CatSongs.ShowCategoryList; + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + break; + end; + end; + + + end + else if (SDL_ModState = KMOD_LCTRL) AND (Ini.Tabs_at_startup = 1) then //random in All Categorys + begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; + + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + + //Choose Cat + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Fix: Not Existing Song selected: + if (I+1=I2) then Inc(I2); + + //Choose Song + SkipTo(I2-I); + + end + else //Random in one Category + begin + SkipTo(2+Random(CatSongs.VisibleSongs-1)); + end; + Music.PlayChange; + + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + Music.Play; + end; + SetScroll4; + UpdateLCD; + end; + end; + + SDLK_1: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[0].Joker); + SelectRandomSong; + SetJoker; + end; + end; + + SDLK_2: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[1].Joker); + SelectRandomSong; + SetJoker; + end; + end; + + SDLK_3: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[2].Joker); + SelectRandomSong; + SetJoker; + end; + end; + + SDLK_Q: + begin + Result := false; + end; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN : + begin + end; + end; +end; + +constructor TScreenSong.Create; +var + Pet: integer; + I: integer; +begin + inherited Create; + +// AddStatic(200, 10, 400, 90, Skin.SelectSong); +// AddStatic(200-10, 140-5, 400+20, 50+10, Skin.Selection, 'JPG', 'Font Gray'); + + AddBackground(Theme.Song.Background.Tex); + + for I := 0 to High(Theme.Song.Static) do + AddStatic(Theme.Song.Static[I]); + + for I := 0 to High(Theme.Song.Text) do + AddText(Theme.Song.Text[I]); + + TextArtist := AddText(Theme.Song.TextArtist); + TextTitle := AddText(Theme.Song.TextTitle); + TextNumber := AddText(Theme.Song.TextNumber); + + //Show Cat in Top Left mod + TextCat := AddText(Theme.Song.TextCat); + StaticCat := AddStatic(Theme.Song.StaticCat); + + //Party Mode + StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1); + StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2); + StaticTeam1Joker3 := AddStatic(Theme.Song.StaticTeam1Joker3); + StaticTeam1Joker4 := AddStatic(Theme.Song.StaticTeam1Joker4); + StaticTeam1Joker5 := AddStatic(Theme.Song.StaticTeam1Joker5); + + StaticTeam2Joker1 := AddStatic(Theme.Song.StaticTeam2Joker1); + StaticTeam2Joker2 := AddStatic(Theme.Song.StaticTeam2Joker2); + StaticTeam2Joker3 := AddStatic(Theme.Song.StaticTeam2Joker3); + StaticTeam2Joker4 := AddStatic(Theme.Song.StaticTeam2Joker4); + StaticTeam2Joker5 := AddStatic(Theme.Song.StaticTeam2Joker5); + + StaticTeam3Joker1 := AddStatic(Theme.Song.StaticTeam3Joker1); + StaticTeam3Joker2 := AddStatic(Theme.Song.StaticTeam3Joker2); + StaticTeam3Joker3 := AddStatic(Theme.Song.StaticTeam3Joker3); + StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); + StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); + + // Song List +// Songs.LoadSongList; // moved to the UltraStar unit + CatSongs.Refresh; + for Pet := 0 to High(CatSongs.Song) do begin // creating all buttons + // new + Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 + + if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' + + if CatSongs.Song[Pet].Cover = '' then + AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) + else begin + // cache texture if there is a need to this + if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then begin + Texture.CreateCacheMipmap := true; + Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap + Texture.CreateCacheMipmap := false; + + // puts this texture to the cache file + Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + + // unload full size texture + Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); + + // we should also add mipmap texture by calling createtexture and use mipmap cache as data source + end; + + // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) + AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + end; + Texture.Limit := 1024*1024; + + +// AddButtonText(11, 10, CatSongs.Song[Pet].Title); // new way + end; +// Covers.Save; + + { if Length(CatSongs.Song) > 0 then // setting to first song + Interaction := 0 + else begin // no song detected + AddButton(400-200, 140, 400, 50, Skin.Button, 'JPG', 'Transparent Range'); + AddButtonText(11, 10, 'No songs detected'); + end;} + + // Randomize Patch + Randomize; + //Equalizer + SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); + //ClearArray + For I := low(EqualizerBands) to high(EqualizerBands) do + EqualizerBands[I] := 3; +end; + +procedure TScreenSong.SetScroll; +begin +//Set Positions + Case Theme.Song.Cover.Style of + 3: SetScroll3; + 5: SetScroll5 + else SetScroll4; + end; +//Set Texts: + Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; + Text[TextTitle].Text := CatSongs.Song[Interaction].Title; + if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then + begin + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); + Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; + end + else if (Ini.Tabs_at_startup = 1) then + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) + else + Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); +end; + +procedure TScreenSong.SetScroll1; +var + B: integer; // button + BMin: integer; // button min + BMax: integer; // button max + Src: integer; +// Dst: integer; + Count: integer; // Dst is not used. Count is used. + Ready: boolean; + + VisCount: integer; // count of visible (or selectable) buttons + VisInt: integer; // visible position of interacted button + Typ: integer; // 0 when all songs fits the screen + Placed: integer; // number of placed visible buttons +begin +// Src := 0; +// Dst := -1; + Count := 1; + Typ := 0; + Ready := false; + Placed := 0; + + VisCount := 0; + for B := 0 to High(Button) do + if CatSongs.Song[B].Visible then Inc(VisCount); + + VisInt := 0; + for B := 0 to Interaction-1 do + if CatSongs.Song[B].Visible then Inc(VisInt); + + + if VisCount <= 6 then begin + Typ := 0; + end else begin + if VisInt <= 3 then begin + Typ := 1; + Count := 7; + Ready := true; + end; + + if (VisCount - VisInt) <= 3 then begin + Typ := 2; + Count := 7; + Ready := true; + end; + + if not Ready then begin + Typ := 3; + Src := Interaction; + end; + end; + + + + // hide all buttons + for B := 0 to High(Button) do begin + Button[B].Visible := false; + Button[B].Selectable := CatSongs.Song[B].Visible; + end; + +{ for B := Src to Dst do begin +// Button[B].Visible := true; + Button[B].Visible := CatSongs.Song[B].Visible; + Button[B].Selectable := Button[B].Visible; + Button[B].Y := 140 + (B-Src) * 60; + end;} + + + if Typ = 0 then begin + for B := 0 to High(Button) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (Placed) * 60; + Inc(Placed); + end; + end; + end; + + if Typ = 1 then begin + B := 0; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Inc(B); + end; + end; + + if Typ = 2 then begin + B := High(Button); + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (6-Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Dec(B); + end; + end; + + if Typ = 3 then begin + B := Src; + Count := 4; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (3+Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Inc(B); + end; + + B := Src-1; + Placed := 0; + Count := 3; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (2-Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Dec(B); + end; + + end; + + if Length(Button) > 0 then + Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture +end; + +procedure TScreenSong.SetScroll2; +var + B: integer; + Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu + Wsp2: real; +begin + // liniowe + for B := 0 to High(Button) do + Button[B].X := 300 + (B - Interaction) * 260; + + if Length(Button) >= 3 then begin + if Interaction = 0 then + Button[High(Button)].X := 300 - 260; + + if Interaction = High(Button) then + Button[0].X := 300 + 260; + end; + + // kolowe +{ for B := 0 to High(Button) do begin + Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. + Wsp2 := Wsp / Length(Button); + Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); +// Button[B].Y := 140 + 50 * ; + end;} +end; + +procedure TScreenSong.SetScroll3; // with slide +var + B: integer; + Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu + Wsp2: real; +begin + SongTarget := Interaction; + + // liniowe + for B := 0 to High(Button) do + begin + Button[B].X := 300 + (B - SongCurrent) * 260; + if (Button[B].X < -Button[B].W) OR (Button[B].X > 800) then + Button[B].Visible := False + else + Button[B].Visible := True; + end; + +{ if Length(Button) >= 3 then begin + if Interaction = 0 then + Button[High(Button)].X := 300 - 260; + + if Interaction = High(Button) then + Button[0].X := 300 + 260; + end;} + + // kolowe +{ for B := 0 to High(Button) do begin + Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. + Wsp2 := Wsp / Length(Button); + Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); +// Button[B].Y := 140 + 50 * ; + end;} +end; + +procedure TScreenSong.SetScroll4; // rotate +var + B: integer; + Wsp: real; + Z, Z2: real; + VS: integer; +begin + VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important + + // kolowe + for B := 0 to High(Button) do begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + +// Wsp := 2 * pi * (B - SongCurrent) / Length(Button); +// Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - 0) / CatSongs.VisibleSongs; + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2; + Z2 := (1 + 2*Z) / 3; + + Button[B].X := Theme.Song.Cover.X + (300 + 37 * VS {CatSongs.VisibleSongs} {Length(Button)} * sin(Wsp) - 400) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z; + + Button[B].H := Theme.Song.Cover.H * Z2; + Button[B].W := Button[B].H; + +// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; + Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.65; + end; + end; +end; + +{procedure TScreenSong.SetScroll4; // rotate +var + B: integer; + Wsp: real; + Z: real; + Z2, Z3: real; + VS: integer; + function modreal (const X, Y: real):real; + begin + Result := Frac(x / y) * y; + if Result < -3 then + Result := Result + Y + else if Result > 3 then + Result := Result - Y; + end; +begin + VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important + Z3 := 1; + if VS < 12 then + Z2 := VS + else + Z2 := 12; + + // kolowe + for B := 0 to High(Button) do begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + if ((ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)>-3) AND (ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)<3)) then + begin + if CatSongs.VisibleIndex(B)> SongCurrent then + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2 + else + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2; + + Z3 := 2; + Z := (1 + cos(Wsp)) / 2; + //Z2 := (1 + 2*Z) / 3; + //Z2 := (0.5 + Z/2); + //Z2 := sin(Wsp); + + //Z2 := Power (Z2,Z3); + + Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); + + //Button[B].X := Theme.Song.CoverX + ({Theme.Song.CoverX + Theme.Song.CoverW/2 + Theme.Song.CoverW*0.18 * VS {CatSongs.VisibleSongs {Length(Button) * sin(Wsp) {- Theme.Song.CoverX - Theme.Song.CoverW) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + if (sin(Wsp)<0) then + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W + else //*Theme.Song.CoverW*0.004*Z3 + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; + Button[B].Z := Z-0.00001; + +// Button[B].Y := {50 + 140 + 50 - 50 * Z2; + // Button[B].Y := (Theme.Song.CoverY + 40 + 50 - 50 * Z2); + Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); + Button[B].H := Button[B].W; + Button[B].Visible := True; + end + {else if (((CatSongs.VisibleIndex(B) - SongCurrent)>-3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) OR ((round (CatSongs.VisibleIndex(B) - SongCurrent) mod VS > -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) then + begin + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / 12 ;// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2 -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); + + if (sin(Wsp)<0) then + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W + else + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; + + Button[B].Z := Z; + + Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); + + Button[B].H := Button[B].W; + Button[B].Visible := True; + end + else Button[B].Visible := False; + end; + end; +end; } + +procedure TScreenSong.SetScroll5; // rotate +var + B: integer; + Angle: real; + Pos: Real; + VS: integer; + diff: real; + X: Real; + {function margin (const X, Y, VS: real):real; //Margin of to Buttons + begin + Result := Frac(x / y) * y; + if (X - VS) >= -3 then + Result := X - VS - Y + else if (X + 3) >= VS then + Result := X - VS + Y + else + Result := X - Y; + end; } +begin + VS := CatSongs.VisibleSongs; // cache Visible Songs + {Vars + Theme.Song.CoverW: Radius des Kreises + Theme.Song.CoverX: X Pos Linke Kante des gewählten Covers + Theme.Song.CoverX: Y Pos Obere Kante des gewählten Covers + Theme.Song.CoverH: Höhe der Cover + + (CatSongs.VisibleIndex(B) - SongCurrent)/VS = Abstand zum MIttleren Cover in % + } + + //Change Pos of all Buttons + for B := low(Button) to high(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visability + if Button[B].Visible then //Only Change Pos for Visible Buttons + begin + Pos := (CatSongs.VisibleIndex(B) - SongCurrent); + if (Pos < -VS) then + Pos := Pos + VS + else if (Pos > VS) then + Pos := Pos - VS; + + if (Abs(Pos) < 3) then {fixed Positions} + begin + Angle := Pi * (Pos / 5); + //Button[B].Visible := False; + + Button[B].H := Theme.Song.Cover.H * cos(Angle);//Power(Z2, 3); + + Button[B].Z := 0.95 - Abs(Pos) * 0.01; + + Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); + + Button[B].W := Button[B].H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2;; + + if (X < 0) then + Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Sin(Angle){ - Theme.Song.Cover.H/2} - Diff + else + Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Sin(Angle){ - Theme.Song.Cover.H/2}- Diff; + + Button[B].Visible := True; + end + else + begin {Behind the Front Covers} + //Button[B].Visible := False; + Pos := Frac(Pos / VS); + if Pos < 0 then + Pos := Pos + 1; + + Angle := Abs(2 * pi * ((Pos) / VS / 2)); + //Pos := Power(Pos*2 - 1, 3); + + Button[B].Z := (0.2 + Pos/2) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + //Pos := abs(Pos) mod 1; + + X := sin(Angle); + //Button[B].H := (0.2 + 0.4 * Abs(Pos)) * Theme.Song.Cover.H; //Cover High + Width + Button[B].H := 80; + Button[B].W := Button[B].H; + + Diff := (Theme.Song.Cover.H - Button[B].H)/2; + + //Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.W) * Sin(Angle) - diff + //Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Pos - Diff; + + if (X < 0) then + Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Sin(Angle) - Theme.Song.Cover.H/2 + Diff + else + Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Sin(Angle) - Theme.Song.Cover.H/2; + + end; + + Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field + + {X := sin(Angle); + + Button[B].H := (0.5 + Power(cos(Angle), 1.7))/1.5 * Theme.Song.Cover.H; //Cover High + Width + Button[B].W := Button[B].H; + + {if (X < 0) then + Diff := Theme.Song.Cover.H - Button[B].H + else + Diff := 0; + + if (((CatSongs.VisibleIndex(B) - SongCurrent)>= -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent) <= 3)) OR (((CatSongs.VisibleIndex(B) - SongCurrent)>= -3 + VS) AND ((CatSongs.VisibleIndex(B) - SongCurrent) <= 3 + VS)) OR (((CatSongs.VisibleIndex(B) - SongCurrent)>= -3 - VS) AND ((CatSongs.VisibleIndex(B) - SongCurrent) <= 3 - VS)) then + Button[B].X := Theme.Song.Cover.X + diff + margin(CatSongs.VisibleIndex(B), SongCurrent, VS)* 30 + else + Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X + diff;}{ + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + if X < 0 then + Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.W) * -Power(-X, 1/2) - diff + else + Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.W) * Power(X, 1/2) - diff;} + end; + end; +end; + +procedure TScreenSong.onShow; +begin + Music.Stop; + + if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; + if Ini.Players = 4 then PlayersPlay := 6; + + //Cat Mod etc + if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then + begin + CatSongs.ShowCategoryList; + SelectNext;SelectPrev; //Workaround <- must be fixed sometime + FixSelected; + //Show Cat in Top Left Mod + HideCatTL; + end; + + + if Length(CatSongs.Song) > 0 then begin + Music.SetLoop(false); + Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + Music.MoveTo(Music.Length / 4); + Music.Play; + SetScroll; + UpdateLCD; + end; + + //Party Mode + if (Mode = 1) then + begin + SelectRandomSong; + end; + + SetJoker; +end; + +function TScreenSong.Draw: boolean; +var + dx: real; + dt: real; +begin + dx := SongTarget-SongCurrent; + dt := TimeSkip*7; + if dt > 1 then dt := 1; + SongCurrent := SongCurrent + dx*dt; + +{ if SongCurrent > Catsongs.VisibleSongs then begin + SongCurrent := SongCurrent - Catsongs.VisibleSongs; + SongTarget := SongTarget - Catsongs.VisibleSongs; + end;} + +// Log.BenchmarkStart(5); + SetScroll; +// Log.BenchmarkEnd(5); +// Log.LogBenchmark('SetScroll4', 5); + + + // 0.5.0: cover fade + if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin + // load new texture + Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture.Alpha := 1; + Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture2.Alpha := 1; + end; + CoverTime := CoverTime + TimeSkip; + Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; + if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; + + inherited Draw; + + //Draw Equalizer + if Theme.Song.Equalizer.Visible then + DrawEqualizer; + + //Draw Song Menu + if (ScreenSongMenu.Visible) then + begin + ScreenSongMenu.Draw; + end; +end; + +procedure TScreenSong.SelectNext; +var + Skip: integer; + I: integer; +begin + CoverTime := 0; + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture + Button[Interaction].Texture2.Alpha := 0; + + //0.5.0: unload old full size texture + if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then + Texture.UnloadTexture(Button[Interaction].Texture.Name, false); + + Skip := 1; + + // this 1 could be changed by CatSongs.FindNextVisible + while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); + SongTarget := SongTarget + 1;//Skip; + + Interaction := (Interaction + Skip) mod Length(Interactions); + + // try to keep all at the beginning + if SongTarget > CatSongs.VisibleSongs-1 then begin + SongTarget := SongTarget - CatSongs.VisibleSongs; + SongCurrent := SongCurrent - CatSongs.VisibleSongs; + end; + + // Interaction -> Button, ktorego okladke przeczytamy +// Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture +end; + +procedure TScreenSong.SelectPrev; +var + Skip: integer; + I: integer; +begin + CoverTime := 0; + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture + Button[Interaction].Texture2.Alpha := 0; + + //0.5.0: unload old full size texture + if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then + Texture.UnloadTexture(Button[Interaction].Texture.Name, false); + + Skip := 1; + + while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); + SongTarget := SongTarget - 1;//Skip; + + Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); + + // try to keep all at the beginning + if SongTarget < 0 then begin + SongTarget := SongTarget + CatSongs.VisibleSongs; + SongCurrent := SongCurrent + CatSongs.VisibleSongs; + end; + +// Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture +end; + +procedure TScreenSong.UpdateLCD; +begin + LCD.HideCursor; + LCD.Clear; + LCD.WriteText(1, Text[TextArtist].Text); + LCD.WriteText(2, Text[TextTitle].Text); +end; + +procedure TScreenSong.SkipTo(Target: integer); // 0.5.0 +var + Skip: integer; + I: integer; +begin + CoverTime := 0; + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture + Button[Interaction].Texture2.Alpha := 0; + + if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then + Texture.UnloadTexture(Button[Interaction].Texture.Name, false); + + Interaction := 0; + SongTarget := 0; + + for I := 2 to Target do + SelectNext; + + FixSelected2; +end; + +procedure TScreenSong.DrawEqualizer; +var + Data: TFFTData; //Audio Data + I, J: Integer; + Res: byte; + A, B: Integer; + PosX, PosY: Integer; + Pos: Real; +begin +if (not Music.Finished) AND (Theme.Song.Equalizer.Length > 0) then +begin + + + A := GetTickCount div 44; + + if (A <> EqualizerTime) then + begin + EqualizerTime := A; + Data := Music.GetFFTData; + + B:=0; + Pos := 0; + Res := floor(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band + //Change Lengths + for I := 0 to 92 do + begin + A := floor(I/Res); + + if (A<>B) then //Band changed + begin + if (Pos <= Theme.Song.Equalizer.Length) then + begin + if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then + EqualizerBands[B] := EqualizerBands[B] - 1 + else + EqualizerBands[B] := floor(Pos); + end + else + EqualizerBands[B] := 1; + + B := A; + Pos := 0; + end; + + if I > 35 then + Data[i] := Data[i] * 8 + else if I > 11 then + Data[i] := Data[i] * 4.5 + else + Data[i] := Data[i] * 1.1; + + if (Data[i] >= 1) then + Data[i] := 0.9999999999999; + + if Data[i]*Theme.Song.Equalizer.Length > Pos then + Pos := Data[i]*Theme.Song.Equalizer.Length; + end; + + //Change Last Band + if (EqualizerBands[B] <= Theme.Song.Equalizer.Length) then + begin + if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then + EqualizerBands[B] := EqualizerBands[B] - 1 + else + EqualizerBands[B] := floor(Pos) + end + else + EqualizerBands[B] := 1; + end; + + //Draw every Channel + glColor4f(Theme.Song.Equalizer.ColR, Theme.Song.Equalizer.ColG, Theme.Song.Equalizer.ColB, Theme.Song.Equalizer.Alpha); //Set Color + glDisable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + + PosY := Theme.Song.Equalizer.Y; + PosX := Theme.Song.Equalizer.X; + + For I := 0 to Theme.Song.Equalizer.Bands do + begin + if Theme.Song.Equalizer.Direction then + PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length + else + PosX := Theme.Song.Equalizer.X; + //Draw for every visible quad + for J := 1 to EqualizerBands[I] do + begin + glBegin(GL_QUADS); + glVertex3f(PosX, PosY, Theme.Song.Equalizer.Z); + glVertex3f(PosX, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); + glVertex3f(PosX+Theme.Song.Equalizer.W, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); + glVertex3f(PosX+Theme.Song.Equalizer.W, PosY, Theme.Song.Equalizer.Z); + glEnd; + + if Theme.Song.Equalizer.Direction then //Vertically + PosY := PosY - Theme.Song.Equalizer.H - Theme.Song.Equalizer.Space + else //Horizontally + PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space; + end; + if Theme.Song.Equalizer.Direction then //Horizontally + PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space + else //Vertically + PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space; + end; +end; +end; + +Procedure TScreenSong.SelectRandomSong; +var + I, I2: Integer; +begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; + + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + + //Choose Cat + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Fix: Not Existing Song selected: + if (I+1=I2) then Inc(I2); + + //Choose Song + SkipTo(I2-I); + + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + Music.Play; + end; +end; + +procedure TScreenSong.SetJoker; +begin + //If Party Mode + if Mode = 1 then //Show Joker that are available + begin + if (PartySession.Teams.NumTeams >= 1) then + begin + Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1); + Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2); + Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3); + Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4); + Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5); + end + else + begin + Static[StaticTeam1Joker1].Visible := False; + Static[StaticTeam1Joker2].Visible := False; + Static[StaticTeam1Joker3].Visible := False; + Static[StaticTeam1Joker4].Visible := False; + Static[StaticTeam1Joker5].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 2) then + begin + Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1); + Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2); + Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3); + Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4); + Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5); + end + else + begin + Static[StaticTeam2Joker1].Visible := False; + Static[StaticTeam2Joker2].Visible := False; + Static[StaticTeam2Joker3].Visible := False; + Static[StaticTeam2Joker4].Visible := False; + Static[StaticTeam2Joker5].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 3) then + begin + Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1); + Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2); + Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3); + Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4); + Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5); + end + else + begin + Static[StaticTeam3Joker1].Visible := False; + Static[StaticTeam3Joker2].Visible := False; + Static[StaticTeam3Joker3].Visible := False; + Static[StaticTeam3Joker4].Visible := False; + Static[StaticTeam3Joker5].Visible := False; + end; + end + else + begin //Hide all + Static[StaticTeam1Joker1].Visible := False; + Static[StaticTeam1Joker2].Visible := False; + Static[StaticTeam1Joker3].Visible := False; + Static[StaticTeam1Joker4].Visible := False; + Static[StaticTeam1Joker5].Visible := False; + + Static[StaticTeam2Joker1].Visible := False; + Static[StaticTeam2Joker2].Visible := False; + Static[StaticTeam2Joker3].Visible := False; + Static[StaticTeam2Joker4].Visible := False; + Static[StaticTeam2Joker5].Visible := False; + + Static[StaticTeam3Joker1].Visible := False; + Static[StaticTeam3Joker2].Visible := False; + Static[StaticTeam3Joker3].Visible := False; + Static[StaticTeam3Joker4].Visible := False; + Static[StaticTeam3Joker5].Visible := False; + end; +end; + +//Procedures for Menu + +procedure TScreenSong.StartSong; +begin + CatSongs.Selected := Interaction; + Music.Stop; + //Party Mode + if (Mode = 1) then + begin + FadeTo(@ScreenSingModi); + end + else + begin + FadeTo(@ScreenSing); + end; +end; + +procedure TScreenSong.OpenEditor; +begin + if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin + Music.Stop; + Music.PlayStart; + ScreenEditSub.Path := CatSongs.Song[Interaction].Path; + ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName; + FadeTo(@ScreenEditSub); + end; +end; + +//Team No of Team (0-5) +procedure TScreenSong.DoJoker (Team: Byte); +begin + if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[Team].Joker); + SelectRandomSong; + SetJoker; + end; +end; + +procedure TScreenSong.Refresh; +begin { +CatSongs.Refresh; +CatSongs.ShowCategoryList; +Interaction := 0; +SelectNext; +FixSelected; } + +end; + +end. diff --git a/Game/Code/Screens/UScreenSongMenu.dcu b/Game/Code/Screens/UScreenSongMenu.dcu new file mode 100644 index 00000000..634a217a Binary files /dev/null and b/Game/Code/Screens/UScreenSongMenu.dcu differ diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas new file mode 100644 index 00000000..2a03a7c2 --- /dev/null +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -0,0 +1,355 @@ +unit UScreenSongMenu; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + +type + TScreenSongMenu = class(TMenu) + private + CurMenu: Byte; //Num of the cur. Shown Menu + public + Visible: Boolean; //Whether the Menu should be Drawn + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + function Draw: boolean; override; + procedure MenuShow(sMenu: Byte); + procedure HandleReturn; + end; + +const + SM_Main = 1; + SM_PlayList = 64 or 1; + SM_Party_Main = 128 or 1; + SM_Party_Joker = 128 or 2; + +var + ISelections: Array of String; + SelectValue: Integer; + + +implementation + +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty; + +function TScreenSongMenu.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; + function IsVisible: Boolean; + begin + Result := True; + if (Interactions[Interaction].Typ = 0) then + begin + Result := Button[Interactions[Interaction].Num].Visible; + end + else if (Interactions[Interaction].Typ = 1) then + begin + //Result := Selects[Interactions[Interaction].Num].Visible; + end + else if (Interactions[Interaction].Typ = 3) then + begin + Result := SelectsS[Interactions[Interaction].Num].Visible; + end; + end; + + Procedure SelectNext; + begin + repeat + InteractNext; + until IsVisible; + end; + + Procedure SelectPrev; + begin + repeat + InteractPrev; + until IsVisible; + end; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE : + begin + Music.PlayBack; + Visible := False; + end; + + SDLK_RETURN: + begin + HandleReturn; + 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: SelectNext; + SDLK_UP: SelectPrev; + + SDLK_RIGHT: + begin + if (Interaction=3) then + InteractInc; + end; + SDLK_LEFT: + begin + if (Interaction=3) then + InteractDec; + end; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN : + begin + end; + end; +end; + +constructor TScreenSongMenu.Create; +var + I: integer; +begin + inherited Create; + SetLength(ISelections, 1); + ISelections[0] := 'Dummy'; + + AddBackground(Theme.SongMenu.Background.Tex); + + AddButton(Theme.SongMenu.Button1); + if (Length(Button[0].Text) = 0) then + AddButtonText(14, 20, 'Button 1'); + + AddButton(Theme.SongMenu.Button2); + if (Length(Button[1].Text) = 0) then + AddButtonText(14, 20, 'Button 2'); + + AddButton(Theme.SongMenu.Button3); + if (Length(Button[2].Text) = 0) then + AddButtonText(14, 20, 'Button 3'); + + AddSelectSlide(Theme.SongMenu.SelectSlide3, SelectValue, ISelections); + + AddButton(Theme.SongMenu.Button4); + if (Length(Button[3].Text) = 0) then + AddButtonText(14, 20, 'Button 4'); + + AddText(Theme.SongMenu.TextMenu); + + for I := 0 to High(Theme.SongMenu.Static) do + AddStatic(Theme.SongMenu.Static[I]); + + for I := 0 to High(Theme.SongMenu.Text) do + AddText(Theme.SongMenu.Text[I]); + + Interaction := 0; +end; + +function TScreenSongMenu.Draw: boolean; +begin + inherited Draw; +end; + +procedure TScreenSongMenu.onShow; +begin + +end; + +procedure TScreenSongMenu.MenuShow(sMenu: Byte); +begin + Interaction := 0; //Reset Interaction + Case sMenu of + SM_Main: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_MAIN'); + + Button[0].Visible := True; + Button[1].Visible := True; + Button[2].Visible := True; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY'); + Button[1].Text[0].Text := Language.Translate('SONG_MENU_EDIT'); + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYMODI'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); + end; + + SM_PlayList: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST'); + + Button[0].Visible := True; + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD'); + Button[1].Text[0].Text := ''; + Button[2].Text[0].Text := ''; + Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); + end; + + SM_Party_Main: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_MAIN'); + + Button[0].Visible := True; + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY'); + Button[1].Text[0].Text := Language.Translate('SONG_MENU_JOKER'); + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYMODI'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_JOKER'); + end; + + SM_Party_Joker: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_JOKER'); + + Button[0].Visible := (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0); + Button[1].Visible := (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0); + Button[2].Visible := (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0); + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := String(PartySession.Teams.Teaminfo[0].Name); + Button[1].Text[0].Text := String(PartySession.Teams.Teaminfo[1].Name); + Button[2].Text[0].Text := String(PartySession.Teams.Teaminfo[2].Name); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); + end; + end; +end; + +procedure TScreenSongMenu.HandleReturn; +begin + Case CurMenu of + SM_Main: + begin + Visible := False; + Case Interaction of + 0: //Button 1 + begin + ScreenSong.StartSong; + end; + + 1: //Button 2 + begin + ScreenSong.OpenEditor; + end; + + 2: //Button 3 + begin + //Todo: Add SingleRound Modi Support + end; + + 3: //SelectSlide 3 + begin + //Dummy + end; + + 4: //Button 4 + begin + //Cancel... (Do Nothing) + end; + end; + end; + + SM_PlayList: + begin + Visible := False; + Case Interaction of + 0: //Button 1 + begin + // + end; + + 1: //Button 2 + begin + // + end; + + 2: //Button 3 + begin + //Todo + end; + + 3: //SelectSlide 3 + begin + //Dummy + end; + + 4: //Button 4 + begin + // + end; + end; + end; + + SM_Party_Main: + begin + Case Interaction of + 0: //Button 1 + begin + //Start Singing + ScreenSong.StartSong; + Visible := False; + end; + + 4: //Button 4 + begin + //Joker + MenuShow(SM_Party_Joker); + end; + end; + end; + + SM_Party_Joker: + begin + Visible := False; + Case Interaction of + 0: //Button 1 + begin + //Joker Team 1 + ScreenSong.DoJoker(0); + end; + + 1: //Button 2 + begin + //Joker Team 2 + ScreenSong.DoJoker(1); + end; + + 2: //Button 3 + begin + //Joker Team 3 + ScreenSong.DoJoker(2); + end; + + 4: //Button 4 + begin + //Cancel... (Fo back to old Menu) + MenuShow(SM_Party_Main); + end; + end; + end; + end; +end; + +end. + \ No newline at end of file diff --git a/Game/Code/Screens/UScreenTop5.dcu b/Game/Code/Screens/UScreenTop5.dcu new file mode 100644 index 00000000..c6db07d0 Binary files /dev/null and b/Game/Code/Screens/UScreenTop5.dcu differ diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas new file mode 100644 index 00000000..41f96281 --- /dev/null +++ b/Game/Code/Screens/UScreenTop5.pas @@ -0,0 +1,166 @@ +unit UScreenTop5; + +interface + +uses + UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes, ULCD; + +type + TScreenTop5 = class(TMenu) + public + TextLevel: integer; + TextArtistTitle: integer; + + StaticNumber: array[1..5] of integer; + TextNumber: array[1..5] of integer; + TextName: array[1..5] of integer; + TextScore: array[1..5] of integer; + + Fadeout: boolean; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + function Draw: boolean; override; + end; + +implementation + +uses UGraphic, UScores, UMain, UIni; + +function TScreenTop5.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then begin + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE, SDLK_RETURN: + begin + if (not Fadeout) then begin + FadeTo(@ScreenSong); + Fadeout := true; + end; + end; + SDLK_SYSREQ: + begin + Display.PrintScreen; + end; + end; + end; +end; + +constructor TScreenTop5.Create; +var + I: integer; +begin + inherited Create; + + AddBackground(Theme.Top5.Background.Tex); + + for I := 0 to High(Theme.Top5.Static) do + AddStatic(Theme.Top5.Static[I]); + + for I := 0 to High(Theme.Top5.Text) do + AddText(Theme.Top5.Text[I]); + + + TextLevel := AddText(Theme.Top5.TextLevel); + TextArtistTitle := AddText(Theme.Top5.TextArtistTitle); + + for I := 0 to 4 do + StaticNumber[I+1] := AddStatic(Theme.Top5.StaticNumber[I]); + + for I := 0 to 4 do + TextNumber[I+1] := AddText(Theme.Top5.TextNumber[I]); + for I := 0 to 4 do + TextName[I+1] := AddText(Theme.Top5.TextName[I]); + for I := 0 to 4 do + TextScore[I+1] := AddText(Theme.Top5.TextScore[I]); + +end; + +procedure TScreenTop5.onShow; +var + I: integer; + PMax: integer; +begin + Fadeout := false; + + //ReadScore(AktSong); + + PMax := Ini.Players; + if Ini.Players = 4 then Ini.Players := 5; + for I := 0 to PMax do + AddScore(AktSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalI)); + + //WriteScore(AktSong); + ReadScore(AktSong); + + Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; + + for I := 1 to Length(AktSong.Score[Ini.Difficulty]) do begin + Static[StaticNumber[I]].Visible := true; + Text[TextNumber[I]].Visible := true; + Text[TextName[I]].Visible := true; + Text[TextScore[I]].Visible := true; + + Text[TextName[I]].Text := AktSong.Score[Ini.Difficulty, I-1].Name; + Text[TextScore[I]].Text := IntToStr(AktSong.Score[Ini.Difficulty, I-1].Score); + end; + + for I := Length(AktSong.Score[Ini.Difficulty])+1 to 5 do begin + Static[StaticNumber[I]].Visible := false; + Text[TextNumber[I]].Visible := false; + Text[TextName[I]].Visible := false; + Text[TextScore[I]].Visible := false; + end; + + Text[TextLevel].Text := IDifficulty[Ini.Difficulty]; +end; + +function TScreenTop5.Draw: boolean; +//var +{ Min: real; + Max: real; + Wsp: real; + Wsp2: real; + Pet: integer;} + +{ Item: integer; + P: integer; + C: integer;} +begin + // Singstar - let it be...... with 6 statics +{ if PlayersPlay = 6 then begin + for Item := 4 to 6 do begin + if ScreenAct = 1 then P := Item-4; + if ScreenAct = 2 then P := Item-1; + + FillPlayer(Item, P); + +{ if ScreenAct = 1 then begin + LoadColor( + Static[StaticBoxLightest[Item]].Texture.ColR, + Static[StaticBoxLightest[Item]].Texture.ColG, + Static[StaticBoxLightest[Item]].Texture.ColB, + 'P1Dark'); + end; + + if ScreenAct = 2 then begin + LoadColor( + Static[StaticBoxLightest[Item]].Texture.ColR, + Static[StaticBoxLightest[Item]].Texture.ColG, + Static[StaticBoxLightest[Item]].Texture.ColB, + 'P4Dark'); + end;} + +{ end; + end;} + + inherited Draw; +end; + +end. diff --git a/Game/Code/Screens/UScreenWelcome.dcu b/Game/Code/Screens/UScreenWelcome.dcu new file mode 100644 index 00000000..196b04be Binary files /dev/null and b/Game/Code/Screens/UScreenWelcome.dcu differ diff --git a/Game/Code/Screens/UScreenWelcome.pas b/Game/Code/Screens/UScreenWelcome.pas new file mode 100644 index 00000000..de3b50f4 --- /dev/null +++ b/Game/Code/Screens/UScreenWelcome.pas @@ -0,0 +1,117 @@ +unit UScreenWelcome; + +interface + +uses + UMenu, SDL, SysUtils, UThemes; + +type + TScreenWelcome = class(TMenu) + public + Animation: real; + Fadeout: boolean; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onShow; override; + end; + +implementation + +uses UGraphic, UTime; + +function TScreenWelcome.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then begin + case PressedKey of + SDLK_ESCAPE : + begin + Result := False; + end; + SDLK_RETURN: + begin + FadeTo(@ScreenMain); + Fadeout := true; + end; + end; + end; +end; + +constructor TScreenWelcome.Create; +begin + inherited Create; +{ AddStatic(-10, -10, 0, 0, 1, 1, 1, Skin.Star, 'BMP', 'Transparent'); + AddStatic(-500, 440, 200, 5, 0, 0, 0, Skin.Line, 'JPG', 'Font Black'); + AddStatic(-500, 472, 200, 5, 0, 0, 0, Skin.Line, 'JPG', 'Font Black'); + AddStatic(-500, 504, 200, 5, 0, 0, 0, Skin.Line, 'JPG', 'Font Black'); + AddStatic(-500, 536, 200, 5, 0, 0, 0, Skin.Line, 'JPG', 'Font Black'); + AddStatic(-500, 568, 200, 5, 0, 0, 0, Skin.Line, 'JPG', 'Font Black'); + Animation := 0; + Fadeout := false;} +end; + +procedure TScreenWelcome.onShow; +begin + CountSkipTimeSet; +end; + +function TScreenWelcome.Draw: boolean; +var + Min: real; + Max: real; + Wsp: real; + Pet: integer; +begin + // star animation + Animation := Animation + TimeSkip*1000; + + // draw nothing + Min := 0; Max := 1000; + if (Animation >= Min) and (Animation < Max) then begin + end; + + // popup + Min := 1000; Max := 1120; + if (Animation >= Min) and (Animation < Max) then begin + Wsp := (Animation - Min) / (Max - Min); + Static[0].Texture.X := 600; + Static[0].Texture.Y := 600 - Wsp * 230; + Static[0].Texture.W := 200; + Static[0].Texture.H := Wsp * 230; + end; + + // bounce + Min := 1120; Max := 1200; + if (Animation >= Min) and (Animation < Max) then begin + Wsp := (Animation - Min) / (Max - Min); + Static[0].Texture.Y := 370 + Wsp * 50; + Static[0].Texture.H := 230 - Wsp * 50; + end; + + // run + Min := 1500; Max := 3500; + if (Animation >= Min) and (Animation < Max) then begin + Wsp := (Animation - Min) / (Max - Min); + + Static[0].Texture.X := 600 - Wsp * 1400; + Static[0].Texture.H := 180; + + + for Pet := 1 to 5 do begin + Static[Pet].Texture.X := 770 - Wsp * 1400; + Static[Pet].Texture.W := 150 + Wsp * 200; + Static[Pet].Texture.Alpha := Wsp * 0.5; + end; + end; + + Min := 3500; + if (Animation >= Min) and (not Fadeout) then begin + FadeTo(@ScreenMain); + Fadeout := true; + end; + + inherited Draw; +end; + +end. -- cgit v1.2.3 From 00822815d626025153389a461db64b83932e6f22 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 21 Mar 2007 19:37:25 +0000 Subject: =?UTF-8?q?Datei=20/=20Ordner=20gel=C3=B6scht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@6 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEdit.dcu | Bin 2915 -> 0 bytes Game/Code/Screens/UScreenEditConvert.dcu | Bin 13604 -> 0 bytes Game/Code/Screens/UScreenEditHeader.dcu | Bin 9398 -> 0 bytes Game/Code/Screens/UScreenEditSub.dcu | Bin 29283 -> 0 bytes Game/Code/Screens/UScreenLevel.dcu | Bin 3407 -> 0 bytes Game/Code/Screens/UScreenLoading.dcu | Bin 2525 -> 0 bytes Game/Code/Screens/UScreenMain.dcu | Bin 9661 -> 0 bytes Game/Code/Screens/UScreenName.dcu | Bin 4199 -> 0 bytes Game/Code/Screens/UScreenOpen.dcu | Bin 4756 -> 0 bytes Game/Code/Screens/UScreenOptions.dcu | Bin 4834 -> 0 bytes Game/Code/Screens/UScreenOptionsGame.dcu | Bin 4049 -> 0 bytes Game/Code/Screens/UScreenOptionsGraphics.dcu | Bin 3911 -> 0 bytes Game/Code/Screens/UScreenOptionsLyrics.dcu | Bin 3566 -> 0 bytes Game/Code/Screens/UScreenOptionsRecord.dcu | Bin 4885 -> 0 bytes Game/Code/Screens/UScreenOptionsSound.dcu | Bin 3629 -> 0 bytes Game/Code/Screens/UScreenOptionsThemes.dcu | Bin 4188 -> 0 bytes Game/Code/Screens/UScreenPartyNewRound.dcu | Bin 9085 -> 0 bytes Game/Code/Screens/UScreenPartyOptions.dcu | Bin 5884 -> 0 bytes Game/Code/Screens/UScreenPartyPlayer.dcu | Bin 6068 -> 0 bytes Game/Code/Screens/UScreenPartyScore.dcu | Bin 5605 -> 0 bytes Game/Code/Screens/UScreenPartyWin.dcu | Bin 4642 -> 0 bytes Game/Code/Screens/UScreenScore.dcu | Bin 10273 -> 0 bytes Game/Code/Screens/UScreenSing.dcu | Bin 23327 -> 0 bytes Game/Code/Screens/UScreenSingModi.dcu | Bin 15109 -> 0 bytes Game/Code/Screens/UScreenSong.dcu | Bin 29384 -> 0 bytes Game/Code/Screens/UScreenSongMenu.dcu | Bin 7346 -> 0 bytes Game/Code/Screens/UScreenTop5.dcu | Bin 4531 -> 0 bytes Game/Code/Screens/UScreenWelcome.dcu | Bin 3228 -> 0 bytes 28 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 Game/Code/Screens/UScreenEdit.dcu delete mode 100644 Game/Code/Screens/UScreenEditConvert.dcu delete mode 100644 Game/Code/Screens/UScreenEditHeader.dcu delete mode 100644 Game/Code/Screens/UScreenEditSub.dcu delete mode 100644 Game/Code/Screens/UScreenLevel.dcu delete mode 100644 Game/Code/Screens/UScreenLoading.dcu delete mode 100644 Game/Code/Screens/UScreenMain.dcu delete mode 100644 Game/Code/Screens/UScreenName.dcu delete mode 100644 Game/Code/Screens/UScreenOpen.dcu delete mode 100644 Game/Code/Screens/UScreenOptions.dcu delete mode 100644 Game/Code/Screens/UScreenOptionsGame.dcu delete mode 100644 Game/Code/Screens/UScreenOptionsGraphics.dcu delete mode 100644 Game/Code/Screens/UScreenOptionsLyrics.dcu delete mode 100644 Game/Code/Screens/UScreenOptionsRecord.dcu delete mode 100644 Game/Code/Screens/UScreenOptionsSound.dcu delete mode 100644 Game/Code/Screens/UScreenOptionsThemes.dcu delete mode 100644 Game/Code/Screens/UScreenPartyNewRound.dcu delete mode 100644 Game/Code/Screens/UScreenPartyOptions.dcu delete mode 100644 Game/Code/Screens/UScreenPartyPlayer.dcu delete mode 100644 Game/Code/Screens/UScreenPartyScore.dcu delete mode 100644 Game/Code/Screens/UScreenPartyWin.dcu delete mode 100644 Game/Code/Screens/UScreenScore.dcu delete mode 100644 Game/Code/Screens/UScreenSing.dcu delete mode 100644 Game/Code/Screens/UScreenSingModi.dcu delete mode 100644 Game/Code/Screens/UScreenSong.dcu delete mode 100644 Game/Code/Screens/UScreenSongMenu.dcu delete mode 100644 Game/Code/Screens/UScreenTop5.dcu delete mode 100644 Game/Code/Screens/UScreenWelcome.dcu (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenEdit.dcu b/Game/Code/Screens/UScreenEdit.dcu deleted file mode 100644 index 1b9c7bb9..00000000 Binary files a/Game/Code/Screens/UScreenEdit.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenEditConvert.dcu b/Game/Code/Screens/UScreenEditConvert.dcu deleted file mode 100644 index 1839ad6b..00000000 Binary files a/Game/Code/Screens/UScreenEditConvert.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenEditHeader.dcu b/Game/Code/Screens/UScreenEditHeader.dcu deleted file mode 100644 index 9508e841..00000000 Binary files a/Game/Code/Screens/UScreenEditHeader.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenEditSub.dcu b/Game/Code/Screens/UScreenEditSub.dcu deleted file mode 100644 index 6b6b6e35..00000000 Binary files a/Game/Code/Screens/UScreenEditSub.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenLevel.dcu b/Game/Code/Screens/UScreenLevel.dcu deleted file mode 100644 index 95cb3267..00000000 Binary files a/Game/Code/Screens/UScreenLevel.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenLoading.dcu b/Game/Code/Screens/UScreenLoading.dcu deleted file mode 100644 index e0eb1cfe..00000000 Binary files a/Game/Code/Screens/UScreenLoading.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenMain.dcu b/Game/Code/Screens/UScreenMain.dcu deleted file mode 100644 index 22bb4883..00000000 Binary files a/Game/Code/Screens/UScreenMain.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenName.dcu b/Game/Code/Screens/UScreenName.dcu deleted file mode 100644 index d14b4296..00000000 Binary files a/Game/Code/Screens/UScreenName.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenOpen.dcu b/Game/Code/Screens/UScreenOpen.dcu deleted file mode 100644 index c59986f9..00000000 Binary files a/Game/Code/Screens/UScreenOpen.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenOptions.dcu b/Game/Code/Screens/UScreenOptions.dcu deleted file mode 100644 index e5d17c3b..00000000 Binary files a/Game/Code/Screens/UScreenOptions.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenOptionsGame.dcu b/Game/Code/Screens/UScreenOptionsGame.dcu deleted file mode 100644 index 3fd70913..00000000 Binary files a/Game/Code/Screens/UScreenOptionsGame.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenOptionsGraphics.dcu b/Game/Code/Screens/UScreenOptionsGraphics.dcu deleted file mode 100644 index 3eddc010..00000000 Binary files a/Game/Code/Screens/UScreenOptionsGraphics.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenOptionsLyrics.dcu b/Game/Code/Screens/UScreenOptionsLyrics.dcu deleted file mode 100644 index 1fcfca9d..00000000 Binary files a/Game/Code/Screens/UScreenOptionsLyrics.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenOptionsRecord.dcu b/Game/Code/Screens/UScreenOptionsRecord.dcu deleted file mode 100644 index 36a04d50..00000000 Binary files a/Game/Code/Screens/UScreenOptionsRecord.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenOptionsSound.dcu b/Game/Code/Screens/UScreenOptionsSound.dcu deleted file mode 100644 index 26c07fe1..00000000 Binary files a/Game/Code/Screens/UScreenOptionsSound.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenOptionsThemes.dcu b/Game/Code/Screens/UScreenOptionsThemes.dcu deleted file mode 100644 index 98bec8a2..00000000 Binary files a/Game/Code/Screens/UScreenOptionsThemes.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenPartyNewRound.dcu b/Game/Code/Screens/UScreenPartyNewRound.dcu deleted file mode 100644 index 24b6953e..00000000 Binary files a/Game/Code/Screens/UScreenPartyNewRound.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenPartyOptions.dcu b/Game/Code/Screens/UScreenPartyOptions.dcu deleted file mode 100644 index 8f0bbf3d..00000000 Binary files a/Game/Code/Screens/UScreenPartyOptions.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenPartyPlayer.dcu b/Game/Code/Screens/UScreenPartyPlayer.dcu deleted file mode 100644 index 1afeac79..00000000 Binary files a/Game/Code/Screens/UScreenPartyPlayer.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenPartyScore.dcu b/Game/Code/Screens/UScreenPartyScore.dcu deleted file mode 100644 index 9dffe2e5..00000000 Binary files a/Game/Code/Screens/UScreenPartyScore.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenPartyWin.dcu b/Game/Code/Screens/UScreenPartyWin.dcu deleted file mode 100644 index d55c0809..00000000 Binary files a/Game/Code/Screens/UScreenPartyWin.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenScore.dcu b/Game/Code/Screens/UScreenScore.dcu deleted file mode 100644 index eee72fd0..00000000 Binary files a/Game/Code/Screens/UScreenScore.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenSing.dcu b/Game/Code/Screens/UScreenSing.dcu deleted file mode 100644 index 0e227a17..00000000 Binary files a/Game/Code/Screens/UScreenSing.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenSingModi.dcu b/Game/Code/Screens/UScreenSingModi.dcu deleted file mode 100644 index 4f806afe..00000000 Binary files a/Game/Code/Screens/UScreenSingModi.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenSong.dcu b/Game/Code/Screens/UScreenSong.dcu deleted file mode 100644 index abc9cc4f..00000000 Binary files a/Game/Code/Screens/UScreenSong.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenSongMenu.dcu b/Game/Code/Screens/UScreenSongMenu.dcu deleted file mode 100644 index 634a217a..00000000 Binary files a/Game/Code/Screens/UScreenSongMenu.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenTop5.dcu b/Game/Code/Screens/UScreenTop5.dcu deleted file mode 100644 index c6db07d0..00000000 Binary files a/Game/Code/Screens/UScreenTop5.dcu and /dev/null differ diff --git a/Game/Code/Screens/UScreenWelcome.dcu b/Game/Code/Screens/UScreenWelcome.dcu deleted file mode 100644 index 196b04be..00000000 Binary files a/Game/Code/Screens/UScreenWelcome.dcu and /dev/null differ -- cgit v1.2.3 From a48be5b4dd13db5cbc2cce4932508e61ff354340 Mon Sep 17 00:00:00 2001 From: mogguh Date: Wed, 21 Mar 2007 21:35:49 +0000 Subject: Golden notes are implemented from now on. So "golden notes" twinkle, and perfect sung notes twinkle too. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@12 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 2a97482d..3dd1119a 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -3,7 +3,7 @@ unit UScreenSing; interface uses UMenu, UMusic, SDL, SysUtils, UPliki, UTime, USongs, UIni, ULog, USmpeg, UTexture, ULyrics, - TextGL, OpenGL12, BASS, UThemes, ULCD; + TextGL, OpenGL12, BASS, UThemes, ULCD, UGraphicClasses; type TScreenSing = class(TMenu) @@ -973,6 +973,9 @@ begin // draw custom items SingDraw; // always draw +//GoldenNoteStarsTwinkle Mod + GoldenRec.SpawnRec; +//GoldenNoteStarsTwinkle Mod // back stereo Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; @@ -1116,6 +1119,9 @@ Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; end; //PhrasenBonus - Line Bonus Mod End// } +//GoldenStarsTwinkle Mod + GoldenRec.KillAll; +//GoldenStarsTwinkle Mod End end; end. -- cgit v1.2.3 From c33620b856f5106ba95638106c5a55ff88e5290c Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 22 Mar 2007 19:59:00 +0000 Subject: Fixed Bug: No BG in Party Mode and little Code clean up git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@16 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSingModi.pas | 41 ++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 18 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 88034f61..ec47dc60 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -585,16 +585,16 @@ begin Log.LogStatus('End', 'onShow'); } -PlayersPlay := TeamInfo.NumTeams; + PlayersPlay := TeamInfo.NumTeams; -if DLLMan.Selected.LoadSong then //Start with Song -begin - inherited; -end -else //Start Without Song -begin - Music.CaptureStart; -end; + if DLLMan.Selected.LoadSong then //Start with Song + begin + inherited; + end + else //Start Without Song + begin + Music.CaptureStart; + end; //Set Playerinfo PlayerInfo.NumPlayers := PlayersPlay; @@ -648,16 +648,21 @@ end; //Music.CaptureStart; //Music.MoveTo(AktSong.Start); -//Init Plugin -if not DLLMan.PluginInit(TeamInfo, PlayerInfo, ToSentences(Czesci[0]), LoadTex, Print, LoadSound, PlaySound) then -begin -//Fehler -Log.LogError('Could not Init Plugin'); -Halt; -end; + //Init Plugin + if not DLLMan.PluginInit(TeamInfo, PlayerInfo, ToSentences(Czesci[0]), LoadTex, Print, LoadSound, PlaySound) then + begin + //Fehler + Log.LogError('Could not Init Plugin'); + Halt; + end; + + // Set Background (Little Workaround, maybe change sometime) + if (DLLMan.Selected.LoadBack) AND (DLLMan.Selected.LoadSong) then + ScreenSing.Tex_Background := Tex_Background; + + Winner := 0; -Winner := 0; -//Set Score Visibility + //Set Score Visibility if PlayersPlay = 1 then begin Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; -- cgit v1.2.3 From 95dc3d90b3eb11080fdcd5edae37cbd35c4ffb57 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 23 Mar 2007 17:40:06 +0000 Subject: Some Changes on Database System and Header Reader Fixed Bug: Scores with 0 are added to DB Made a Class instead of many Functions Fixed a Bug in UFiles, not reading Gap from Header correctly git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@20 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenTop5.pas | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas index 41f96281..94f3de1e 100644 --- a/Game/Code/Screens/UScreenTop5.pas +++ b/Game/Code/Screens/UScreenTop5.pas @@ -25,7 +25,7 @@ type implementation -uses UGraphic, UScores, UMain, UIni; +uses UGraphic, UDataBase, UMain, UIni; function TScreenTop5.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -94,10 +94,10 @@ begin PMax := Ini.Players; if Ini.Players = 4 then Ini.Players := 5; for I := 0 to PMax do - AddScore(AktSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalI)); + DataBase.AddScore(AktSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalI)); - //WriteScore(AktSong); - ReadScore(AktSong); + DataBase.WriteScore(AktSong); + DataBase.ReadScore(AktSong); Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; -- cgit v1.2.3 From 7c809200754d707f440ec45686692db405da8ae1 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 24 Mar 2007 12:23:00 +0000 Subject: Fixed Bug: Not translating Texts reading Theme.Ini Compiler doesn't define CompilerConst Translate correctly. Fixed by Commenting IFDEF Operations out git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@21 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenScore.pas | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 2e509a6f..eb92a3d2 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -45,11 +45,11 @@ type implementation -{$IFDEF TRANSLATE} +{{$IFDEF TRANSLATE} uses UGraphic, UScreenSong, UMenuStatic, UTime, UMain, UIni, ULanguage; -{$ELSE} +{{$ELSE}{ uses UGraphic, UScreenSong, UMenuStatic, UTime, UMain, UIni; -{$ENDIF} +{{$ENDIF} function TScreenScore.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin Result := true; @@ -291,7 +291,7 @@ begin Text[TextName[PP]].Text := Ini.Name[P]; - {$IFDEF TRANSLATE} + {{$IFDEF TRANSLATE} case (Player[P].ScoreTotalI) of 0..2000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_TONE_DEAF'); 2010..4000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_AMATEUR'); @@ -301,7 +301,7 @@ begin 9010..9800: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_SUPERSTAR'); 9810..10000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_ULTRASTAR'); end; - {$ELSE} + {{$ELSE}{ case (Player[P].ScoreTotalI) of 0..2000: Text[TextScore[PP]].Text := 'Tone Deaf'; 2010..4000: Text[TextScore[PP]].Text := 'Amateur'; -- cgit v1.2.3 From b7ae6bb3c682473abc6c642ce4f15a4ffa9d630d Mon Sep 17 00:00:00 2001 From: mogguh Date: Sat, 24 Mar 2007 20:20:47 +0000 Subject: Bugfix: UScreenSing.pas fixed a minor bug that would've caused redrawing of golden stars in a different song git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@30 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 3dd1119a..f6ec6224 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -636,6 +636,10 @@ begin // prepare timer (II) CountSkipTimeSet; + +//GoldenStarsTwinkle Mod + GoldenRec.KillAll; +//GoldenStarsTwinkle Mod End end; function TScreenSing.Draw: boolean; -- cgit v1.2.3 From 60521ca33e23a91f2ea8aecf506b9aa5e6bda54a Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 25 Mar 2007 10:41:53 +0000 Subject: 2 Bugs in Cover Positions fixed: Style4 (Classic): Positions now Readed from Theme, No Overlapping Style5 (Deluxe): correct Positions of Covers in the Front No Cut from Last to First Todo: Correct Positions of Covers in the back(Now Invisible) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@32 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 82 ++++++++++++--------------------------- 1 file changed, 25 insertions(+), 57 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 0d7860a7..cd412ceb 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1021,21 +1021,19 @@ begin Button[B].Visible := CatSongs.Song[B].Visible; // nowe if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed -// Wsp := 2 * pi * (B - SongCurrent) / Length(Button); -// Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - 0) / CatSongs.VisibleSongs; Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - Z := (1 + cos(Wsp)) / 2; + Z := (1 + cos(Wsp)) / 2 - 0.02; Z2 := (1 + 2*Z) / 3; - Button[B].X := Theme.Song.Cover.X + (300 + 37 * VS {CatSongs.VisibleSongs} {Length(Button)} * sin(Wsp) - 400) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.W + 0.185 * Theme.Song.Cover.H * VS * sin(Wsp) - Theme.Song.Cover.X) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs Button[B].Z := Z; - Button[B].H := Theme.Song.Cover.H * Z2; - Button[B].W := Button[B].H; + Button[B].W := Theme.Song.Cover.H * Z2; // Button[B].Y := {50 +} 140 + 50 - 50 * Z2; - Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.65; + Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; + Button[B].H := Button[B].W; end; end; end; @@ -1158,17 +1156,17 @@ begin if Button[B].Visible then //Only Change Pos for Visible Buttons begin Pos := (CatSongs.VisibleIndex(B) - SongCurrent); - if (Pos < -VS) then + if (Pos < -VS/2) then Pos := Pos + VS - else if (Pos > VS) then + else if (Pos > VS/2) then Pos := Pos - VS; - if (Abs(Pos) < 3) then {fixed Positions} + if (Abs(Pos) < 2.5) then {fixed Positions} begin Angle := Pi * (Pos / 5); //Button[B].Visible := False; - Button[B].H := Theme.Song.Cover.H * cos(Angle);//Power(Z2, 3); + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle));//Power(Z2, 3); Button[B].Z := 0.95 - Abs(Pos) * 0.01; @@ -1178,67 +1176,37 @@ begin Diff := (Button[B].H - Theme.Song.Cover.H)/2;; - if (X < 0) then - Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Sin(Angle){ - Theme.Song.Cover.H/2} - Diff - else - Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Sin(Angle){ - Theme.Song.Cover.H/2}- Diff; + Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Sin(Angle) - Diff; - Button[B].Visible := True; end else begin {Behind the Front Covers} - //Button[B].Visible := False; - Pos := Frac(Pos / VS); - if Pos < 0 then - Pos := Pos + 1; - - Angle := Abs(2 * pi * ((Pos) / VS / 2)); - //Pos := Power(Pos*2 - 1, 3); + Button[B].Visible := False; - Button[B].Z := (0.2 + Pos/2) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + if Pos < 0 then + Pos := (Pos - VS/2) /VS + else + Pos := (Pos + VS/2) /VS; - //Pos := abs(Pos) mod 1; + Angle := 2 * pi * Pos; - X := sin(Angle); - //Button[B].H := (0.2 + 0.4 * Abs(Pos)) * Theme.Song.Cover.H; //Cover High + Width - Button[B].H := 80; - Button[B].W := Button[B].H; + Button[B].Z := (0.5 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - Diff := (Theme.Song.Cover.H - Button[B].H)/2; + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle));//Power(Z2, 3); - //Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.W) * Sin(Angle) - diff - //Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Pos - Diff; + Button[B].W := Button[B].H; - if (X < 0) then - Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Sin(Angle) - Theme.Song.Cover.H/2 + Diff - else - Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Sin(Angle) - Theme.Song.Cover.H/2; - - end; + Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); - Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field + Diff := (Button[B].H - Theme.Song.Cover.H)/2;; - {X := sin(Angle); + Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.W + Theme.Song.Cover.H*VS*0.185)* Sin(Angle) - Diff - Button[B].H := (0.5 + Power(cos(Angle), 1.7))/1.5 * Theme.Song.Cover.H; //Cover High + Width - Button[B].W := Button[B].H; - - {if (X < 0) then - Diff := Theme.Song.Cover.H - Button[B].H - else - Diff := 0; - - if (((CatSongs.VisibleIndex(B) - SongCurrent)>= -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent) <= 3)) OR (((CatSongs.VisibleIndex(B) - SongCurrent)>= -3 + VS) AND ((CatSongs.VisibleIndex(B) - SongCurrent) <= 3 + VS)) OR (((CatSongs.VisibleIndex(B) - SongCurrent)>= -3 - VS) AND ((CatSongs.VisibleIndex(B) - SongCurrent) <= 3 - VS)) then - Button[B].X := Theme.Song.Cover.X + diff + margin(CatSongs.VisibleIndex(B), SongCurrent, VS)* 30 - else - Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X + diff;}{ + end; - Diff := (Button[B].H - Theme.Song.Cover.H)/2; + //Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field + Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); - if X < 0 then - Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.W) * -Power(-X, 1/2) - diff - else - Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.W) * Power(X, 1/2) - diff;} end; end; end; -- cgit v1.2.3 From e558c05847fc836ceecbfe9de67af36b84f2b367 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 25 Mar 2007 15:23:10 +0000 Subject: ScreenEditSub: Automatically set down music playback-volume to hear the Midi Sounds better. Also Show Note Names in Editor (e.g. c, d'', F#) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@36 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditSub.pas | 41 ++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 7bdbac0d..52cd0b26 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -55,6 +55,8 @@ type 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; @@ -1110,7 +1112,9 @@ begin Czesci[0].Czesc[0].Nuta[0].Color := 1; Music.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; @@ -1207,7 +1211,7 @@ 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); + 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; // Text Edit Mode @@ -1231,6 +1235,39 @@ procedure TScreenEditSub.onHide; begin MidiOut.Close; MidiOut.Free; + Music.SetVolume(100); +end; + +function TScreenEditSub.GetNoteName(Note: Integer): String; +var N1, N2: Integer; +begin + N1 := Note mod 12; + N2 := Note div 12; + + 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. -- cgit v1.2.3 From 3ba33f8e920a9e9a3114f159e2b6fda4273a6efb Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 28 Mar 2007 13:08:41 +0000 Subject: Added Jumpto Ability to SongScreen (Press J) Fixed: Golden Notes are not shown in PartyMode git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@39 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 9 +- Game/Code/Screens/UScreenSingModi.pas | 6 +- Game/Code/Screens/UScreenSong.pas | 371 ++++++++++++++-------------------- Game/Code/Screens/UScreenSongMenu.pas | 1 + 4 files changed, 160 insertions(+), 227 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index f6ec6224..7b96e273 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -636,10 +636,6 @@ begin // prepare timer (II) CountSkipTimeSet; - -//GoldenStarsTwinkle Mod - GoldenRec.KillAll; -//GoldenStarsTwinkle Mod End end; function TScreenSing.Draw: boolean; @@ -1016,6 +1012,11 @@ begin Music.CaptureStop; Music.Stop; + //Kill all Stars not Killed yet + //GoldenStarsTwinkle Mod + GoldenRec.KillAll; + //GoldenStarsTwinkle Mod End + if Ini.SavePlayback = 1 then begin Log.BenchmarkStart(0); Log.LogVoice(0); diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index ec47dc60..bf342e7a 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -63,7 +63,7 @@ procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sou function ToSentences(Const Czeski: TCzesci): TSentences; implementation -uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math, UDLLManager, USkins; +uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math, UDLLManager, USkins, UGraphicClasses; // Method for input parsing. If False is returned, GetNextWindow // should be checked to know the next window to load; @@ -967,6 +967,10 @@ end; // draw custom items SingModiDraw(PlayerInfo); // always draw + //GoldenNoteStarsTwinkle Mod + GoldenRec.SpawnRec; + //GoldenNoteStarsTwinkle Mod + //Update PlayerInfo for I := 0 to PlayerInfo.NumPlayers-1 do begin diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index cd412ceb..69ec8639 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -69,7 +69,8 @@ type procedure SkipTo(Target: integer); procedure FixSelected; //Show Wrong Song when Tabs on Fix procedure FixSelected2; //Show Wrong Song when Tabs on Fix - procedure ShowCatTL(Cat: Integer);// Show Cat in Tob left + procedure ShowCatTL(Cat: Integer);// Show Cat in Top left + procedure ShowCatTLCustom(Caption: String);// Show Custom Text in Top left procedure HideCatTL;// Show Cat in Tob left procedure Refresh; //Refresh Song Sorting procedure DrawEqualizer; @@ -81,6 +82,9 @@ type procedure StartSong; procedure OpenEditor; procedure DoJoker(Team: Byte); + + //Extensions + procedure DrawExtensions; end; implementation @@ -92,37 +96,50 @@ uses UGraphic, UMain, UCovers, math, OpenGL12, Windows, USkins, UDLLManager, UPa procedure TScreenSong.FixSelected; var I, I2: Integer; begin - I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do + if CatSongs.VisibleSongs > 0 then begin - if CatSongs.Song[I].Visible then - inc(I2); + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); - if I = Interaction - 1 then - break; - end; + if I = Interaction - 1 then + break; + end; - SongCurrent := I2; - SongTarget := I2; + SongCurrent := I2; + SongTarget := I2; + end; end; procedure TScreenSong.FixSelected2; var I, I2: Integer; begin - I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do + if CatSongs.VisibleSongs > 0 then begin - if CatSongs.Song[I].Visible then - inc(I2); + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); - if I = Interaction - 1 then - break; - end; + if I = Interaction - 1 then + break; + end; - SongTarget := I2; + SongTarget := I2; + end; end; //Show Wrong Song when Tabs on Fix End + procedure TScreenSong.ShowCatTLCustom(Caption: String);// Show Custom Text in Top left + begin + Text[TextCat].Text := Caption; + Text[TextCat].Visible := true; + Static[StaticCat].Visible := False; + end; + //Show Cat in Top Left Mod procedure TScreenSong.ShowCatTL(Cat: Integer); begin @@ -162,164 +179,24 @@ var begin Result := true; - //Song Menu + //Song Screen Extensions (Jumpto + Menu) if (ScreenSongMenu.Visible) then begin Result := ScreenSongMenu.ParseInput(PressedKey, ScanCode, PressedDown); Exit; + end + else if (ScreenSongJumpto.Visible) then + begin + Result := ScreenSongJumpto.ParseInput(PressedKey, ScanCode, PressedDown); + Exit; end; If (PressedDown) Then begin // Key Down -// HS := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT); -{ if (not HighSpeed) and (HS > 0) then begin - HighSpeed := true; - SDL_EnableKeyRepeat(50, 50); - end; - if (HighSpeed) and (HS = 0) then begin - HighSpeed := false; - SDL_EnableKeyRepeat(125, 125); - end;} - - SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); - // Jump to Key Mod - if (SDL_ModState = KMOD_LALT) AND (Mode = 0) then //Jump to Key - begin - //get Letter - case PressedKey of - SDLK_A : Letter := 'A'; - SDLK_B : Letter := 'B'; - SDLK_C : Letter := 'C'; - SDLK_D : Letter := 'D'; - SDLK_E : Letter := 'E'; - SDLK_F : Letter := 'F'; - SDLK_G : Letter := 'G'; - SDLK_H : Letter := 'H'; - SDLK_I : Letter := 'I'; - SDLK_J : Letter := 'J'; - SDLK_K : Letter := 'K'; - SDLK_L : Letter := 'L'; - SDLK_M : Letter := 'M'; - SDLK_N : Letter := 'N'; - SDLK_O : Letter := 'O'; - SDLK_P : Letter := 'P'; - SDLK_Q : Letter := 'Q'; - SDLK_R : Letter := 'R'; - SDLK_S : Letter := 'S'; - SDLK_T : Letter := 'T'; - SDLK_U : Letter := 'U'; - SDLK_V : Letter := 'V'; - SDLK_W : Letter := 'W'; - SDLK_X : Letter := 'X'; - SDLK_Y : Letter := 'Y'; - SDLK_Z : Letter := 'Z'; - SDLK_1 : Letter := '1'; - SDLK_2 : Letter := '2'; - SDLK_3 : Letter := '3'; - SDLK_4 : Letter := '4'; - SDLK_5 : Letter := '5'; - SDLK_6 : Letter := '6'; - SDLK_7 : Letter := '7'; - SDLK_8 : Letter := '8'; - SDLK_9 : Letter := '9'; - SDLK_0 : Letter := '0'; - else exit; - end; - - {//Search Letter - for I := Interaction + 1 to high(CatSongs.Song) do - begin - if CatSongs.Song[I].Visible and (Letter = Uppercase(CatSongs.Song[I].Artist)[1]) then - break; //Found Song - if I = Interaction then //went through complete array but nothing Found - break; - if I = high(CatSongs.Song) then //At the end of the array->Go to beginning - for I2 := low(CatSongs.Song) to Interaction do - if CatSongs.Song[I].Visible and (Letter = Uppercase(CatSongs.Song[I].Artist)[1]) then - break; //Found Song - end; } - - for I := 0 to High(CatSongs.Song) do begin - if (CatSongs.Song[I].Visible) AND (UpperCase(CatSongs.Song[I].Artist[1]) = Letter) then - begin - //Select Song - Interaction := I; - SkipTo(Interaction); - break; - end; - end; - - //Don't do other Functions - exit; - end; - - if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then //Jump to Key - begin - //get Letter - case PressedKey of - SDLK_a..SDLK_z : Letter := Chr(Ord('a')+PressedKey-97); - SDLK_1 : Letter := '1'; - SDLK_2 : Letter := '2'; - SDLK_3 : Letter := '3'; - SDLK_4 : Letter := '4'; - SDLK_5 : Letter := '5'; - SDLK_6 : Letter := '6'; - SDLK_7 : Letter := '7'; - SDLK_8 : Letter := '8'; - SDLK_9 : Letter := '9'; - SDLK_0 : Letter := '0'; - else exit; - end; - - {//Search Letter - for I := Interaction + 1 to high(CatSongs.Song) do - begin - if CatSongs.Song[I].Visible and (Letter = Uppercase(CatSongs.Song[I].Artist)[1]) then - break; //Found Song - if I = Interaction then //went through complete array but nothing Found - break; - if I = high(CatSongs.Song) then //At the end of the array->Go to beginning - for I2 := low(CatSongs.Song) to Interaction do - if CatSongs.Song[I].Visible and (Letter = Uppercase(CatSongs.Song[I].Artist)[1]) then - break; //Found Song - end; } - - {for I := 0 to High(CatSongs.Song) do begin - if (CatSongs.Song[I].Visible) AND (UpperCase(CatSongs.Song[I].Artist[1]) = Letter) then} - - for I := Interaction + 1 to high(CatSongs.Song) + 1 do - begin - if (I > high(CatSongs.Song)) then - begin - for I2 := low(CatSongs.Song) to Interaction do - begin - if CatSongs.Song[I2].Visible and (Letter = lowercase(CatSongs.Song[I2].Artist[1])) then - begin - Interaction := I2; - break; //Found Song - end; - end; - break; - end - else if CatSongs.Song[I].Visible and (Letter = lowercase(CatSongs.Song[I].Artist[1])) then - begin - Interaction := I; - break; //Found Song - end; - end; - - - //Select Song - SkipTo(Interaction); - - //Don't do other Functions - exit; - end; - - case PressedKey of SDLK_ESCAPE : begin @@ -406,7 +283,6 @@ begin end else if (Mode = 1) then //PartyMode -> Show Menu begin - ScreenSongMenu.Visible := True; ScreenSongMenu.MenuShow(SM_Party_Main); end; end; @@ -417,12 +293,19 @@ begin begin if Length(Songs.Song) > 0 then begin if not CatSongs.Song[Interaction].Main then begin // clicked on Song - ScreenSongMenu.Visible := True; ScreenSongMenu.MenuShow(SM_Main); end; end; end; + SDLK_J: //Show SongMenu + begin + if Length(Songs.Song) > 0 then + begin + ScreenSongJumpto.Visible := True; + end; + end; + SDLK_DOWN: begin if (Mode = 0) then @@ -788,25 +671,47 @@ begin end; procedure TScreenSong.SetScroll; +var + VS, B: Integer; begin -//Set Positions - Case Theme.Song.Cover.Style of - 3: SetScroll3; - 5: SetScroll5 - else SetScroll4; - end; -//Set Texts: - Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; - Text[TextTitle].Text := CatSongs.Song[Interaction].Title; - if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then + VS := CatSongs.VisibleSongs; + if VS > 0 then begin - Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); - Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; + //Set Positions + Case Theme.Song.Cover.Style of + 3: SetScroll3; + 5:begin + if VS > 5 then + SetScroll5 + else + SetScroll4; + end; + else SetScroll4; + end; + //Set Texts: + Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; + Text[TextTitle].Text := CatSongs.Song[Interaction].Title; + if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then + begin + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); + Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; + end + else if (CatSongs.CatNumShow = -2) then + Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) + else if (Ini.Tabs_at_startup = 1) then + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) + else + Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); end - else if (Ini.Tabs_at_startup = 1) then - Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) else - Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); + begin + Text[TextNumber].Text := '0/0'; + Text[TextArtist].Text := ''; + Text[TextTitle].Text := ''; + for B := 0 to High(Button) do + Button[B].Visible := False; + + end; end; procedure TScreenSong.SetScroll1; @@ -1023,7 +928,7 @@ begin Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - Z := (1 + cos(Wsp)) / 2 - 0.02; + Z := (1 + cos(Wsp)) / 2 - 0.2; Z2 := (1 + 2*Z) / 3; Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.W + 0.185 * Theme.Song.Cover.H * VS * sin(Wsp) - Theme.Song.Cover.X) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs @@ -1247,6 +1152,19 @@ begin SetJoker; end; +procedure TScreenSong.DrawExtensions; +begin + //Draw Song Menu + if (ScreenSongMenu.Visible) then + begin + ScreenSongMenu.Draw; + end + else if (ScreenSongJumpto.Visible) then + begin + ScreenSongJumpto.Draw; + end +end; + function TScreenSong.Draw: boolean; var dx: real; @@ -1286,71 +1204,80 @@ begin if Theme.Song.Equalizer.Visible then DrawEqualizer; - //Draw Song Menu - if (ScreenSongMenu.Visible) then - begin - ScreenSongMenu.Draw; - end; + DrawExtensions; end; procedure TScreenSong.SelectNext; var Skip: integer; I: integer; + VS: Integer; begin - CoverTime := 0; - Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture - Button[Interaction].Texture2.Alpha := 0; + VS := CatSongs.VisibleSongs; - //0.5.0: unload old full size texture - if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then - Texture.UnloadTexture(Button[Interaction].Texture.Name, false); + if VS > 0 then + begin + CoverTime := 0; + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture + Button[Interaction].Texture2.Alpha := 0; - Skip := 1; + //0.5.0: unload old full size texture + if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then + Texture.UnloadTexture(Button[Interaction].Texture.Name, false); - // this 1 could be changed by CatSongs.FindNextVisible - while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); - SongTarget := SongTarget + 1;//Skip; + Skip := 1; - Interaction := (Interaction + Skip) mod Length(Interactions); + // this 1 could be changed by CatSongs.FindNextVisible + while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); - // try to keep all at the beginning - if SongTarget > CatSongs.VisibleSongs-1 then begin - SongTarget := SongTarget - CatSongs.VisibleSongs; - SongCurrent := SongCurrent - CatSongs.VisibleSongs; - end; + SongTarget := SongTarget + 1;//Skip; - // Interaction -> Button, ktorego okladke przeczytamy -// Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture + Interaction := (Interaction + Skip) mod Length(Interactions); + + // try to keep all at the beginning + if SongTarget > VS-1 then begin + SongTarget := SongTarget - VS; + SongCurrent := SongCurrent - VS; + end; + + end; + // Interaction -> Button, ktorego okladke przeczytamy + // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture end; procedure TScreenSong.SelectPrev; var Skip: integer; I: integer; + VS: Integer; begin - CoverTime := 0; - Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture - Button[Interaction].Texture2.Alpha := 0; + VS := CatSongs.VisibleSongs; - //0.5.0: unload old full size texture - if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then - Texture.UnloadTexture(Button[Interaction].Texture.Name, false); + if VS > 0 then + begin + CoverTime := 0; + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture + Button[Interaction].Texture2.Alpha := 0; - Skip := 1; + //0.5.0: unload old full size texture + if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then + Texture.UnloadTexture(Button[Interaction].Texture.Name, false); - while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); - SongTarget := SongTarget - 1;//Skip; + Skip := 1; - Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); + while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); + SongTarget := SongTarget - 1;//Skip; - // try to keep all at the beginning - if SongTarget < 0 then begin - SongTarget := SongTarget + CatSongs.VisibleSongs; - SongCurrent := SongCurrent + CatSongs.VisibleSongs; - end; + Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); -// Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture + // try to keep all at the beginning + if SongTarget < 0 then begin + SongTarget := SongTarget + CatSongs.VisibleSongs; + SongCurrent := SongCurrent + CatSongs.VisibleSongs; + end; + + // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture + end; end; procedure TScreenSong.UpdateLCD; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 2a03a7c2..a5ae2083 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -165,6 +165,7 @@ end; procedure TScreenSongMenu.MenuShow(sMenu: Byte); begin Interaction := 0; //Reset Interaction + Visible := True; //Set Visible Case sMenu of SM_Main: begin -- cgit v1.2.3 From 2bc1fdaec54eca194f6873589334cf0b649536d4 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 28 Mar 2007 19:01:01 +0000 Subject: Add Jumpto Screen to ThemeAdded Jumpto Ability to SongScreen (Press J) Fixed: Golden Notes are not shown in PartyMode git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@44 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSongJumpto.pas | 194 ++++++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 Game/Code/Screens/UScreenSongJumpto.pas (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas new file mode 100644 index 00000000..449141c3 --- /dev/null +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -0,0 +1,194 @@ +unit UScreenSongJumpto; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + +type + TScreenSongJumpto = class(TMenu) + private + Songsfound: String; + NoSongsfound: String; + CatText: String; + public + Visible: Boolean; //Whether the Menu should be Drawn + VisSongs: Integer; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + function Draw: boolean; override; + + procedure SetTextFound(const Count: Cardinal); + end; + +var + IType: Array [0..2] of String; + SelectType: Integer; + + +implementation + +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, USongs, UScreenSong; + +function TScreenSongJumpto.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; + function IsVisible: Boolean; + begin + Result := True; + if (Interactions[Interaction].Typ = 0) then + begin + Result := Button[Interactions[Interaction].Num].Visible; + end + else if (Interactions[Interaction].Typ = 1) then + begin + //Result := Selects[Interactions[Interaction].Num].Visible; + end + else if (Interactions[Interaction].Typ = 3) then + begin + Result := SelectsS[Interactions[Interaction].Num].Visible; + end; + end; + + Procedure SelectNext; + begin + repeat + InteractNext; + until IsVisible; + end; + + Procedure SelectPrev; + begin + repeat + InteractPrev; + until IsVisible; + end; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + 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 + if Interaction = 0 then + begin + Button[0].Text[0].Text := Button[0].Text[0].Text + chr(ScanCode); + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + end; + end; + + SDLK_BACKSPACE: + begin + if Interaction = 0 then + begin + Delete(Button[0].Text[0].Text, + Length(Button[0].Text[0].Text), 1); + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + end; + end; + + SDLK_ESCAPE : + begin + Music.PlayBack; + Visible := False; + if VisSongs = 0 then + CatSongs.SetFilter('', 0); + end; + + SDLK_RETURN: + begin + Visible := False; + Music.PlayBack; + if VisSongs = 0 then + CatSongs.SetFilter('', 0); + 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: SelectNext; + SDLK_UP: SelectPrev; + + SDLK_RIGHT: + begin + if (Interaction=1) then + InteractInc; + end; + SDLK_LEFT: + begin + if (Interaction=1) then + InteractDec; + end; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN : + begin + end; + end; +end; + +constructor TScreenSongJumpto.Create; +var + I: integer; +begin + inherited Create; + //Translate Texts //TODO: Port to UTheme (Linebonus and PartyScreens, too + IType[0] := Language.Translate('SONG_JUMPTO_TYPE1'); + IType[1] := Language.Translate('SONG_JUMPTO_TYPE2'); + IType[2] := Language.Translate('SONG_JUMPTO_TYPE3'); + SongsFound := Language.Translate('SONG_JUMPTO_SONGSFOUND'); + NoSongsFound := Language.Translate('SONG_JUMPTO_NOSONGSFOUND'); + CatText := Language.Translate('SONG_JUMPTO_CATTEXT'); + + AddBackground(Theme.SongJumpto.Background.Tex); + + AddButton(Theme.SongJumpto.ButtonSearchText); + if (Length(Button[0].Text) = 0) then + AddButtonText(14, 20, ''); + + SelectType := 0; + AddSelectSlide(Theme.SongJumpto.SelectSlideType, SelectType, IType); + + AddText(Theme.SongJumpto.TextFound); + + for I := 0 to High(Theme.SongJumpto.Static) do + AddStatic(Theme.SongJumpto.Static[I]); + + for I := 0 to High(Theme.SongJumpto.Text) do + AddText(Theme.SongJumpto.Text[I]); + + Interaction := 0; +end; + +procedure TScreenSongJumpto.onShow; +begin + Interaction := 0; + SetTextFound(0); +end; + +function TScreenSongJumpto.Draw: boolean; +begin + Result := inherited Draw; +end; + +procedure TScreenSongJumpto.SetTextFound(const Count: Cardinal); +begin + if (Count = 0) then + Text[0].Text := NoSongsFound + else + Text[0].Text := Format(SongsFound, [Count]); + + //Set CatTopLeftText + ScreenSong.ShowCatTLCustom(Format(CatText, [Button[0].Text[0].Text])); + + //visSongs setzen + VisSongs := Count; + + //Fix SongSelection + ScreenSong.Interaction := 0; + ScreenSong.SelectNext; + ScreenSong.FixSelected; +end; + +end. -- cgit v1.2.3 From 8d591b8344e0cb87e1a987961b3790fa26d323a6 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 29 Mar 2007 12:40:11 +0000 Subject: Fixed Some Bugs in JumpTo Screen: Now plays correct music Space Bug is gone Added onSentenceChange Procedure to ScreenSing git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@48 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 116 +++++++++++++++++--------------- Game/Code/Screens/UScreenSong.pas | 58 +++++++--------- Game/Code/Screens/UScreenSongJumpto.pas | 41 ++++++++++- 3 files changed, 123 insertions(+), 92 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 7b96e273..201b97fa 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -50,6 +50,8 @@ type //OnSentenceEnd for LineBonus + Singbar procedure onSentenceEnd(S: Cardinal); + //OnSentenceChange (for Golden Notes) + procedure onSentenceChange(S: Cardinal); end; implementation @@ -1055,73 +1057,73 @@ A: Real; B: integer; //Max Points for Notes begin -//Check for Empty Sentence -if (Czesci[0].Czesc[S].TotalNotes<=0) then - exit; + //Check for Empty Sentence + if (Czesci[0].Czesc[S].TotalNotes<=0) then + exit; -//Set Max Note Points -if (Ini.LineBonus > 0) then - B := 9000 -else - B := 10000; + //Set Max Note Points + if (Ini.LineBonus > 0) then + B := 9000 + else + B := 10000; -for I := 0 to High(Player) do begin - A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2; + for I := 0 to High(Player) do begin + A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2; - //SingBar Mod - If ({(Ini.Oscilloscope = 2) and }(Czesci[0].Czesc[S].TotalNotes>0)) then - begin - Player[I].ScorePercentTarget := Player[I].ScorePercentTarget + floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 40 - 26); - if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0; - if Player[I].ScorePercentTarget > 99 then Player[I].ScorePercentTarget := 99; + //SingBar Mod + If ({(Ini.Oscilloscope = 2) and }(Czesci[0].Czesc[S].TotalNotes>0)) then + begin + Player[I].ScorePercentTarget := Player[I].ScorePercentTarget + floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 40 - 26); + if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0; + if Player[I].ScorePercentTarget > 99 then Player[I].ScorePercentTarget := 99; //end Singbar Mod - end; + end; //PhrasenBonus - Line Bonus Mod - If (Ini.LineBonus > 0) then - begin - - //Generate Steps 0 to 8 - A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); - if A >= 8 then - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_PERFECT') - else if (A = 6) or (A = 7) then - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_BETTER') - else if A = 5 then - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_GOOD') - else if (A = 3) or (A = 4) then - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_NORMAL') - else if A = 2 then - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_BAD') - else - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_WORST'); - - //PhrasenBonus give Points - Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8); - Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10; - //Update Total Score - Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; - - //Color - Player[I].LineBonus_Color.B := 0; - Player[I].LineBonus_Color.R := (8-A)/8; - Player[I].LineBonus_Color.G := A/10; - - Player[I].LineBonus_PosX := Player[I].LineBonus_StartX; - Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; - Player[I].LineBonus_Alpha := 0.92; - Player[I].LineBonus_Visible := True; + If (Ini.LineBonus > 0) then + begin + + //Generate Steps 0 to 8 + A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); + if A >= 8 then + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_PERFECT') + else if (A = 6) or (A = 7) then + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_BETTER') + else if A = 5 then + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_GOOD') + else if (A = 3) or (A = 4) then + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_NORMAL') + else if A = 2 then + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_BAD') + else + Player[I].LineBonus_Text := Language.Translate('LINEBONUS_WORST'); + + //PhrasenBonus give Points + Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8); + Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10; + //Update Total Score + Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; + + //Color + Player[I].LineBonus_Color.B := 0; + Player[I].LineBonus_Color.R := (8-A)/8; + Player[I].LineBonus_Color.G := A/10; + + Player[I].LineBonus_PosX := Player[I].LineBonus_StartX; + Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; + Player[I].LineBonus_Alpha := 0.92; + Player[I].LineBonus_Visible := True; - end; + end; -//Refresh LastScore -Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; + //Refresh LastScore + Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; -end; + end; //PhrasenBonus - Line Bonus Mod End// } //GoldenStarsTwinkle Mod @@ -1129,4 +1131,10 @@ end; //GoldenStarsTwinkle Mod End end; +//Called on Sentence Change S= New Current Sentence +procedure TScreenSing.onSentenceChange(S: Cardinal); +begin + //Dummy +end; + end. diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 69ec8639..9202717d 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -74,6 +74,7 @@ type procedure HideCatTL;// Show Cat in Tob left procedure Refresh; //Refresh Song Sorting procedure DrawEqualizer; + procedure ChangeMusic; //Party Mode procedure SelectRandomSong; procedure SetJoker; @@ -269,11 +270,7 @@ begin FixSelected; //Play Music: - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); - Music.Play; - end; + ChangeMusic; end else begin // clicked on song if (Mode = 0) then //Normal Mode -> Start Song @@ -342,11 +339,7 @@ begin //Play Music: Music.PlayChange; - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); - Music.Play; - end; + ChangeMusic; end; @@ -392,11 +385,7 @@ begin //Play Music: Music.PlayChange; - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); - Music.Play; - end; + ChangeMusic; end; @@ -412,11 +401,7 @@ begin SelectNext; // InteractNext; // SongTarget := Interaction; - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); - Music.Play; - end; + ChangeMusic; SetScroll4; UpdateLCD; Light.LightOne(1, 200); @@ -428,11 +413,7 @@ begin if (Length(Songs.Song) > 0)AND (Mode = 0) then begin Music.PlayChange; SelectPrev; - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); - Music.Play; - end; + ChangeMusic; SetScroll4; UpdateLCD; Light.LightOne(0, 200); @@ -514,11 +495,7 @@ begin end; Music.PlayChange; - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); - Music.Play; - end; + ChangeMusic; SetScroll4; UpdateLCD; end; @@ -1288,6 +1265,21 @@ begin LCD.WriteText(2, Text[TextTitle].Text); end; +//Procedure Change current played Preview +procedure TScreenSong.ChangeMusic; +begin + if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then + begin + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + Music.Play; + end; + end + else + Music.Stop; +end; + procedure TScreenSong.SkipTo(Target: integer); // 0.5.0 var Skip: integer; @@ -1447,11 +1439,7 @@ begin //Choose Song SkipTo(I2-I); - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); - Music.Play; - end; + ChangeMusic; end; procedure TScreenSong.SetJoker; diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 449141c3..2bf0cb5b 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -11,10 +11,20 @@ type Songsfound: String; NoSongsfound: String; CatText: String; + + //For ChangeMusic + LastPlayed: Integer; + VisibleBool: Boolean; public - Visible: Boolean; //Whether the Menu should be Drawn VisSongs: Integer; + constructor Create; override; + + //Visible //Whether the Menu should be Drawn + //Whether the Menu should be Drawn + procedure SetVisible(Value: Boolean); + property Visible: Boolean read VisibleBool write SetVisible; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; function Draw: boolean; override; @@ -159,12 +169,29 @@ begin AddText(Theme.SongJumpto.Text[I]); Interaction := 0; + LastPlayed := 0; +end; + +procedure TScreenSongJumpto.SetVisible(Value: Boolean); +begin +//If change from unvisible to Visible then OnShow + if (VisibleBool = False) AND (Value = True) then + OnShow; + + VisibleBool := Value; end; procedure TScreenSongJumpto.onShow; begin - Interaction := 0; - SetTextFound(0); + //Reset Screen if no Old Search is Displayed + if (CatSongs.CatNumShow <> -2) then + begin + Interaction := 0; + SelectType := 0; + + Button[0].Text[0].Text := ''; + Text[0].Text := NoSongsFound; + end; end; function TScreenSongJumpto.Draw: boolean; @@ -189,6 +216,14 @@ begin ScreenSong.Interaction := 0; ScreenSong.SelectNext; ScreenSong.FixSelected; + + //Play Correct Music + if (ScreenSong.Interaction <> LastPlayed) then + begin + LastPlayed := ScreenSong.Interaction; + + ScreenSong.ChangeMusic; + end; end; end. -- cgit v1.2.3 From e0e16a3b1d28cf51fecf669d42465cf2a65728f3 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 29 Mar 2007 16:54:52 +0000 Subject: Added SBGW to TSelectSlide: Defining the Width of the Selections BG Added W to TText + Pagebreaks. If Width is given the Text breaks at the given width. Breaks are not generated perfect yet, needs some tuning. Changed all affected Screens to fit the new TText Component git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@49 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditHeader.pas | 2 +- Game/Code/Screens/UScreenName.pas | 3 +-- Game/Code/Screens/UScreenOpen.pas | 6 +++--- Game/Code/Screens/UScreenPartyPlayer.pas | 3 +-- Game/Code/Screens/UScreenSing.pas | 12 +++++++----- Game/Code/Screens/UScreenSongJumpto.pas | 9 +++++++-- 6 files changed, 20 insertions(+), 15 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenEditHeader.pas b/Game/Code/Screens/UScreenEditHeader.pas index 65f39e44..a601555a 100644 --- a/Game/Code/Screens/UScreenEditHeader.pas +++ b/Game/Code/Screens/UScreenEditHeader.pas @@ -105,7 +105,7 @@ begin begin T := Interaction - 2 + TextTitle; if (Interaction >= 2) and (Interaction <= 13) and (Length(Text[T].Text) >= 1) then begin - Delete(Text[T].Text, Length(Text[T].Text), 1); + Text[T].DeleteLastL; SetRoundButtons; end; end; diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index 99f5d40a..82519e87 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -33,8 +33,7 @@ begin SDLK_BACKSPACE: begin - Delete(Button[Interaction].Text[0].Text, - Length(Button[Interaction].Text[0].Text), 1); + Button[Interaction].Text[0].DeleteLastL; end; SDLK_ESCAPE : diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index 723f299f..264f57a9 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -43,9 +43,9 @@ begin case PressedKey of 8: // del begin - if Interaction = 0 then - if Length(Text[TextN].Text) >= 1 then begin - Delete(Text[TextN].Text, Length(Text[TextN].Text), 1); + if Interaction = 0 then + begin + Text[TextN].DeleteLastL; FileName := Text[TextN].Text; end; end; diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index b954212a..4fc43013 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -63,8 +63,7 @@ begin SDLK_BACKSPACE: begin - Delete(Button[Interaction].Text[0].Text, - Length(Button[Interaction].Text[0].Text), 1); + Button[Interaction].Text[0].DeleteLastL; end; SDLK_ESCAPE : diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 201b97fa..ee4bedc8 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -369,6 +369,11 @@ begin //Deactivate Pause Paused := False; + //Kill all Stars not Killed yet + //GoldenStarsTwinkle Mod + GoldenRec.KillAll; + //GoldenStarsTwinkle Mod End + {Static[StaticP2R].Visible := V2R; Static[StaticP2RScoreBG].Visible := V2R; Text[TextP2R].Visible := V2R; @@ -1014,11 +1019,6 @@ begin Music.CaptureStop; Music.Stop; - //Kill all Stars not Killed yet - //GoldenStarsTwinkle Mod - GoldenRec.KillAll; - //GoldenStarsTwinkle Mod End - if Ini.SavePlayback = 1 then begin Log.BenchmarkStart(0); Log.LogVoice(0); @@ -1032,6 +1032,8 @@ begin CloseSmpeg; AktSong.VideoLoaded := false; // to prevent drawing closed video end; + + SetFontItalic (False); end; procedure TScreenSing.UpdateLCD; diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 2bf0cb5b..0ba61450 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -90,8 +90,7 @@ begin begin if Interaction = 0 then begin - Delete(Button[0].Text[0].Text, - Length(Button[0].Text[0].Text), 1); + Button[0].Text[0].DeleteLastL; SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); end; end; @@ -121,12 +120,18 @@ begin SDLK_RIGHT: begin if (Interaction=1) then + begin InteractInc; + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + end; end; SDLK_LEFT: begin if (Interaction=1) then + begin InteractDec; + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + end; end; end; end -- cgit v1.2.3 From 563375e18e4aeba0152a9761f1f84d66aaeb27d2 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 30 Mar 2007 12:19:08 +0000 Subject: Finished Code for Plugin Sound PlayBack Removed Debug Message from ULanguage git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@50 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 9202717d..694ecc39 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -149,7 +149,7 @@ var I, I2: Integer; //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover); //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); - Static[StaticCat].Texture := Texture.GetTexture(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover, 'Plain', true); + Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false); //Button[Cat]. //Cover @@ -198,6 +198,30 @@ begin SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + {//Jump To + if (SDL_ModState = KMOD_LALT) AND (PressedKey > SDLK_A) AND (PressedKey < SDLK_Z) then + begin + Letter := UpCase(Chr(ScanCode)); + Log.LogError(Letter); + I2 := Length(CatSongs.Song); + For I := 1 to high(CatSongs.Song) do + begin + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + + Music.PlayChange; + + ChangeMusic; + SetScroll4; + UpdateLCD; + //Break and Exit + Exit; + end; + end; + Exit; + end; } + case PressedKey of SDLK_ESCAPE : begin -- cgit v1.2.3 From 162c1ce5d4c68fc6784fd4a8f0b975b857505574 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 30 Mar 2007 19:17:23 +0000 Subject: Fixed a Bug that causes a wrong Category-Title is displayed in SongScreen after a Search without a result. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@55 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSongJumpto.pas | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 0ba61450..c2107507 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -114,8 +114,17 @@ begin // 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: SelectNext; - SDLK_UP: SelectPrev; + SDLK_DOWN: + begin + SelectNext; + Button[0].Text[0].Selected := (Interaction = 0); + end; + + SDLK_UP: + begin + SelectPrev; + Button[0].Text[0].Selected := (Interaction = 0); + end; SDLK_RIGHT: begin @@ -191,12 +200,15 @@ begin //Reset Screen if no Old Search is Displayed if (CatSongs.CatNumShow <> -2) then begin - Interaction := 0; SelectType := 0; Button[0].Text[0].Text := ''; Text[0].Text := NoSongsFound; end; + + //Select Input + Interaction := 0; + Button[0].Text[0].Selected := True; end; function TScreenSongJumpto.Draw: boolean; @@ -207,14 +219,20 @@ end; procedure TScreenSongJumpto.SetTextFound(const Count: Cardinal); begin if (Count = 0) then - Text[0].Text := NoSongsFound + begin + Text[0].Text := NoSongsFound; + ScreenSong.HideCatTL; + end else + begin Text[0].Text := Format(SongsFound, [Count]); - //Set CatTopLeftText - ScreenSong.ShowCatTLCustom(Format(CatText, [Button[0].Text[0].Text])); + //Set CatTopLeftText + ScreenSong.ShowCatTLCustom(Format(CatText, [Button[0].Text[0].Text])); + end; + - //visSongs setzen + //Set visSongs VisSongs := Count; //Fix SongSelection -- cgit v1.2.3 From 42717e4611f758f137d86fd99e69bf9791d3a727 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 5 Apr 2007 12:50:05 +0000 Subject: Fixed: Not loading Button Texts from Ini Fixed: Exit Text in Option Screens not translated git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@57 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenOptions.pas | 21 ++++++++++++++------- Game/Code/Screens/UScreenOptionsGame.pas | 3 ++- Game/Code/Screens/UScreenOptionsGraphics.pas | 3 ++- Game/Code/Screens/UScreenOptionsLyrics.pas | 3 ++- Game/Code/Screens/UScreenOptionsRecord.pas | 3 ++- Game/Code/Screens/UScreenOptionsSound.pas | 3 ++- Game/Code/Screens/UScreenOptionsThemes.pas | 5 ++--- 7 files changed, 26 insertions(+), 15 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas index 76ff2adc..f24b29c1 100644 --- a/Game/Code/Screens/UScreenOptions.pas +++ b/Game/Code/Screens/UScreenOptions.pas @@ -159,25 +159,32 @@ begin AddBackground(Theme.Options.Background.Tex); AddButton(Theme.Options.ButtonGame); - AddButtonText(14, 20, Theme.Options.Description[0]); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[0]); AddButton(Theme.Options.ButtonGraphics); - AddButtonText(14, 20, Theme.Options.Description[1]); + if (Length(Button[1].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[1]); AddButton(Theme.Options.ButtonSound); - AddButtonText(14, 20, Theme.Options.Description[2]); + if (Length(Button[2].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[2]); AddButton(Theme.Options.ButtonLyrics); - AddButtonText(14, 20, Theme.Options.Description[3]); + if (Length(Button[3].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[3]); AddButton(Theme.Options.ButtonThemes); - AddButtonText(14, 20, Theme.Options.Description[4]); + if (Length(Button[4].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[4]); AddButton(Theme.Options.ButtonRecord); - AddButtonText(14, 20, Theme.Options.Description[5]); + if (Length(Button[5].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[5]); AddButton(Theme.Options.ButtonExit); - AddButtonText(14, 20, Theme.Options.Description[6]); + if (Length(Button[6].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[6]); for I := 0 to High(Theme.Options.Static) do AddStatic(Theme.Options.Static[I]); diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index 6f49bd19..cc6e850b 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -88,7 +88,8 @@ begin AddButton(Theme.OptionsGame.ButtonExit); - AddButtonText(14, 20, 'Exit'); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[6]); end; diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index 1f30f9b5..62648e0c 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -89,7 +89,8 @@ begin AddButton(Theme.OptionsGraphics.ButtonExit); - AddButtonText(14, 20, 'Exit'); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[6]); end; diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas index 21a33998..0ce5c970 100644 --- a/Game/Code/Screens/UScreenOptionsLyrics.pas +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -79,7 +79,8 @@ begin AddButton(Theme.OptionsLyrics.ButtonExit); - AddButtonText(14, 20, 'Exit'); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[6]); end; diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index c27ec02a..b4075ba8 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -104,7 +104,8 @@ begin SelectSlideChannelR := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelR, Ini.CardList[0].ChannelR, IChannel); AddButton(Theme.OptionsRecord.ButtonExit); - AddButtonText(14, 20, 'Exit'); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[6]); Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index a99ae86d..ad6db766 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -80,7 +80,8 @@ begin //AddSelect(Theme.OptionsSound.SelectTwoPlayerMode, Ini.TwoPlayerMode, ITwoPlayerMode); AddButton(Theme.OptionsSound.ButtonExit); - AddButtonText(14, 20, 'Exit'); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[6]); Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index b7d18fa5..eb5ed33e 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -99,15 +99,14 @@ begin AddText(Theme.OptionsThemes.Text[I]); AddSelectSlide(Theme.OptionsThemes.SelectTheme, Ini.Theme, ITheme); - //SelectsS[High(SelectsS)].SetSelectOpt(Ini.Theme); SkinSelect := AddSelectSlide(Theme.OptionsThemes.SelectSkin, Ini.SkinNo, ISkin); - //AddSelectSlideOption('SingStar'); AddSelectSlide(Theme.OptionsThemes.SelectColor, Ini.Color, IColor); AddButton(Theme.OptionsThemes.ButtonExit); - AddButtonText(14, 20, 'Exit'); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[6]); end; procedure TScreenOptionsThemes.onShow; -- cgit v1.2.3 From e2cd03822f28a4866f98fb0893a73b02bd60ce03 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 5 Apr 2007 14:37:58 +0000 Subject: Added Playlist Support Working correct with Standard Mode Only for now Now working on Playlist Support for Party Mode git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@59 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 32 ++++- Game/Code/Screens/UScreenSongJumpto.pas | 21 +-- Game/Code/Screens/UScreenSongMenu.pas | 242 +++++++++++++++++++++++++++++--- 3 files changed, 258 insertions(+), 37 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 694ecc39..6a1df197 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -314,12 +314,26 @@ begin begin if Length(Songs.Song) > 0 then begin if not CatSongs.Song[Interaction].Main then begin // clicked on Song - ScreenSongMenu.MenuShow(SM_Main); + if CatSongs.CatNumShow = -3 then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end + else + begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); end; end; end; - SDLK_J: //Show SongMenu + SDLK_P: //Show Playlist Menu + begin + if Length(Songs.Song) > 0 then begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); + end; + end; + + SDLK_J: //Show Jumpto Menu begin if Length(Songs.Song) > 0 then begin @@ -699,6 +713,8 @@ begin end else if (CatSongs.CatNumShow = -2) then Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) + else if (CatSongs.CatNumShow = -3) then + Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) else if (Ini.Tabs_at_startup = 1) then Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) else @@ -1144,8 +1160,18 @@ begin UpdateLCD; end; + //Playlist Mode + if (Mode = 0) then + begin + //If Playlist Shown -> Select Next automatically + if (CatSongs.CatNumShow = -3) then + begin + SelectNext; + ChangeMusic; + end; + end //Party Mode - if (Mode = 1) then + else if (Mode = 1) then begin SelectRandomSong; end; diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index c2107507..123146c7 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -8,10 +8,6 @@ uses type TScreenSongJumpto = class(TMenu) private - Songsfound: String; - NoSongsfound: String; - CatText: String; - //For ChangeMusic LastPlayed: Integer; VisibleBool: Boolean; @@ -157,13 +153,6 @@ var I: integer; begin inherited Create; - //Translate Texts //TODO: Port to UTheme (Linebonus and PartyScreens, too - IType[0] := Language.Translate('SONG_JUMPTO_TYPE1'); - IType[1] := Language.Translate('SONG_JUMPTO_TYPE2'); - IType[2] := Language.Translate('SONG_JUMPTO_TYPE3'); - SongsFound := Language.Translate('SONG_JUMPTO_SONGSFOUND'); - NoSongsFound := Language.Translate('SONG_JUMPTO_NOSONGSFOUND'); - CatText := Language.Translate('SONG_JUMPTO_CATTEXT'); AddBackground(Theme.SongJumpto.Background.Tex); @@ -172,7 +161,7 @@ begin AddButtonText(14, 20, ''); SelectType := 0; - AddSelectSlide(Theme.SongJumpto.SelectSlideType, SelectType, IType); + AddSelectSlide(Theme.SongJumpto.SelectSlideType, SelectType, Theme.SongJumpto.IType); AddText(Theme.SongJumpto.TextFound); @@ -203,7 +192,7 @@ begin SelectType := 0; Button[0].Text[0].Text := ''; - Text[0].Text := NoSongsFound; + Text[0].Text := Theme.SongJumpto.NoSongsFound; end; //Select Input @@ -220,15 +209,15 @@ procedure TScreenSongJumpto.SetTextFound(const Count: Cardinal); begin if (Count = 0) then begin - Text[0].Text := NoSongsFound; + Text[0].Text := Theme.SongJumpto.NoSongsFound; ScreenSong.HideCatTL; end else begin - Text[0].Text := Format(SongsFound, [Count]); + Text[0].Text := Format(Theme.SongJumpto.SongsFound, [Count]); //Set CatTopLeftText - ScreenSong.ShowCatTLCustom(Format(CatText, [Button[0].Text[0].Text])); + ScreenSong.ShowCatTLCustom(Format(Theme.SongJumpto.CatText, [Button[0].Text[0].Text])); end; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index a5ae2083..849716c4 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -22,7 +22,16 @@ type const SM_Main = 1; + SM_PlayList = 64 or 1; + SM_Playlist_Add = 64 or 2; + SM_Playlist_New = 64 or 3; + + SM_Playlist_Del = 64 or 5; + + SM_Playlist_Load = 64 or 8 or 1; + + SM_Party_Main = 128 or 1; SM_Party_Joker = 128 or 2; @@ -33,7 +42,7 @@ var implementation -uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty; +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist; function TScreenSongMenu.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; function IsVisible: Boolean; @@ -70,6 +79,23 @@ begin Result := true; If (PressedDown) Then begin // Key Down + if (CurMenu = SM_Playlist_New) AND (Interaction=0) then + begin + case PressedKey of + 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 + Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + chr(ScanCode); + exit; + end; + + SDLK_BACKSPACE: + begin + Button[Interaction].Text[0].DeleteLastL; + exit; + end; + end; + end; + case PressedKey of SDLK_Q: begin @@ -87,9 +113,6 @@ begin HandleReturn; 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: SelectNext; SDLK_UP: SelectPrev; @@ -179,9 +202,9 @@ begin SelectsS[0].Visible := False; Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY'); - Button[1].Text[0].Text := Language.Translate('SONG_MENU_EDIT'); - Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYMODI'); - Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); + Button[1].Text[0].Text := Language.Translate('SONG_MENU_CHANGEPLAYERS'); + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_EDIT'); end; SM_PlayList: @@ -189,18 +212,111 @@ begin CurMenu := sMenu; Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST'); + Button[0].Visible := True; + Button[1].Visible := True; + Button[2].Visible := True; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY'); + Button[1].Text[0].Text := Language.Translate('SONG_MENU_CHANGEPLAYERS'); + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_DEL'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_EDIT'); + end; + + SM_Playlist_Add: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_ADD'); + + Button[0].Visible := True; + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := True; + SelectsS[0].Visible := True; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD_NEW'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD_EXISTING'); + + SetLength(ISelections, Length(PlaylistMan.Playlists)); + PlaylistMan.GetNames(ISelections); + + if (Length(ISelections)>=1) then + begin + UpdateSelectSlideOptions(Theme.SongMenu.SelectSlide3, 0, ISelections, SelectValue); + end + else + begin + Button[3].Visible := False; + SelectsS[0].Visible := False; + Button[2].Visible := True; + Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING'); + end; + end; + + SM_Playlist_New: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_NEW'); + + Button[0].Visible := True; + Button[1].Visible := False; + Button[2].Visible := True; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NEW_UNNAMED'); + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NEW_CREATE'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); + end; + + SM_PlayList_Del: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_Del'); + Button[0].Visible := True; Button[1].Visible := False; Button[2].Visible := False; Button[3].Visible := True; SelectsS[0].Visible := False; - Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD'); - Button[1].Text[0].Text := ''; - Button[2].Text[0].Text := ''; + Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES'); Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); end; + SM_Playlist_Load: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_LOAD'); + + Button[0].Visible := False; + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := True; + SelectsS[0].Visible := True; + + Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_LOAD'); + + SetLength(ISelections, Length(PlaylistMan.Playlists)); + PlaylistMan.GetNames(ISelections); + + if (Length(ISelections)>=1) then + begin + UpdateSelectSlideOptions(Theme.SongMenu.SelectSlide3, 0, ISelections, SelectValue); + Interaction := 4; + end + else + begin + Button[3].Visible := False; + SelectsS[0].Visible := False; + Button[2].Visible := True; + Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING'); + Interaction := 3; + end; + end; + + SM_Party_Main: begin CurMenu := sMenu; @@ -242,21 +358,24 @@ begin Case CurMenu of SM_Main: begin - Visible := False; Case Interaction of 0: //Button 1 begin ScreenSong.StartSong; + Visible := False; end; 1: //Button 2 begin - ScreenSong.OpenEditor; + //Select New Players then Sing: + + Visible := False; end; 2: //Button 3 begin - //Todo: Add SingleRound Modi Support + //Show add to Playlist Menu + MenuShow(SM_Playlist_Add); end; 3: //SelectSlide 3 @@ -266,7 +385,8 @@ begin 4: //Button 4 begin - //Cancel... (Do Nothing) + ScreenSong.OpenEditor; + Visible := False; end; end; end; @@ -277,17 +397,21 @@ begin Case Interaction of 0: //Button 1 begin - // + ScreenSong.StartSong; + Visible := False; end; 1: //Button 2 begin - // + //Select New Players then Sing: + + Visible := False; end; 2: //Button 3 begin - //Todo + //Show add to Playlist Menu + MenuShow(SM_Playlist_Del); end; 3: //SelectSlide 3 @@ -297,7 +421,89 @@ begin 4: //Button 4 begin - // + ScreenSong.OpenEditor; + Visible := False; + end; + end; + end; + + SM_Playlist_Add: + begin + Case Interaction of + 0: //Button 1 + begin + MenuShow(SM_Playlist_New); + end; + + 3: //SelectSlide 3 + begin + //Dummy + end; + + 4: //Button 4 + begin + PlaylistMan.AddItem(ScreenSong.Interaction, SelectValue); + Visible := False; + end; + end; + end; + + SM_Playlist_New: + begin + Case Interaction of + 0: //Button 1 + begin + //Nothing, Button for Entering Name + end; + + 2: //Button 3 + begin + //Create Playlist and Add Song + PlaylistMan.AddItem( + ScreenSong.Interaction, + PlaylistMan.AddPlaylist(Button[0].Text[0].Text)); + Visible := False; + end; + + 3: //SelectSlide 3 + begin + //Cancel -> Go back to Add screen + MenuShow(SM_Playlist_Add); + end; + + 4: //Button 4 + begin + Visible := False; + end; + end; + end; + + SM_PlayList_Del: + begin + Visible := False; + Case Interaction of + 0: //Button 1 + begin + //Delete + PlayListMan.DelItem(PlayListMan.GetIndexbySongID(ScreenSong.Interaction)); + Visible := False; + end; + + 4: //Button 4 + begin + MenuShow(SM_Playlist); + end; + end; + end; + + SM_Playlist_Load: + begin + Case Interaction of + 4: //Button 4 + begin + //Load Playlist + PlaylistMan.SetPlayList(SelectValue); + Visible := False; end; end; end; -- cgit v1.2.3 From 966955d94331c4cf78e16215bf2c30268be035ed Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 5 Apr 2007 14:49:46 +0000 Subject: Fixed a spelling mistake in ScreenSongMenu Translation Texts Fixed Set wrong Interaction in Playlist Load Menu git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@60 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSongMenu.pas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 849716c4..0b4a9d91 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -273,7 +273,7 @@ begin SM_PlayList_Del: begin CurMenu := sMenu; - Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_Del'); + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_DEL'); Button[0].Visible := True; Button[1].Visible := False; @@ -304,7 +304,7 @@ begin if (Length(ISelections)>=1) then begin UpdateSelectSlideOptions(Theme.SongMenu.SelectSlide3, 0, ISelections, SelectValue); - Interaction := 4; + Interaction := 3; end else begin @@ -312,7 +312,7 @@ begin SelectsS[0].Visible := False; Button[2].Visible := True; Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING'); - Interaction := 3; + Interaction := 2; end; end; -- cgit v1.2.3 From 9d01c8801db29d6ff3d64ef81b84321549d84688 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 5 Apr 2007 21:09:52 +0000 Subject: Added Advanced Screen and Options in TIni Options working now only for Effect Perfect and Effect Golden. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@65 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditSub.pas | 4 +- Game/Code/Screens/UScreenOptions.pas | 11 +++- Game/Code/Screens/UScreenOptionsAdvanced.pas | 95 ++++++++++++++++++++++++++++ Game/Code/Screens/UScreenOptionsGraphics.pas | 1 - Game/Code/Screens/UScreenSing.pas | 14 ++-- Game/Code/Screens/UScreenSongMenu.pas | 4 +- 6 files changed, 114 insertions(+), 15 deletions(-) create mode 100644 Game/Code/Screens/UScreenOptionsAdvanced.pas (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 52cd0b26..6094edd1 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -1096,6 +1096,8 @@ begin MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table MidiOut.Open; + //MidiOut.SetVolume(65535, 65535); + CzyscNuty; @@ -1113,7 +1115,7 @@ begin Music.Open(Path + AktSong.Mp3); //Set Down Music Volume for Better hearability of Midi Sounds - Music.SetVolume(40); + //Music.SetVolume(40); Lyric.Clear; Lyric.X := 400; diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas index f24b29c1..2a8d0d9a 100644 --- a/Game/Code/Screens/UScreenOptions.pas +++ b/Game/Code/Screens/UScreenOptions.pas @@ -70,6 +70,11 @@ begin end; if SelInteraction = 6 then begin + Music.PlayStart; + FadeTo(@ScreenOptionsAdvanced); + end; + + if SelInteraction = 7 then begin Ini.Save; Music.PlayBack; FadeTo(@ScreenMain); @@ -182,10 +187,14 @@ begin if (Length(Button[5].Text)=0) then AddButtonText(14, 20, Theme.Options.Description[5]); - AddButton(Theme.Options.ButtonExit); + AddButton(Theme.Options.ButtonAdvanced); if (Length(Button[6].Text)=0) then AddButtonText(14, 20, Theme.Options.Description[6]); + AddButton(Theme.Options.ButtonExit); + if (Length(Button[7].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[7]); + for I := 0 to High(Theme.Options.Static) do AddStatic(Theme.Options.Static[I]); diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas new file mode 100644 index 00000000..bfbd54a7 --- /dev/null +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -0,0 +1,95 @@ +unit UScreenOptionsAdvanced; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + +type + TScreenOptionsAdvanced = class(TMenu) + public + constructor Create(Back: String); override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + end; + +implementation + +uses UGraphic; + +function TScreenOptionsAdvanced.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_ESCAPE : + begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 6 then begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + Music.PlayOption; + InteractInc; + end; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + Music.PlayOption; + InteractDec; + end; + end; + end; + end; +end; + +constructor TScreenOptionsAdvanced.Create(Back: String); +var + I: integer; +begin + inherited Create(Back); + + AddBackground(Theme.OptionsAdvanced.Background.Tex); + + for I := 0 to High(Theme.OptionsAdvanced.Static) do + AddStatic(Theme.OptionsAdvanced.Static[I]); + + for I := 0 to High(Theme.OptionsAdvanced.Text) do + AddText(Theme.OptionsAdvanced.Text[I]); + + AddSelect(Theme.OptionsAdvanced.SelectLoadAnimation, Ini.LoadAnimation, ILoadAnimation); + AddSelect(Theme.OptionsAdvanced.SelectEffectPerfect, Ini.EffectPerfect, IEffectPerfect); + AddSelect(Theme.OptionsAdvanced.SelectEffectGolden, Ini.EffectGolden, IEffectGolden); + AddSelect(Theme.OptionsAdvanced.SelectLineBonus, Ini.LineBonus, ILineBonus); + AddSelectSlide(Theme.OptionsAdvanced.SelectOnSongClick, Ini.OnSongClick, IOnSongClick); + AddSelect(Theme.OptionsAdvanced.SelectAskbeforeDel, Ini.AskbeforeDel, IAskbeforeDel); + + AddButton(Theme.OptionsAdvanced.ButtonExit); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[6]); + + Interaction := 0; +end; + +procedure TScreenOptionsAdvanced.onShow; +begin + Interaction := 0; +end; + +end. diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index 62648e0c..d39a10c8 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -84,7 +84,6 @@ begin AddSelect(Theme.OptionsGraphics.SelectFullscreen, Ini.Fullscreen, IFullscreen); AddSelect(Theme.OptionsGraphics.SelectDepth, Ini.Depth, IDepth); AddSelect(Theme.OptionsGraphics.SelectOscilloscope, Ini.Oscilloscope, IOscilloscope); - AddSelect(Theme.OptionsGraphics.SelectLineBonus, Ini.LineBonus, ILineBonus); AddSelect(Theme.OptionsGraphics.SelectMovieSize, Ini.MovieSize, IMovieSize); diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index ee4bedc8..d684dc3c 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1089,18 +1089,12 @@ begin //Generate Steps 0 to 8 A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); + + //Generate Text if A >= 8 then - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_PERFECT') - else if (A = 6) or (A = 7) then - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_BETTER') - else if A = 5 then - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_GOOD') - else if (A = 3) or (A = 4) then - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_NORMAL') - else if A = 2 then - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_BAD') + Player[I].LineBonus_Text := Theme.Sing.LineBonusText[8] else - Player[I].LineBonus_Text := Language.Translate('LINEBONUS_WORST'); + Player[I].LineBonus_Text := Theme.Sing.LineBonusText[Floor(A)]; //PhrasenBonus give Points Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8); diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 0b4a9d91..3ccba228 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -250,7 +250,7 @@ begin Button[3].Visible := False; SelectsS[0].Visible := False; Button[2].Visible := True; - Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING'); + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING'); end; end; @@ -311,7 +311,7 @@ begin Button[3].Visible := False; SelectsS[0].Visible := False; Button[2].Visible := True; - Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING'); + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING'); Interaction := 2; end; end; -- cgit v1.2.3 From 4f7bf28056fefdcd000499c583a47738ce7d9b07 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 6 Apr 2007 10:32:24 +0000 Subject: Fixed a Bug in Optionsscreen after adding OptionsAdvanced Screen Added Jump to Title HotKey (Alt + A..Z) Added Playlist Support to Party Mode, Category Only Mode is still buggy. Fixed: Team3 Players are now Hidden when only 2 Teams are Selected git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@67 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenOptionsAdvanced.pas | 2 +- Game/Code/Screens/UScreenOptionsGame.pas | 2 +- Game/Code/Screens/UScreenOptionsGraphics.pas | 2 +- Game/Code/Screens/UScreenOptionsLyrics.pas | 2 +- Game/Code/Screens/UScreenOptionsRecord.pas | 2 +- Game/Code/Screens/UScreenOptionsSound.pas | 2 +- Game/Code/Screens/UScreenOptionsThemes.pas | 2 +- Game/Code/Screens/UScreenPartyOptions.pas | 137 +++++++++++++++++++++++++-- Game/Code/Screens/UScreenSong.pas | 89 +++++++++++------ 9 files changed, 198 insertions(+), 42 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index bfbd54a7..7904a284 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -82,7 +82,7 @@ begin AddButton(Theme.OptionsAdvanced.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[6]); + AddButtonText(14, 20, Theme.Options.Description[7]); Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index cc6e850b..63bbec36 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -89,7 +89,7 @@ begin AddButton(Theme.OptionsGame.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[6]); + AddButtonText(14, 20, Theme.Options.Description[7]); end; diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index d39a10c8..4befb092 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -89,7 +89,7 @@ begin AddButton(Theme.OptionsGraphics.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[6]); + AddButtonText(14, 20, Theme.Options.Description[7]); end; diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas index 0ce5c970..35cb2415 100644 --- a/Game/Code/Screens/UScreenOptionsLyrics.pas +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -80,7 +80,7 @@ begin AddButton(Theme.OptionsLyrics.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[6]); + AddButtonText(14, 20, Theme.Options.Description[7]); end; diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index b4075ba8..e6989d43 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -105,7 +105,7 @@ begin AddButton(Theme.OptionsRecord.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[6]); + AddButtonText(14, 20, Theme.Options.Description[7]); Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index ad6db766..aea6cdbc 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -81,7 +81,7 @@ begin AddButton(Theme.OptionsSound.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[6]); + AddButtonText(14, 20, Theme.Options.Description[7]); Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index eb5ed33e..151913be 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -106,7 +106,7 @@ begin AddButton(Theme.OptionsThemes.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[6]); + AddButtonText(14, 20, Theme.Options.Description[7]); end; procedure TScreenOptionsThemes.onShow; diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 148289e8..042e944f 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -27,10 +27,13 @@ type function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure SetAnimationProgress(Progress: real); override; + procedure SetPlaylist2; end; var ILevel: array[0..2] of String; + 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'); @@ -38,10 +41,42 @@ const implementation -uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UDLLManager; +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UDLLManager, UPlaylist, USongs; function TScreenPartyOptions.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -var I: Integer; + var + I, J: Integer; + + function IsVisible: Boolean; + begin + Result := True; + if (Interactions[Interaction].Typ = 0) then + begin + Result := Button[Interactions[Interaction].Num].Visible; + end + else if (Interactions[Interaction].Typ = 1) then + begin + //Result := Selects[Interactions[Interaction].Num].Visible; + end + else if (Interactions[Interaction].Typ = 3) then + begin + Result := SelectsS[Interactions[Interaction].Num].Visible; + end; + end; + + Procedure SelectNext; + begin + repeat + InteractNext; + until IsVisible; + end; + + Procedure SelectPrev; + begin + repeat + InteractPrev; + until IsVisible; + end; begin Result := true; If (PressedDown) Then @@ -71,6 +106,26 @@ begin 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; + //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; + end + else + PlaylistMan.CurPlayList := Playlist2; //Save Rounds + Random SetLength (PartySession.Rounds, Rounds + 2); For I := 0 to high (PartySession.Rounds) do @@ -86,17 +141,43 @@ begin // 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_DOWN: SelectNext; + SDLK_UP: SelectPrev; SDLK_RIGHT: begin Music.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 + Case NumTeams of + 0: SelectsS[7].Visible := False; + 1: SelectsS[7].Visible := True; + end; + end; end; SDLK_LEFT: begin Music.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 + Case NumTeams of + 0: SelectsS[7].Visible := False; + 1: SelectsS[7].Visible := True; + end; + end; end; end; end @@ -119,6 +200,15 @@ begin ILevel[1] := Language.Translate('SING_MEDIUM'); ILevel[2] := Language.Translate('SING_HARD'); + //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] := '---'; + NumTeams := 0; NumPlayer1 := 0; NumPlayer2 := 0; @@ -130,8 +220,8 @@ begin AddBackground(Theme.PartyOptions.Background.Tex); SelectLevel := AddSelectSlide (Theme.PartyOptions.SelectLevel, Ini.Difficulty, ILevel); - SelectPlayList := AddSelectSlide (Theme.PartyOptions.SelectPlayList, PlayList, ITeams); - SelectPlayList2 := AddSelectSlide (Theme.PartyOptions.SelectPlayList2, PlayList2, ITeams); + 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); @@ -145,6 +235,41 @@ begin AddText(Theme.PartyOptions.Text[I]); 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; + end; + 2: + begin + SetLength(IPlaylist2, Length(PlaylistMan.Playlists)); + PlaylistMan.GetNames(IPlaylist2); + end; + end; + + Playlist2 := 0; + UpdateSelectSlideOptions(Theme.PartyOptions.SelectPlayList2, 2, IPlaylist2, Playlist2); end; procedure TScreenPartyOptions.onShow; diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 6a1df197..2af37dd5 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -89,7 +89,7 @@ type end; implementation -uses UGraphic, UMain, UCovers, math, OpenGL12, Windows, USkins, UDLLManager, UParty, UScreenSongMenu; +uses UGraphic, UMain, UCovers, math, OpenGL12, Windows, USkins, UDLLManager, UParty, UPlaylist, UScreenSongMenu; // ***** Public methods ****** // @@ -198,8 +198,8 @@ begin SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); - {//Jump To - if (SDL_ModState = KMOD_LALT) AND (PressedKey > SDLK_A) AND (PressedKey < SDLK_Z) then + //Jump To + if (SDL_ModState = KMOD_LALT) AND (Mode = 0) AND (PressedKey > SDLK_A) AND (PressedKey < SDLK_Z) then begin Letter := UpCase(Chr(ScanCode)); Log.LogError(Letter); @@ -208,7 +208,7 @@ begin begin if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + SkipTo(2 + CatSongs.VisibleIndex((I + Interaction) mod I2)); Music.PlayChange; @@ -220,7 +220,7 @@ begin end; end; Exit; - end; } + end; case PressedKey of SDLK_ESCAPE : @@ -312,7 +312,7 @@ begin SDLK_M: //Show SongMenu begin - if Length(Songs.Song) > 0 then begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin if not CatSongs.Song[Interaction].Main then begin // clicked on Song if CatSongs.CatNumShow = -3 then ScreenSongMenu.MenuShow(SM_Playlist) @@ -328,14 +328,14 @@ begin SDLK_P: //Show Playlist Menu begin - if Length(Songs.Song) > 0 then begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin ScreenSongMenu.MenuShow(SM_Playlist_Load); end; end; SDLK_J: //Show Jumpto Menu begin - if Length(Songs.Song) > 0 then + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin ScreenSongJumpto.Visible := True; end; @@ -1462,34 +1462,65 @@ Procedure TScreenSong.SelectRandomSong; var I, I2: Integer; begin - repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; + Case PlaylistMan.Mode of + 0: //All Songs Just Select Random Song + begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; - //Search Cat - for I := I2 downto low(CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - break; - end; - //In I ist jetzt die Kategorie in I2 der Song + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song - //Choose Cat - CatSongs.ShowCategoryList; + //Choose Cat + CatSongs.ShowCategoryList; - //Show Cat in Top Left Mod - ShowCatTL (I); + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Fix: Not Existing Song selected: + if (I+1=I2) then Inc(I2); + + //Choose Song + SkipTo(I2-I); + end; + 1: //One Category Select Category and Select Random Song + begin + CatSongs.HideCategory(-1); + CatSongs.ShowCategory(PlaylistMan.CurPlayList); + ShowCatTL(PlaylistMan.CurPlayList); - CatSongs.ClickCategoryButton(I); - SelectNext; + SelectNext; + FixSelected; - //Fix: Not Existing Song selected: - if (I+1=I2) then Inc(I2); + SkipTo(2+Random(CatSongs.VisibleSongs-1)); + Music.PlayChange; + ChangeMusic; + SetScroll4; + UpdateLCD; + end; + 2: //Playlist: Select Playlist and Select Random Song + begin + PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); - //Choose Song - SkipTo(I2-I); + SkipTo(2+Random(CatSongs.VisibleSongs-1)); + Music.PlayChange; + ChangeMusic; + SetScroll4; + UpdateLCD; + FixSelected; + end; + end; - ChangeMusic; + ChangeMusic; end; procedure TScreenSong.SetJoker; -- cgit v1.2.3 From 4ce8b89fdaf829546449c0d1acab14df80c49d95 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 7 Apr 2007 12:58:11 +0000 Subject: Fixed some Bugs in Effect Engine: Perfect Note Stars was drawn 2 Times Golden Note Extra twinkling stops and is redrawn until next Sentece or Note at the End of the Golden Note. Redrawing of Golden Note Twinkles at the next Sentence git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@71 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index d684dc3c..ae5b239c 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1121,16 +1121,14 @@ begin end; //PhrasenBonus - Line Bonus Mod End// } - -//GoldenStarsTwinkle Mod - GoldenRec.KillAll; -//GoldenStarsTwinkle Mod End end; //Called on Sentence Change S= New Current Sentence procedure TScreenSing.onSentenceChange(S: Cardinal); begin - //Dummy + //GoldenStarsTwinkle Mod + GoldenRec.KillAll; + //GoldenStarsTwinkle Mod End end; end. -- cgit v1.2.3 From e9a8dafe97dfc4570e08bd8a1054e7f6e91ff8a1 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 8 Apr 2007 21:50:36 +0000 Subject: Fixed a Bug Fading in to Options Screen Fixed Exit in Grafic Screen don't work git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@74 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenOptions.pas | 2 ++ Game/Code/Screens/UScreenOptionsGraphics.pas | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas index 2a8d0d9a..0fffedac 100644 --- a/Game/Code/Screens/UScreenOptions.pas +++ b/Game/Code/Screens/UScreenOptions.pas @@ -232,6 +232,8 @@ begin Button[3].Texture.ScaleW := Progress; Button[4].Texture.ScaleW := Progress; Button[5].Texture.ScaleW := Progress; + Button[6].Texture.ScaleW := Progress; + Button[7].Texture.ScaleW := Progress; end; end. diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index 4befb092..6152c9c0 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -38,7 +38,7 @@ begin { if SelInteraction <= 1 then begin Restart := true; end;} - if SelInteraction = 6 then begin + if SelInteraction = 5 then begin Ini.Save; Music.PlayBack; FadeTo(@ScreenOptions); @@ -50,14 +50,14 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + if (SelInteraction >= 0) and (SelInteraction <= 4) then begin Music.PlayOption; InteractInc; end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + if (SelInteraction >= 0) and (SelInteraction <= 4) then begin Music.PlayOption; InteractDec; end; -- cgit v1.2.3 From d28350b7fe6e1c827e9994d28f7f95cae4ac2db6 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 10 Apr 2007 10:15:14 +0000 Subject: Corrected Coverpositions in Style 4 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@75 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 2af37dd5..e873d287 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -945,11 +945,12 @@ begin Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - Z := (1 + cos(Wsp)) / 2 - 0.2; + Z := (1 + cos(Wsp)) / 2; Z2 := (1 + 2*Z) / 3; - Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.W + 0.185 * Theme.Song.Cover.H * VS * sin(Wsp) - Theme.Song.Cover.X) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - Button[B].Z := Z; + + Button[B].X := Theme.Song.Cover.X + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z / 2 + 0.3; Button[B].W := Theme.Song.Cover.H * Z2; @@ -1050,16 +1051,6 @@ var VS: integer; diff: real; X: Real; - {function margin (const X, Y, VS: real):real; //Margin of to Buttons - begin - Result := Frac(x / y) * y; - if (X - VS) >= -3 then - Result := X - VS - Y - else if (X + 3) >= VS then - Result := X - VS + Y - else - Result := X - Y; - end; } begin VS := CatSongs.VisibleSongs; // cache Visible Songs {Vars @@ -1096,9 +1087,12 @@ begin Button[B].W := Button[B].H; - Diff := (Button[B].H - Theme.Song.Cover.H)/2;; + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + + X := Sin(Angle); - Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * Sin(Angle) - Diff; + Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Diff; end else -- cgit v1.2.3 From da9dc16fd9983e4af6790900c7c007cfe603709b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 10 Apr 2007 15:10:26 +0000 Subject: Beautified Credits Screen Edited Texts to Fit Screen Width git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@76 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenMain.pas | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index dcd7db26..ccd81ee9 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -45,11 +45,11 @@ const Credits_Text: Array[0..46] of PChar = ( 'DennistheMenace:', 'Beta Testing and great Support in "the Board"', ':SPACE:', - 'Moq/Moguhguh:', + 'Mog:', 'Programming', ':SPACE:', 'Mota:', - 'Programming, Idea of creating this Mod, Team Leading', + 'Programming, Idea of creating this Mod', ':SPACE:', 'Sawyer:', 'Web Master, Programming', @@ -72,9 +72,9 @@ const Credits_Text: Array[0..46] of PChar = ( ':SPACE:', ':SPACE:', 'Visit us at:', - 'http://www.UltraStar-Deluxe.de.vu', - 'http://www.USD.de.vu', - 'http://www.Ultra-Star.dl.am ("The Board" by Blind Guard)', + 'http://www.ultrastardx.dl.am', + 'http://sourceforge.net/projects/ultrastardx/', + 'http://www.Ultra-Star.dl.am', 'Please write Bug Reports and Feature Requests', 'to help making this a better Game'); @@ -329,7 +329,7 @@ begin SetFontStyle (2); SetFontItalic(False); SetFontSize(9); - SetFontPos (460, 570); + SetFontPos (10, 5); glColor4f(1, 0, 0, 0.2 + Abs((Credits_Alpha mod 150)/100 - 0.75)); glPrint ('Credits! Press any Key to Continue'); @@ -339,7 +339,12 @@ begin if (Credits_Y>-35) then begin Ver := PChar(Language.Translate('US_VERSION')); - glColor4f(1, 0.6, 0.08, 0.8); + //Set Color + if Credits_Y > 500 then + glColor4f(1, 0.6, 0.08, (600 - Credits_Y)/100 - 0.2) + else + glColor4f(1, 0.6, 0.08, 0.8); + SetFontPos (400 - glTextWidth(Ver)/2, Credits_Y); glprint(Ver); end; @@ -367,6 +372,12 @@ begin Y := Y + 55 else begin + //Set Color + if Y > 500 then + glColor4f(0.8, 0.8, 1, (600 - Y)/100 - 0.2) + else + glColor4f(0.8, 0.8, 1, 0.8); + SetFontPos (400 - glTextWidth(Credits_Text[T])/2, Y); glprint(Credits_Text[T]); Y := Y + 30; @@ -376,7 +387,7 @@ begin break; end; - //If lower Position is outside the Screen-> Show MainMenu + //If lowest Position is outside the Screen-> Show MainMenu if (Y <= 0) then Credits_Visible := False; end; -- cgit v1.2.3 From 44956e119562be2defd82eba8b10e7069ead5b76 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 10 Apr 2007 15:12:07 +0000 Subject: Edited Mogs Text: Now hes a Graphics Guy ^^ git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@77 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenLoading.pas | 8 +++++++- Game/Code/Screens/UScreenMain.pas | 2 +- Game/Code/Screens/UScreenSing.pas | 3 +++ Game/Code/Screens/UScreenWelcome.pas | 16 ++++++++-------- 4 files changed, 19 insertions(+), 10 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenLoading.pas b/Game/Code/Screens/UScreenLoading.pas index 05b308ac..5cc938bb 100644 --- a/Game/Code/Screens/UScreenLoading.pas +++ b/Game/Code/Screens/UScreenLoading.pas @@ -3,7 +3,7 @@ unit UScreenLoading; interface uses - UMenu, SDL, SysUtils, UThemes; + UMenu, SDL, SysUtils, UThemes, OpenGL12; type TScreenLoading = class(TMenu) @@ -11,6 +11,7 @@ type Fadeout: boolean; constructor Create(Back: String); override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function GetBGTexNum: GLUInt; procedure onShow; override; end; @@ -45,4 +46,9 @@ 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 ccd81ee9..43034912 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -46,7 +46,7 @@ const Credits_Text: Array[0..46] of PChar = ( 'Beta Testing and great Support in "the Board"', ':SPACE:', 'Mog:', - 'Programming', + 'Programming, Graphics', ':SPACE:', 'Mota:', 'Programming, Idea of creating this Mod', diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index ae5b239c..c6191cec 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1119,6 +1119,8 @@ begin //Refresh LastScore Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; + + end; //PhrasenBonus - Line Bonus Mod End// } end; @@ -1129,6 +1131,7 @@ begin //GoldenStarsTwinkle Mod GoldenRec.KillAll; //GoldenStarsTwinkle Mod End + end; end. diff --git a/Game/Code/Screens/UScreenWelcome.pas b/Game/Code/Screens/UScreenWelcome.pas index de3b50f4..79fcc2c4 100644 --- a/Game/Code/Screens/UScreenWelcome.pas +++ b/Game/Code/Screens/UScreenWelcome.pas @@ -18,7 +18,7 @@ type implementation -uses UGraphic, UTime; +uses UGraphic, UTime, USkins; function TScreenWelcome.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -41,14 +41,14 @@ end; constructor TScreenWelcome.Create; begin inherited Create; -{ AddStatic(-10, -10, 0, 0, 1, 1, 1, Skin.Star, 'BMP', 'Transparent'); - AddStatic(-500, 440, 200, 5, 0, 0, 0, Skin.Line, 'JPG', 'Font Black'); - AddStatic(-500, 472, 200, 5, 0, 0, 0, Skin.Line, 'JPG', 'Font Black'); - AddStatic(-500, 504, 200, 5, 0, 0, 0, Skin.Line, 'JPG', 'Font Black'); - AddStatic(-500, 536, 200, 5, 0, 0, 0, Skin.Line, 'JPG', 'Font Black'); - AddStatic(-500, 568, 200, 5, 0, 0, 0, Skin.Line, 'JPG', 'Font Black'); + AddStatic(-10, -10, 0, 0, 1, 1, 1, Skin.GetTextureFileName('ButtonAlt') , 'JPG', 'Transparent'); + AddStatic(-500, 440, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), 'JPG', 'Font Black'); + AddStatic(-500, 472, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), 'JPG', 'Font Black'); + AddStatic(-500, 504, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), 'JPG', 'Font Black'); + AddStatic(-500, 536, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), 'JPG', 'Font Black'); + AddStatic(-500, 568, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), 'JPG', 'Font Black'); Animation := 0; - Fadeout := false;} + Fadeout := false; end; procedure TScreenWelcome.onShow; -- cgit v1.2.3 From 80e691699f2b236e4af80f8c1178cde07b458da3 Mon Sep 17 00:00:00 2001 From: mogguh Date: Wed, 11 Apr 2007 14:10:41 +0000 Subject: Feature: ScoreScreen now has the ability to show extra texts (UThemes.pas, UScreenScore.pas) Feature: Hit golden note effect, is now even more astonishing (UGraphicClasses.pas) Feature: It's now possible to turn of GoldenNoteTwinkle (UDraw.pas) BugFix: OptionsAdvanced is now opened correctly, instead of producing a bug (UGraphic.pas) BugFix: Modified some language entries to fit option screen (optionen instead of einstellungen) (German.ini) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@78 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenScore.pas | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index eb92a3d2..9184b3f5 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -11,6 +11,8 @@ type TextArtist: integer; TextTitle: integer; + TextArtistTitle : integer; + TextName: array[1..6] of integer; TextScore: array[1..6] of integer; @@ -24,6 +26,8 @@ type TextTotalScore: array[1..6] of integer; PlayerStatic: array[1..6] of array of integer; + PlayerTexts : array[1..6] of array of integer; + StaticBoxLightest: array[1..6] of integer; StaticBoxLight: array[1..6] of integer; @@ -91,7 +95,7 @@ end; constructor TScreenScore.Create(Back: String); var P: integer; - I: integer; + I, C: integer; begin inherited Create(Back); @@ -146,6 +150,8 @@ begin TextArtist := AddText(Theme.Score.TextArtist); TextTitle := AddText(Theme.Score.TextTitle); + TextArtistTitle := AddText(Theme.Score.TextArtistTitle); + for P := 1 to 6 do begin TextName[P] := AddText(Theme.Score.TextName[P]); TextScore[P] := AddText(Theme.Score.TextScore[P]); @@ -160,9 +166,16 @@ begin TextTotalScore[P] := AddText(Theme.Score.TextTotalScore[P]); SetLength(PlayerStatic[P], Length(Theme.Score.PlayerStatic[P])); + for I := 0 to High(Theme.Score.PlayerStatic[P]) do PlayerStatic[P, I] := AddStatic(Theme.Score.PlayerStatic[P, I]); + + //added by mog + for C := 0 to High(Theme.Score.PlayerTexts[P]) do + PlayerTexts[P, C] := AddText(Theme.Score.PlayerTexts[P, C]); + // more skinable now + StaticBoxLightest[P] := AddStatic(Theme.Score.StaticBoxLightest[P]); StaticBoxLight[P] := AddStatic(Theme.Score.StaticBoxLight[P]); StaticBoxDark[P] := AddStatic(Theme.Score.StaticBoxDark[P]); @@ -225,6 +238,7 @@ begin Text[TextArtist].Text := AktSong.Artist; Text[TextTitle].Text := AktSong.Title; + Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; // set visibility case PlayersPlay of @@ -270,6 +284,9 @@ begin for I := 0 to high(PlayerStatic[P]) do Static[PlayerStatic[P, I]].Visible := V[P]; + for I := 0 to high(PlayerTexts[P]) do + Static[PlayerTexts[P, I]].Visible := V[P]; + Static[StaticBoxLightest[P]].Visible := V[P]; Static[StaticBoxLight[P]].Visible := V[P]; Static[StaticBoxDark[P]].Visible := V[P]; -- cgit v1.2.3 From d74fd107869347fef713d187dcd925257bfdadfe Mon Sep 17 00:00:00 2001 From: mogguh Date: Wed, 11 Apr 2007 17:57:18 +0000 Subject: Bugfix: Score screen is now able to handle texts depended on the player count (UScreenScore.pas) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@79 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenScore.pas | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 9184b3f5..2c018b96 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -167,6 +167,8 @@ begin SetLength(PlayerStatic[P], Length(Theme.Score.PlayerStatic[P])); + SetLength(PlayerTexts[P], Length(Theme.Score.PlayerTexts[P])); + for I := 0 to High(Theme.Score.PlayerStatic[P]) do PlayerStatic[P, I] := AddStatic(Theme.Score.PlayerStatic[P, I]); @@ -285,7 +287,7 @@ begin Static[PlayerStatic[P, I]].Visible := V[P]; for I := 0 to high(PlayerTexts[P]) do - Static[PlayerTexts[P, I]].Visible := V[P]; + Text[PlayerTexts[P, I]].Visible := V[P]; Static[StaticBoxLightest[P]].Visible := V[P]; Static[StaticBoxLight[P]].Visible := V[P]; -- cgit v1.2.3 From 943d001a21095f936fdcfc58f11cdbd6d30578a5 Mon Sep 17 00:00:00 2001 From: b1indy Date: Wed, 11 Apr 2007 20:22:01 +0000 Subject: first implementation of perfect line twinkle effect - works correctly for up to 3 players, restructured parts of particle code git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@80 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index c6191cec..e3b7c7ad 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -371,7 +371,7 @@ begin //Kill all Stars not Killed yet //GoldenStarsTwinkle Mod - GoldenRec.KillAll; + GoldenRec.SentenceChange; //GoldenStarsTwinkle Mod End {Static[StaticP2R].Visible := V2R; @@ -1119,17 +1119,24 @@ begin //Refresh LastScore Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; - + //PerfectLineTwinkle Mod (effect) Pt.1 + if A >= 8 then Player[I].LastSentencePerfect := True + else Player[I].LastSentencePerfect := False; + //PerfectLineTwinkle Mod end end; //PhrasenBonus - Line Bonus Mod End// } + + //PerfectLineTwinkle Mod (effect) Pt.2 + GoldenRec.SpawnPerfectLineTwinkle; + //PerfectLineTwinkle Mod end end; //Called on Sentence Change S= New Current Sentence procedure TScreenSing.onSentenceChange(S: Cardinal); begin //GoldenStarsTwinkle Mod - GoldenRec.KillAll; + GoldenRec.SentenceChange; //GoldenStarsTwinkle Mod End end; -- cgit v1.2.3 From 0d4f50f6a2ba32a0176d768646208dbec3136084 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 13 Apr 2007 16:28:45 +0000 Subject: Fixed some Bugs in Skipto and Random Methods Now the last Song of a Category could be the Result of Randomize when there is an odd number of Songs. Also a little bit better Random Results git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@85 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index e873d287..7ea5d268 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -66,7 +66,7 @@ type procedure SelectNext; procedure SelectPrev; procedure UpdateLCD; - procedure SkipTo(Target: integer); + procedure SkipTo(Target: Cardinal); procedure FixSelected; //Show Wrong Song when Tabs on Fix procedure FixSelected2; //Show Wrong Song when Tabs on Fix procedure ShowCatTL(Cat: Integer);// Show Cat in Top left @@ -208,7 +208,7 @@ begin begin if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then begin - SkipTo(2 + CatSongs.VisibleIndex((I + Interaction) mod I2)); + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); Music.PlayChange; @@ -521,7 +521,7 @@ begin SelectNext; //Fix: Not Existing Song selected: - if (I+1=I2) then Inc(I2); + //if (I+1=I2) then Inc(I2); //Choose Song SkipTo(I2-I); @@ -529,7 +529,7 @@ begin end else //Random in one Category begin - SkipTo(2+Random(CatSongs.VisibleSongs-1)); + SkipTo(Random(CatSongs.VisibleSongs)); end; Music.PlayChange; @@ -1324,7 +1324,7 @@ begin Music.Stop; end; -procedure TScreenSong.SkipTo(Target: integer); // 0.5.0 +procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0 var Skip: integer; I: integer; @@ -1339,7 +1339,7 @@ begin Interaction := 0; SongTarget := 0; - for I := 2 to Target do + for I := 1 to Target+1 do SelectNext; FixSelected2; @@ -1481,7 +1481,7 @@ begin SelectNext; //Fix: Not Existing Song selected: - if (I+1=I2) then Inc(I2); + //if (I+1=I2) then Inc(I2); //Choose Song SkipTo(I2-I); @@ -1495,7 +1495,7 @@ begin SelectNext; FixSelected; - SkipTo(2+Random(CatSongs.VisibleSongs-1)); + SkipTo(Random(CatSongs.VisibleSongs)); Music.PlayChange; ChangeMusic; SetScroll4; @@ -1505,7 +1505,7 @@ begin begin PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); - SkipTo(2+Random(CatSongs.VisibleSongs-1)); + SkipTo(Random(CatSongs.VisibleSongs)); Music.PlayChange; ChangeMusic; SetScroll4; -- cgit v1.2.3 From b1e40ba133782a3d36ec78d4cf9c0245b88448d1 Mon Sep 17 00:00:00 2001 From: b1indy Date: Fri, 13 Apr 2007 22:17:48 +0000 Subject: implemented fading between screens (needs to be tested), minor tweaking of perfect-line effect position, added myself to credits ;) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@86 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenMain.pas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 43034912..70916437 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -29,7 +29,7 @@ type function Draw: boolean; override; end; -const Credits_Text: Array[0..46] of PChar = ( +const Credits_Text: Array[0..49] of PChar = ( ':SPACE:', 'Main Idea: Corvus 5', 'Thank you very much for this great Game', @@ -48,6 +48,9 @@ const Credits_Text: Array[0..46] of PChar = ( 'Mog:', 'Programming, Graphics', ':SPACE:', + 'blindy:', + 'VFX Programming', + ':SPACE:', 'Mota:', 'Programming, Idea of creating this Mod', ':SPACE:', -- cgit v1.2.3 From 12eb3f055c7c75dbfeb168d5c38f87a901a6ab89 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 14 Apr 2007 10:03:18 +0000 Subject: Fixed a bug that causes Perfect Line twinkles to spawn at each Line when LineBonus is deactivated. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@87 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index e3b7c7ad..e4fd7add 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1084,12 +1084,12 @@ begin //PhrasenBonus - Line Bonus Mod + //Generate Steps 0 to 8 + A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); + If (Ini.LineBonus > 0) then begin - //Generate Steps 0 to 8 - A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); - //Generate Text if A >= 8 then Player[I].LineBonus_Text := Theme.Sing.LineBonusText[8] @@ -1111,21 +1111,21 @@ begin Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; Player[I].LineBonus_Alpha := 0.92; Player[I].LineBonus_Visible := True; + end; + //PhrasenBonus - Line Bonus Mod End// } - - + //PerfectLineTwinkle Mod (effect) Pt.1 + If (Ini.EffectPerfect>=1) then + begin + if A >= 8 then Player[I].LastSentencePerfect := True + else Player[I].LastSentencePerfect := False; end; + //PerfectLineTwinkle Mod end //Refresh LastScore Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; - //PerfectLineTwinkle Mod (effect) Pt.1 - if A >= 8 then Player[I].LastSentencePerfect := True - else Player[I].LastSentencePerfect := False; - //PerfectLineTwinkle Mod end - end; -//PhrasenBonus - Line Bonus Mod End// } //PerfectLineTwinkle Mod (effect) Pt.2 GoldenRec.SpawnPerfectLineTwinkle; @@ -1138,7 +1138,6 @@ begin //GoldenStarsTwinkle Mod GoldenRec.SentenceChange; //GoldenStarsTwinkle Mod End - end; end. -- cgit v1.2.3 From b627232ec93e4cb32790ddf30e3d27e7a2775cbb Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 14 Apr 2007 14:30:37 +0000 Subject: added some error checking to screen-fade-effect, restored proper order of credits git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@88 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenMain.pas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 70916437..5849341c 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -36,6 +36,9 @@ const Credits_Text: Array[0..49] of PChar = ( ':SPACE:', 'The Ultrastar Deluxe Team:', ':SPACE:', + 'blindy:', + 'VFX Programming', + ':SPACE:', 'commandi00:', 'Beta Testing', ':SPACE:', @@ -48,9 +51,6 @@ const Credits_Text: Array[0..49] of PChar = ( 'Mog:', 'Programming, Graphics', ':SPACE:', - 'blindy:', - 'VFX Programming', - ':SPACE:', 'Mota:', 'Programming, Idea of creating this Mod', ':SPACE:', -- cgit v1.2.3 From 1fcd567446dce6e5e02d802e26cf38a538092cf3 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 14 Apr 2007 16:54:30 +0000 Subject: Did Some Code Cleanup Fixed some Bugs in Party Mode Added a Better Round Plugin Selection git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@89 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenMain.pas | 61 +------------------------------ Game/Code/Screens/UScreenPartyOptions.pas | 23 ++++-------- Game/Code/Screens/UScreenPartyPlayer.pas | 4 -- 3 files changed, 9 insertions(+), 79 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 5849341c..976c0e07 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -128,65 +128,8 @@ begin end; SDLK_M: begin - if (SDL_ModState = KMOD_LALT) then - begin - //Create Teams: - PartySession.Teams.NumTeams := 3; - //Team 1 - PartySession.Teams.Teaminfo[0].Name := 'Team 1'; - PartySession.Teams.Teaminfo[0].Score:= 0; - PartySession.Teams.Teaminfo[0].Joker := 3; - PartySession.Teams.Teaminfo[0].CurPlayer := 0; - PartySession.Teams.Teaminfo[0].NumPlayers := 2; - PartySession.Teams.Teaminfo[0].Playerinfo[0].Name := 'Player 1'; - PartySession.Teams.Teaminfo[0].Playerinfo[0].TimesPlayed := 0; - PartySession.Teams.Teaminfo[0].Playerinfo[1].Name := 'Player 2'; - PartySession.Teams.Teaminfo[0].Playerinfo[1].TimesPlayed := 0; - - //Team 2 - PartySession.Teams.Teaminfo[1].Name := 'Team 2'; - PartySession.Teams.Teaminfo[1].Score:= 0; - PartySession.Teams.Teaminfo[1].Joker := 3; - PartySession.Teams.Teaminfo[1].CurPlayer := 0; - PartySession.Teams.Teaminfo[1].NumPlayers := 2; - PartySession.Teams.Teaminfo[1].Playerinfo[0].Name := 'Player 3'; - PartySession.Teams.Teaminfo[1].Playerinfo[0].TimesPlayed := 0; - PartySession.Teams.Teaminfo[1].Playerinfo[1].Name := 'Player 4'; - PartySession.Teams.Teaminfo[1].Playerinfo[1].TimesPlayed := 0; - - //Team 3 - PartySession.Teams.Teaminfo[2].Name := 'Team 3'; - PartySession.Teams.Teaminfo[2].Score:= 0; - PartySession.Teams.Teaminfo[2].Joker := 3; - PartySession.Teams.Teaminfo[2].CurPlayer := 0; - PartySession.Teams.Teaminfo[2].NumPlayers := 2; - PartySession.Teams.Teaminfo[2].Playerinfo[0].Name := 'Player 5'; - PartySession.Teams.Teaminfo[2].Playerinfo[0].TimesPlayed := 0; - PartySession.Teams.Teaminfo[2].Playerinfo[1].Name := 'Player 6'; - PartySession.Teams.Teaminfo[2].Playerinfo[1].TimesPlayed := 0; - - //Rounds: - SetLength (PartySession.Rounds, 3); - PartySession.Rounds[0].Plugin := 1; - PartySession.Rounds[0].Winner := 0; - PartySession.Rounds[1].Plugin := 0; - PartySession.Rounds[1].Winner := 0; - PartySession.Rounds[2].Plugin := 0; - PartySession.Rounds[2].Winner := 0; - - //Start Party - PartySession.StartNewParty; - //Change Screen - Music.PlayStart; - FadeTo(@ScreenPartyNewRound); - - end - else - begin - Music.PlayStart; - FadeTo(@ScreenPartyOptions); - end; - + Music.PlayStart; + FadeTo(@ScreenPartyOptions); end; SDLK_RETURN: diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 042e944f..1fd4da8f 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -95,7 +95,6 @@ begin SDLK_RETURN: begin - //Save Difficulty Ini.Difficulty := SelectsS[SelectLevel].SelectedOption; Ini.SaveLevel; @@ -106,6 +105,7 @@ begin 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; //If Category Selected Search Category ID @@ -126,13 +126,10 @@ begin end else PlaylistMan.CurPlayList := Playlist2; - //Save Rounds + Random - SetLength (PartySession.Rounds, Rounds + 2); - For I := 0 to high (PartySession.Rounds) do - begin - PartySession.Rounds[I].Plugin := Random (Length(DLLMan.Plugins)); - PartySession.Rounds[I].Winner := 0; - end; + + //Start Party + PartySession.StartNewParty(Rounds + 2); + Music.PlayStart; //Go to Player Screen FadeTo(@ScreenPartyPlayer); @@ -155,10 +152,7 @@ begin end //Change Team3 Players visibility Else If (Interaction = 4) then begin - Case NumTeams of - 0: SelectsS[7].Visible := False; - 1: SelectsS[7].Visible := True; - end; + SelectsS[7].Visible := (NumTeams = 1); end; end; SDLK_LEFT: @@ -173,10 +167,7 @@ begin end //Change Team3 Players visibility Else If (Interaction = 4) then begin - Case NumTeams of - 0: SelectsS[7].Visible := False; - 1: SelectsS[7].Visible := True; - end; + SelectsS[7].Visible := (NumTeams = 1); end; end; end; diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index 4fc43013..498514fb 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -87,10 +87,6 @@ begin PartySession.Teams.Teaminfo[I].Joker := Round (Length(PartySession.Rounds) * 0.85); end; - - //Start Party - PartySession.StartNewParty; - Music.PlayStart; FadeTo(@ScreenPartyNewRound); end; -- cgit v1.2.3 From b271750f0ba7b1174d26f8164bc8f9f46766c5e3 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 15 Apr 2007 10:05:09 +0000 Subject: Added Prevention of starting PartyMode without Plugins Loaded or with less then 2 Players git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@92 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenMain.pas | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 976c0e07..90a6310d 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -84,7 +84,7 @@ const Credits_Text: Array[0..49] of PChar = ( implementation -uses Windows, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl, ULanguage, UParty; +uses Windows, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl, ULanguage, UParty, UDLLManager; function TScreenMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; @@ -128,8 +128,11 @@ begin end; SDLK_M: begin - Music.PlayStart; - FadeTo(@ScreenPartyOptions); + if (Ini.Players >= 2) AND (Length(DLLMan.Plugins)>=1) then + begin + Music.PlayStart; + FadeTo(@ScreenPartyOptions); + end; end; SDLK_RETURN: @@ -147,8 +150,6 @@ begin if Interaction = 2 then begin Music.PlayStart; FadeTo(@ScreenOptions); -// SDL_SetVideoMode(800, 600, 32, SDL_OPENGL);// or SDL_FULLSCREEN); -// LoadTextures; end; if Interaction = 3 then begin Result := false; -- cgit v1.2.3 From fae5839e8025f020638b4cd0583a9a992c5a7a1e Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 15 Apr 2007 11:05:10 +0000 Subject: Fixed some Bugs in Party Mode Fixed Support CategoryOnly Playlist Support git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@93 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenMain.pas | 2 +- Game/Code/Screens/UScreenPartyNewRound.pas | 4 ---- Game/Code/Screens/UScreenPartyPlayer.pas | 2 +- Game/Code/Screens/UScreenPartyScore.pas | 8 ++++---- Game/Code/Screens/UScreenSong.pas | 4 ++-- 5 files changed, 8 insertions(+), 12 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 90a6310d..dd7f21c5 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -128,7 +128,7 @@ begin end; SDLK_M: begin - if (Ini.Players >= 2) AND (Length(DLLMan.Plugins)>=1) then + if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then begin Music.PlayStart; FadeTo(@ScreenPartyOptions); diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 1e9be1f5..c8c0febc 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -176,10 +176,6 @@ procedure TScreenPartyNewRound.onShow; var I: Integer; begin - //If not First Round, End Last Round - if (PartySession.CurRound <> 255) then - PartySession.EndRound; - PartySession.StartRound; Log.LogError(InttoStr(Length(DllMan.Plugins))); diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index 498514fb..02f87710 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -76,6 +76,7 @@ begin SDLK_RETURN: begin + //Save PlayerNames for I := 0 to PartySession.Teams.NumTeams-1 do begin PartySession.Teams.Teaminfo[I].Name := PChar(Button[I*5].Text[0].Text); @@ -84,7 +85,6 @@ begin PartySession.Teams.Teaminfo[I].Playerinfo[J].Name := PChar(Button[I*5 + J+1].Text[0].Text); PartySession.Teams.Teaminfo[I].Playerinfo[J].TimesPlayed := 0; end; - PartySession.Teams.Teaminfo[I].Joker := Round (Length(PartySession.Rounds) * 0.85); end; Music.PlayStart; diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index 9cbeb5d5..142ec947 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -57,13 +57,10 @@ begin SDLK_RETURN: begin Music.PlayStart; - if (PartySession.CurRound <= High(PartySession.Rounds)) then + if (PartySession.CurRound < High(PartySession.Rounds)) then FadeTo(@ScreenPartyNewRound) else - begin - PartySession.EndRound; FadeTo(@ScreenPartyWin); - end; end; end; end; @@ -114,6 +111,9 @@ begin Static[StaticTeam2].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100; Static[StaticTeam3].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[2].Percentage / 100; + //End Last Round + PartySession.EndRound; + //Set Winnertext Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.GetWinnerString(PartySession.CurRound)]); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 7ea5d268..7c8447ee 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1488,8 +1488,8 @@ begin end; 1: //One Category Select Category and Select Random Song begin - CatSongs.HideCategory(-1); - CatSongs.ShowCategory(PlaylistMan.CurPlayList); + CatSongs.ShowCategoryList; + CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); ShowCatTL(PlaylistMan.CurPlayList); SelectNext; -- cgit v1.2.3 From e8f259a1a37ce5cf10a79dc53e184d6af4e7b7d6 Mon Sep 17 00:00:00 2001 From: b1indy Date: Tue, 17 Apr 2007 00:48:03 +0000 Subject: Changed aadvanced options to switch on/off sing-effects and screen-fading Changed Languages (english, german) and Theme (deluxe) to reflect these changes implemented checks for config values to make these things work as expected git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@101 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenOptionsAdvanced.pas | 4 ++-- Game/Code/Screens/UScreenSing.pas | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index 7904a284..ed3bc164 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -74,8 +74,8 @@ begin AddText(Theme.OptionsAdvanced.Text[I]); AddSelect(Theme.OptionsAdvanced.SelectLoadAnimation, Ini.LoadAnimation, ILoadAnimation); - AddSelect(Theme.OptionsAdvanced.SelectEffectPerfect, Ini.EffectPerfect, IEffectPerfect); - AddSelect(Theme.OptionsAdvanced.SelectEffectGolden, Ini.EffectGolden, IEffectGolden); + AddSelect(Theme.OptionsAdvanced.SelectScreenFade, Ini.ScreenFade, IScreenFade); + AddSelect(Theme.OptionsAdvanced.SelectEffectSing, Ini.EffectSing, IEffectSing); AddSelect(Theme.OptionsAdvanced.SelectLineBonus, Ini.LineBonus, ILineBonus); AddSelectSlide(Theme.OptionsAdvanced.SelectOnSongClick, Ini.OnSongClick, IOnSongClick); AddSelect(Theme.OptionsAdvanced.SelectAskbeforeDel, Ini.AskbeforeDel, IAskbeforeDel); diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index e4fd7add..29ea5c8b 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1115,7 +1115,7 @@ begin //PhrasenBonus - Line Bonus Mod End// } //PerfectLineTwinkle Mod (effect) Pt.1 - If (Ini.EffectPerfect>=1) then + If (Ini.EffectSing=1) then begin if A >= 8 then Player[I].LastSentencePerfect := True else Player[I].LastSentencePerfect := False; @@ -1128,7 +1128,8 @@ begin end; //PerfectLineTwinkle Mod (effect) Pt.2 - GoldenRec.SpawnPerfectLineTwinkle; + if Ini.EffectSing=1 then + GoldenRec.SpawnPerfectLineTwinkle; //PerfectLineTwinkle Mod end end; -- cgit v1.2.3 From 7cbb58f6fe6cd8d81e21d6e0b1ebdc2fd872b773 Mon Sep 17 00:00:00 2001 From: mogguh Date: Tue, 17 Apr 2007 20:01:16 +0000 Subject: Feature: Added the possibility to skin the sing screen, it's now possible to set player 1 stuff related to player modi (1, 2 or 3 player mode) (affected UThemes.pas, UScreenSing.pas, UScreenSingModi.pas) Theme/Skin: Used the new sing screen possibility, looks way more ps3 now :P git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@109 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 238 ++++++++++++++++++++-------------- Game/Code/Screens/UScreenSingModi.pas | 95 +++++++------- 2 files changed, 185 insertions(+), 148 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 29ea5c8b..650cfdff 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -19,6 +19,19 @@ type TextP1: integer; TextP1Score: integer; + //Added for ps3 skin + //shown when game is in 2/4 player modus + StaticP1TwoP: integer; + StaticP1TwoPScoreBG: integer; + TextP1TwoP: integer; + TextP1TwoPScore: integer; + //shown when game is in 3/6 player modus + StaticP1ThreeP: integer; + StaticP1ThreePScoreBG: integer; + TextP1ThreeP: integer; + TextP1ThreePScore: integer; + //eoa + StaticP2R: integer; StaticP2RScoreBG: integer; TextP2R: integer; @@ -157,6 +170,20 @@ begin TextP1 := AddText(Theme.Sing.TextP1); TextP1Score := AddText(Theme.Sing.TextP1Score); + //Added for ps3 skin + //This one is shown in 2/4P mode + StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); + StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG); + TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); + TextP1TwoPScore := AddText(Theme.Sing.TextP1TwoPScore); + + //This one is shown in 3/6P mode + StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); + StaticP1ThreePScoreBG := AddStatic(Theme.Sing.StaticP1ThreePScoreBG); + TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); + TextP1ThreePScore := AddText(Theme.Sing.TextP1ThreePScore); + //eoa + StaticP2R := AddStatic(Theme.Sing.StaticP2R); StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); TextP2R := AddText(Theme.Sing.TextP2R); @@ -178,11 +205,13 @@ end; procedure TScreenSing.onShow; var - P: integer; - V1: boolean; - V2R: boolean; - V2M: boolean; - V3R: boolean; + P: integer; + V1: boolean; + V1TwoP: boolean; //added for ps3 skin + V1ThreeP: boolean; //added for ps3 skin + V2R: boolean; + V2M: boolean; + V3R: boolean; NR: TRecR; //Line Bonus Mod begin Log.LogStatus('Begin', 'onShow'); @@ -195,39 +224,65 @@ begin case PlayersPlay of 1: begin - V1 := true; - V2R := false; - V2M := false; - V3R := false; + V1 := true; + V1TwoP := false; //added for ps3 skin + V1ThreeP := false; //added for ps3 skin + V2R := false; + V2M := false; + V3R := false; end; 2: begin - V1 := true; - V2R := true; - V2M := false; - V3R := false; + V1 := false; + V1TwoP := true; //added for ps3 skin + V1ThreeP := false; //added for ps3 skin + V2R := true; + V2M := false; + V3R := false; end; 3: begin - V1 := true; - V2R := false; - V2M := true; - V3R := true; + V1 := false; + V1TwoP := false; //added for ps3 skin + V1ThreeP := true; //added for ps3 skin + V2R := false; + V2M := true; + V3R := true; end; 4: begin // double screen - V1 := true; - V2R := true; - V2M := false; - V3R := false; + V1 := false; + V1TwoP := true; //added for ps3 skin + V1ThreeP := false; //added for ps3 skin + V2R := true; + V2M := false; + V3R := false; end; 6: begin // double screen - V1 := true; - V2R := false; - V2M := true; - V3R := true; + V1 := false; + V1TwoP := false; //added for ps3 skin + V1ThreeP := true; //added for ps3 skin + V2R := false; + V2M := true; + V3R := true; end; end; - + //Added for ps3 skin + //This one is shown in 1P mode + Static[StaticP1].Visible := V1; + Static[StaticP1ScoreBG].Visible := V1; + Text[TextP1].Visible := V1; + Text[TextP1Score].Visible := V1; + //This one is shown in 2/4P mode + Static[StaticP1TwoP].Visible := V1TwoP; + Static[StaticP1TwoPScoreBG].Visible := V1TwoP; + Text[TextP1TwoP].Visible := V1TwoP; + Text[TextP1TwoPScore].Visible := V1TwoP; + //This one is shown in 3/6P mode + Static[StaticP1ThreeP].Visible := V1ThreeP; + Static[StaticP1ThreePScoreBG].Visible := V1ThreeP; + Text[TextP1ThreeP].Visible := V1ThreeP; + Text[TextP1ThreePScore].Visible := V1ThreeP; + //eoa Static[StaticP2R].Visible := V2R; Static[StaticP2RScoreBG].Visible := V2R; @@ -402,10 +457,10 @@ begin 2: begin //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.X; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.X; + Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; //P2 Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.X; @@ -416,10 +471,10 @@ begin 3: begin //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; //P2 Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; @@ -436,10 +491,10 @@ begin 4: begin //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; //P2 Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; @@ -448,10 +503,10 @@ begin Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + Player[2].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; //P4 Player[3].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; @@ -462,10 +517,10 @@ begin 6: begin //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; //P2 Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; @@ -480,10 +535,10 @@ begin Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; //P4 - Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[3].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[3].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[3].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[3].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[3].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[3].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; //P5 Player[4].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; @@ -661,15 +716,15 @@ begin // set player colors if PlayersPlay = 4 then begin if ScreenAct = 1 then begin - LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - Static[StaticP1].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, - Static[StaticP1ScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); @@ -677,15 +732,15 @@ begin end; if ScreenAct = 2 then begin - LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - Static[StaticP1].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, - Static[StaticP1ScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); @@ -696,8 +751,8 @@ begin if PlayersPlay = 6 then begin if ScreenAct = 1 then begin - LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - Static[StaticP1].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P2Dark'); LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, @@ -705,8 +760,8 @@ begin - LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, - Static[StaticP1ScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, @@ -716,8 +771,8 @@ begin end; if ScreenAct = 2 then begin - LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - Static[StaticP1].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P5Dark'); LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, @@ -726,8 +781,8 @@ begin - LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, - Static[StaticP1ScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, @@ -781,6 +836,8 @@ begin // set player names (for 2 screens and only Singstar skin) if ScreenAct = 1 then begin Text[TextP1].Text := 'P1'; + Text[TextP1TwoP].Text := 'P1'; //added for ps3 skin + Text[TextP1ThreeP].Text := 'P1'; //added for ps3 skin Text[TextP2R].Text := 'P2'; Text[TextP2M].Text := 'P2'; Text[TextP3R].Text := 'P3'; @@ -802,11 +859,11 @@ begin end;} 4: begin - Text[TextP1].Text := 'P3'; + Text[TextP1TwoP].Text := 'P3'; Text[TextP2R].Text := 'P4'; end; 6: begin - Text[TextP1].Text := 'P4'; + Text[TextP1ThreeP].Text := 'P4'; Text[TextP2M].Text := 'P5'; Text[TextP3R].Text := 'P6'; end; @@ -814,31 +871,21 @@ begin end; // if // stereo - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; - - - +// weird stuff, maybe this is for "dual screen?", but where is player three then? + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; - - - - Text[TextP1].X := Text[TextP1].X + 10*ScreenX; Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; - - - - Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; - - + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; + Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; +// end of weird stuff for S := 1 to 1 do Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; @@ -865,7 +912,7 @@ begin if PlayersPlay = 2 then begin Tekst := IntToStr(Player[0].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1TwoPScore].Text := Tekst; Tekst := IntToStr(Player[1].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -875,7 +922,7 @@ begin if PlayersPlay = 3 then begin Tekst := IntToStr(Player[0].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1ThreePScore].Text := Tekst; Tekst := IntToStr(Player[1].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -890,7 +937,7 @@ begin if ScreenAct = 1 then begin Tekst := IntToStr(Player[0].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1TwoPScore].Text := Tekst; Tekst := IntToStr(Player[1].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -899,7 +946,7 @@ begin if ScreenAct = 2 then begin Tekst := IntToStr(Player[2].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1TwoPScore].Text := Tekst; Tekst := IntToStr(Player[3].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -911,7 +958,7 @@ begin if ScreenAct = 1 then begin Tekst := IntToStr(Player[0].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1ThreePScore].Text := Tekst; Tekst := IntToStr(Player[1].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -924,7 +971,7 @@ begin if ScreenAct = 2 then begin Tekst := IntToStr(Player[3].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1ThreePScore].Text := Tekst; Tekst := IntToStr(Player[4].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -985,26 +1032,21 @@ begin //GoldenNoteStarsTwinkle Mod // back stereo - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; - +// weird stuff, maybe this is for "dual screen?", but where is player three then? + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; - - Text[TextP1].X := Text[TextP1].X - 10*ScreenX; Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; - - + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; - - Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; +//weird end for S := 1 to 1 do Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index bf342e7a..86613152 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -619,20 +619,20 @@ begin PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; end; 2,4: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; - PlayerInfo.Playerinfo[2].PosX := Static[StaticP1ScoreBG].Texture.X; - PlayerInfo.Playerinfo[2].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1TwoPScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; + PlayerInfo.Playerinfo[2].PosX := Static[StaticP1TwoPScoreBG].Texture.X; + PlayerInfo.Playerinfo[2].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; PlayerInfo.Playerinfo[1].PosX := Static[StaticP2RScoreBG].Texture.X; PlayerInfo.Playerinfo[1].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; PlayerInfo.Playerinfo[3].PosX := Static[StaticP2RScoreBG].Texture.X; PlayerInfo.Playerinfo[3].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; end; 3,6: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; - PlayerInfo.Playerinfo[3].PosX := Static[StaticP1ScoreBG].Texture.X; - PlayerInfo.Playerinfo[3].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ThreePScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; + PlayerInfo.Playerinfo[3].PosX := Static[StaticP1ThreePScoreBG].Texture.X; + PlayerInfo.Playerinfo[3].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; PlayerInfo.Playerinfo[1].PosX := Static[StaticP2MScoreBG].Texture.X; PlayerInfo.Playerinfo[1].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; PlayerInfo.Playerinfo[4].PosX := Static[StaticP2MScoreBG].Texture.X; @@ -669,16 +669,16 @@ begin end; if (PlayersPlay = 2) OR (PlayersPlay = 4) then begin - Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; - Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; + Text[TextP1TwoPScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1TwoPScoreBG].Visible := DLLMan.Selected.ShowScore; Text[TextP2RScore].Visible := DLLMan.Selected.ShowScore; Static[StaticP2RScoreBG].Visible := DLLMan.Selected.ShowScore; end; if (PlayersPlay = 3) OR (PlayersPlay = 6) then begin - Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; - Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; + Text[TextP1ThreePScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1ThreePScoreBG].Visible := DLLMan.Selected.ShowScore; Text[TextP2MScore].Visible := DLLMan.Selected.ShowScore; Static[StaticP2MScoreBG].Visible := DLLMan.Selected.ShowScore; @@ -716,15 +716,15 @@ begin // set player colors if PlayersPlay = 4 then begin if ScreenAct = 1 then begin - LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - Static[StaticP1].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, - Static[StaticP1ScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); @@ -732,15 +732,15 @@ begin end; if ScreenAct = 2 then begin - LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - Static[StaticP1].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, - Static[StaticP1ScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); @@ -751,8 +751,8 @@ begin if PlayersPlay = 6 then begin if ScreenAct = 1 then begin - LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - Static[StaticP1].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P2Dark'); LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, @@ -760,8 +760,8 @@ begin - LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, - Static[StaticP1ScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, @@ -771,8 +771,8 @@ begin end; if ScreenAct = 2 then begin - LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - Static[StaticP1].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P5Dark'); LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, @@ -781,8 +781,8 @@ begin - LoadColor(Static[StaticP1ScoreBG].Texture.ColR, Static[StaticP1ScoreBG].Texture.ColG, - Static[StaticP1ScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, @@ -797,20 +797,22 @@ begin // set player names (for 2 screens and only Singstar skin) if ScreenAct = 1 then begin - Text[TextP1].Text := 'P1'; - Text[TextP2R].Text := 'P2'; - Text[TextP2M].Text := 'P2'; - Text[TextP3R].Text := 'P3'; + Text[TextP1].Text := 'P1'; + Text[TextP1TwoP].Text := 'P1'; // added for ps3 skin + Text[TextP1ThreeP].Text := 'P1'; // added for ps3 skin + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; end; if ScreenAct = 2 then begin case PlayersPlay of 4: begin - Text[TextP1].Text := 'P3'; + Text[TextP1TwoP].Text := 'P3'; Text[TextP2R].Text := 'P4'; end; 6: begin - Text[TextP1].Text := 'P4'; + Text[TextP1ThreeP].Text := 'P4'; Text[TextP2M].Text := 'P5'; Text[TextP3R].Text := 'P6'; end; @@ -818,7 +820,7 @@ begin end; // if - // stereo + // stereo <- and where iss P2M? or P3? Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; @@ -841,7 +843,7 @@ begin if PlayersPlay = 2 then begin Tekst := IntToStr(Player[0].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1TwoPScore].Text := Tekst; Tekst := IntToStr(Player[1].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -851,7 +853,7 @@ begin if PlayersPlay = 3 then begin Tekst := IntToStr(Player[0].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1ThreePScore].Text := Tekst; Tekst := IntToStr(Player[1].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -866,7 +868,7 @@ begin if ScreenAct = 1 then begin Tekst := IntToStr(Player[0].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1TwoPScore].Text := Tekst; Tekst := IntToStr(Player[1].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -875,7 +877,7 @@ begin if ScreenAct = 2 then begin Tekst := IntToStr(Player[2].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1TwoPScore].Text := Tekst; Tekst := IntToStr(Player[3].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -887,7 +889,7 @@ begin if ScreenAct = 1 then begin Tekst := IntToStr(Player[0].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1ThreePScore].Text := Tekst; Tekst := IntToStr(Player[1].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -900,7 +902,7 @@ begin if ScreenAct = 2 then begin Tekst := IntToStr(Player[3].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + Text[TextP1ThreePScore].Text := Tekst; Tekst := IntToStr(Player[4].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -1007,26 +1009,19 @@ end; // back stereo Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; - - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; - - Text[TextP1].X := Text[TextP1].X - 10*ScreenX; Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; - - + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; - - Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; + for S := 1 to 1 do Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; -- cgit v1.2.3 From 1c5357580b64fb3573728803e11b769cecb5f45a Mon Sep 17 00:00:00 2001 From: mogguh Date: Tue, 17 Apr 2007 21:19:31 +0000 Subject: Bugfix: Scores where not shown correctly when in 4 or 6 player mode (UScreenScore.pas), some more effort should be needed to draw the score bars in this mode correctly (but not now) Theme/Skin: Playerboxes in score screen are now draw in player color (just affected the 4 and 6 player mode) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@110 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenScore.pas | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 2c018b96..72c42cb8 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -574,8 +574,23 @@ begin while (Length(S)<4) do S := '0' + S; Text[TextNotesScore[Item]].Text := S; - while (Length(S)<5) do S := '0' + S; - Text[TextTotalScore[Item]].Text := S; +// while (Length(S)<5) do S := '0' + S; +// Text[TextTotalScore[Item]].Text := S; + +//fixed: line bonus and golden notes don't show up, +// another bug: total score was shown without added golden-, linebonus + S := IntToStr(Player[P].ScoreTotalI); + while (Length(S)<5) do S := '0' + S; + Text[TextTotalScore[Item]].Text := S; + + S := IntToStr(Player[P].ScoreLineI); + while (Length(S)<4) do S := '0' + S; + Text[TextLineBonusScore[Item]].Text := S; + + S := IntToStr(Player[P].ScoreGoldenI); + while (Length(S)<4) do S := '0' + S; + Text[TextGoldenNotesScore[Item]].Text := S; +//end of fix LoadColor( Text[TextName[Item]].ColR, -- cgit v1.2.3 From 6cdcfb402ce738dfc77b008fcb98fd1cda691eb5 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 19 Apr 2007 18:53:22 +0000 Subject: Added Statistic Screens to C0de and to Theme Moved some Translated Strings from UScreenPartyOptions to UTheme to use it with the Statistic Screens, too. Fixed use of /n Tag istead of the correct \n git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@118 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenMain.pas | 6 + Game/Code/Screens/UScreenPartyOptions.pas | 9 +- Game/Code/Screens/UScreenStatDetail.pas | 254 ++++++++++++++++++++++++++++++ Game/Code/Screens/UScreenStatMain.pas | 229 +++++++++++++++++++++++++++ 4 files changed, 490 insertions(+), 8 deletions(-) create mode 100644 Game/Code/Screens/UScreenStatDetail.pas create mode 100644 Game/Code/Screens/UScreenStatMain.pas (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index dd7f21c5..8d2d13b6 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -135,6 +135,12 @@ begin end; end; + SDLK_S: + begin + Music.PlayStart; + FadeTo(@ScreenStatMain); + end; + SDLK_RETURN: begin if (Interaction = 0) and (Length(Songs.Song) >= 1) then begin diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 1fd4da8f..fd7b5107 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -31,7 +31,6 @@ type end; var - ILevel: array[0..2] of String; IPlaylist: array[0..2] of String; IPlaylist2: array of String; const @@ -185,12 +184,6 @@ var I: integer; begin inherited Create; - - //Fill ILevel - ILevel[0] := Language.Translate('SING_EASY'); - ILevel[1] := Language.Translate('SING_MEDIUM'); - ILevel[2] := Language.Translate('SING_HARD'); - //Fill IPlaylist IPlaylist[0] := Language.Translate('PARTY_PLAYLIST_ALL'); IPlaylist[1] := Language.Translate('PARTY_PLAYLIST_CATEGORY'); @@ -210,7 +203,7 @@ begin AddBackground(Theme.PartyOptions.Background.Tex); - SelectLevel := AddSelectSlide (Theme.PartyOptions.SelectLevel, Ini.Difficulty, ILevel); + 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); diff --git a/Game/Code/Screens/UScreenStatDetail.pas b/Game/Code/Screens/UScreenStatDetail.pas new file mode 100644 index 00000000..dc4a0f1f --- /dev/null +++ b/Game/Code/Screens/UScreenStatDetail.pas @@ -0,0 +1,254 @@ +unit UScreenStatDetail; + +interface + +uses + UMenu, SDL, SysUtils, UDisplay, UMusic, UIni, UThemes; + +type + TScreenStatDetail = class(TMenu) + public + Typ: Byte; + Page: CardinaL; + Count: Byte; + Reversed: Boolean; + + TotEntrys: Cardinal; + TotPages: Cardinal; + + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + + procedure SetTitle; + Procedure SetPage(NewPage: Cardinal); + end; + +implementation + +{Stat Screens: + 0 - Best Scores + 1 - Best Singers + 2 - Most sung Songs + 3 - Most popular Band +} + +uses UGraphic, UDataBase, ULanguage, math, ULog; + +function TScreenStatDetail.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: + begin + Music.PlayBack; + FadeTo(@ScreenStatMain); + end; + SDLK_RETURN: + begin + if Interaction = 0 then begin + //Next Page + SetPage(Page+1); + end; + + if Interaction = 1 then begin + //Previous Page + if (Page > 0) then + SetPage(Page-1); + end; + + if Interaction = 2 then begin + //Reverse Order + Reversed := not Reversed; + SetPage(Page); + end; + + if Interaction = 3 then begin + Music.PlayBack; + FadeTo(@ScreenStatMain); + end; + end; + SDLK_LEFT: + begin + InteractPrev; + end; + SDLK_RIGHT: + begin + InteractNext; + end; + SDLK_UP: + begin + InteractPrev; + end; + SDLK_DOWN: + begin + InteractNext; + end; + end; + end; +end; + +constructor TScreenStatDetail.Create; +var + I: integer; +begin + inherited Create; + + AddBackground(Theme.StatDetail.Background.Tex); + + AddButton(Theme.StatDetail.ButtonNext); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Language.Translate('STAT_NEXT')); + + AddButton(Theme.StatDetail.ButtonPrev); + if (Length(Button[1].Text)=0) then + AddButtonText(14, 20, Language.Translate('STAT_PREV')); + + AddButton(Theme.StatDetail.ButtonReverse); + if (Length(Button[2].Text)=0) then + AddButtonText(14, 20, Language.Translate('STAT_REVERSE')); + + AddButton(Theme.StatDetail.ButtonExit); + if (Length(Button[3].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[7]); + + for I := 0 to High(Theme.StatDetail.TextList) do + AddText(Theme.StatDetail.TextList[I]); + + Count := Length(Theme.StatDetail.TextList); + + AddText(Theme.StatDetail.TextDescription); + AddText(Theme.StatDetail.TextPage); + + for I := 0 to High(Theme.StatDetail.Static) do + AddStatic(Theme.StatDetail.Static[I]); + + for I := 0 to High(Theme.StatDetail.Text) do + AddText(Theme.StatDetail.Text[I]); + + + + Interaction := 0; + Typ := 0; +end; + +procedure TScreenStatDetail.onShow; +begin + //Set Tot Entrys and PAges + TotEntrys := DataBase.GetTotalEntrys(Typ); + TotPages := Ceil(TotEntrys / Count); + //Show correct Title + SetTitle; + //Show First Page + Reversed := False; + SetPage(0); +end; + +procedure TScreenStatDetail.SetTitle; +begin + //Set Title + Case Reversed of + True: Text[Count].Text := Theme.StatDetail.DescriptionR[Typ]; + False: Text[Count].Text := Theme.StatDetail.Description[Typ]; + end; +end; + +Procedure TScreenStatDetail.SetPage(NewPage: Cardinal); +var + Result: AStatResult; + I: Integer; + FormatStr: String; + PerPage: Byte; +begin + SetLength(Result, Count); + if (Database.GetStats(Result, Typ, Count, NewPage, Reversed)) then + begin + Page := NewPage; + + FormatStr := Theme.StatDetail.FormatStr[Typ]; + + //refresh Texts + For I := 0 to Count-1 do + begin + try + case Typ of + 0:begin //Best Scores + //Set Texts + if (Result[I].Score>0) then + Text[I].Text := Format(FormatStr, [Result[I].Singer, + Result[I].Score, + Theme.ILevel[Result[I].Difficulty], + Result[I].SongArtist, + Result[I].SongTitle]) + else + Text[I].Text := ''; + end; + + 1:begin //Best Singers + //Set Texts + if (Result[I].AverageScore>0) then + Text[I].Text := Format(FormatStr, [Result[I].Player, + Result[I].AverageScore]) + else + Text[I].Text := ''; + end; + + 2:begin //Popular Songs + //Set Texts + if (Result[I].Artist<>'') then + Text[I].Text := Format(FormatStr, [Result[I].Artist, + Result[I].Title, + Result[I].TimesSung]) + else + Text[I].Text := ''; + end; + + 3:begin //Popular Bands + //Set Texts + if (Result[I].ArtistName<>'') then + Text[I].Text := Format(FormatStr, [Result[I].ArtistName, + Result[I].TimesSungtot]) + else + Text[I].Text := ''; + end; + end; + except + on E: EConvertError do + Log.LogError('Error Parsing FormatString in UScreenStatDetail: ' + E.Message); + end; + end; + + if (Page + 1 = TotPages) AND (TotEntrys Mod Count <> 0) then + PerPage := (TotEntrys Mod Count) + else + PerPage := Count; + + Text[Count+1].Text := Format(Theme.StatDetail.PageStr, [Page + 1, + TotPages, + PerPage, + TotEntrys]); + + //Show correct Title + SetTitle; + + end; + +end; + + +procedure TScreenStatDetail.SetAnimationProgress(Progress: real); +var I: Integer; +begin + For I := 0 to high(Button) do + Button[I].Texture.ScaleW := Progress; +end; + +end. diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas new file mode 100644 index 00000000..337ed745 --- /dev/null +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -0,0 +1,229 @@ +unit UScreenStatMain; + +interface + +uses + UMenu, SDL, SysUtils, UDisplay, UMusic, UIni, UThemes; + +type + TScreenStatMain = class(TMenu) + private + //Some Stat Value that don't need to be calculated 2 times + SongswithVid: Cardinal; + public + TextOverview: integer; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + + procedure SetOverview; + end; + +implementation + +uses UGraphic, UDataBase, USongs, ULanguage, windows, ULog; + +function TScreenStatMain.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: + begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenMain); + end; + SDLK_RETURN: + begin + //Exit Button Pressed + if Interaction = 4 then begin + Music.PlayBack; + FadeTo(@ScreenMain); + end + else //One of the Stats Buttons Pressed + begin + Music.PlayBack; + ScreenStatDetail.Typ := Interaction; + FadeTo(@ScreenStatDetail); + end; + end; + SDLK_LEFT: + begin + InteractPrev; + end; + SDLK_RIGHT: + begin + InteractNext; + end; + SDLK_UP: + begin + InteractPrev; + end; + SDLK_DOWN: + begin + InteractNext; + end; + end; + end; +end; + +constructor TScreenStatMain.Create; +var + I: integer; +begin + inherited Create; + + AddBackground(Theme.StatMain.Background.Tex); + + AddButton(Theme.StatMain.ButtonScores); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.StatDetail.Description[0]); + + AddButton(Theme.StatMain.ButtonSingers); + if (Length(Button[1].Text)=0) then + AddButtonText(14, 20, Theme.StatDetail.Description[1]); + + AddButton(Theme.StatMain.ButtonSongs); + if (Length(Button[2].Text)=0) then + AddButtonText(14, 20, Theme.StatDetail.Description[2]); + + AddButton(Theme.StatMain.ButtonBands); + if (Length(Button[3].Text)=0) then + AddButtonText(14, 20, Theme.StatDetail.Description[3]); + + AddButton(Theme.StatMain.ButtonExit); + if (Length(Button[4].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[4]); + + TextOverview := AddText(Theme.StatMain.TextOverview); + + for I := 0 to High(Theme.StatMain.Static) do + AddStatic(Theme.StatMain.Static[I]); + + for I := 0 to High(Theme.StatMain.Text) do + AddText(Theme.StatMain.Text[I]); + + Interaction := 0; + + SongswithVid := 0; + For I := 0 to high(Songs.Song) do + if (Songs.Song[I].Video <> '') AND FileExists(Songs.Song[I].Path + Songs.Song[I].Video) then + Inc(SongswithVid); +end; + +procedure TScreenStatMain.onShow; +begin + //Set Overview Text: + SetOverview; +end; + +procedure TScreenStatMain.SetOverview; +var + Overview, Formatstr: String; + I: Integer; + //Some Vars to Save Attributes to + A1, A2, A3: Integer; + A4, A5: String; + Result1, Result2: AStatResult; + ResetTime: TSystemTime; + function GetFileCreation(Filename: String): TSystemTime; + var + FindData: TWin32FindData; + Handle: THandle; + begin + Handle := FindFirstFile(PChar(Filename), FindData); + if Handle <> INVALID_HANDLE_VALUE then + begin + FileTimeToSystemTime(FindData.ftCreationTime, Result); + Windows.FindClose(Handle); + end; + end; +begin + //Song Overview + + //Introduction + Formatstr := Language.Translate ('STAT_OVERVIEW_INTRO'); + {Format: + %0:d Ultrastar Version + %1:d Day of Reset (A1) + %2:d Month of Reset (A2) + %3:d Year of Reset (A3)} + + ResetTime := GetFileCreation(Database.Filename); + + A1 := ResetTime.wDay; + A2 := ResetTime.wMonth; + A3 := ResetTime.wYear; + try + Overview := Format(Formatstr, [Language.Translate('US_VERSION'), A1, A2, A3]); + except + on E: EConvertError do + Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_INTRO": ' + E.Message); + end; + + Formatstr := Language.Translate ('STAT_OVERVIEW_SONG'); + {Format: + %0:d Count Songs (A1) + %1:d Count of Sung Songs (A2) + %2:d Count of UnSung Songs + %3:d Count of Songs with Video (A3) + %4:s Name of the most popular Song} + A1 := Length(CatSongs.Song); + A2 := Database.GetTotalEntrys(2); + + A3 := SongswithVid; + + SetLength(Result1, 1); + Database.GetStats(Result1, 2, 1, 0, False); + A4 := Result1[0].Artist; + A5 := Result1[0].Title; + + try + Overview := Overview + '\n \n' + Format(Formatstr, [A1, A2, A1-A2, A3, A4, A5]); + except + on E: EConvertError do + Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_SONG": ' + E.Message); + end; + + //Player Overview + Formatstr := Language.Translate ('STAT_OVERVIEW_PLAYER'); + {Format: + %0:d Count Players (A1) + %1:s Best Player (Result) + %2:d Best Players Score + %3:s Best Score Player (Result2) + %4:d Best Score} + A1 := Database.GetTotalEntrys(1); + + SetLength(Result1, 1); + Database.GetStats(Result1, 1, 1, 0, False); + + SetLength(Result2, 1); + Database.GetStats(Result2, 0, 1, 0, False); + + try + Overview := Overview + '\n \n' + Format(Formatstr, [A1, Result1[0].Player, Result1[0].AverageScore, Result2[0].Singer, Result2[0].Score]); + except + on E: EConvertError do + Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_PLAYER": ' + E.Message); + end; + + Text[0].Text := Overview; +end; + + +procedure TScreenStatMain.SetAnimationProgress(Progress: real); +var I: Integer; +begin + For I := 0 to high(Button) do + Button[I].Texture.ScaleW := Progress; +end; + +end. \ No newline at end of file -- cgit v1.2.3 From 34988301a511ca8552a954c231fafde007cb94a1 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 20 Apr 2007 15:29:48 +0000 Subject: Some Memory tweaking (13 MB Less Ram using at 800 Songs) Some Loading Time tweaking (From 8 Secs to 6 Secs on my Computer) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@123 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenOptionsRecord.pas | 2 ++ Game/Code/Screens/UScreenSong.pas | 3 +++ 2 files changed, 5 insertions(+) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index e6989d43..1d09d0b8 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -72,6 +72,8 @@ var SC: integer; SCI: integer; begin + inherited Create; + AddBackground(Theme.OptionsRecord.Background.Tex); for I := 0 to High(Theme.OptionsRecord.Static) do AddStatic(Theme.OptionsRecord.Static[I]); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 7c8447ee..79a5abb1 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -634,6 +634,9 @@ begin // Song List // Songs.LoadSongList; // moved to the UltraStar unit CatSongs.Refresh; + + //Set Length of Button Array one Time Instead of one time for every Song + SetButtonLength(Length(CatSongs.Song)); for Pet := 0 to High(CatSongs.Song) do begin // creating all buttons // new Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 -- cgit v1.2.3 From e68a4499226b3b9a129e55c94cebee5910c0ff02 Mon Sep 17 00:00:00 2001 From: mota23 Date: Fri, 20 Apr 2007 17:19:05 +0000 Subject: Changed LinePopup Colors from Red->Green to Red->Yellow->Green git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@124 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 650cfdff..e7572ab9 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1145,9 +1145,36 @@ begin Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; //Color - Player[I].LineBonus_Color.B := 0; - Player[I].LineBonus_Color.R := (8-A)/8; - Player[I].LineBonus_Color.G := A/10; + Case Floor(A) of + 0: begin + Player[I].LineBonus_Color.R := 1; + Player[I].LineBonus_Color.G := 0; + Player[I].LineBonus_Color.B := 0; + end; + 1..3: begin + Player[I].LineBonus_Color.R := 1; + Player[I].LineBonus_Color.G := (A * 0.25); + Player[I].LineBonus_Color.B := 0; + end; + 4: begin + Player[I].LineBonus_Color.R := 1; + Player[I].LineBonus_Color.G := 1; + Player[I].LineBonus_Color.B := 0; + end; + 5..7: begin + Player[I].LineBonus_Color.R := 1-((a-4)*0.25); + Player[I].LineBonus_Color.G := 1; + Player[I].LineBonus_Color.B := 0; + end; + 8: begin + Player[I].LineBonus_Color.R := 0; + Player[I].LineBonus_Color.G := 1; + Player[I].LineBonus_Color.B := 0; + end; + End; //Case + //Player[I].LineBonus_Color.B := 0; + //Player[I].LineBonus_Color.R := (8-A)/8; + //Player[I].LineBonus_Color.G := A/10; Player[I].LineBonus_PosX := Player[I].LineBonus_StartX; Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; -- cgit v1.2.3 From 3c106109e17a62c0d6c3620fc290a90410cae84c Mon Sep 17 00:00:00 2001 From: mota23 Date: Fri, 20 Apr 2007 20:36:21 +0000 Subject: Made the Line-Popup pop up. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@125 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 1 + 1 file changed, 1 insertion(+) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index e7572ab9..6cd444a2 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1180,6 +1180,7 @@ begin Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; Player[I].LineBonus_Alpha := 0.92; Player[I].LineBonus_Visible := True; + Player[I].LineBonus_Age := 1; end; //PhrasenBonus - Line Bonus Mod End// } -- cgit v1.2.3 From e7e9d945a53b293516c4a248abb042872759ba1d Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 21 Apr 2007 17:42:22 +0000 Subject: Fixed some Bugs in Party Mode Fixed TeamScores are not Reseted Added SBGW to MenuSelectSlide3 to Fit the Menu a little bit More. Need much Work to be Perfect git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@126 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenPartyNewRound.pas | 1 - 1 file changed, 1 deletion(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index c8c0febc..b268e04f 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -177,7 +177,6 @@ var I: Integer; begin PartySession.StartRound; - Log.LogError(InttoStr(Length(DllMan.Plugins))); //Set Visibility of Round Infos I := Length(PartySession.Rounds); -- cgit v1.2.3 From b49192ef9d03915744a65009e25f06fafd72bd30 Mon Sep 17 00:00:00 2001 From: mogguh Date: Mon, 23 Apr 2007 21:38:08 +0000 Subject: Feature: SingBar is now moveable via theme/skin (affects UDraw.pas, UThemes.pas, UScreenSing.pas) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@128 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 6cd444a2..01195db2 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -19,6 +19,15 @@ type TextP1: integer; TextP1Score: integer; + //moveable singbar mod + StaticP1SingBar: integer; + StaticP1ThreePSingBar: integer; + StaticP1TwoPSingBar: integer; + StaticP2RSingBar: integer; + StaticP2MSingBar: integer; + StaticP3SingBar: integer; + //eoa moveable singbar + //Added for ps3 skin //shown when game is in 2/4 player modus StaticP1TwoP: integer; @@ -170,6 +179,15 @@ begin TextP1 := AddText(Theme.Sing.TextP1); TextP1Score := AddText(Theme.Sing.TextP1Score); + //moveable singbar mod + StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar); + StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar); + StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); + StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); + StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar); + StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar); + //eoa moveable singbar + //Added for ps3 skin //This one is shown in 2/4P mode StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); -- cgit v1.2.3 From e79530fd2165c92a9291076b05dfb0e0236fc222 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 24 Apr 2007 12:59:54 +0000 Subject: Added ability to Select Players before Song Make Option OnSongClick Work git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@131 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenMain.pas | 19 +++++++++++++++++++ Game/Code/Screens/UScreenName.pas | 9 ++++++++- Game/Code/Screens/UScreenSong.pas | 23 +++++++++++++++++++++-- Game/Code/Screens/UScreenSongMenu.pas | 2 +- 4 files changed, 49 insertions(+), 4 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 8d2d13b6..051cd101 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -147,6 +147,8 @@ begin Music.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; if Interaction = 1 then begin @@ -206,6 +208,23 @@ begin TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong); Interaction := 0; + + //Some Testing for Button Fade + Button[0].SelectH := Button[0].H * 3; + Button[0].Fade := True; + Button[0].FadeText := True; + Button[0].DeSelectReflectionspacing := 280; + + Button[1].SelectH := Button[0].H * 3; + Button[1].Fade := True; + + Button[2].SelectH := Button[0].H * 3; + Button[2].Fade := True; + Button[2].FadeText := True; + + Button[3].SelectH := Button[0].H * 3; + Button[3].Fade := True; + Button[3].FadeText := True; end; procedure TScreenMain.onShow; diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index 82519e87..e8bc2dd8 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -8,6 +8,7 @@ uses type TScreenName = class(TMenu) public + Goto_SingScreen: Boolean; //If True then next Screen in SingScreen constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; @@ -49,7 +50,13 @@ begin Ini.Name[I-1] := Button[I-1].Text[0].Text; Ini.SaveNames; Music.PlayStart; - FadeTo(@ScreenLevel); + + if GoTo_SingScreen then + FadeTo(@ScreenSing) + else + FadeTo(@ScreenLevel); + + GoTo_SingScreen := False; end; // Up and Down could be done at the same time, diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 79a5abb1..5814efbf 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -83,6 +83,7 @@ type procedure StartSong; procedure OpenEditor; procedure DoJoker(Team: Byte); + procedure SelectPlayers; //Extensions procedure DrawExtensions; @@ -299,8 +300,17 @@ begin end else begin // clicked on song if (Mode = 0) then //Normal Mode -> Start Song begin - StartSong; - + //Do the Action that is specified in Ini + case Ini.OnSongClick of + 0: StartSong; + 1: SelectPlayers; + 2:begin + If (CatSongs.CatNumShow = -3) then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end; + end; end else if (Mode = 1) then //PartyMode -> Show Menu begin @@ -1615,6 +1625,15 @@ begin end; end; +procedure TScreenSong.SelectPlayers; +begin + CatSongs.Selected := Interaction; + Music.Stop; + + ScreenName.Goto_SingScreen := True; + FadeTo(@ScreenName); +end; + procedure TScreenSong.OpenEditor; begin if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 3ccba228..699e0b92 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -368,7 +368,7 @@ begin 1: //Button 2 begin //Select New Players then Sing: - + ScreenSong.SelectPlayers; Visible := False; end; -- cgit v1.2.3 From 4ca6b721c705fb98e3dd7f952403e600ddee9238 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 24 Apr 2007 13:09:36 +0000 Subject: Fixed: Select a not Visible Button in Joker Menu, if the first Team has no Joker git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@133 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSongMenu.pas | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 699e0b92..d4ad8016 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -329,8 +329,8 @@ begin SelectsS[0].Visible := False; Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY'); - Button[1].Text[0].Text := Language.Translate('SONG_MENU_JOKER'); - Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYMODI'); + //Button[1].Text[0].Text := Language.Translate('SONG_MENU_JOKER'); + //Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYMODI'); Button[3].Text[0].Text := Language.Translate('SONG_MENU_JOKER'); end; @@ -349,6 +349,21 @@ begin Button[1].Text[0].Text := String(PartySession.Teams.Teaminfo[1].Name); Button[2].Text[0].Text := String(PartySession.Teams.Teaminfo[2].Name); Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); + + //Set right Interaction + if (not Button[0].Visible) then + begin + if (not Button[1].Visible) then + begin + if (not Button[2].Visible) then + begin + Interaction := 4; + end + else Interaction := 2; + end + else Interaction := 1; + end; + end; end; end; -- cgit v1.2.3 From 85dd8313961a9a7c519a3f4466c46f3027a67411 Mon Sep 17 00:00:00 2001 From: mota23 Date: Wed, 25 Apr 2007 19:36:07 +0000 Subject: Fixed positions for popups git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@139 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 64 +++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 01195db2..cca398a1 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -592,107 +592,107 @@ begin Case PlayersPlay of 1: begin - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[0].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[0].LineBonus_StartY := Skin_P2_NotesB - 105; end; 2: begin //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; end; 3: begin //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[0].LineBonus_TargetY := 120 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[0].LineBonus_StartY := 120 + 28; //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[1].LineBonus_TargetY := 245 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[1].LineBonus_StartY := 245 + 28; //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[2].LineBonus_TargetY := 370 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[2].LineBonus_StartY := 370 + 28; end; 4: begin //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[2].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[2].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; //P4 - Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[3].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[3].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; end; 6: begin //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[0].LineBonus_TargetY := 120 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[0].LineBonus_StartY := 120 + 28; //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[1].LineBonus_TargetY := 245 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[1].LineBonus_StartY := 245 + 28; //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[2].LineBonus_TargetY := 370 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[2].LineBonus_StartY := 370 + 28; //P4 - Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[3].LineBonus_TargetY := 120 - 65 + 28; - Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[3].LineBonus_StartY := 120 + 28; //P5 - Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[4].LineBonus_TargetY := 245 - 65 + 28; - Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[4].LineBonus_StartY := 245 + 28; //P6 - Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); + Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); Player[5].LineBonus_TargetY := 370 - 65 + 28; - Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); + Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); Player[5].LineBonus_StartY := 370 + 28; end; end; -- cgit v1.2.3 From e3ec6fbc344c9af26b80932d3a29fb4bf1f6c9a2 Mon Sep 17 00:00:00 2001 From: mogguh Date: Thu, 26 Apr 2007 00:11:39 +0000 Subject: Feature: Credits screen is now a screen for itself (UGraphic.pas, UScreenMain.pas, UScreenCredits.pas) Feature: Credits screen now has a tune in the background, thanks weezl <3 !! (place the mp3 into your "Sounds" path) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@141 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 223 +++++++++++++++++++++++++++++++++++ Game/Code/Screens/UScreenMain.pas | 184 +++-------------------------- 2 files changed, 237 insertions(+), 170 deletions(-) create mode 100644 Game/Code/Screens/UScreenCredits.pas (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas new file mode 100644 index 00000000..2e5f4abc --- /dev/null +++ b/Game/Code/Screens/UScreenCredits.pas @@ -0,0 +1,223 @@ +unit UScreenCredits; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes, ULCD, ULight; + +type + TScreenCredits = class(TMenu) + public + + Credits_Y: Real; + Credits_Time: Cardinal; + Credits_Alpha: Cardinal; + + Fadeout: boolean; + constructor Create(Back: String); override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure DrawCredits; + end; + + const Credits_Text: Array[0..52] of PChar = ( + ':SPACE:', + 'Main Idea: Corvus 5', + 'Thank you very much for this great Game', + ':SPACE:', + 'The Ultrastar Deluxe Team:', + ':SPACE:', + 'blindy:', + 'VFX Programming', + ':SPACE:', + 'commandi00:', + 'Beta Testing', + ':SPACE:', + 'Crazy Joker:', + 'Graphics', + ':SPACE:', + 'DennistheMenace:', + 'Beta Testing and great Support in "the Board"', + ':SPACE:', + 'Mog:', + 'Programming, Graphics', + ':SPACE:', + 'Mota:', + 'Programming, Idea of creating this Mod', + ':SPACE:', + 'Sawyer:', + 'Web Master, Programming', + ':SPACE:', + 'Whiteshark:', + 'Programming, Creating Release', + ':SPACE:', + ':SPACE:', + 'Thanks to', + ':SPACE:', + 'Blind Guard', + 'for supporting us and administrate this great Board', + ':SPACE:', + 'Weezl', + 'for the credits screen music', + ':SPACE:', + 'The whole Community from www.ultra-star.dl.am', + 'for supporting us, supporting the newbies', + 'and remembering us to continue work', + ':SPACE:', + 'You', + 'for using Ultrastar Deluxe', + ':SPACE:', + ':SPACE:', + 'Visit us at:', + 'http://www.ultrastardx.dl.am', + 'http://sourceforge.net/projects/ultrastardx/', + 'http://www.Ultra-Star.dl.am', + 'Please write Bug Reports and Feature Requests', + 'to help making this a better Game'); + + +implementation + +uses Dialogs,Windows, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl, ULanguage; + +function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_ESCAPE : + begin + FadeTo(@ScreenMain); + Music.PlayBack; + end; + end;//esac + end; //fi +end; + +constructor TScreenCredits.Create(Back: String); +var + I: integer; +begin + inherited Create(Back); + + AddBackground(Theme.Loading.Background.Tex); + +// for I := 0 to High(Theme.Loading.Static) do +// AddStatic(Theme.Loading.Static[I]); + +// for I := 0 to High(Theme.Loading.Text) do +// AddText(Theme.Loading.Text[I]); + + Fadeout := false; +end; + +function TScreenCredits.Draw: boolean; +begin + DrawCredits; +end; + +procedure TScreenCredits.onShow; +begin + Credits_Y := 600; + Credits_Alpha := 0; + //Music.SetLoop(true); Loop looped ned, so ne scheisse + Music.Open(soundpath + 'wome_-_echoes.mp3'); //danke kleinster liebster weeeetüüüüü!! + Music.Play; +end; + +procedure TScreenCredits.onHide; +begin + Music.Stop; +end; + +procedure TScreenCredits.DrawCredits; +var + T,I: Cardinal; + Y: Real; + Ver: PChar; +begin + T := GetTickCount div 33; + if T <> Credits_Time then + begin + Credits_Time := T; + //Change Position + Credits_Y := Credits_Y - 1; + //Change Alpha + Inc (Credits_Alpha, 3); + end; + //If lowest Position is outside the Screen-> Show MainMenu + if (Y <= 0) then + Y := 600; + //Draw BackGround + DrawBG; + + + //Draw pulsing Credits Text + //Set Font + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (10, 5); + glColor4f(1, 0, 0, 0.2 + Abs((Credits_Alpha mod 150)/100 - 0.75)); + glPrint ('You may press ESC now'); + + //Set Font Size for Credits + SetFontSize(12); + //Draw Version + if (Credits_Y>-35) then + begin + Ver := PChar(Language.Translate('US_VERSION')); + //Set Color + if Credits_Y > 500 then + glColor4f(1, 0.6, 0.08, (600 - Credits_Y)/100 - 0.2) + else + glColor4f(1, 0.6, 0.08, 0.8); + + SetFontPos (400 - glTextWidth(Ver)/2, Credits_Y); + glprint(Ver); + end; + + //Set Color + Start Pos + glColor4f(0.8, 0.8, 1, 0.8); + Y := Credits_Y + 50; + + //Search upper Position + For I := 0 to high(Credits_Text) do + begin + if (Credits_Text[I]=':SPACE:') then //Spacer + Y := Y + 55 + else + Y := Y + 30; + + if Y > -35 then + break; + end; + + //Draw Text + For T := I+1 to high(Credits_Text) do + begin + if (Credits_Text[T]=':SPACE:') then //Spacer + Y := Y + 55 + else + begin + //Set Color + if Y > 500 then + glColor4f(0.8, 0.8, 1, (600 - Y)/100 - 0.2) + else + glColor4f(0.8, 0.8, 1, 0.8); + + SetFontPos (400 - glTextWidth(Credits_Text[T])/2, Y); + glprint(Credits_Text[T]); + Y := Y + 30; + end; + + if Y > 600 then + break; + end; + +end; + +end. diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 051cd101..28c255d1 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -11,14 +11,6 @@ type TextDescription: integer; TextDescriptionLong: integer; - //Credits Mod - Credits_Visible: Boolean; - Credits_Y: Real; - Credits_Time: Cardinal; - Credits_Alpha: Cardinal; - procedure DrawCredits; - //Credits Mod End - constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; @@ -26,65 +18,12 @@ type procedure InteractPrev; override; procedure UpdateLCD; procedure SetAnimationProgress(Progress: real); override; - function Draw: boolean; override; + //function Draw: boolean; override; end; -const Credits_Text: Array[0..49] of PChar = ( - ':SPACE:', - 'Main Idea: Corvus 5', - 'Thank you very much for this great Game', - ':SPACE:', - 'The Ultrastar Deluxe Team:', - ':SPACE:', - 'blindy:', - 'VFX Programming', - ':SPACE:', - 'commandi00:', - 'Beta Testing', - ':SPACE:', - 'Crazy Joker:', - 'Graphics', - ':SPACE:', - 'DennistheMenace:', - 'Beta Testing and great Support in "the Board"', - ':SPACE:', - 'Mog:', - 'Programming, Graphics', - ':SPACE:', - 'Mota:', - 'Programming, Idea of creating this Mod', - ':SPACE:', - 'Sawyer:', - 'Web Master, Programming', - ':SPACE:', - 'Whiteshark:', - 'Programming, Creating Release', - ':SPACE:', - ':SPACE:', - 'Thanks to', - ':SPACE:', - 'Blind Guard', - 'for supporting us and administrate this great Board', - ':SPACE:', - 'The whole Community from www.ultra-star.dl.am', - 'for supporting us, supporting the newbies', - 'and remembering us to continue work', - ':SPACE:', - 'You', - 'for using Ultrastar Deluxe', - ':SPACE:', - ':SPACE:', - 'Visit us at:', - 'http://www.ultrastardx.dl.am', - 'http://sourceforge.net/projects/ultrastardx/', - 'http://www.Ultra-Star.dl.am', - 'Please write Bug Reports and Feature Requests', - 'to help making this a better Game'); - - implementation -uses Windows, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl, ULanguage, UParty, UDLLManager; +uses Windows, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl, ULanguage, UParty, UDLLManager, UScreenCredits; function TScreenMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; @@ -98,11 +37,11 @@ begin + 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 Credits_Visible then +// begin +// Credits_Visible := False; +// exit; +// end; If (PressedDown) Then begin // Key Down @@ -121,9 +60,11 @@ begin begin if (SDL_ModState = KMOD_LALT) then begin - Credits_Y := 600; - Credits_Alpha := 0; - Credits_Visible := True; + //Credits_Y := 600; + //Credits_Alpha := 0; + //Credits_Visible := True; + Music.PlayStart; + FadeTo(@ScreenCredits); end; end; SDLK_M: @@ -210,7 +151,7 @@ begin Interaction := 0; //Some Testing for Button Fade - Button[0].SelectH := Button[0].H * 3; +{ Button[0].SelectH := Button[0].H * 3; Button[0].Fade := True; Button[0].FadeText := True; Button[0].DeSelectReflectionspacing := 280; @@ -225,6 +166,7 @@ begin Button[3].SelectH := Button[0].H * 3; Button[3].Fade := True; Button[3].FadeText := True; +} end; procedure TScreenMain.onShow; @@ -266,102 +208,4 @@ begin Static[0].Texture.ScaleW := Progress; Static[0].Texture.ScaleH := Progress; end; - -function TScreenMain.Draw: boolean; -begin -Result := True; -if Credits_Visible then - DrawCredits -else - Result := inherited Draw; -end; - -procedure TScreenMain.DrawCredits; -var - T, I: Cardinal; - Y: Real; - Ver: PChar; -begin - T := GetTickCount div 33; - if T <> Credits_Time then - begin - Credits_Time := T; - //Change Position - Credits_Y := Credits_Y - 1; - //Change Alpha - Inc (Credits_Alpha, 3); - end; - - //Draw BackGround - DrawBG; - - - //Draw pulsing Credits Text - //Set Font - SetFontStyle (2); - SetFontItalic(False); - SetFontSize(9); - SetFontPos (10, 5); - glColor4f(1, 0, 0, 0.2 + Abs((Credits_Alpha mod 150)/100 - 0.75)); - glPrint ('Credits! Press any Key to Continue'); - - //Set Font Size for Credits - SetFontSize(12); - //Draw Version - if (Credits_Y>-35) then - begin - Ver := PChar(Language.Translate('US_VERSION')); - //Set Color - if Credits_Y > 500 then - glColor4f(1, 0.6, 0.08, (600 - Credits_Y)/100 - 0.2) - else - glColor4f(1, 0.6, 0.08, 0.8); - - SetFontPos (400 - glTextWidth(Ver)/2, Credits_Y); - glprint(Ver); - end; - - //Set Color + Start Pos - glColor4f(0.8, 0.8, 1, 0.8); - Y := Credits_Y + 50; - - //Search upper Position - For I := 0 to high(Credits_Text) do - begin - if (Credits_Text[I]=':SPACE:') then //Spacer - Y := Y + 55 - else - Y := Y + 30; - - if Y > -35 then - break; - end; - - //Draw Text - For T := I+1 to high(Credits_Text) do - begin - if (Credits_Text[T]=':SPACE:') then //Spacer - Y := Y + 55 - else - begin - //Set Color - if Y > 500 then - glColor4f(0.8, 0.8, 1, (600 - Y)/100 - 0.2) - else - glColor4f(0.8, 0.8, 1, 0.8); - - SetFontPos (400 - glTextWidth(Credits_Text[T])/2, Y); - glprint(Credits_Text[T]); - Y := Y + 30; - end; - - if Y > 600 then - break; - end; - - //If lowest Position is outside the Screen-> Show MainMenu - if (Y <= 0) then - Credits_Visible := False; -end; - end. -- cgit v1.2.3 From b2518890d0dd62eeb96ee8b4b5f2d86e61ca75e7 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 26 Apr 2007 19:42:55 +0000 Subject: Added PS3 like ButtonFade ability Some new ThemeButton Attributes: DeSelectReflectionSpacing: ReflectionSpacing when Button is not Selected Fade: Enable Stepings in Fading FadeText: Fade Texts with Button SelectW, SelectH: Width and Height when Button is Selected FadeTex: Texture used when Button Fades to not stretch the Texture. Not nessecary. FadeTexPos: Position of FadeTex git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@143 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenMain.pas | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 28c255d1..4c822640 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -23,7 +23,7 @@ type implementation -uses Windows, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl, ULanguage, UParty, UDLLManager, UScreenCredits; +uses Windows, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl, ULanguage, UParty, UDLLManager, UScreenCredits, USkins; function TScreenMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; @@ -149,24 +149,6 @@ begin TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong); Interaction := 0; - - //Some Testing for Button Fade -{ Button[0].SelectH := Button[0].H * 3; - Button[0].Fade := True; - Button[0].FadeText := True; - Button[0].DeSelectReflectionspacing := 280; - - Button[1].SelectH := Button[0].H * 3; - Button[1].Fade := True; - - Button[2].SelectH := Button[0].H * 3; - Button[2].Fade := True; - Button[2].FadeText := True; - - Button[3].SelectH := Button[0].H * 3; - Button[3].Fade := True; - Button[3].FadeText := True; -} end; procedure TScreenMain.onShow; -- cgit v1.2.3 From ef87bafc41e7321c8559a23005c79de88b625741 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 28 Apr 2007 09:25:53 +0000 Subject: SongScreen: Changed Alt+Letter now Jump to Artist Added Alt+Shift+Letter: Jump to Title git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@147 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 48 +++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 12 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 5814efbf..16ac46ab 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -199,25 +199,49 @@ begin SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); - //Jump To - if (SDL_ModState = KMOD_LALT) AND (Mode = 0) AND (PressedKey > SDLK_A) AND (PressedKey < SDLK_Z) then + //Jump to Artist/Titel + if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey > SDLK_A) AND (PressedKey < SDLK_Z) then begin Letter := UpCase(Chr(ScanCode)); - Log.LogError(Letter); I2 := Length(CatSongs.Song); - For I := 1 to high(CatSongs.Song) do + + //Jump To Titel + if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then + For I := 1 to high(CatSongs.Song) do begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - Music.PlayChange; + Music.PlayChange; - ChangeMusic; - SetScroll4; - UpdateLCD; - //Break and Exit - Exit; + ChangeMusic; + SetScroll4; + UpdateLCD; + //Break and Exit + Exit; + end; + end; + end + //Jump to Artist + else if (SDL_ModState = KMOD_LALT) then + begin + For I := 1 to high(CatSongs.Song) do + begin + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Artist[1]) = Letter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + + Music.PlayChange; + + ChangeMusic; + SetScroll4; + UpdateLCD; + + //Break and Exit + Exit; + end; end; end; Exit; -- cgit v1.2.3 From bda4fa8e57ca63a1d591433f120b4226d6a5d327 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 29 Apr 2007 17:50:29 +0000 Subject: Added 2 new Buttons to ScreenMain: Multi and Stats Updated Language Fiels to Fit with new Buttons Some CodeClean Up in Menu Class and in Screens Some minor Bug fixes I forgot about Added ability to group Buttons within a Screen New Theme Object: ButtonCollection: Same Attributes as a Button Plus FirstChild: Defining the First Button in the Group. For Example: SingSolo is 1, SingMulti Button is 2, in ScreenMain Added Attribute to Theme Button: Parent: Number of the assigned Group, 0 for no Group Used new Abilitys in MainScreen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@149 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 6 +- Game/Code/Screens/UScreenEdit.pas | 6 +- Game/Code/Screens/UScreenEditConvert.pas | 6 +- Game/Code/Screens/UScreenEditHeader.pas | 6 +- Game/Code/Screens/UScreenEditSub.pas | 6 +- Game/Code/Screens/UScreenLevel.pas | 8 +-- Game/Code/Screens/UScreenLoading.pas | 16 ++--- Game/Code/Screens/UScreenMain.pas | 79 ++++++++++++++++++------ Game/Code/Screens/UScreenName.pas | 9 +-- Game/Code/Screens/UScreenOpen.pas | 6 +- Game/Code/Screens/UScreenOptions.pas | 91 +++------------------------- Game/Code/Screens/UScreenOptionsAdvanced.pas | 14 ++--- Game/Code/Screens/UScreenOptionsGame.pas | 14 ++--- Game/Code/Screens/UScreenOptionsGraphics.pas | 14 ++--- Game/Code/Screens/UScreenOptionsLyrics.pas | 14 ++--- Game/Code/Screens/UScreenOptionsRecord.pas | 14 +---- Game/Code/Screens/UScreenOptionsSound.pas | 15 ++--- Game/Code/Screens/UScreenOptionsThemes.pas | 14 ++--- Game/Code/Screens/UScreenPartyNewRound.pas | 13 +--- Game/Code/Screens/UScreenPartyOptions.pas | 45 ++------------ Game/Code/Screens/UScreenPartyPlayer.pas | 8 +-- Game/Code/Screens/UScreenPartyScore.pas | 8 +-- Game/Code/Screens/UScreenPartyWin.pas | 8 +-- Game/Code/Screens/UScreenScore.pas | 54 ++--------------- Game/Code/Screens/UScreenSing.pas | 8 +-- Game/Code/Screens/UScreenSong.pas | 8 +-- Game/Code/Screens/UScreenSongJumpto.pas | 11 +--- Game/Code/Screens/UScreenSongMenu.pas | 48 +++------------ Game/Code/Screens/UScreenStatDetail.pas | 26 +++----- Game/Code/Screens/UScreenStatMain.pas | 13 ++-- Game/Code/Screens/UScreenTop5.pas | 8 +-- 31 files changed, 160 insertions(+), 436 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 2e5f4abc..0411c7b6 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -14,7 +14,7 @@ type Credits_Alpha: Cardinal; Fadeout: boolean; - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; function Draw: boolean; override; procedure onShow; override; @@ -97,11 +97,11 @@ begin end; //fi end; -constructor TScreenCredits.Create(Back: String); +constructor TScreenCredits.Create; var I: integer; begin - inherited Create(Back); + inherited Create; AddBackground(Theme.Loading.Background.Tex); diff --git a/Game/Code/Screens/UScreenEdit.pas b/Game/Code/Screens/UScreenEdit.pas index aa3301a7..00df0418 100644 --- a/Game/Code/Screens/UScreenEdit.pas +++ b/Game/Code/Screens/UScreenEdit.pas @@ -11,7 +11,7 @@ type FadeOut: boolean; Path: string; FileName: string;} - constructor Create(Back: String); override; + constructor Create; override; procedure onShow; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; { function Draw: boolean; override; @@ -63,9 +63,9 @@ begin end; end; -constructor TScreenEdit.Create(Back: String); +constructor TScreenEdit.Create; begin - inherited Create(Back); + inherited Create; AddButton(400-200, 100 + 0*70, 400, 40, Skin.GetTextureFileName('ButtonF')); AddButtonText(10, 5, 0, 0, 0, 'Convert Midi to Txt'); // Button[High(Button)].Text[0].Size := 11; diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index 68742535..62a50b3e 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -58,7 +58,7 @@ type procedure Extract; procedure MidiFile1MidiEvent(event: PMidiEvent); function SelectedNumber: integer; - constructor Create(Back: String); override; + constructor Create; override; procedure onShow; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; function Draw: boolean; override; @@ -299,11 +299,11 @@ begin MidiOut.PutShort(event.event, event.data1, event.data2); end; -constructor TScreenEditConvert.Create(Back: String); +constructor TScreenEditConvert.Create; var P: integer; begin - inherited Create(Back); + inherited Create; AddButton(40, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); AddButtonText(15, 5, 0, 0, 0, 'Open'); // Button[High(Button)].Text[0].Size := 11; diff --git a/Game/Code/Screens/UScreenEditHeader.pas b/Game/Code/Screens/UScreenEditHeader.pas index a601555a..dbdd186c 100644 --- a/Game/Code/Screens/UScreenEditHeader.pas +++ b/Game/Code/Screens/UScreenEditHeader.pas @@ -35,7 +35,7 @@ type Sel: array[0..11] of boolean; procedure SetRoundButtons; - constructor Create(Back: String); override; + constructor Create; override; procedure onShow; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; { function Draw: boolean; override; @@ -124,9 +124,9 @@ begin end; end; -constructor TScreenEditHeader.Create(Back: String); +constructor TScreenEditHeader.Create; begin - inherited Create(Back); + inherited Create; AddButton(40, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); AddButtonText(15, 5, 'Open'); diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 6094edd1..a665ba1c 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -62,7 +62,7 @@ type FadeOut: boolean; Path: string; FileName: string; - constructor Create(Back: String); override; + 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; @@ -1035,9 +1035,9 @@ begin end; -constructor TScreenEditSub.Create(Back: String); +constructor TScreenEditSub.Create; begin - inherited Create(Back); + inherited Create; SetLength(Player, 1); // linijka diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas index 28aa40ea..80d42773 100644 --- a/Game/Code/Screens/UScreenLevel.pas +++ b/Game/Code/Screens/UScreenLevel.pas @@ -68,18 +68,12 @@ var begin inherited Create; - AddBackground(Theme.Level.Background.Tex); + LoadFromTheme(Theme.Level); AddButton(Theme.Level.ButtonEasy); AddButton(Theme.Level.ButtonMedium); AddButton(Theme.Level.ButtonHard); - for I := 0 to High(Theme.Level.Static) do - AddStatic(Theme.Level.Static[I]); - - for I := 0 to High(Theme.Level.Text) do - AddText(Theme.Level.Text[I]); - Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenLoading.pas b/Game/Code/Screens/UScreenLoading.pas index 5cc938bb..438b606e 100644 --- a/Game/Code/Screens/UScreenLoading.pas +++ b/Game/Code/Screens/UScreenLoading.pas @@ -9,7 +9,7 @@ type TScreenLoading = class(TMenu) public Fadeout: boolean; - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; function GetBGTexNum: GLUInt; procedure onShow; override; @@ -24,19 +24,11 @@ begin Result := true; end; -constructor TScreenLoading.Create(Back: String); -var - I: integer; +constructor TScreenLoading.Create; begin - inherited Create(Back); + inherited Create; - AddBackground(Theme.Loading.Background.Tex); - - for I := 0 to High(Theme.Loading.Static) do - AddStatic(Theme.Loading.Static[I]); - - for I := 0 to High(Theme.Loading.Text) do - AddText(Theme.Loading.Text[I]); + LoadFromTheme(Theme.Loading); Fadeout := false; end; diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 4c822640..49bd98ee 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -16,6 +16,8 @@ type 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; @@ -84,6 +86,7 @@ begin SDLK_RETURN: begin + //Solo if (Interaction = 0) and (Length(Songs.Song) >= 1) then begin Music.PlayStart; if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1; @@ -92,23 +95,44 @@ begin ScreenName.Goto_SingScreen := False; FadeTo(@ScreenName); end; + + //Multi if Interaction = 1 then begin + if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then + begin + Music.PlayStart; + FadeTo(@ScreenPartyOptions); + end; + end; + + //Stats + if Interaction = 2 then begin + Music.PlayStart; + FadeTo(@ScreenStatMain); + end; + + //Editor + if Interaction = 3 then begin Music.PlayStart; FadeTo(@ScreenEdit); end; - if Interaction = 2 then begin + + //Options + if Interaction = 4 then begin Music.PlayStart; FadeTo(@ScreenOptions); end; - if Interaction = 3 then begin + + //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: InteractNext; - SDLK_UP: InteractPrev; + SDLK_DOWN: InteractInc; + SDLK_UP: InteractDec; SDLK_RIGHT: InteractNext; SDLK_LEFT: InteractPrev; end; @@ -127,27 +151,28 @@ var begin inherited Create; -// AddButton(400-200, 320, 400, 60, Skin.GameStart); -// AddButton(400-200, 390, 400, 60, Skin.Editor); -// AddButton(400-200, 460, 400, 60, Skin.Options); -// AddButton(400-200, 530, 400, 60, Skin.Exit); + //---------------- + //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); - AddBackground(Theme.Main.Background.Tex); + 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); - for I := 0 to High(Theme.Main.Static) do - AddStatic(Theme.Main.Static[I]); - - for I := 0 to High(Theme.Main.Text) do - AddText(Theme.Main.Text[I]); - - TextDescription := AddText(Theme.Main.TextDescription); - TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong); - Interaction := 0; end; @@ -175,6 +200,24 @@ begin 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 diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index e8bc2dd8..9819b994 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -76,17 +76,12 @@ var begin inherited Create; - AddBackground(Theme.Name.Background.Tex); + LoadFromTheme(Theme.Name); + for I := 1 to 6 do AddButton(Theme.Name.ButtonPlayer[I]); - for I := 0 to High(Theme.Name.Static) do - AddStatic(Theme.Name.Static[I]); - - for I := 0 to High(Theme.Name.Text) do - AddText(Theme.Name.Text[I]); - Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index 264f57a9..4f0c32c5 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -16,7 +16,7 @@ type Path: string; BackScreen: pointer; procedure AddBox(X, Y, W, H: real); - constructor Create(Back: String); override; + constructor Create; override; procedure onShow; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; // function Draw: boolean; override; @@ -90,9 +90,9 @@ begin AddStatic(X+2, Y+2, W-4, H-4, 1, 1, 1, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); end; -constructor TScreenOpen.Create(Back: String); +constructor TScreenOpen.Create; begin - inherited Create(Back); + inherited Create; // linijka { AddStatic(20, 10, 80, 30, 0, 0, 0, 'Bar', 'JPG', 'Font Black'); diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas index 0fffedac..f0229d8c 100644 --- a/Game/Code/Screens/UScreenOptions.pas +++ b/Game/Code/Screens/UScreenOptions.pas @@ -9,7 +9,7 @@ type TScreenOptions = class(TMenu) public TextDescription: integer; - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure InteractNext; override; @@ -80,88 +80,23 @@ begin FadeTo(@ScreenMain); end; end; - SDLK_LEFT: - begin - {case SelInteraction of - 0: InteractCustom(+2); - 1: InteractCustom(-1); - 2: InteractCustom(-1); - 3: InteractCustom(+2); - 4: InteractCustom(-1); - 5: InteractCustom(-1); - end;} - InteractPrev; - end; - SDLK_RIGHT: - begin - {case SelInteraction of - 0: InteractCustom(+1); - 1: InteractCustom(+1); - 2: InteractCustom(-2); - 3: InteractCustom(+1); - 4: InteractCustom(+1); - 5: InteractCustom(-2); - end;} - InteractNext; - end; - SDLK_UP: - begin - InteractPrev; - {case SelInteraction of - 0: InteractCustom(+3); - 1: InteractCustom(+3); - 2: InteractCustom(+3); - 3: InteractCustom(-3); - 4: InteractCustom(-3); - 5: InteractCustom(-3); - end; } - end; - SDLK_DOWN: - begin - {case SelInteraction of - 0: InteractCustom(+3); - 1: InteractCustom(+3); - 2: InteractCustom(+3); - 3: InteractCustom(-3); - 4: InteractCustom(-3); - 5: InteractCustom(-3); - end; } - InteractNext; - end; + SDLK_DOWN: InteractInc; + SDLK_UP: InteractDec; + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; end; end; end; -constructor TScreenOptions.Create(Back: String); +constructor TScreenOptions.Create; var I: integer; begin - inherited Create(Back); + inherited Create; - // Game -{ AddButton(225, 100 + 0*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); - AddButtonText(11, 10, 'Game');} - - // Graphics -{ AddButton(225, 100 + 1*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); - AddButtonText(11, 10, 'Graphics'); - - // Sound - AddButton(225, 100 + 2*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); - AddButtonText(11, 10, 'Sound'); - - // Lyrics - AddButton(225, 100 + 3*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); - AddButtonText(11, 10, 'Lyrics'); - - // Themes - AddButton(225, 100 + 4*60, 350, 50, Skin.Button, 'JPG', 'Transparent Range'); - AddButtonText(11, 10, 'Themes'); - - // Exit - AddButton(225, 100 + 6*60, 350, 50, Skin.Exit);} + TextDescription := AddText(Theme.Options.TextDescription); - AddBackground(Theme.Options.Background.Tex); + LoadFromTheme(Theme.Options); AddButton(Theme.Options.ButtonGame); if (Length(Button[0].Text)=0) then @@ -195,14 +130,6 @@ begin if (Length(Button[7].Text)=0) then AddButtonText(14, 20, Theme.Options.Description[7]); - for I := 0 to High(Theme.Options.Static) do - AddStatic(Theme.Options.Static[I]); - - for I := 0 to High(Theme.Options.Text) do - AddText(Theme.Options.Text[I]); - - TextDescription := AddText(Theme.Options.TextDescription); - Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index ed3bc164..256b02db 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -8,7 +8,7 @@ uses type TScreenOptionsAdvanced = class(TMenu) public - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; end; @@ -59,19 +59,13 @@ begin end; end; -constructor TScreenOptionsAdvanced.Create(Back: String); +constructor TScreenOptionsAdvanced.Create; var I: integer; begin - inherited Create(Back); + inherited Create; - AddBackground(Theme.OptionsAdvanced.Background.Tex); - - for I := 0 to High(Theme.OptionsAdvanced.Static) do - AddStatic(Theme.OptionsAdvanced.Static[I]); - - for I := 0 to High(Theme.OptionsAdvanced.Text) do - AddText(Theme.OptionsAdvanced.Text[I]); + LoadFromTheme(Theme.OptionsAdvanced); AddSelect(Theme.OptionsAdvanced.SelectLoadAnimation, Ini.LoadAnimation, ILoadAnimation); AddSelect(Theme.OptionsAdvanced.SelectScreenFade, Ini.ScreenFade, IScreenFade); diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index 63bbec36..88bb34e3 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -9,7 +9,7 @@ type TScreenOptionsGame = class(TMenu) public old_Tabs, old_Sorting: integer; - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure RefreshSongs; @@ -61,19 +61,13 @@ begin end; end; -constructor TScreenOptionsGame.Create(Back: String); +constructor TScreenOptionsGame.Create; var I: integer; begin - inherited Create(Back); + inherited Create; - AddBackground(Theme.OptionsGame.Background.Tex); - - for I := 0 to High(Theme.OptionsGame.Static) do - AddStatic(Theme.OptionsGame.Static[I]); - - for I := 0 to High(Theme.OptionsGame.Text) do - AddText(Theme.OptionsGame.Text[I]); + LoadFromTheme(Theme.OptionsGame); //Refresh Songs Patch old_Sorting := Ini.Sorting; diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index 6152c9c0..b36bb7d3 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -8,7 +8,7 @@ uses type TScreenOptionsGraphics = class(TMenu) public - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; end; @@ -66,19 +66,13 @@ begin end; end; -constructor TScreenOptionsGraphics.Create(Back: String); +constructor TScreenOptionsGraphics.Create; var I: integer; begin - inherited Create(Back); + inherited Create; - AddBackground(Theme.OptionsGraphics.Background.Tex); - - for I := 0 to High(Theme.OptionsGraphics.Static) do - AddStatic(Theme.OptionsGraphics.Static[I]); - - for I := 0 to High(Theme.OptionsGraphics.Text) do - AddText(Theme.OptionsGraphics.Text[I]); + LoadFromTheme(Theme.OptionsGraphics); AddSelectSlide(Theme.OptionsGraphics.SelectSlideResolution, Ini.Resolution, IResolution); AddSelect(Theme.OptionsGraphics.SelectFullscreen, Ini.Fullscreen, IFullscreen); diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas index 35cb2415..ff03b2ba 100644 --- a/Game/Code/Screens/UScreenOptionsLyrics.pas +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -8,7 +8,7 @@ uses type TScreenOptionsLyrics = class(TMenu) public - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; end; @@ -59,19 +59,13 @@ begin end; end; -constructor TScreenOptionsLyrics.Create(Back: String); +constructor TScreenOptionsLyrics.Create; var I: integer; begin - inherited Create(Back); + inherited Create; - AddBackground(Theme.OptionsLyrics.Background.Tex); - - for I := 0 to High(Theme.OptionsLyrics.Static) do - AddStatic(Theme.OptionsLyrics.Static[I]); - - for I := 0 to High(Theme.OptionsLyrics.Text) do - AddText(Theme.OptionsLyrics.Text[I]); + LoadFromTheme(Theme.OptionsLyrics); AddSelect(Theme.OptionsLyrics.SelectLyricsFont, Ini.LyricsFont, ILyricsFont); AddSelect(Theme.OptionsLyrics.SelectLyricsEffect, Ini.LyricsEffect, ILyricsEffect); diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index 1d09d0b8..af7d2cd6 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -74,20 +74,8 @@ var begin inherited Create; - AddBackground(Theme.OptionsRecord.Background.Tex); - for I := 0 to High(Theme.OptionsRecord.Static) do - AddStatic(Theme.OptionsRecord.Static[I]); + LoadFromTheme(Theme.OptionsRecord); - for I := 0 to High(Theme.OptionsRecord.Text) do - AddText(Theme.OptionsRecord.Text[I]); - -// SetLength(ICard, 0); -// ICard[0] := 'karta'; - -// SetLength(IInput, 0); -// IInput[0] := 'wejscie'; - -// if Length(Recording.SoundCard) > 0 then begin SetLength(ICard, Length(Recording.SoundCard)); for SC := 0 to High(Recording.SoundCard) do ICard[SC] := Recording.SoundCard[SC].Description; diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index aea6cdbc..ee53ef02 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -8,7 +8,7 @@ uses type TScreenOptionsSound = class(TMenu) public - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; end; @@ -59,25 +59,18 @@ begin end; end; -constructor TScreenOptionsSound.Create(Back: String); +constructor TScreenOptionsSound.Create; var I: integer; begin - inherited Create(Back); + inherited Create; - AddBackground(Theme.OptionsSound.Background.Tex); - - for I := 0 to High(Theme.OptionsSound.Static) do - AddStatic(Theme.OptionsSound.Static[I]); - - for I := 0 to High(Theme.OptionsSound.Text) do - AddText(Theme.OptionsSound.Text[I]); + LoadFromTheme(Theme.OptionsSound); AddSelect(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost); AddSelect(Theme.OptionsSound.SelectClickAssist, Ini.ClickAssist, IClickAssist); AddSelect(Theme.OptionsSound.SelectBeatClick, Ini.BeatClick, IBeatClick); AddSelect(Theme.OptionsSound.SelectThreshold, Ini.Threshold, IThreshold); - //AddSelect(Theme.OptionsSound.SelectTwoPlayerMode, Ini.TwoPlayerMode, ITwoPlayerMode); AddButton(Theme.OptionsSound.ButtonExit); if (Length(Button[0].Text)=0) then diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index 151913be..c0bf2e15 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -9,7 +9,7 @@ type TScreenOptionsThemes = class(TMenu) public SkinSelect: Integer; - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure InteractInc; override; @@ -84,19 +84,13 @@ begin end; end; -constructor TScreenOptionsThemes.Create(Back: String); +constructor TScreenOptionsThemes.Create; var I: integer; begin - inherited Create(Back); + inherited Create; - AddBackground(Theme.OptionsThemes.Background.Tex); - - for I := 0 to High(Theme.OptionsThemes.Static) do - AddStatic(Theme.OptionsThemes.Static[I]); - - for I := 0 to High(Theme.OptionsThemes.Text) do - AddText(Theme.OptionsThemes.Text[I]); + LoadFromTheme(Theme.OptionsThemes); AddSelectSlide(Theme.OptionsThemes.SelectTheme, Ini.Theme, ITheme); diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index b268e04f..cf643310 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -116,9 +116,6 @@ var begin inherited Create; - AddBackground(Theme.PartyNewRound.Background.Tex); - Log.LogError(Theme.PartyNewRound.Background.Tex); - TextRound1 := AddText (Theme.PartyNewRound.TextRound1); TextRound2 := AddText (Theme.PartyNewRound.TextRound2); TextRound3 := AddText (Theme.PartyNewRound.TextRound3); @@ -161,15 +158,7 @@ begin StaticTeam2 := AddStatic (Theme.PartyNewRound.StaticTeam2); StaticTeam3 := AddStatic (Theme.PartyNewRound.StaticTeam3); - AddButton (Theme.PartyNewRound.ButtonNext); - - for I := 0 to High(Theme.PartyNewRound.Static) do - AddStatic(Theme.PartyNewRound.Static[I]); - - for I := 0 to High(Theme.PartyNewRound.Text) do - AddText(Theme.PartyNewRound.Text[I]); - - Interaction := 0; + LoadFromTheme(Theme.PartyNewRound); end; procedure TScreenPartyNewRound.onShow; diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index fd7b5107..f0df9871 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -45,37 +45,6 @@ uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UDLLManager, UPlaylist, function TScreenPartyOptions.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; var I, J: Integer; - - function IsVisible: Boolean; - begin - Result := True; - if (Interactions[Interaction].Typ = 0) then - begin - Result := Button[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 1) then - begin - //Result := Selects[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 3) then - begin - Result := SelectsS[Interactions[Interaction].Num].Visible; - end; - end; - - Procedure SelectNext; - begin - repeat - InteractNext; - until IsVisible; - end; - - Procedure SelectPrev; - begin - repeat - InteractPrev; - until IsVisible; - end; begin Result := true; If (PressedDown) Then @@ -137,8 +106,8 @@ begin // 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: SelectNext; - SDLK_UP: SelectPrev; + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; SDLK_RIGHT: begin Music.PlayOption; @@ -193,6 +162,7 @@ begin SetLength(IPlaylist2, 1); IPlaylist2[0] := '---'; + //Clear all Selects NumTeams := 0; NumPlayer1 := 0; NumPlayer2 := 0; @@ -201,7 +171,8 @@ begin PlayList := 0; PlayList2 := 0; - AddBackground(Theme.PartyOptions.Background.Tex); + //Load Screen From Theme + LoadFromTheme(Theme.PartyOptions); SelectLevel := AddSelectSlide (Theme.PartyOptions.SelectLevel, Ini.Difficulty, Theme.ILevel); SelectPlayList := AddSelectSlide (Theme.PartyOptions.SelectPlayList, PlayList, IPlaylist); @@ -212,12 +183,6 @@ begin SelectPlayers2 := AddSelectSlide (Theme.PartyOptions.SelectPlayers2, NumPlayer2, IPlayers); SelectPlayers3 := AddSelectSlide (Theme.PartyOptions.SelectPlayers3, NumPlayer3, IPlayers); - for I := 0 to High(Theme.PartyOptions.Static) do - AddStatic(Theme.PartyOptions.Static[I]); - - for I := 0 to High(Theme.PartyOptions.Text) do - AddText(Theme.PartyOptions.Text[I]); - Interaction := 0; //Hide Team3 Players diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index 02f87710..d6e13d65 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -108,7 +108,7 @@ var begin inherited Create; - AddBackground(Theme.PartyPlayer.Background.Tex); + LoadFromTheme(Theme.PartyPlayer); Team1Name := AddButton(Theme.PartyPlayer.Team1Name); AddButton(Theme.PartyPlayer.Player1Name); @@ -128,12 +128,6 @@ begin AddButton(Theme.PartyPlayer.Player11Name); AddButton(Theme.PartyPlayer.Player12Name); - for I := 0 to High(Theme.PartyPlayer.Static) do - AddStatic(Theme.PartyPlayer.Static[I]); - - for I := 0 to High(Theme.PartyPlayer.Text) do - AddText(Theme.PartyPlayer.Text[I]); - Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index 142ec947..805525a1 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -72,8 +72,6 @@ var begin inherited Create; - AddBackground(Theme.PartyScore.Background.Tex); - TextScoreTeam1 := AddText (Theme.PartyScore.TextScoreTeam1); TextScoreTeam2 := AddText (Theme.PartyScore.TextScoreTeam2); TextScoreTeam3 := AddText (Theme.PartyScore.TextScoreTeam3); @@ -87,11 +85,7 @@ begin TextWinner := AddText (Theme.PartyScore.TextWinner); - for I := 0 to High(Theme.PartyScore.Static) do - AddStatic(Theme.PartyScore.Static[I]); - - for I := 0 to High(Theme.PartyScore.Text) do - AddText(Theme.PartyScore.Text[I]); + LoadFromTheme(Theme.PartyScore); end; procedure TScreenPartyScore.onShow; diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas index ac5f38d9..ff65e82f 100644 --- a/Game/Code/Screens/UScreenPartyWin.pas +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -61,8 +61,6 @@ var begin inherited Create; - AddBackground(Theme.PartyWin.Background.Tex); - TextScoreTeam1 := AddText (Theme.PartyWin.TextScoreTeam1); TextScoreTeam2 := AddText (Theme.PartyWin.TextScoreTeam2); TextScoreTeam3 := AddText (Theme.PartyWin.TextScoreTeam3); @@ -76,11 +74,7 @@ begin TextWinner := AddText (Theme.PartyWin.TextWinner); - for I := 0 to High(Theme.PartyWin.Static) do - AddStatic(Theme.PartyWin.Static[I]); - - for I := 0 to High(Theme.PartyWin.Text) do - AddText(Theme.PartyWin.Text[I]); + LoadFromTheme(Theme.PartyWin); end; procedure TScreenPartyWin.onShow; diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 72c42cb8..af1ccb59 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -40,7 +40,7 @@ type Animation: real; Fadeout: boolean; - constructor Create(Back: String); override; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; function Draw: boolean; override; @@ -92,60 +92,14 @@ begin end; end; -constructor TScreenScore.Create(Back: String); +constructor TScreenScore.Create; var P: integer; I, C: integer; begin - inherited Create(Back); + inherited Create; - // background arrows sorted from farthest to nearest -{ AddStatic(-2000 + 400, 100, 360, 60, 1, 1, 1, Skin.Arrow2, 'JPG', 'Arrow'); - AddStatic(-2000 + -50, 200, 420, 70, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); - AddStatic(-2000 + 90, 30, 500, 90, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); - AddStatic(-2000 + -250, 100, 800, 150, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); - - Static[0].Texture.Rot := 100 * pi/180; - Static[1].Texture.Rot := 7 * pi/180; - Static[2].Texture.Rot := 35 * pi/180; - - - // main arrow with text - AddStatic(0, 340, 1000, 180, 1, 1, 1, Skin.Arrow2, 'JPG', 'Arrow'); -// AddText(450, 409, 4, 15, 1, 1, 1, 'Smile'); - AddText(450, 409, 4, 15, 1, 1, 1, 'Let''s see the results'); - Text[0].Y := 401; - - Static[4].Texture.Rot := -3 * pi/180; - - - // two mid arrows - AddStatic(-2000 + -250, 100, 800, 150, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); - AddStatic(-2000 + -250, 100, 800, 150, 1, 1, 1, Skin.Arrow, 'JPG', 'Arrow'); - - - // last arrow - AddStatic(-2000, 340, 1100, 180, 1, 1, 1, Skin.Arrow2, 'JPG', 'Arrow'); -// AddText(-2000, 407, 4, 17, 1, 1, 1, 'SHUFFLE !'); - AddText(-2000, 407, 4, 15, 1, 1, 1, 'SHUFFLE !'); - - Static[7].Texture.Rot := 184 * pi/180; - - // score text - AddText(-2000, 407, 4, 17, 1, 1, 1, '10010 points'); - AddText(-2000, 407, 4, 17, 1, 1, 1, 'Cheater'); - - Fadeout := false;} - - - // Singstar Theme - AddBackground(Theme.Score.Background.Tex); - - for I := 0 to High(Theme.Score.Static) do - AddStatic(Theme.Score.Static[I]); - - for I := 0 to High(Theme.Score.Text) do - AddText(Theme.Score.Text[I]); + LoadFromTheme(Theme.Score); TextArtist := AddText(Theme.Score.TextArtist); TextTitle := AddText(Theme.Score.TextTitle); diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index cca398a1..93c3ac48 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -163,13 +163,7 @@ var begin inherited Create; - AddBackground(Theme.Sing.Background.Tex); - - for I := 0 to High(Theme.Sing.Static) do - AddStatic(Theme.Sing.Static[I]); - - for I := 0 to High(Theme.Sing.Text) do - AddText(Theme.Sing.Text[I]); + LoadFromTheme(Theme.Sing); // time TextTime := AddText(75, 14, 1, 8, 0.25, 0.25, 0.25, '00:00'); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 16ac46ab..5c383168 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -630,13 +630,7 @@ begin // AddStatic(200, 10, 400, 90, Skin.SelectSong); // AddStatic(200-10, 140-5, 400+20, 50+10, Skin.Selection, 'JPG', 'Font Gray'); - AddBackground(Theme.Song.Background.Tex); - - for I := 0 to High(Theme.Song.Static) do - AddStatic(Theme.Song.Static[I]); - - for I := 0 to High(Theme.Song.Text) do - AddText(Theme.Song.Text[I]); + LoadFromTheme(Theme.Song); TextArtist := AddText(Theme.Song.TextArtist); TextTitle := AddText(Theme.Song.TextTitle); diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 123146c7..b90c558b 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -154,7 +154,9 @@ var begin inherited Create; - AddBackground(Theme.SongJumpto.Background.Tex); + AddText(Theme.SongJumpto.TextFound); + + LoadFromTheme(Theme.SongJumpto); AddButton(Theme.SongJumpto.ButtonSearchText); if (Length(Button[0].Text) = 0) then @@ -163,13 +165,6 @@ begin SelectType := 0; AddSelectSlide(Theme.SongJumpto.SelectSlideType, SelectType, Theme.SongJumpto.IType); - AddText(Theme.SongJumpto.TextFound); - - for I := 0 to High(Theme.SongJumpto.Static) do - AddStatic(Theme.SongJumpto.Static[I]); - - for I := 0 to High(Theme.SongJumpto.Text) do - AddText(Theme.SongJumpto.Text[I]); Interaction := 0; LastPlayed := 0; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index d4ad8016..fd875527 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -45,36 +45,6 @@ implementation uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist; function TScreenSongMenu.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; - function IsVisible: Boolean; - begin - Result := True; - if (Interactions[Interaction].Typ = 0) then - begin - Result := Button[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 1) then - begin - //Result := Selects[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 3) then - begin - Result := SelectsS[Interactions[Interaction].Num].Visible; - end; - end; - - Procedure SelectNext; - begin - repeat - InteractNext; - until IsVisible; - end; - - Procedure SelectPrev; - begin - repeat - InteractPrev; - until IsVisible; - end; begin Result := true; If (PressedDown) Then @@ -113,8 +83,8 @@ begin HandleReturn; end; - SDLK_DOWN: SelectNext; - SDLK_UP: SelectPrev; + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; SDLK_RIGHT: begin @@ -141,10 +111,15 @@ var I: integer; begin inherited Create; + + //Create Dummy SelectSlide Entrys SetLength(ISelections, 1); ISelections[0] := 'Dummy'; - AddBackground(Theme.SongMenu.Background.Tex); + + AddText(Theme.SongMenu.TextMenu); + + LoadFromTheme(Theme.SongMenu); AddButton(Theme.SongMenu.Button1); if (Length(Button[0].Text) = 0) then @@ -164,13 +139,6 @@ begin if (Length(Button[3].Text) = 0) then AddButtonText(14, 20, 'Button 4'); - AddText(Theme.SongMenu.TextMenu); - - for I := 0 to High(Theme.SongMenu.Static) do - AddStatic(Theme.SongMenu.Static[I]); - - for I := 0 to High(Theme.SongMenu.Text) do - AddText(Theme.SongMenu.Text[I]); Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenStatDetail.pas b/Game/Code/Screens/UScreenStatDetail.pas index dc4a0f1f..1461a9da 100644 --- a/Game/Code/Screens/UScreenStatDetail.pas +++ b/Game/Code/Screens/UScreenStatDetail.pas @@ -102,7 +102,15 @@ var begin inherited Create; - AddBackground(Theme.StatDetail.Background.Tex); + for I := 0 to High(Theme.StatDetail.TextList) do + AddText(Theme.StatDetail.TextList[I]); + + Count := Length(Theme.StatDetail.TextList); + + AddText(Theme.StatDetail.TextDescription); + AddText(Theme.StatDetail.TextPage); + + LoadFromTheme(Theme.StatDetail); AddButton(Theme.StatDetail.ButtonNext); if (Length(Button[0].Text)=0) then @@ -120,22 +128,6 @@ begin if (Length(Button[3].Text)=0) then AddButtonText(14, 20, Theme.Options.Description[7]); - for I := 0 to High(Theme.StatDetail.TextList) do - AddText(Theme.StatDetail.TextList[I]); - - Count := Length(Theme.StatDetail.TextList); - - AddText(Theme.StatDetail.TextDescription); - AddText(Theme.StatDetail.TextPage); - - for I := 0 to High(Theme.StatDetail.Static) do - AddStatic(Theme.StatDetail.Static[I]); - - for I := 0 to High(Theme.StatDetail.Text) do - AddText(Theme.StatDetail.Text[I]); - - - Interaction := 0; Typ := 0; end; diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index 337ed745..219ccd57 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -80,7 +80,9 @@ var begin inherited Create; - AddBackground(Theme.StatMain.Background.Tex); + TextOverview := AddText(Theme.StatMain.TextOverview); + + LoadFromTheme(Theme.StatMain); AddButton(Theme.StatMain.ButtonScores); if (Length(Button[0].Text)=0) then @@ -102,16 +104,9 @@ begin if (Length(Button[4].Text)=0) then AddButtonText(14, 20, Theme.Options.Description[4]); - TextOverview := AddText(Theme.StatMain.TextOverview); - - for I := 0 to High(Theme.StatMain.Static) do - AddStatic(Theme.StatMain.Static[I]); - - for I := 0 to High(Theme.StatMain.Text) do - AddText(Theme.StatMain.Text[I]); - Interaction := 0; + //Set Songs with Vid SongswithVid := 0; For I := 0 to high(Songs.Song) do if (Songs.Song[I].Video <> '') AND FileExists(Songs.Song[I].Path + Songs.Song[I].Video) then diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas index 94f3de1e..4d542bf0 100644 --- a/Game/Code/Screens/UScreenTop5.pas +++ b/Game/Code/Screens/UScreenTop5.pas @@ -58,13 +58,7 @@ var begin inherited Create; - AddBackground(Theme.Top5.Background.Tex); - - for I := 0 to High(Theme.Top5.Static) do - AddStatic(Theme.Top5.Static[I]); - - for I := 0 to High(Theme.Top5.Text) do - AddText(Theme.Top5.Text[I]); + LoadFromTheme(Theme.Top5); TextLevel := AddText(Theme.Top5.TextLevel); -- cgit v1.2.3 From cc06446d0a651113083478fda94dfaa9a25d1d7e Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 29 Apr 2007 18:29:42 +0000 Subject: Commented some Debuging Outputs in ULog Fixed a Bug in ButtonCollection that causes a Crash when UpButton is Pressed at the Last Button Added ShortCut E in MainMenu for Editor git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@150 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenMain.pas | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 49bd98ee..78c98218 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -84,6 +84,12 @@ begin FadeTo(@ScreenStatMain); end; + SDLK_E: + begin + Music.PlayStart; + FadeTo(@ScreenEdit); + end; + SDLK_RETURN: begin //Solo -- cgit v1.2.3 From 37f734e1943563ca121791eabb9bff067a591e3d Mon Sep 17 00:00:00 2001 From: mota23 Date: Mon, 30 Apr 2007 09:24:50 +0000 Subject: Added new Static to ScreenPartyNewRound. Some Themework in Party-Mode. Still needs work. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@151 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenPartyNewRound.pas | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index cf643310..8c1b8369 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -30,6 +30,7 @@ type TextNextPlayer1: Cardinal; TextNextPlayer2: Cardinal; TextNextPlayer3: Cardinal; + //Statics StaticRound1: Cardinal; StaticRound2: Cardinal; @@ -50,6 +51,12 @@ type 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; @@ -157,6 +164,9 @@ begin 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; @@ -297,12 +307,14 @@ begin Text[TextScoreTeam1].Visible := True; Text[TextNameTeam1].Visible := True; Static[StaticTeam1].Visible := True; + Static[StaticNextPlayer1].Visible := True; end else begin Text[TextScoreTeam1].Visible := False; Text[TextNameTeam1].Visible := False; Static[StaticTeam1].Visible := False; + Static[StaticNextPlayer1].Visible := False; end; if (PartySession.Teams.NumTeams >= 2) then @@ -313,12 +325,14 @@ begin Text[TextScoreTeam2].Visible := True; Text[TextNameTeam2].Visible := True; Static[StaticTeam2].Visible := True; + Static[StaticNextPlayer2].Visible := True; end else begin Text[TextScoreTeam2].Visible := False; Text[TextNameTeam2].Visible := False; Static[StaticTeam2].Visible := False; + Static[StaticNextPlayer2].Visible := False; end; if (PartySession.Teams.NumTeams >= 3) then @@ -329,12 +343,14 @@ begin Text[TextScoreTeam3].Visible := True; Text[TextNameTeam3].Visible := True; Static[StaticTeam3].Visible := True; + Static[StaticNextPlayer3].Visible := True; end else begin Text[TextScoreTeam3].Visible := False; Text[TextNameTeam3].Visible := False; Static[StaticTeam3].Visible := False; + Static[StaticNextPlayer3].Visible := False; end; //nextRound Texts -- cgit v1.2.3 From 5737662e749229ef0631e3731858a5bf013c78eb Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 30 Apr 2007 12:30:35 +0000 Subject: Added ability to make buttons invisible(and also unselectable) in Theme. Visible = 0 Useful for f.e. the Exit Button from MainScreen Fixed a bug in PartyNewRoundScreen that causes a crash when an Arrow Button is pressed git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@152 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenPartyNewRound.pas | 8 -------- 1 file changed, 8 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 8c1b8369..09391438 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -99,14 +99,6 @@ begin FadeTo(@ScreenSingModi); 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: InteractNext; - SDLK_UP: InteractPrev; - SDLK_RIGHT: InteractNext; - SDLK_LEFT: InteractPrev; end; end else // Key Up -- cgit v1.2.3 From ac508bab2e69d6ed7987c23f383ed503a310785c Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 30 Apr 2007 15:50:23 +0000 Subject: Added new Object to PartyNewRound Screen TextTeam[1..3]Players: Text shows the Players of the Team git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@153 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenPartyNewRound.pas | 36 ++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 09391438..22f76218 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -48,6 +48,10 @@ type TextNameTeam2: Cardinal; TextNameTeam3: Cardinal; + TextTeam1Players: Cardinal; + TextTeam2Players: Cardinal; + TextTeam3Players: Cardinal; + StaticTeam1: Cardinal; StaticTeam2: Cardinal; StaticTeam3: Cardinal; @@ -153,6 +157,11 @@ begin 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); @@ -166,6 +175,22 @@ 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; @@ -295,9 +320,11 @@ begin 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 @@ -305,6 +332,7 @@ begin begin Text[TextScoreTeam1].Visible := False; Text[TextNameTeam1].Visible := False; + Text[TextTeam1Players].Visible := False; Static[StaticTeam1].Visible := False; Static[StaticNextPlayer1].Visible := False; end; @@ -313,9 +341,11 @@ begin 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 @@ -323,6 +353,7 @@ begin begin Text[TextScoreTeam2].Visible := False; Text[TextNameTeam2].Visible := False; + Text[TextTeam2Players].Visible := False; Static[StaticTeam2].Visible := False; Static[StaticNextPlayer2].Visible := False; end; @@ -331,9 +362,11 @@ begin 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 @@ -341,6 +374,7 @@ begin begin Text[TextScoreTeam3].Visible := False; Text[TextNameTeam3].Visible := False; + Text[TextTeam3Players].Visible := False; Static[StaticTeam3].Visible := False; Static[StaticNextPlayer3].Visible := False; end; @@ -372,8 +406,6 @@ begin else Text[TextNextPlayer3].Visible := False; - Log.LogError('Plugin Selected: ' + InttoStr(PartySession.Rounds[0].Plugin)); - // LCD.WriteText(1, ' Choose mode: '); // UpdateLCD; -- cgit v1.2.3 From dfa0f5a144b8bf018b29d801f7d8a7c54ae6d108 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 2 May 2007 17:44:23 +0000 Subject: 2 Bugs Fixed: Select Last Song instead First Song when showing Song Screen for the first Time Go to MainScreen instead of Song Screen when pressing Esc in the Name Screen after Selecting Select Players from Menu git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@154 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenName.pas | 5 ++++- Game/Code/Screens/UScreenSong.pas | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index 9819b994..9db7947c 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -41,7 +41,10 @@ begin begin Ini.SaveNames; Music.PlayBack; - FadeTo(@ScreenMain); + if GoTo_SingScreen then + FadeTo(@ScreenSong) + else + FadeTo(@ScreenMain); end; SDLK_RETURN: diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 5c383168..1f3c7c8f 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1169,7 +1169,7 @@ begin if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then begin CatSongs.ShowCategoryList; - SelectNext;SelectPrev; //Workaround <- must be fixed sometime + SelectNext; //Workaround <- must be fixed sometime FixSelected; //Show Cat in Top Left Mod HideCatTL; -- cgit v1.2.3 From 79c50bf9f8b6ae2046deaa401005944e2ce4d17b Mon Sep 17 00:00:00 2001 From: b1indy Date: Wed, 2 May 2007 19:37:02 +0000 Subject: popup-screen will be included soon git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@155 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenPopup.pas | 165 +++++++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 Game/Code/Screens/UScreenPopup.pas (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas new file mode 100644 index 00000000..41279197 --- /dev/null +++ b/Game/Code/Screens/UScreenPopup.pas @@ -0,0 +1,165 @@ +unit UScreenPopup; + +interface + +uses + UMenu, SDL, UMusic, UPliki, SysUtils, UThemes, dialogs, Messages; + +type + TScreenPopup = class(TMenu) + private + CurMenu: Byte; //Num of the cur. Shown Menu + public + Visible: Boolean; //Whether the Menu should be Drawn + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure ShowPopup(sPopup: Byte); + function Draw: boolean; override; + end; + +const + PU_Error = 1; + + +var + ISelections: Array of String; + SelectValue: Integer; + + +implementation + +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist; + +function TScreenPopup.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; + function IsVisible: Boolean; + begin + Result := True; + if (Interactions[Interaction].Typ = 0) then + begin + Result := Button[Interactions[Interaction].Num].Visible; + end + else if (Interactions[Interaction].Typ = 1) then + begin + //Result := Selects[Interactions[Interaction].Num].Visible; + end + else if (Interactions[Interaction].Typ = 3) then + begin + Result := SelectsS[Interactions[Interaction].Num].Visible; + end; + end; + + Procedure SelectNext; + begin + repeat + InteractNext; + until IsVisible; + end; + + Procedure SelectPrev; + begin + repeat + InteractPrev; + until IsVisible; + end; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE : + begin + Result := false; + end; + + SDLK_RETURN: + begin + Visible:=False; + Result := false; + end; + + SDLK_DOWN: SelectNext; + SDLK_UP: SelectPrev; + + SDLK_RIGHT: SelectNext; + SDLK_LEFT: SelectPrev; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN : + begin + end; + end; +end; + +constructor TScreenPopup.Create; +var + I: integer; +begin + inherited Create; + SetLength(ISelections, 1); + ISelections[0] := 'Dummy'; + + AddBackground(Theme.CheckPopup.Background.Tex); + + AddButton(Theme.CheckPopup.Button1); + if (Length(Button[0].Text) = 0) then + AddButtonText(14, 20, 'Button 1'); + + AddButton(Theme.CheckPopup.Button2); + if (Length(Button[1].Text) = 0) then + AddButtonText(14, 20, 'Button 2'); + + AddText(Theme.CheckPopup.TextCheck); + + for I := 0 to High(Theme.CheckPopup.Static) do + AddStatic(Theme.CheckPopup.Static[I]); + + for I := 0 to High(Theme.CheckPopup.Text) do + AddText(Theme.CheckPopup.Text[I]); + + Interaction := 0; +end; + +function TScreenPopup.Draw: boolean; +begin + inherited Draw; +end; + +procedure TScreenPopup.onShow; +begin + +end; + +procedure TScreenPopup.ShowPopup(sPopup: Byte); +begin + Interaction := 0; //Reset Interaction + Visible := True; //Set Visible + Case sPopup of + PU_Error: + begin + Text[0].Text := 'Wirklich beenden?';{Language.Translate('SONG_MENU_NAME_MAIN');} + + Button[0].Visible := True; + Button[1].Visible := True; +// Button[2].Visible := True; +// Button[3].Visible := True; +// SelectsS[0].Visible := False; + + Button[0].Text[0].Text := 'JA'; + Button[1].Text[0].Text := 'NEIN'; +// Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD'); +// Button[3].Text[0].Text := Language.Translate('SONG_MENU_EDIT'); + end; + end; +end; + +end. \ No newline at end of file -- cgit v1.2.3 From 5bf0ebf274fef28811ab952338bd261bd1dd0fa8 Mon Sep 17 00:00:00 2001 From: b1indy Date: Thu, 3 May 2007 00:19:52 +0000 Subject: added "popups" to ask for confirmation when leaving party mode or game or to display messages (like minor errors) still ugly, needs some theme work git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@157 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenMain.pas | 10 +- Game/Code/Screens/UScreenPartyNewRound.pas | 2 +- Game/Code/Screens/UScreenPopup.pas | 204 ++++++++++++++++++++++++----- 3 files changed, 181 insertions(+), 35 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 78c98218..f339fa04 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -55,7 +55,9 @@ begin SDLK_ESCAPE : begin - Result := False; + //popup hack + CheckFadeTo(NIL,'MSG_QUIT_USDX'); +// Result := False; end; SDLK_C: @@ -116,7 +118,7 @@ begin Music.PlayStart; FadeTo(@ScreenStatMain); end; - + //Editor if Interaction = 3 then begin Music.PlayStart; @@ -131,7 +133,9 @@ begin //Exit if Interaction = 5 then begin - Result := false; + //popup hack + CheckFadeTo(NIL,'MSG_QUIT_USDX'); +// Result := false; end; end; // Up and Down could be done at the same time, diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 22f76218..894e96d2 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -86,7 +86,7 @@ begin SDLK_ESCAPE : begin Music.PlayBack; - FadeTo(@ScreenMain); + CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); end; SDLK_RETURN: diff --git a/Game/Code/Screens/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas index 41279197..25f647a2 100644 --- a/Game/Code/Screens/UScreenPopup.pas +++ b/Game/Code/Screens/UScreenPopup.pas @@ -3,10 +3,10 @@ unit UScreenPopup; interface uses - UMenu, SDL, UMusic, UPliki, SysUtils, UThemes, dialogs, Messages; + UMenu, SDL, UMusic, UPliki, SysUtils, UThemes; type - TScreenPopup = class(TMenu) + TScreenPopupCheck = class(TMenu) private CurMenu: Byte; //Num of the cur. Shown Menu public @@ -15,24 +15,35 @@ type constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; - procedure ShowPopup(sPopup: Byte); + procedure ShowPopup(msg: String); function Draw: boolean; override; end; -const - PU_Error = 1; +type + TScreenPopupError = class(TMenu) + private + CurMenu: Byte; //Num of the cur. Shown Menu + public + Visible: Boolean; //Whether the Menu should be Drawn + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure ShowPopup(msg: array of String); + function Draw: boolean; override; + end; var - ISelections: Array of String; +// ISelections: Array of String; SelectValue: Integer; implementation -uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist; +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist, UDisplay; -function TScreenPopup.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +function TScreenPopupCheck.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; function IsVisible: Boolean; begin Result := True; @@ -81,6 +92,15 @@ begin SDLK_RETURN: begin + case Interaction of + 0: begin + Display.CheckOK:=True; + end; + 1: begin + Display.CheckOK:=False; + Display.NextScreenWithCheck:=NIL; + end; + end; Visible:=False; Result := false; end; @@ -100,13 +120,11 @@ begin end; end; -constructor TScreenPopup.Create; +constructor TScreenPopupCheck.Create; var I: integer; begin inherited Create; - SetLength(ISelections, 1); - ISelections[0] := 'Dummy'; AddBackground(Theme.CheckPopup.Background.Tex); @@ -129,37 +147,161 @@ begin Interaction := 0; end; -function TScreenPopup.Draw: boolean; +function TScreenPopupCheck.Draw: boolean; begin inherited Draw; end; -procedure TScreenPopup.onShow; +procedure TScreenPopupCheck.onShow; begin end; -procedure TScreenPopup.ShowPopup(sPopup: Byte); +procedure TScreenPopupCheck.ShowPopup(msg: String); begin Interaction := 0; //Reset Interaction Visible := True; //Set Visible - Case sPopup of - PU_Error: - begin - Text[0].Text := 'Wirklich beenden?';{Language.Translate('SONG_MENU_NAME_MAIN');} - - Button[0].Visible := True; - Button[1].Visible := True; -// Button[2].Visible := True; -// Button[3].Visible := True; -// SelectsS[0].Visible := False; - - Button[0].Text[0].Text := 'JA'; - Button[1].Text[0].Text := 'NEIN'; -// Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD'); -// Button[3].Text[0].Text := Language.Translate('SONG_MENU_EDIT'); - end; + + Text[0].Text := Language.Translate(msg); + + Button[0].Visible := True; + Button[1].Visible := True; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES'); + Button[1].Text[0].Text := Language.Translate('SONG_MENU_NO'); +end; + +// error popup + +function TScreenPopupError.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; + function IsVisible: Boolean; + begin + Result := True; + if (Interactions[Interaction].Typ = 0) then + begin + Result := Button[Interactions[Interaction].Num].Visible; + end + else if (Interactions[Interaction].Typ = 1) then + begin + //Result := Selects[Interactions[Interaction].Num].Visible; + end + else if (Interactions[Interaction].Typ = 3) then + begin + Result := SelectsS[Interactions[Interaction].Num].Visible; + end; + end; + + Procedure SelectNext; + begin + repeat + InteractNext; + until IsVisible; + end; + + Procedure SelectPrev; + begin + repeat + InteractPrev; + until IsVisible; end; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE : + begin + Result := false; + end; + + SDLK_RETURN: + begin + Visible:=False; + Result := false; + end; + + SDLK_DOWN: SelectNext; + SDLK_UP: SelectPrev; + + SDLK_RIGHT: SelectNext; + SDLK_LEFT: SelectPrev; + end; + end + else // Key Up + case PressedKey of + SDLK_RETURN : + begin + end; + end; +end; + +constructor TScreenPopupError.Create; +var + I: integer; +begin + inherited Create; + + AddBackground(Theme.CheckPopup.Background.Tex); + + AddButton(Theme.ErrorPopup.Button1); + if (Length(Button[0].Text) = 0) then + AddButtonText(14, 20, 'Button 1'); + + AddText(Theme.ErrorPopup.TextError); + + for I := 0 to High(Theme.ErrorPopup.Static) do + AddStatic(Theme.ErrorPopup.Static[I]); + + for I := 0 to High(Theme.ErrorPopup.Text) do + AddText(Theme.ErrorPopup.Text[I]); + + Interaction := 0; +end; + +function TScreenPopupError.Draw: boolean; +begin + inherited Draw; +end; + +procedure TScreenPopupError.onShow; +begin + +end; + +procedure TScreenPopupError.onHide; +var i: integer; +begin + for i:=0 to high(Text) do + Text[i].Text:=''; +end; + +procedure TScreenPopupError.ShowPopup(msg: array of String); +var i: integer; +begin + Interaction := 0; //Reset Interaction + Visible := True; //Set Visible + + //dirty hack... Text[0] is invisible for some strange reason + for i:=1 to high(Text) do + if i-1 <= high(msg) then + begin + Text[i].Visible:=True; + Text[i].Text := msg[i-1]; + end + else + begin + Text[i].Visible:=False; + end; + + Button[0].Visible := True; + + Button[0].Text[0].Text := 'OK'; end; -end. \ No newline at end of file +end. -- cgit v1.2.3 From 7ddd1afb9bec5dca80a272a50ea02f6c3cfbc2b7 Mon Sep 17 00:00:00 2001 From: mota23 Date: Thu, 3 May 2007 01:15:41 +0000 Subject: Esc in Popup escapes the Popup. Higher usability. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@159 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenPopup.pas | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas index 25f647a2..a6e8ccca 100644 --- a/Game/Code/Screens/UScreenPopup.pas +++ b/Game/Code/Screens/UScreenPopup.pas @@ -87,6 +87,9 @@ begin SDLK_ESCAPE : begin + Display.CheckOK:=False; + Display.NextScreenWithCheck:=NIL; + Visible:=False; Result := false; end; -- cgit v1.2.3 From c7db744c1dcbafb38f25a5cb005219faf16134b8 Mon Sep 17 00:00:00 2001 From: b1indy Date: Thu, 3 May 2007 15:34:36 +0000 Subject: minor changes to PopUp code and to related parts of themes git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@160 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenPopup.pas | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas index a6e8ccca..019632ff 100644 --- a/Game/Code/Screens/UScreenPopup.pas +++ b/Game/Code/Screens/UScreenPopup.pas @@ -7,8 +7,6 @@ uses type TScreenPopupCheck = class(TMenu) - private - CurMenu: Byte; //Num of the cur. Shown Menu public Visible: Boolean; //Whether the Menu should be Drawn @@ -30,7 +28,7 @@ type function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure onHide; override; - procedure ShowPopup(msg: array of String); + procedure ShowPopup(msg: String); function Draw: boolean; override; end; @@ -220,6 +218,7 @@ begin SDLK_ESCAPE : begin + Visible:=False; Result := false; end; @@ -280,17 +279,15 @@ end; procedure TScreenPopupError.onHide; var i: integer; begin - for i:=0 to high(Text) do - Text[i].Text:=''; end; -procedure TScreenPopupError.ShowPopup(msg: array of String); +procedure TScreenPopupError.ShowPopup(msg: String); var i: integer; begin Interaction := 0; //Reset Interaction Visible := True; //Set Visible - //dirty hack... Text[0] is invisible for some strange reason +{ //dirty hack... Text[0] is invisible for some strange reason for i:=1 to high(Text) do if i-1 <= high(msg) then begin @@ -300,7 +297,8 @@ begin else begin Text[i].Visible:=False; - end; + end;} + Text[0].Text:=msg; Button[0].Visible := True; -- cgit v1.2.3 From 3114977b5509c775c93d5ba3d5220a1ff9d363a7 Mon Sep 17 00:00:00 2001 From: b1indy Date: Thu, 3 May 2007 20:12:20 +0000 Subject: slight changes to positions of song covers (in SetScroll5) ReflectionSpacing now varies with the size of the cover -- the further back a cover, the smaller it is... as should be the reflection spacing git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@163 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 1f3c7c8f..e0714c2d 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1104,24 +1104,26 @@ begin Pos := Pos + VS else if (Pos > VS/2) then Pos := Pos - VS; - + if (Abs(Pos) < 2.5) then {fixed Positions} begin Angle := Pi * (Pos / 5); //Button[B].Visible := False; - Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle));//Power(Z2, 3); + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); + + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; Button[B].Z := 0.95 - Abs(Pos) * 0.01; - Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); + Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.7); Button[B].W := Button[B].H; Diff := (Button[B].H - Theme.Song.Cover.H)/2; - X := Sin(Angle); + X := Sin(Angle*1.3)*0.9; Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Diff; -- cgit v1.2.3 From 0f327cf133373168d94538686b57c22ba364f2a8 Mon Sep 17 00:00:00 2001 From: mogguh Date: Thu, 3 May 2007 21:09:24 +0000 Subject: Feature: It's now possible to move/skin the time progress thing (no fix positions anymore) (affected: UDraw.pas, UGraphic.pas, UThemes.pas, UScreenSing.pas, UScreenSingModi.pas) Theme/Skin: Added the time stuff beneath the lyrics (as "the others" did too) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@164 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 24 +++++++++++++++++------- Game/Code/Screens/UScreenSingModi.pas | 10 +++++----- 2 files changed, 22 insertions(+), 12 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 93c3ac48..3e66b197 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -12,7 +12,12 @@ type PauseTime: Real; NumEmptySentences: integer; public - TextTime: integer; + //TextTime: integer; + + //TimeBar mod + StaticTimeProgress: integer; + TextTimeText: integer; + //eoa TimeBar mod StaticP1: integer; StaticP1ScoreBG: integer; @@ -166,7 +171,12 @@ begin LoadFromTheme(Theme.Sing); // time - TextTime := AddText(75, 14, 1, 8, 0.25, 0.25, 0.25, '00:00'); + //TextTime := AddText(75, 14, 1, 8, 0.25, 0.25, 0.25, '00:00'); + + //TimeBar mod + StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); + TextTimeText := AddText(Theme.Sing.TextTimeText); + //eoa TimeBar mod StaticP1 := AddStatic(Theme.Sing.StaticP1); StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); @@ -908,11 +918,11 @@ begin // update static menu with time ... Min := Round(Czas.Teraz) div 60; Sec := Round(Czas.Teraz) mod 60; - Text[TextTime].Text := ''; - if Min < 10 then Text[TextTime].Text := '0'; - Text[TextTime].Text := Text[TextTime].Text + IntToStr(Min) + ':'; - if Sec < 10 then Text[TextTime].Text := Text[TextTime].Text + '0'; - Text[TextTime].Text := Text[TextTime].Text + IntToStr(Sec); + Text[TextTimeText].Text := ''; + if Min < 10 then Text[TextTimeText].Text := '0'; + Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':'; + if Sec < 10 then Text[TextTimeText].Text := Text[TextTimeText].Text + '0'; + Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec); // .. and scores if PlayersPlay = 1 then begin diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 86613152..484d7d56 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -927,11 +927,11 @@ begin // update static menu with time ... Min := Round(Czas.Teraz) div 60; Sec := Round(Czas.Teraz) mod 60; - Text[TextTime].Text := ''; - if Min < 10 then Text[TextTime].Text := '0'; - Text[TextTime].Text := Text[TextTime].Text + IntToStr(Min) + ':'; - if Sec < 10 then Text[TextTime].Text := Text[TextTime].Text + '0'; - Text[TextTime].Text := Text[TextTime].Text + IntToStr(Sec); + Text[TextTimeText].Text := ''; + if Min < 10 then Text[TextTimeText].Text := '0'; + Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':'; + if Sec < 10 then Text[TextTimeText].Text := Text[TextTimeText].Text + '0'; + Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec); end; // draw static menu (BG) -- cgit v1.2.3 From a1624a62face0dc4edb0908ba09b6bcd2f43d065 Mon Sep 17 00:00:00 2001 From: b1indy Date: Thu, 3 May 2007 22:45:08 +0000 Subject: re-enabled covers behind the 5 front-covers in songselection fiddled with position-calculations until it looked not too bad git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@166 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index e0714c2d..738eb01e 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1116,7 +1116,7 @@ begin Button[B].Z := 0.95 - Abs(Pos) * 0.01; - Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.7); + Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); Button[B].W := Button[B].H; @@ -1130,31 +1130,34 @@ begin end else begin {Behind the Front Covers} - Button[B].Visible := False; +// Button[B].Visible := False; +// if VS/2-abs(Pos)>VS*0.4 then Button[B].Visible := False; if Pos < 0 then Pos := (Pos - VS/2) /VS else Pos := (Pos + VS/2) /VS; - Angle := 2 * pi * Pos; + Angle := 2 * pi * Pos*1.2; - Button[B].Z := (0.5 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle));//Power(Z2, 3); + Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); Button[B].W := Button[B].H; - Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); + Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; - Diff := (Button[B].H - Theme.Song.Cover.H)/2;; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.W + Theme.Song.Cover.H*VS*0.185)* Sin(Angle) - Diff + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2 + (Theme.Song.Cover.H)*sin(Angle/2)*1.52; end; //Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field - Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); +// Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); end; end; -- cgit v1.2.3 From 73347d4f77edb7e79709b7af9f23e0faa2b38f8b Mon Sep 17 00:00:00 2001 From: b1indy Date: Fri, 4 May 2007 00:12:38 +0000 Subject: reflections were gone after my last hack in UMenuButton... should be back now git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@168 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 738eb01e..b32571c8 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1112,7 +1112,7 @@ begin Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; Button[B].Z := 0.95 - Abs(Pos) * 0.01; @@ -1148,7 +1148,7 @@ begin Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; Diff := (Button[B].H - Theme.Song.Cover.H)/2; -- cgit v1.2.3 From 188929aca69791bc755db6562582acfcf10df2e5 Mon Sep 17 00:00:00 2001 From: b1indy Date: Fri, 4 May 2007 16:21:40 +0000 Subject: well... changed Button Reflections back to old behavior git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@173 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index b32571c8..e4ab8854 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1112,7 +1112,8 @@ begin Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); - Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; +// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; Button[B].Z := 0.95 - Abs(Pos) * 0.01; @@ -1148,7 +1149,8 @@ begin Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; - Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; +// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; Diff := (Button[B].H - Theme.Song.Cover.H)/2; -- cgit v1.2.3 From 042a5e57be1ada25cbbc6e7f5f34c0c0ea5e9de2 Mon Sep 17 00:00:00 2001 From: mota23 Date: Mon, 7 May 2007 19:17:25 +0000 Subject: Some Themework done. Added new Statics to ScreenPartyScore. [PartyScoreStaticTeam(n)BG and Deco] To do: 1 Screen in Party-Mode, SingScreen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@177 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenPartyScore.pas | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index 805525a1..4afaee09 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -15,8 +15,14 @@ type TextNameTeam2: Cardinal; TextNameTeam3: Cardinal; StaticTeam1: Cardinal; + StaticTeam1BG: Cardinal; + StaticTeam1Deco: Cardinal; StaticTeam2: Cardinal; + StaticTeam2BG: Cardinal; + StaticTeam2Deco: Cardinal; StaticTeam3: Cardinal; + StaticTeam3BG: Cardinal; + StaticTeam3Deco: Cardinal; TextWinner: Cardinal; MaxScore: Word; @@ -80,8 +86,14 @@ begin TextNameTeam3 := AddText (Theme.PartyScore.TextNameTeam3); StaticTeam1 := AddStatic (Theme.PartyScore.StaticTeam1); + StaticTeam1BG := AddStatic (Theme.PartyScore.StaticTeam1BG); + StaticTeam1Deco := AddStatic (Theme.PartyScore.StaticTeam1Deco); StaticTeam2 := AddStatic (Theme.PartyScore.StaticTeam2); + StaticTeam2BG := AddStatic (Theme.PartyScore.StaticTeam2BG); + StaticTeam2Deco := AddStatic (Theme.PartyScore.StaticTeam2Deco); StaticTeam3 := AddStatic (Theme.PartyScore.StaticTeam3); + StaticTeam3BG := AddStatic (Theme.PartyScore.StaticTeam3BG); + StaticTeam3Deco := AddStatic (Theme.PartyScore.StaticTeam3Deco); TextWinner := AddText (Theme.PartyScore.TextWinner); @@ -105,6 +117,11 @@ begin Static[StaticTeam2].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100; Static[StaticTeam3].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[2].Percentage / 100; + //fix: prevents static from drawn out of bounds. + if Static[StaticTeam1].Texture.ScaleW > 99 then Static[StaticTeam1].Texture.ScaleW := 99; + if Static[StaticTeam2].Texture.ScaleW > 99 then Static[StaticTeam2].Texture.ScaleW := 99; + if Static[StaticTeam3].Texture.ScaleW > 99 then Static[StaticTeam3].Texture.ScaleW := 99; + //End Last Round PartySession.EndRound; @@ -119,12 +136,16 @@ begin Text[TextScoreTeam1].Visible := True; Text[TextNameTeam1].Visible := True; Static[StaticTeam1].Visible := True; + Static[StaticTeam1BG].Visible := True; + Static[StaticTeam1Deco].Visible := True; end else begin Text[TextScoreTeam1].Visible := False; Text[TextNameTeam1].Visible := False; Static[StaticTeam1].Visible := False; + Static[StaticTeam1BG].Visible := False; + Static[StaticTeam1Deco].Visible := False; end; if (ScreenSingModi.PlayerInfo.NumPlayers >= 2) then @@ -135,12 +156,16 @@ begin Text[TextScoreTeam2].Visible := True; Text[TextNameTeam2].Visible := True; Static[StaticTeam2].Visible := True; + Static[StaticTeam2BG].Visible := True; + Static[StaticTeam2Deco].Visible := True; end else begin Text[TextScoreTeam2].Visible := False; Text[TextNameTeam2].Visible := False; Static[StaticTeam2].Visible := False; + Static[StaticTeam2BG].Visible := False; + Static[StaticTeam2Deco].Visible := False; end; if (ScreenSingModi.PlayerInfo.NumPlayers >= 3) then @@ -151,12 +176,16 @@ begin Text[TextScoreTeam3].Visible := True; Text[TextNameTeam3].Visible := True; Static[StaticTeam3].Visible := True; + Static[StaticTeam3BG].Visible := True; + Static[StaticTeam3Deco].Visible := True; end else begin Text[TextScoreTeam3].Visible := False; Text[TextNameTeam3].Visible := False; Static[StaticTeam3].Visible := False; + Static[StaticTeam3BG].Visible := False; + Static[StaticTeam3Deco].Visible := False; end; -- cgit v1.2.3 From b61e647b67ac0d449d764b89b117a3ac8b603403 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 8 May 2007 19:00:47 +0000 Subject: Readded Q Shortcut (Exit Application) on all Screens Clean up Popup Code a little bit git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@180 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEdit.pas | 4 ++ Game/Code/Screens/UScreenEditHeader.pas | 4 ++ Game/Code/Screens/UScreenLevel.pas | 8 +-- Game/Code/Screens/UScreenMain.pas | 8 +-- Game/Code/Screens/UScreenOpen.pas | 4 ++ Game/Code/Screens/UScreenOptionsAdvanced.pas | 4 ++ Game/Code/Screens/UScreenOptionsGame.pas | 4 ++ Game/Code/Screens/UScreenOptionsLyrics.pas | 4 ++ Game/Code/Screens/UScreenOptionsRecord.pas | 4 ++ Game/Code/Screens/UScreenOptionsSound.pas | 4 ++ Game/Code/Screens/UScreenOptionsThemes.pas | 4 ++ Game/Code/Screens/UScreenPartyNewRound.pas | 8 +-- Game/Code/Screens/UScreenPartyOptions.pas | 8 +-- Game/Code/Screens/UScreenPopup.pas | 101 +++++---------------------- Game/Code/Screens/UScreenSing.pas | 25 ++++--- Game/Code/Screens/UScreenSong.pas | 17 ++--- Game/Code/Screens/UScreenSongJumpto.pas | 8 +-- Game/Code/Screens/UScreenSongMenu.pas | 8 +-- 18 files changed, 79 insertions(+), 148 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenEdit.pas b/Game/Code/Screens/UScreenEdit.pas index 00df0418..ac2964cd 100644 --- a/Game/Code/Screens/UScreenEdit.pas +++ b/Game/Code/Screens/UScreenEdit.pas @@ -28,6 +28,10 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin Music.PlayBack; diff --git a/Game/Code/Screens/UScreenEditHeader.pas b/Game/Code/Screens/UScreenEditHeader.pas index dbdd186c..f3e21fd0 100644 --- a/Game/Code/Screens/UScreenEditHeader.pas +++ b/Game/Code/Screens/UScreenEditHeader.pas @@ -53,6 +53,10 @@ begin Result := true; If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin // Music.PlayBack; diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas index 80d42773..a1d8fa33 100644 --- a/Game/Code/Screens/UScreenLevel.pas +++ b/Game/Code/Screens/UScreenLevel.pas @@ -53,13 +53,7 @@ begin SDLK_RIGHT: InteractNext; SDLK_LEFT: InteractPrev; end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; - end; + end; end; constructor TScreenLevel.Create; diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index f339fa04..6fd458d7 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -55,9 +55,7 @@ begin SDLK_ESCAPE : begin - //popup hack - CheckFadeTo(NIL,'MSG_QUIT_USDX'); -// Result := False; + Result := False; end; SDLK_C: @@ -133,9 +131,7 @@ begin //Exit if Interaction = 5 then begin - //popup hack - CheckFadeTo(NIL,'MSG_QUIT_USDX'); -// Result := false; + Result := false; end; end; // Up and Down could be done at the same time, diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index 4f0c32c5..3a78b3e2 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -41,6 +41,10 @@ begin end; case PressedKey of + SDLK_Q: + begin + Result := false; + end; 8: // del begin if Interaction = 0 then diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index 256b02db..3e3f2da7 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -23,6 +23,10 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin Ini.Save; diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index 88bb34e3..540931af 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -25,6 +25,10 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin Music.PlayBack; diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas index ff03b2ba..f60c9765 100644 --- a/Game/Code/Screens/UScreenOptionsLyrics.pas +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -23,6 +23,10 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin Ini.Save; diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index af7d2cd6..c474bd7f 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -28,6 +28,10 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE, SDLK_BACKSPACE: begin Ini.Save; diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index ee53ef02..d4ab27d2 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -23,6 +23,10 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin Ini.Save; diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index c0bf2e15..580f9c4d 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -26,6 +26,10 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin Ini.Save; diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 894e96d2..c914ee4b 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -104,13 +104,7 @@ begin end; end; end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; - end; + end; end; constructor TScreenPartyNewRound.Create; diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index f0df9871..7f3b1209 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -139,13 +139,7 @@ begin end; end; end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; - end; + end; end; constructor TScreenPartyOptions.Create; diff --git a/Game/Code/Screens/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas index 019632ff..9b71eb9a 100644 --- a/Game/Code/Screens/UScreenPopup.pas +++ b/Game/Code/Screens/UScreenPopup.pas @@ -42,36 +42,6 @@ implementation uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist, UDisplay; function TScreenPopupCheck.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; - function IsVisible: Boolean; - begin - Result := True; - if (Interactions[Interaction].Typ = 0) then - begin - Result := Button[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 1) then - begin - //Result := Selects[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 3) then - begin - Result := SelectsS[Interactions[Interaction].Num].Visible; - end; - end; - - Procedure SelectNext; - begin - repeat - InteractNext; - until IsVisible; - end; - - Procedure SelectPrev; - begin - repeat - InteractPrev; - until IsVisible; - end; begin Result := true; If (PressedDown) Then @@ -95,6 +65,15 @@ begin begin case Interaction of 0: begin + //Hack to Finish Singscreen correct on Exit with Q Shortcut + if (Display.NextScreenWithCheck = NIL) then + begin + if (Display.ActualScreen = @ScreenSing) then + ScreenSing.Finish + else if (Display.ActualScreen = @ScreenSingModi) then + ScreenSingModi.Finish; + end; + Display.CheckOK:=True; end; 1: begin @@ -106,19 +85,13 @@ begin Result := false; end; - SDLK_DOWN: SelectNext; - SDLK_UP: SelectPrev; + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; - SDLK_RIGHT: SelectNext; - SDLK_LEFT: SelectPrev; - end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; end; + end; end; constructor TScreenPopupCheck.Create; @@ -175,36 +148,6 @@ end; // error popup function TScreenPopupError.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; - function IsVisible: Boolean; - begin - Result := True; - if (Interactions[Interaction].Typ = 0) then - begin - Result := Button[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 1) then - begin - //Result := Selects[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 3) then - begin - Result := SelectsS[Interactions[Interaction].Num].Visible; - end; - end; - - Procedure SelectNext; - begin - repeat - InteractNext; - until IsVisible; - end; - - Procedure SelectPrev; - begin - repeat - InteractPrev; - until IsVisible; - end; begin Result := true; If (PressedDown) Then @@ -228,19 +171,13 @@ begin Result := false; end; - SDLK_DOWN: SelectNext; - SDLK_UP: SelectPrev; + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; - SDLK_RIGHT: SelectNext; - SDLK_LEFT: SelectPrev; - end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; end; + end; end; constructor TScreenPopupError.Create; diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 3e66b197..6985672f 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -92,6 +92,17 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + //When not ask before Exit then Finish now + if (Ini.AskbeforeDel <> 1) then + Finish + //else just Pause and let the Popup make the Work + else if not paused then + Pause; + + Result := false; + end; SDLK_ESCAPE : begin //Record Sound Hack: @@ -102,12 +113,6 @@ begin FadeTo(@ScreenScore); end; - SDLK_Q: - begin - Finish; - Result := false; - end; - SDLK_P://Pause Mod begin Pause; @@ -127,13 +132,7 @@ begin begin end; end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; - end; + end; end; //Pause Mod diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index e4ab8854..139d6984 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -248,6 +248,10 @@ begin end; case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin if (Mode = 0) then @@ -605,19 +609,8 @@ begin SetJoker; end; end; - - SDLK_Q: - begin - Result := false; - end; - end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; end; + end; end; constructor TScreenSong.Create; diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index b90c558b..44c12f51 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -139,13 +139,7 @@ begin end; end; end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; - end; + end; end; constructor TScreenSongJumpto.Create; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index fd875527..73b38a05 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -97,13 +97,7 @@ begin InteractDec; end; end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; - end; + end; end; constructor TScreenSongMenu.Create; -- cgit v1.2.3 From 5270a02d1dea4f660349f0414d63c3b969def187 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 8 May 2007 19:23:02 +0000 Subject: Added Ability to Leave Song Screen in Party Mode with Popup. Show Menu directly in Songscreen in PartyMode git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@181 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 139d6984..296b6d2f 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -63,6 +63,7 @@ type function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; function Draw: boolean; override; procedure onShow; override; + procedure onHide; override; procedure SelectNext; procedure SelectPrev; procedure UpdateLCD; @@ -298,6 +299,12 @@ begin // Music.Open(Skin.SkinPath + 'Menu Music 3.mp3'); // Music.Play; end; + end + //When in party Mode then Ask before Close + else if (Mode = 1) then + begin + Music.PlayBack; + CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); end; end; SDLK_RETURN: @@ -1198,12 +1205,21 @@ begin //Party Mode else if (Mode = 1) then begin + SelectRandomSong; + //Show Mennu direct in PartyMode + ScreenSongMenu.MenuShow(SM_Party_Main); end; SetJoker; end; +procedure TScreenSong.onHide; +begin + //When hide then Stop Music (For Party Mode Popup on Exit) + Music.Stop; +end; + procedure TScreenSong.DrawExtensions; begin //Draw Song Menu @@ -1631,7 +1647,7 @@ end; procedure TScreenSong.StartSong; begin CatSongs.Selected := Interaction; - Music.Stop; + //Music.Stop; //Party Mode if (Mode = 1) then begin -- cgit v1.2.3 From e452e8c6d60af8e8a8eb957f1ef59d461f48c99a Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 8 May 2007 19:55:34 +0000 Subject: Fixed the "one Song too much" Bug Added 2 Error Messages: When Opening Sing or Party: No Songs Loaded When Opening Party: No Plugins loaded Added Messages to Language File git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@182 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenMain.pas | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 6fd458d7..47a79496 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -93,22 +93,35 @@ begin SDLK_RETURN: begin //Solo - if (Interaction = 0) and (Length(Songs.Song) >= 1) then begin - Music.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); + if (Interaction = 0) then + begin + if (Length(Songs.Song) >= 1) then + begin + Music.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 (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then + if (Length(Songs.Song) >= 1) then begin - Music.PlayStart; - FadeTo(@ScreenPartyOptions); - end; + if (Length(DLLMan.Plugins)>=1) then + begin + Music.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 -- cgit v1.2.3 From e0b0396acf6101acf2608d9fe4b36fa735196b2a Mon Sep 17 00:00:00 2001 From: mota23 Date: Wed, 9 May 2007 03:26:41 +0000 Subject: Some Themework done. Added new Statics to PartyWin. [PartyWinStaticTeam(n)BG and Deco] Fix: bug in PartyScore (esc skipped to PartyNewRound where PartyWin should come) Disabled Esc in PartyWin. To do: Sing-Screen, Stats git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@183 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenPartyScore.pas | 2 +- Game/Code/Screens/UScreenPartyWin.pas | 30 +++++++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index 4afaee09..324656c0 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -51,7 +51,7 @@ begin SDLK_ESCAPE : begin Music.PlayStart; - if (PartySession.CurRound <= High(PartySession.Rounds)) then + if (PartySession.CurRound < High(PartySession.Rounds)) then FadeTo(@ScreenPartyNewRound) else begin diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas index ff65e82f..a6486f67 100644 --- a/Game/Code/Screens/UScreenPartyWin.pas +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -15,10 +15,16 @@ type TextNameTeam2: Cardinal; TextNameTeam3: Cardinal; StaticTeam1: Cardinal; + StaticTeam1BG: Cardinal; + StaticTeam1Deco: Cardinal; StaticTeam2: Cardinal; + StaticTeam2BG: Cardinal; + StaticTeam2Deco: Cardinal; StaticTeam3: Cardinal; + StaticTeam3BG: Cardinal; + StaticTeam3Deco: Cardinal; TextWinner: Cardinal; - + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; @@ -40,11 +46,11 @@ begin Result := false; end; - SDLK_ESCAPE : + {SDLK_ESCAPE : begin Music.PlayStart; FadeTo(@ScreenMain); - end; + end;} SDLK_RETURN: begin @@ -69,8 +75,14 @@ begin TextNameTeam3 := AddText (Theme.PartyWin.TextNameTeam3); StaticTeam1 := AddStatic (Theme.PartyWin.StaticTeam1); + StaticTeam1BG := AddStatic (Theme.PartyWin.StaticTeam1BG); + StaticTeam1Deco := AddStatic (Theme.PartyWin.StaticTeam1Deco); StaticTeam2 := AddStatic (Theme.PartyWin.StaticTeam2); + StaticTeam2BG := AddStatic (Theme.PartyWin.StaticTeam2BG); + StaticTeam2Deco := AddStatic (Theme.PartyWin.StaticTeam2Deco); StaticTeam3 := AddStatic (Theme.PartyWin.StaticTeam3); + StaticTeam3BG := AddStatic (Theme.PartyWin.StaticTeam3BG); + StaticTeam3Deco := AddStatic (Theme.PartyWin.StaticTeam3Deco); TextWinner := AddText (Theme.PartyWin.TextWinner); @@ -93,12 +105,16 @@ begin Text[TextScoreTeam1].Visible := True; Text[TextNameTeam1].Visible := True; Static[StaticTeam1].Visible := True; + Static[StaticTeam1BG].Visible := True; + Static[StaticTeam1Deco].Visible := True; end else begin Text[TextScoreTeam1].Visible := False; Text[TextNameTeam1].Visible := False; Static[StaticTeam1].Visible := False; + Static[StaticTeam1BG].Visible := False; + Static[StaticTeam1Deco].Visible := False; end; if (PartySession.Teams.NumTeams >= 2) then @@ -109,12 +125,16 @@ begin Text[TextScoreTeam2].Visible := True; Text[TextNameTeam2].Visible := True; Static[StaticTeam2].Visible := True; + Static[StaticTeam2BG].Visible := True; + Static[StaticTeam2Deco].Visible := True; end else begin Text[TextScoreTeam2].Visible := False; Text[TextNameTeam2].Visible := False; Static[StaticTeam2].Visible := False; + Static[StaticTeam2BG].Visible := False; + Static[StaticTeam2Deco].Visible := False; end; if (PartySession.Teams.NumTeams >= 3) then @@ -125,12 +145,16 @@ begin Text[TextScoreTeam3].Visible := True; Text[TextNameTeam3].Visible := True; Static[StaticTeam3].Visible := True; + Static[StaticTeam3BG].Visible := True; + Static[StaticTeam3Deco].Visible := True; end else begin Text[TextScoreTeam3].Visible := False; Text[TextNameTeam3].Visible := False; Static[StaticTeam3].Visible := False; + Static[StaticTeam3BG].Visible := False; + Static[StaticTeam3Deco].Visible := False; end; -- cgit v1.2.3 From 48e9a9faea54c6fa5b2b98e242444ae4c0183a7a Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 9 May 2007 16:45:46 +0000 Subject: Fix: Readded ability to close the Window Fix: Crash when SongScreen is opened in PartyMode when Tabs = On. Caused by SelectRandomSong procedure Upd: M in SongScreen works now in PartyMode, too git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@184 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 85 ++++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 41 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 296b6d2f..3f733210 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -357,17 +357,20 @@ begin SDLK_M: //Show SongMenu begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin - if not CatSongs.Song[Interaction].Main then begin // clicked on Song - if CatSongs.CatNumShow = -3 then - ScreenSongMenu.MenuShow(SM_Playlist) + if (Length(Songs.Song) > 0) then begin + if (Mode = 0) then begin + if not CatSongs.Song[Interaction].Main then begin // clicked on Song + if CatSongs.CatNumShow = -3 then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end else - ScreenSongMenu.MenuShow(SM_Main); - end - else - begin - ScreenSongMenu.MenuShow(SM_Playlist_Load); - end; + begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); + end; + end //Party Mode -> Show Party Menu + else ScreenSongMenu.MenuShow(SM_Party_Main); end; end; @@ -1506,32 +1509,37 @@ begin Case PlaylistMan.Mode of 0: //All Songs Just Select Random Song begin - repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; - - //Search Cat - for I := I2 downto low(CatSongs.Song) do + //When Tabs are activated then use Tab Method + if (Ini.Tabs_at_startup = 1) then begin - if CatSongs.Song[I].Main then - break; - end; - //In I ist jetzt die Kategorie in I2 der Song + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; - //Choose Cat - CatSongs.ShowCategoryList; + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + //I is the CatNum, I2 is the No of the Song within this Cat - //Show Cat in Top Left Mod - ShowCatTL (I); + //Choose Cat + CatSongs.ShowCategoryList; - CatSongs.ClickCategoryButton(I); - SelectNext; + //Show Cat in Top Left Mod + ShowCatTL (I); - //Fix: Not Existing Song selected: - //if (I+1=I2) then Inc(I2); + CatSongs.ClickCategoryButton(I); + SelectNext; - //Choose Song - SkipTo(I2-I); + //Choose Song + SkipTo(I2-I); + end + //When Tabs are deactivated use easy Method + else + SkipTo(Random(CatSongs.VisibleSongs)); end; 1: //One Category Select Category and Select Random Song begin @@ -1540,28 +1548,23 @@ begin ShowCatTL(PlaylistMan.CurPlayList); SelectNext; - FixSelected; + FixSelected2; SkipTo(Random(CatSongs.VisibleSongs)); - Music.PlayChange; - ChangeMusic; - SetScroll4; - UpdateLCD; end; 2: //Playlist: Select Playlist and Select Random Song begin PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); SkipTo(Random(CatSongs.VisibleSongs)); - Music.PlayChange; - ChangeMusic; - SetScroll4; - UpdateLCD; - FixSelected; + FixSelected2; end; end; - ChangeMusic; + Music.PlayChange; + ChangeMusic; + SetScroll; + UpdateLCD; end; procedure TScreenSong.SetJoker; -- cgit v1.2.3 From 00a4cc524dc2d60c95970def337155b7b57fb4ce Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 9 May 2007 17:44:12 +0000 Subject: Fixed a bug in UScreenSong that causes a little gap between lyrics and Singing in UScreenSing git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@185 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 3f733210..114c52a3 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1220,7 +1220,8 @@ end; procedure TScreenSong.onHide; begin //When hide then Stop Music (For Party Mode Popup on Exit) - Music.Stop; + if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) then + Music.Stop; end; procedure TScreenSong.DrawExtensions; @@ -1650,7 +1651,7 @@ end; procedure TScreenSong.StartSong; begin CatSongs.Selected := Interaction; - //Music.Stop; + Music.Stop; //Party Mode if (Mode = 1) then begin -- cgit v1.2.3 From dcb6e5d386735b3ced44d7c6d6280343a16ca7db Mon Sep 17 00:00:00 2001 From: mota23 Date: Thu, 10 May 2007 00:57:17 +0000 Subject: Some Themework in Stats and SingScreen. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@187 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 6985672f..b49e0add 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -368,7 +368,7 @@ begin // sub text LyricSub.Clear; LyricSub.X := 400; - LyricSub.Y := Skin_LyricsT + 42; //40 + LyricSub.Y := Skin_LyricsT + 35; //42 //40 LyricSub.Align := 1; // set custom options @@ -385,13 +385,13 @@ begin {LyricMain.ColSR := Skin_FontHighlightR; LyricMain.ColSG := Skin_FontHighlightG; LyricMain.ColSB := Skin_FontHighlightB;1aa5dc} - LyricMain.ColSR := 26/255; - LyricMain.ColSG := 165/255; - LyricMain.ColSB := 220/255; + LyricMain.ColSR := 96/255; //26 + LyricMain.ColSG := 192/255; //165 + LyricMain.ColSB := 96/255; //220 - LyricSub.ColR := 0.6; - LyricSub.ColG := 0.6; - LyricSub.ColB := 0.6; + LyricSub.ColR := 0.4; //0.6 + LyricSub.ColG := 0.4; //0.6 + LyricSub.ColB := 0.4; //0.6 end; 1: begin -- cgit v1.2.3 From 4036ca0937c05444b23018a19d69d1aef90495db Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 12 May 2007 09:17:15 +0000 Subject: Party Win Screen now works the way it should. The Statics are sorted by Score git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@190 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenPartyWin.pas | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas index a6486f67..1c4549a4 100644 --- a/Game/Code/Screens/UScreenPartyWin.pas +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -46,11 +46,11 @@ begin Result := false; end; - {SDLK_ESCAPE : + SDLK_ESCAPE : begin Music.PlayStart; FadeTo(@ScreenMain); - end;} + end; SDLK_RETURN: begin @@ -92,15 +92,18 @@ end; procedure TScreenPartyWin.onShow; var I: Integer; + Placing: TeamOrderArray; begin - + //Get Team Placing + Placing := PartySession.GetTeamOrder; + //Set Winnertext - Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.GetWinnerString(255)]); + Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.Teams.Teaminfo[Placing[0]].Name]); 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[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[0]].Score); + Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[Placing[0]].Name); Text[TextScoreTeam1].Visible := True; Text[TextNameTeam1].Visible := True; @@ -119,8 +122,8 @@ begin 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[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[1]].Score); + Text[TextNameTeam2].Text := String(PartySession.Teams.TeamInfo[Placing[1]].Name); Text[TextScoreTeam2].Visible := True; Text[TextNameTeam2].Visible := True; @@ -139,8 +142,8 @@ begin 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[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[2]].Score); + Text[TextNameTeam3].Text := String(PartySession.Teams.TeamInfo[Placing[2]].Name); Text[TextScoreTeam3].Visible := True; Text[TextNameTeam3].Visible := True; -- cgit v1.2.3 From 78ddfd6d20e419716dfa5085e01b059d40dd61ed Mon Sep 17 00:00:00 2001 From: b1indy Date: Tue, 15 May 2007 17:49:27 +0000 Subject: fixed angle calculation of covers in the background git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@193 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 114c52a3..9fcb7ee8 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1142,7 +1142,7 @@ begin else Pos := (Pos + VS/2) /VS; - Angle := 2 * pi * Pos*1.2; + Angle := pi * Pos*2; Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers -- cgit v1.2.3 From 66f4c5511f1cc61b68e75d874ea6a1dc88f9e75a Mon Sep 17 00:00:00 2001 From: mota23 Date: Tue, 15 May 2007 18:04:42 +0000 Subject: Added: Keys 1.2.3 to use Joker in Popup-Party-Menu Added: 2 sets of Statics for Song-Screen. (need work, just startet) Some Fixes in Deluxe Theme. (missing texts, fixed positions etc.) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@194 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 26 ++++++++++++++++++++++++-- Game/Code/Screens/UScreenSongMenu.pas | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 9fcb7ee8..2ce6b6df 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -52,7 +52,9 @@ type StaticTeam3Joker3: Cardinal; StaticTeam3Joker4: Cardinal; StaticTeam3Joker5: Cardinal; - + StaticKeys1: Cardinal; + TextKeys1: integer; + constructor Create; override; procedure SetScroll; procedure SetScroll1; @@ -79,7 +81,7 @@ type //Party Mode procedure SelectRandomSong; procedure SetJoker; - + procedure SetStatics; //procedures for Menu procedure StartSong; procedure OpenEditor; @@ -662,6 +664,10 @@ begin StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); + StaticKeys1 := AddStatic(Theme.Song.StaticKeys1); + + TextKeys1 := AddText(Theme.Song.TextKeys1); + // Song List // Songs.LoadSongList; // moved to the UltraStar unit CatSongs.Refresh; @@ -1215,6 +1221,7 @@ begin end; SetJoker; + SetStatics; end; procedure TScreenSong.onHide; @@ -1646,6 +1653,21 @@ begin end; end; +procedure TScreenSong.SetStatics; +begin + //If Party Mode + if Mode = 1 then //Use Statics for Party-Song-Selection + begin + Static[StaticKeys1].Visible := false; + Text[TextKeys1].Visible := false; + end + else //Use regular Statics for Song-Selection + begin //Hide all + Static[StaticKeys1].Visible := true; + Text[TextKeys1].Visible := true; + end; +end; + //Procedures for Menu procedure TScreenSong.StartSong; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 73b38a05..537536bb 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -96,6 +96,39 @@ begin if (Interaction=3) then InteractDec; end; + + SDLK_1: + begin //Jocker + //Joker spielen + case CurMenu of + SM_Party_Main: + begin + ScreenSong.DoJoker(0) + end; + end; + end; + SDLK_2: + begin //Jocker + //Joker spielen + case CurMenu of + SM_Party_Main: + begin + ScreenSong.DoJoker(1) + end; + end; + end; + SDLK_3: + begin //Jocker + //Joker spielen + case CurMenu of + SM_Party_Main: + begin + ScreenSong.DoJoker(2) + end; + end; + end; + + end; end; end; -- cgit v1.2.3 From 4a731514163a14bd3a9222d99707880b56772663 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 16 May 2007 19:19:35 +0000 Subject: all SongFile Loading and Saving procedures moved to UFiles. Added Some Tolerance in Song File Loading and Song Header Loading. Fix: Programm doesn't Crash anymore when a coruppted Song is loaded for Singing or Editing. Now Jump back to SongScreen and show an Error Message. Also Party Mode is not Interupted, a new Song will be selected automatically. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@197 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 2 +- Game/Code/Screens/UScreenEditConvert.pas | 2 +- Game/Code/Screens/UScreenEditHeader.pas | 2 +- Game/Code/Screens/UScreenEditSub.pas | 79 +++++++++++++++++----------- Game/Code/Screens/UScreenLevel.pas | 2 +- Game/Code/Screens/UScreenMain.pas | 2 +- Game/Code/Screens/UScreenName.pas | 2 +- Game/Code/Screens/UScreenOpen.pas | 2 +- Game/Code/Screens/UScreenOptions.pas | 2 +- Game/Code/Screens/UScreenOptionsAdvanced.pas | 2 +- Game/Code/Screens/UScreenOptionsGame.pas | 2 +- Game/Code/Screens/UScreenOptionsGraphics.pas | 2 +- Game/Code/Screens/UScreenOptionsLyrics.pas | 2 +- Game/Code/Screens/UScreenOptionsRecord.pas | 2 +- Game/Code/Screens/UScreenOptionsSound.pas | 2 +- Game/Code/Screens/UScreenOptionsThemes.pas | 2 +- Game/Code/Screens/UScreenPartyNewRound.pas | 2 +- Game/Code/Screens/UScreenPartyOptions.pas | 2 +- Game/Code/Screens/UScreenPartyPlayer.pas | 2 +- Game/Code/Screens/UScreenPopup.pas | 2 +- Game/Code/Screens/UScreenSing.pas | 26 +++++++-- Game/Code/Screens/UScreenSingModi.pas | 2 +- Game/Code/Screens/UScreenSong.pas | 4 +- Game/Code/Screens/UScreenSongJumpto.pas | 2 +- Game/Code/Screens/UScreenSongMenu.pas | 2 +- 25 files changed, 93 insertions(+), 60 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 0411c7b6..98cdc417 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -3,7 +3,7 @@ unit UScreenCredits; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes, ULCD, ULight; + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes, ULCD, ULight; type TScreenCredits = class(TMenu) diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index 62a50b3e..92e8544c 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -66,7 +66,7 @@ type end; implementation -uses UGraphic, SysUtils, UDrawTexture, TextGL, UPliki, UMain, UIni, OpenGL, USkins; +uses UGraphic, SysUtils, UDrawTexture, TextGL, UFiles, UMain, UIni, OpenGL, USkins; function TScreenEditConvert.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; var diff --git a/Game/Code/Screens/UScreenEditHeader.pas b/Game/Code/Screens/UScreenEditHeader.pas index f3e21fd0..35d7840f 100644 --- a/Game/Code/Screens/UScreenEditHeader.pas +++ b/Game/Code/Screens/UScreenEditHeader.pas @@ -44,7 +44,7 @@ type implementation -uses UGraphic, UMusic, SysUtils, UPliki, USkins; +uses UGraphic, UMusic, SysUtils, UFiles, USkins; function TScreenEditHeader.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; var diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index a665ba1c..a0adef2c 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -2,12 +2,15 @@ unit UScreenEditSub; interface -uses UMenu, UMusic, SDL, SysUtils, UPliki, UTime, USongs, UIni, ULog, USmpeg, UTexture, UMenuText, +uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, UMenuText, ULyrics, Math, OpenGL12, UThemes, MidiOut; type TScreenEditSub = class(TMenu) private + //Variable is True if no SOng is loaded + Error: Boolean; + TextNote: integer; TextSentence: integer; TextTitle: integer; @@ -71,7 +74,7 @@ type end; implementation -uses UGraphic, UDraw, UMain, USkins; +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; @@ -190,17 +193,15 @@ begin SDLK_S: begin - if SDL_ModState = 0 then - // Save Song - SaveSong(AktSong, Czesci[0], Path + FileName, false); - + // Save Song if SDL_ModState = KMOD_LSHIFT then - // Save Song - SaveSong(AktSong, Czesci[0], Path + FileName, true); + 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 + {if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL + KMOD_LALT then // Save Song - SaveSongDebug(AktSong, Czesci[0], 'C:\song.asm', false); + SaveSongDebug(AktSong, Czesci[0], 'C:\song.asm', false);} end; @@ -1091,20 +1092,26 @@ procedure TScreenEditSub.onShow; begin Log.LogStatus('Initializing', 'TEditScreen.onShow'); - MidiOut := TMidiOutput.Create(nil); - if Ini.Debug = 1 then - MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table - MidiOut.Open; - - //MidiOut.SetVolume(65535, 65535); - - + try + ResetSingTemp; + Error := not LoadSong(Path + FileName); + except + Error := True; + end; - CzyscNuty; - if WczytajCzesci(Path + FileName) = false then -// if WczytajCzesci(SongPath + 'Zapis.txt') = false then - Text[TextTitle].Text := 'Error loading file' + 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 + MidiOut := TMidiOutput.Create(nil); + if Ini.Debug = 1 then + MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table + MidiOut.Open; + Text[TextTitle].Text := AktSong.Title; Text[TextArtist].Text := AktSong.Artist; Text[TextMp3].Text := AktSong.Mp3; @@ -1201,7 +1208,7 @@ begin 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); @@ -1210,23 +1217,31 @@ begin Text[TextBPM].Text := FloatToStr(AktSong.BPM[0].BPM / 4); Text[TextGAP].Text := FloatToStr(AktSong.GAP); - // 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; + //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 + '|'; + Text[TextNText].Text := Text[TextNText].Text + '|'; // draw static menu inherited Draw; // draw notes SingDrawNoteLines(20, 300, 780, 15); - SingDrawBeatDelimeters(40, 300, 760, 0); - EditDrawCzesc(40, 405, 760, 0, 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; @@ -1237,7 +1252,7 @@ procedure TScreenEditSub.onHide; begin MidiOut.Close; MidiOut.Free; - Music.SetVolume(100); + //Music.SetVolume(100); end; function TScreenEditSub.GetNoteName(Note: Integer): String; diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas index a1d8fa33..fc343042 100644 --- a/Game/Code/Screens/UScreenLevel.pas +++ b/Game/Code/Screens/UScreenLevel.pas @@ -3,7 +3,7 @@ unit UScreenLevel; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; type TScreenLevel = class(TMenu) diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 47a79496..085f253d 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -3,7 +3,7 @@ unit UScreenMain; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes, ULCD, ULight; + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes, ULCD, ULight; type TScreenMain = class(TMenu) diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index 9db7947c..e2a80687 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -3,7 +3,7 @@ unit UScreenName; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; type TScreenName = class(TMenu) diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index 3a78b3e2..f5e121f9 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -2,7 +2,7 @@ unit UScreenOpen; interface -uses UMenu, UMusic, SDL, SysUtils, UPliki, UTime, USongs, UIni, ULog, USmpeg, UTexture, UMenuText, +uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, UMenuText, ULyrics, Math, OpenGL12, UThemes; type diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas index f0229d8c..02d42568 100644 --- a/Game/Code/Screens/UScreenOptions.pas +++ b/Game/Code/Screens/UScreenOptions.pas @@ -3,7 +3,7 @@ unit UScreenOptions; interface uses - UMenu, SDL, SysUtils, UDisplay, UMusic, UPliki, UIni, UThemes; + UMenu, SDL, SysUtils, UDisplay, UMusic, UFiles, UIni, UThemes; type TScreenOptions = class(TMenu) diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index 3e3f2da7..a28945c1 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -3,7 +3,7 @@ unit UScreenOptionsAdvanced; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; type TScreenOptionsAdvanced = class(TMenu) diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index 540931af..8712decc 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -3,7 +3,7 @@ unit UScreenOptionsGame; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes, USongs; + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes, USongs; type TScreenOptionsGame = class(TMenu) diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index b36bb7d3..c0641fc2 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -3,7 +3,7 @@ unit UScreenOptionsGraphics; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; type TScreenOptionsGraphics = class(TMenu) diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas index f60c9765..f4044933 100644 --- a/Game/Code/Screens/UScreenOptionsLyrics.pas +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -3,7 +3,7 @@ unit UScreenOptionsLyrics; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; type TScreenOptionsLyrics = class(TMenu) diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index c474bd7f..b005492a 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -3,7 +3,7 @@ unit UScreenOptionsRecord; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; type TScreenOptionsRecord = class(TMenu) diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index d4ab27d2..c99f1ef6 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -3,7 +3,7 @@ unit UScreenOptionsSound; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; type TScreenOptionsSound = class(TMenu) diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index 580f9c4d..b73693c1 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -3,7 +3,7 @@ unit UScreenOptionsThemes; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, UIni, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; type TScreenOptionsThemes = class(TMenu) diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index c914ee4b..f084ee10 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -3,7 +3,7 @@ unit UScreenPartyNewRound; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; type TScreenPartyNewRound = class(TMenu) diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 7f3b1209..aa8681d0 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -3,7 +3,7 @@ unit UScreenPartyOptions; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; type TScreenPartyOptions = class(TMenu) diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index d6e13d65..f6bcb0b7 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -3,7 +3,7 @@ unit UScreenPartyPlayer; Interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; type TScreenPartyPlayer = class(TMenu) diff --git a/Game/Code/Screens/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas index 9b71eb9a..2a789e42 100644 --- a/Game/Code/Screens/UScreenPopup.pas +++ b/Game/Code/Screens/UScreenPopup.pas @@ -3,7 +3,7 @@ unit UScreenPopup; interface uses - UMenu, SDL, UMusic, UPliki, SysUtils, UThemes; + UMenu, SDL, UMusic, UFiles, SysUtils, UThemes; type TScreenPopupCheck = class(TMenu) diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index b49e0add..cdce5984 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -2,7 +2,7 @@ unit UScreenSing; interface -uses UMenu, UMusic, SDL, SysUtils, UPliki, UTime, USongs, UIni, ULog, USmpeg, UTexture, ULyrics, +uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, ULyrics, TextGL, OpenGL12, BASS, UThemes, ULCD, UGraphicClasses; type @@ -321,11 +321,29 @@ begin Text[TextP3RScore].Visible := V3R; // load notes - CzyscNuty; + ResetSingTemp; // Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); AktSong := CatSongs.Song[CatSongs.Selected]; - - WczytajCzesci(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName); + try + if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName) then + begin + //Error Loading Song -> Go back to Song Screen and Show some Error Message + FadeTo(@ScreenSong); + //Select New Song in Party Mode + if ScreenSong.Mode = 1 then + ScreenSong.SelectRandomSong; + ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); + Exit; + end; + except + //Error Loading Song -> Go back to Song Screen and Show some Error Message + FadeTo(@ScreenSong); + //Select New Song in Party Mode + if ScreenSong.Mode = 1 then + ScreenSong.SelectRandomSong; + ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); + Exit; + end; AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; // AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 484d7d56..93ede980 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -2,7 +2,7 @@ unit UScreenSingModi; interface -uses UMenu, UMusic, SDL, SysUtils, UPliki, UTime, USongs, UIni, ULog, USmpeg, UTexture, ULyrics, +uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, ULyrics, TextGL, OpenGL12, BASS, UThemes, ULCD, UScreenSing, ModiSDK; type diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 2ce6b6df..33a6752d 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -3,7 +3,7 @@ unit UScreenSong; interface uses - UMenu, SDL, UMusic, UPliki, UTime, UDisplay, USongs, SysUtils, ULog, UThemes, UTexture, ULanguage, + UMenu, SDL, UMusic, UFiles, UTime, UDisplay, USongs, SysUtils, ULog, UThemes, UTexture, ULanguage, ULCD, ULight, UIni; type @@ -1227,7 +1227,7 @@ end; procedure TScreenSong.onHide; begin //When hide then Stop Music (For Party Mode Popup on Exit) - if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) then + if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then Music.Stop; end; diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 44c12f51..79e851ab 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -3,7 +3,7 @@ unit UScreenSongJumpto; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; type TScreenSongJumpto = class(TMenu) diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 537536bb..2469240f 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -3,7 +3,7 @@ unit UScreenSongMenu; interface uses - UMenu, SDL, UDisplay, UMusic, UPliki, SysUtils, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; type TScreenSongMenu = class(TMenu) -- cgit v1.2.3 From 955e54f098cf8c282fdf72f3bca5f87c1db79df6 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 16 May 2007 20:59:37 +0000 Subject: Fixed a Bug in SongScreen that causes Playlist and Search is unclosable when Tabs=Off git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@201 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 33a6752d..48c6597a 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -292,14 +292,31 @@ begin end else begin - //On Escape goto Cat-List Hack End - Music.Stop; - Music.PlayBack; -// FadeTo(@ScreenLevel); - FadeTo(@ScreenMain); + //On Escape goto Cat-List Hack End + //Tabs off and in Search or Playlist -> Go back to Song view + if (CatSongs.CatNumShow < -1) then + begin + //Atm: Set Empty Filter + CatSongs.SetFilter('', 0); + + //Show Cat in Top Left Mod + HideCatTL; + Interaction := 0; + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + + ChangeMusic; + end + else + begin + Music.Stop; + Music.PlayBack; + + FadeTo(@ScreenMain); + end; -// Music.Open(Skin.SkinPath + 'Menu Music 3.mp3'); -// Music.Play; end; end //When in party Mode then Ask before Close -- cgit v1.2.3 From fb785ffee0bc3e1db1022a2c8286f5b9f8944b37 Mon Sep 17 00:00:00 2001 From: mota23 Date: Thu, 17 May 2007 01:10:39 +0000 Subject: Added: New Options/Advanced item "auto party-menu": Switches automatic popup-menu in party-mode on/off. "on" is better usability for joypad, "off" for keyboard. Changed: Keys in Party Song Selection, "m" is popup-menu and "enter" direkt to singscreen. Added: new Statics and Texts to UScreenSong, 2 sets, one for "normal" the other for party-mode. Added: dismissed sound for party-mode. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@202 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenOptionsAdvanced.pas | 7 +- Game/Code/Screens/UScreenSong.pas | 178 +++++++++++++++++++++++++-- 2 files changed, 174 insertions(+), 11 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index a28945c1..4c3356d0 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -35,7 +35,7 @@ begin end; SDLK_RETURN: begin - if SelInteraction = 6 then begin + if SelInteraction = 7 then begin Ini.Save; Music.PlayBack; FadeTo(@ScreenOptions); @@ -47,14 +47,14 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + if (SelInteraction >= 0) and (SelInteraction <= 6) then begin Music.PlayOption; InteractInc; end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + if (SelInteraction >= 0) and (SelInteraction <= 6) then begin Music.PlayOption; InteractDec; end; @@ -77,6 +77,7 @@ begin AddSelect(Theme.OptionsAdvanced.SelectLineBonus, Ini.LineBonus, ILineBonus); AddSelectSlide(Theme.OptionsAdvanced.SelectOnSongClick, Ini.OnSongClick, IOnSongClick); AddSelect(Theme.OptionsAdvanced.SelectAskbeforeDel, Ini.AskbeforeDel, IAskbeforeDel); + AddSelect(Theme.OptionsAdvanced.SelectPartyPopup, Ini.PartyPopup, IPartyPopup); AddButton(Theme.OptionsAdvanced.ButtonExit); if (Length(Button[0].Text)=0) then diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 48c6597a..26fcba2e 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -52,8 +52,46 @@ type StaticTeam3Joker3: Cardinal; StaticTeam3Joker4: Cardinal; StaticTeam3Joker5: Cardinal; + StaticKeys1: Cardinal; TextKeys1: integer; + StaticKeys1Party: Cardinal; + TextKeys1Party: integer; + + StaticKeys2: Cardinal; + TextKeys2: integer; + StaticKeys2Party: Cardinal; + TextKeys2Party: integer; + + StaticKeys3: Cardinal; + TextKeys3: integer; + StaticKeys3Party: Cardinal; + TextKeys3Party: integer; + + StaticKeys4: Cardinal; + TextKeys4: integer; + StaticKeys4Party: Cardinal; + TextKeys4Party: integer; + + StaticKeys5: Cardinal; + TextKeys5: integer; + StaticKeys5Party: Cardinal; + TextKeys5Party: integer; + + StaticKeys6: Cardinal; + TextKeys6: integer; + StaticKeys6Party: Cardinal; + TextKeys6Party: integer; + + StaticKeys7: Cardinal; + TextKeys7: integer; + StaticKeys7Party: Cardinal; + TextKeys7Party: integer; + + StaticKeys8: Cardinal; + TextKeys8: integer; + StaticKeys8Party: Cardinal; + TextKeys8Party: integer; constructor Create; override; procedure SetScroll; @@ -163,6 +201,7 @@ var I, I2: Integer; Text[TextCat].Visible := true; Static[StaticCat].Visible := True; end; + procedure TScreenSong.HideCatTL; begin //Hide @@ -368,7 +407,9 @@ begin end else if (Mode = 1) then //PartyMode -> Show Menu begin - ScreenSongMenu.MenuShow(SM_Party_Main); + //Is this Right? + ScreenSong.StartSong; + //ScreenSongMenu.MenuShow(SM_Party_Main); end; end; end; @@ -682,8 +723,44 @@ begin StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); StaticKeys1 := AddStatic(Theme.Song.StaticKeys1); - TextKeys1 := AddText(Theme.Song.TextKeys1); + StaticKeys1Party := AddStatic(Theme.Song.StaticKeys1Party); + TextKeys1Party := AddText(Theme.Song.TextKeys1Party); + + StaticKeys2 := AddStatic(Theme.Song.StaticKeys2); + TextKeys2 := AddText(Theme.Song.TextKeys2); + StaticKeys2Party := AddStatic(Theme.Song.StaticKeys2Party); + TextKeys2Party := AddText(Theme.Song.TextKeys2Party); + + StaticKeys3 := AddStatic(Theme.Song.StaticKeys3); + TextKeys3 := AddText(Theme.Song.TextKeys3); + StaticKeys3Party := AddStatic(Theme.Song.StaticKeys3Party); + TextKeys3Party := AddText(Theme.Song.TextKeys3Party); + + StaticKeys4 := AddStatic(Theme.Song.StaticKeys4); + TextKeys4 := AddText(Theme.Song.TextKeys4); + StaticKeys4Party := AddStatic(Theme.Song.StaticKeys4Party); + TextKeys4Party := AddText(Theme.Song.TextKeys4Party); + + StaticKeys5 := AddStatic(Theme.Song.StaticKeys5); + TextKeys5 := AddText(Theme.Song.TextKeys5); + StaticKeys5Party := AddStatic(Theme.Song.StaticKeys5Party); + TextKeys5Party := AddText(Theme.Song.TextKeys5Party); + + StaticKeys6 := AddStatic(Theme.Song.StaticKeys6); + TextKeys6 := AddText(Theme.Song.TextKeys6); + StaticKeys6Party := AddStatic(Theme.Song.StaticKeys6Party); + TextKeys6Party := AddText(Theme.Song.TextKeys6Party); + + StaticKeys7 := AddStatic(Theme.Song.StaticKeys7); + TextKeys7 := AddText(Theme.Song.TextKeys7); + StaticKeys7Party := AddStatic(Theme.Song.StaticKeys7Party); + TextKeys7Party := AddText(Theme.Song.TextKeys7Party); + + StaticKeys8 := AddStatic(Theme.Song.StaticKeys8); + TextKeys8 := AddText(Theme.Song.TextKeys8); + StaticKeys8Party := AddStatic(Theme.Song.StaticKeys8Party); + TextKeys8Party := AddText(Theme.Song.TextKeys8Party); // Song List // Songs.LoadSongList; // moved to the UltraStar unit @@ -1234,7 +1311,13 @@ begin SelectRandomSong; //Show Mennu direct in PartyMode - ScreenSongMenu.MenuShow(SM_Party_Main); + //But only if selected in Options + if (Ini.PartyPopup = 1) then + begin + ScreenSongMenu.MenuShow(SM_Party_Main); + end; + + end; SetJoker; @@ -1675,13 +1758,92 @@ begin //If Party Mode if Mode = 1 then //Use Statics for Party-Song-Selection begin - Static[StaticKeys1].Visible := false; - Text[TextKeys1].Visible := false; + Static[StaticKeys1].Visible := False; + Text[TextKeys1].Visible := False; + Static[StaticKeys1Party].Visible := True; + Text[TextKeys1Party].Visible := True; + + Static[StaticKeys2].Visible := False; + Text[TextKeys2].Visible := False; + Static[StaticKeys2Party].Visible := True; + Text[TextKeys2Party].Visible := True; + + Static[StaticKeys3].Visible := False; + Text[TextKeys3].Visible := False; + Static[StaticKeys3Party].Visible := True; + Text[TextKeys3Party].Visible := True; + + Static[StaticKeys4].Visible := False; + Text[TextKeys4].Visible := False; + Static[StaticKeys4Party].Visible := True; + Text[TextKeys4Party].Visible := True; + + Static[StaticKeys5].Visible := False; + Text[TextKeys5].Visible := False; + Static[StaticKeys5Party].Visible := True; + Text[TextKeys5Party].Visible := True; + + Static[StaticKeys6].Visible := False; + Text[TextKeys6].Visible := False; + Static[StaticKeys6Party].Visible := True; + Text[TextKeys6Party].Visible := True; + + Static[StaticKeys7].Visible := False; + Text[TextKeys7].Visible := False; + Static[StaticKeys7Party].Visible := True; + Text[TextKeys7Party].Visible := True; + + Static[StaticKeys8].Visible := False; + Text[TextKeys8].Visible := False; + Static[StaticKeys8Party].Visible := True; + Text[TextKeys8Party].Visible := True; end else //Use regular Statics for Song-Selection - begin //Hide all - Static[StaticKeys1].Visible := true; - Text[TextKeys1].Visible := true; + begin + Static[StaticKeys1].Visible := True; + Text[TextKeys1].Visible := True; + Static[StaticKeys1Party].Visible := False; + Text[TextKeys1Party].Visible := False; + + Static[StaticKeys2].Visible := True; + Text[TextKeys2].Visible := True; + Static[StaticKeys2Party].Visible := False; + Text[TextKeys2Party].Visible := False; + + Static[StaticKeys2].Visible := True; + Text[TextKeys2].Visible := True; + Static[StaticKeys2Party].Visible := False; + Text[TextKeys2Party].Visible := False; + + Static[StaticKeys3].Visible := True; + Text[TextKeys3].Visible := True; + Static[StaticKeys3Party].Visible := False; + Text[TextKeys3Party].Visible := False; + + Static[StaticKeys4].Visible := True; + Text[TextKeys4].Visible := True; + Static[StaticKeys4Party].Visible := False; + Text[TextKeys4Party].Visible := False; + + Static[StaticKeys5].Visible := True; + Text[TextKeys5].Visible := True; + Static[StaticKeys5Party].Visible := False; + Text[TextKeys5Party].Visible := False; + + Static[StaticKeys6].Visible := True; + Text[TextKeys6].Visible := True; + Static[StaticKeys6Party].Visible := False; + Text[TextKeys6Party].Visible := False; + + Static[StaticKeys7].Visible := True; + Text[TextKeys7].Visible := True; + Static[StaticKeys7Party].Visible := False; + Text[TextKeys7Party].Visible := False; + + Static[StaticKeys8].Visible := True; + Text[TextKeys8].Visible := True; + Static[StaticKeys8Party].Visible := False; + Text[TextKeys8Party].Visible := False; end; end; -- cgit v1.2.3 From c07c700247d4c70f79d2f7fb9c5b368196d1cf53 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 17 May 2007 09:47:02 +0000 Subject: Added functionality to Cancel Button in ScreenOpen Pressing ESC in ScreenOpen now causes last Screen to be displayed git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@205 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenOpen.pas | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index f5e121f9..af984a21 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -35,7 +35,6 @@ begin begin if Interaction = 0 then begin Text[TextN].Text := Text[TextN].Text + chr(ScanCode); - FileName := Text[TextN].Text; end; end; end; @@ -50,18 +49,29 @@ begin if Interaction = 0 then begin Text[TextN].DeleteLastL; - FileName := Text[TextN].Text; end; end; SDLK_ESCAPE: begin - result := false; + //Empty Filename and go to last Screen + FileName := ''; + Music.PlayBack; + FadeTo(BackScreen); end; SDLK_RETURN: begin - if Interaction = 2 then begin + if (Interaction = 2) then begin + //Update Filename and go to last Screen + FileName := Text[TextN].Text; + Music.PlayBack; + FadeTo(BackScreen); + end + else if (Interaction = 1) then + begin + //Empty Filename and go to last Screen + FileName := ''; Music.PlayBack; FadeTo(BackScreen); end; -- cgit v1.2.3 From f11d9806f4623dc4dbf14e521624109b7a69b86b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 17 May 2007 10:33:27 +0000 Subject: Deleted Motas Methods to display variable Statics and Texts in Party Mode. Added a new, more extendable and easier in Code Method for displaying Statics in Party Mode or in Normal Mode only Enter in Songscreen in Party Mode Opens now SongMenu again when PartyPopup=1 Changed Theme to Fit these changes git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@206 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 222 +++++++++----------------------------- 1 file changed, 48 insertions(+), 174 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 26fcba2e..95550a32 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -53,45 +53,10 @@ type StaticTeam3Joker4: Cardinal; StaticTeam3Joker5: Cardinal; - StaticKeys1: Cardinal; - TextKeys1: integer; - StaticKeys1Party: Cardinal; - TextKeys1Party: integer; - - StaticKeys2: Cardinal; - TextKeys2: integer; - StaticKeys2Party: Cardinal; - TextKeys2Party: integer; - - StaticKeys3: Cardinal; - TextKeys3: integer; - StaticKeys3Party: Cardinal; - TextKeys3Party: integer; - - StaticKeys4: Cardinal; - TextKeys4: integer; - StaticKeys4Party: Cardinal; - TextKeys4Party: integer; - - StaticKeys5: Cardinal; - TextKeys5: integer; - StaticKeys5Party: Cardinal; - TextKeys5Party: integer; - - StaticKeys6: Cardinal; - TextKeys6: integer; - StaticKeys6Party: Cardinal; - TextKeys6Party: integer; - - StaticKeys7: Cardinal; - TextKeys7: integer; - StaticKeys7Party: Cardinal; - TextKeys7Party: integer; - - StaticKeys8: Cardinal; - TextKeys8: integer; - StaticKeys8Party: Cardinal; - TextKeys8Party: integer; + StaticParty: Array of Cardinal; + TextParty: Array of Cardinal; + StaticNonParty: Array of Cardinal; + TextNonParty: Array of Cardinal; constructor Create; override; procedure SetScroll; @@ -407,9 +372,11 @@ begin end else if (Mode = 1) then //PartyMode -> Show Menu begin - //Is this Right? - ScreenSong.StartSong; - //ScreenSongMenu.MenuShow(SM_Party_Main); + //Is this Right? + if (Ini.PartyPopup = 1) then + ScreenSongMenu.MenuShow(SM_Party_Main) + else + ScreenSong.StartSong; end; end; end; @@ -722,45 +689,22 @@ begin StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); - StaticKeys1 := AddStatic(Theme.Song.StaticKeys1); - TextKeys1 := AddText(Theme.Song.TextKeys1); - StaticKeys1Party := AddStatic(Theme.Song.StaticKeys1Party); - TextKeys1Party := AddText(Theme.Song.TextKeys1Party); - - StaticKeys2 := AddStatic(Theme.Song.StaticKeys2); - TextKeys2 := AddText(Theme.Song.TextKeys2); - StaticKeys2Party := AddStatic(Theme.Song.StaticKeys2Party); - TextKeys2Party := AddText(Theme.Song.TextKeys2Party); - - StaticKeys3 := AddStatic(Theme.Song.StaticKeys3); - TextKeys3 := AddText(Theme.Song.TextKeys3); - StaticKeys3Party := AddStatic(Theme.Song.StaticKeys3Party); - TextKeys3Party := AddText(Theme.Song.TextKeys3Party); - - StaticKeys4 := AddStatic(Theme.Song.StaticKeys4); - TextKeys4 := AddText(Theme.Song.TextKeys4); - StaticKeys4Party := AddStatic(Theme.Song.StaticKeys4Party); - TextKeys4Party := AddText(Theme.Song.TextKeys4Party); - - StaticKeys5 := AddStatic(Theme.Song.StaticKeys5); - TextKeys5 := AddText(Theme.Song.TextKeys5); - StaticKeys5Party := AddStatic(Theme.Song.StaticKeys5Party); - TextKeys5Party := AddText(Theme.Song.TextKeys5Party); - - StaticKeys6 := AddStatic(Theme.Song.StaticKeys6); - TextKeys6 := AddText(Theme.Song.TextKeys6); - StaticKeys6Party := AddStatic(Theme.Song.StaticKeys6Party); - TextKeys6Party := AddText(Theme.Song.TextKeys6Party); - - StaticKeys7 := AddStatic(Theme.Song.StaticKeys7); - TextKeys7 := AddText(Theme.Song.TextKeys7); - StaticKeys7Party := AddStatic(Theme.Song.StaticKeys7Party); - TextKeys7Party := AddText(Theme.Song.TextKeys7Party); - - StaticKeys8 := AddStatic(Theme.Song.StaticKeys8); - TextKeys8 := AddText(Theme.Song.TextKeys8); - StaticKeys8Party := AddStatic(Theme.Song.StaticKeys8Party); - TextKeys8Party := AddText(Theme.Song.TextKeys8Party); + //Load Party or NonParty specific Statics and Texts + SetLength(StaticParty, Length(Theme.Song.StaticParty)); + for I := 0 to High(Theme.Song.StaticParty) do + StaticParty[I] := AddStatic(Theme.Song.StaticParty[I]); + + SetLength(TextParty, Length(Theme.Song.TextParty)); + for I := 0 to High(Theme.Song.TextParty) do + TextParty[I] := AddText(Theme.Song.TextParty[I]); + + SetLength(StaticNonParty, Length(Theme.Song.StaticNonParty)); + for I := 0 to High(Theme.Song.StaticNonParty) do + StaticNonParty[I] := AddStatic(Theme.Song.StaticNonParty[I]); + + SetLength(TextNonParty, Length(Theme.Song.TextNonParty)); + for I := 0 to High(Theme.Song.TextNonParty) do + TextNonParty[I] := AddText(Theme.Song.TextNonParty[I]); // Song List // Songs.LoadSongList; // moved to the UltraStar unit @@ -1310,12 +1254,12 @@ begin begin SelectRandomSong; - //Show Mennu direct in PartyMode + //Show Menu directly in PartyMode //But only if selected in Options if (Ini.PartyPopup = 1) then - begin + begin ScreenSongMenu.MenuShow(SM_Party_Main); - end; + end; end; @@ -1754,97 +1698,27 @@ begin end; procedure TScreenSong.SetStatics; +var + I: Integer; + Visible: Boolean; begin - //If Party Mode - if Mode = 1 then //Use Statics for Party-Song-Selection - begin - Static[StaticKeys1].Visible := False; - Text[TextKeys1].Visible := False; - Static[StaticKeys1Party].Visible := True; - Text[TextKeys1Party].Visible := True; - - Static[StaticKeys2].Visible := False; - Text[TextKeys2].Visible := False; - Static[StaticKeys2Party].Visible := True; - Text[TextKeys2Party].Visible := True; - - Static[StaticKeys3].Visible := False; - Text[TextKeys3].Visible := False; - Static[StaticKeys3Party].Visible := True; - Text[TextKeys3Party].Visible := True; - - Static[StaticKeys4].Visible := False; - Text[TextKeys4].Visible := False; - Static[StaticKeys4Party].Visible := True; - Text[TextKeys4Party].Visible := True; - - Static[StaticKeys5].Visible := False; - Text[TextKeys5].Visible := False; - Static[StaticKeys5Party].Visible := True; - Text[TextKeys5Party].Visible := True; - - Static[StaticKeys6].Visible := False; - Text[TextKeys6].Visible := False; - Static[StaticKeys6Party].Visible := True; - Text[TextKeys6Party].Visible := True; - - Static[StaticKeys7].Visible := False; - Text[TextKeys7].Visible := False; - Static[StaticKeys7Party].Visible := True; - Text[TextKeys7Party].Visible := True; - - Static[StaticKeys8].Visible := False; - Text[TextKeys8].Visible := False; - Static[StaticKeys8Party].Visible := True; - Text[TextKeys8Party].Visible := True; - end - else //Use regular Statics for Song-Selection - begin - Static[StaticKeys1].Visible := True; - Text[TextKeys1].Visible := True; - Static[StaticKeys1Party].Visible := False; - Text[TextKeys1Party].Visible := False; - - Static[StaticKeys2].Visible := True; - Text[TextKeys2].Visible := True; - Static[StaticKeys2Party].Visible := False; - Text[TextKeys2Party].Visible := False; - - Static[StaticKeys2].Visible := True; - Text[TextKeys2].Visible := True; - Static[StaticKeys2Party].Visible := False; - Text[TextKeys2Party].Visible := False; - - Static[StaticKeys3].Visible := True; - Text[TextKeys3].Visible := True; - Static[StaticKeys3Party].Visible := False; - Text[TextKeys3Party].Visible := False; - - Static[StaticKeys4].Visible := True; - Text[TextKeys4].Visible := True; - Static[StaticKeys4Party].Visible := False; - Text[TextKeys4Party].Visible := False; - - Static[StaticKeys5].Visible := True; - Text[TextKeys5].Visible := True; - Static[StaticKeys5Party].Visible := False; - Text[TextKeys5Party].Visible := False; - - Static[StaticKeys6].Visible := True; - Text[TextKeys6].Visible := True; - Static[StaticKeys6Party].Visible := False; - Text[TextKeys6Party].Visible := False; - - Static[StaticKeys7].Visible := True; - Text[TextKeys7].Visible := True; - Static[StaticKeys7Party].Visible := False; - Text[TextKeys7Party].Visible := False; - - Static[StaticKeys8].Visible := True; - Text[TextKeys8].Visible := True; - Static[StaticKeys8Party].Visible := False; - Text[TextKeys8Party].Visible := False; - end; + //Set Visibility of Party Statics and Text + Visible := (Mode = 1); + + For I := 0 to high(StaticParty) do + Static[StaticParty[I]].Visible := Visible; + + For I := 0 to high(TextParty) do + Text[TextParty[I]].Visible := Visible; + + //Set Visibility of Non Party Statics and Text + Visible := not Visible; + + For I := 0 to high(StaticNonParty) do + Static[StaticNonParty[I]].Visible := Visible; + + For I := 0 to high(TextNonParty) do + Text[TextNonParty[I]].Visible := Visible; end; //Procedures for Menu -- cgit v1.2.3 From 718855f7191c9d4963da9977ee49d155e376691b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 17 May 2007 10:42:45 +0000 Subject: Now when no Cat, Search or Playlist is shown, the Text specified in Theme for TextCat is shown git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@207 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 95550a32..31d05dce 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -170,8 +170,11 @@ var I, I2: Integer; procedure TScreenSong.HideCatTL; begin //Hide - Text[TextCat].Visible := false; + //Text[TextCat].Visible := false; Static[StaticCat].Visible := false; + //New -> Show Text specified in Theme + Text[TextCat].Visible := True; + Text[TextCat].Text := Theme.Song.TextCat.Text; end; //Show Cat in Top Left Mod End -- cgit v1.2.3 From b00fb13d63e4b82a1de662bf3a37814bfd58dc8b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 17 May 2007 11:04:54 +0000 Subject: Added ability to use German Umlaute Jump To Song Screen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@208 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSongJumpto.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 79e851ab..60410d91 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -35,7 +35,7 @@ var implementation -uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, USongs, UScreenSong; +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, USongs, UScreenSong, ULog; function TScreenSongJumpto.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; function IsVisible: Boolean; @@ -73,7 +73,7 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of - 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: + 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, SDLK_LEFTBRACKET, SDLK_SEMICOLON: begin if Interaction = 0 then begin -- cgit v1.2.3 From d2f6ecd73457de4ca12603b57e6c5d2e135e5d2d Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 17 May 2007 11:21:36 +0000 Subject: Fixed a Bug in UScreenSongJumpto that causes a wrong Song is Displayed in Song Selection when Tabs=0 and Search is opened, Search Type is changed and Search is closed. Fixed Position of SelectSlideType in Jump to Song Screen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@209 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSongJumpto.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 60410d91..42aedf3c 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -214,7 +214,7 @@ begin VisSongs := Count; //Fix SongSelection - ScreenSong.Interaction := 0; + ScreenSong.Interaction := high(CatSongs.Song); ScreenSong.SelectNext; ScreenSong.FixSelected; -- cgit v1.2.3 From 04189268afb620a6a0d09a675f771c0df9f1264f Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 17 May 2007 11:33:40 +0000 Subject: Fixed a Bug in Jump to Letter: A and Z now Works correctly Fixed a Bug in Skipto funktion that causes a wrong Song is Selected when Tabs=0. This was the Reason for some Bugs in Jump to and Random Functions. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@210 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 31d05dce..6f3bbc63 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -210,7 +210,7 @@ begin + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); //Jump to Artist/Titel - if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey > SDLK_A) AND (PressedKey < SDLK_Z) then + if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then begin Letter := UpCase(Chr(ScanCode)); I2 := Length(CatSongs.Song); @@ -1441,7 +1441,7 @@ begin if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then Texture.UnloadTexture(Button[Interaction].Texture.Name, false); - Interaction := 0; + Interaction := High(CatSongs.Song); SongTarget := 0; for I := 1 to Target+1 do -- cgit v1.2.3 From d52cb874cd39eac4a4aff100c22bf3280eea4275 Mon Sep 17 00:00:00 2001 From: mota23 Date: Thu, 17 May 2007 14:04:07 +0000 Subject: added: Video Icon. Shows if Video is present in Song-Selection. Needs to be fixed. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@212 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 6f3bbc63..4fe679f7 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -13,6 +13,9 @@ type TextTitle: integer; TextNumber: integer; + //Video Icon Mod + VideoIcon: Cardinal; + TextCat: integer; StaticCat: integer; @@ -58,6 +61,7 @@ type StaticNonParty: Array of Cardinal; TextNonParty: Array of Cardinal; + constructor Create; override; procedure SetScroll; procedure SetScroll1; @@ -1326,6 +1330,13 @@ begin inherited Draw; + //Draw Video Icon if Video is present + if CatSongs.Song[Interaction].Video <> '' then + Static[VideoIcon].Visible := True + else + Static[VideoIcon].Visible := False; + + //Draw Equalizer if Theme.Song.Equalizer.Visible then DrawEqualizer; -- cgit v1.2.3 From 8c035bb950519a86c90f64aab7c58aa98089569c Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 17 May 2007 14:15:50 +0000 Subject: Some Code Cleanup in UScreenSong Fixed VideoIcon Display git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@213 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 4fe679f7..82dad1ed 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -664,9 +664,6 @@ var begin inherited Create; -// AddStatic(200, 10, 400, 90, Skin.SelectSong); -// AddStatic(200-10, 140-5, 400+20, 50+10, Skin.Selection, 'JPG', 'Font Gray'); - LoadFromTheme(Theme.Song); TextArtist := AddText(Theme.Song.TextArtist); @@ -677,6 +674,9 @@ begin TextCat := AddText(Theme.Song.TextCat); StaticCat := AddStatic(Theme.Song.StaticCat); + //Show Video Icon Mod + VideoIcon := AddStatic(Theme.Song.VideoIcon); + //Party Mode StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1); StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2); @@ -748,21 +748,12 @@ begin AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); end; Texture.Limit := 1024*1024; - - -// AddButtonText(11, 10, CatSongs.Song[Pet].Title); // new way end; -// Covers.Save; - { if Length(CatSongs.Song) > 0 then // setting to first song - Interaction := 0 - else begin // no song detected - AddButton(400-200, 140, 400, 50, Skin.Button, 'JPG', 'Transparent Range'); - AddButtonText(11, 10, 'No songs detected'); - end;} + // Randomize Patch - Randomize; + Randomize; //Equalizer SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); //ClearArray @@ -788,6 +779,9 @@ begin end; else SetScroll4; end; + //Set Visibility of Video Icon + Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> ''); + //Set Texts: Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; Text[TextTitle].Text := CatSongs.Song[Interaction].Title; @@ -1330,12 +1324,6 @@ begin inherited Draw; - //Draw Video Icon if Video is present - if CatSongs.Song[Interaction].Video <> '' then - Static[VideoIcon].Visible := True - else - Static[VideoIcon].Visible := False; - //Draw Equalizer if Theme.Song.Equalizer.Visible then -- cgit v1.2.3 From 1858dadeadf071bbc3eb16ae835fc9bd95440eab Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 17 May 2007 14:23:38 +0000 Subject: Video Tag will now only be read when the VideoFile exists. -> Better usability of VideoIcon git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@214 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenStatMain.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index 219ccd57..54457a6e 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -109,7 +109,7 @@ begin //Set Songs with Vid SongswithVid := 0; For I := 0 to high(Songs.Song) do - if (Songs.Song[I].Video <> '') AND FileExists(Songs.Song[I].Path + Songs.Song[I].Video) then + if (Songs.Song[I].Video <> '') then Inc(SongswithVid); end; -- cgit v1.2.3 From 7bf5487faf2b099ced0b2126c2cca164be80acf1 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 18 May 2007 10:57:17 +0000 Subject: Some changes mode on ModiSDK and Depending Files(Plugin Loader, Party SingScreen and Plugins) Changes make the Pluginsystem more extendable with backwards compatibility in further Versions. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@220 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSingModi.pas | 2 -- 1 file changed, 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 93ede980..0b9ab893 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -1061,8 +1061,6 @@ begin Result.TexNum := Tex.TexNum; Result.W := Tex.W; Result.H := Tex.H; - Result.ScaleW := Tex.ScaleW; - Result.ScaleH := Tex.ScaleH; end; { function Translate (const Name: PChar): PChar; stdcall; -- cgit v1.2.3 From ab2634e9b83cb44ad7d5a8b54a397b8c22a78778 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 18 May 2007 18:06:54 +0000 Subject: Fixed a Bug in Jump to Menu that causes a Wrong Song is Played, when the first Song is in the Results and Tabs=off. LastPlayed Variable was not set correctly. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@221 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSongJumpto.pas | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 42aedf3c..cfb897a8 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -187,6 +187,8 @@ begin //Select Input Interaction := 0; Button[0].Text[0].Selected := True; + + LastPlayed := ScreenSong.Interaction; end; function TScreenSongJumpto.Draw: boolean; -- cgit v1.2.3 From f0e4ad452891aec64c777c4bf806fc6f989ee327 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 18 May 2007 19:31:55 +0000 Subject: Some Code Cleanup and Minor Bugfixes in UScreenSongJumpto git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@222 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSongJumpto.pas | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index cfb897a8..2ea94cdc 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -84,27 +84,23 @@ begin SDLK_BACKSPACE: begin - if Interaction = 0 then + if (Interaction = 0) AND (Length(Button[0].Text[0].Text) > 0) then begin Button[0].Text[0].DeleteLastL; SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); end; end; - SDLK_ESCAPE : - begin - Music.PlayBack; - Visible := False; - if VisSongs = 0 then - CatSongs.SetFilter('', 0); - end; - - SDLK_RETURN: + SDLK_RETURN, SDLK_ESCAPE: begin Visible := False; Music.PlayBack; - if VisSongs = 0 then + if (VisSongs = 0) AND (Length(Button[0].Text[0].Text) > 0) then + begin + Button[0].Text[0].Text := ''; CatSongs.SetFilter('', 0); + SetTextFound(0); + end; end; // Up and Down could be done at the same time, @@ -127,7 +123,8 @@ begin if (Interaction=1) then begin InteractInc; - SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + if (Length(Button[0].Text[0].Text) > 0) then + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); end; end; SDLK_LEFT: @@ -135,7 +132,8 @@ begin if (Interaction=1) then begin InteractDec; - SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + if (Length(Button[0].Text[0].Text) > 0) then + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); end; end; end; @@ -178,7 +176,7 @@ begin //Reset Screen if no Old Search is Displayed if (CatSongs.CatNumShow <> -2) then begin - SelectType := 0; + SelectsS[0].SetSelectOpt(0); Button[0].Text[0].Text := ''; Text[0].Text := Theme.SongJumpto.NoSongsFound; @@ -201,7 +199,10 @@ begin if (Count = 0) then begin Text[0].Text := Theme.SongJumpto.NoSongsFound; - ScreenSong.HideCatTL; + if (Length(Button[0].Text[0].Text) = 0) then + ScreenSong.HideCatTL + else + ScreenSong.ShowCatTLCustom(Format(Theme.SongJumpto.CatText, [Button[0].Text[0].Text])); end else begin -- cgit v1.2.3 From 2a172c386d2c69a5a4157d8a6c0d4e64875b7011 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 20 May 2007 09:37:38 +0000 Subject: Fixed a Bug in UScreenSong. Everytime the Category List is shown, the next Song was selected. (Tabs=On) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@224 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 82dad1ed..12929629 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -218,7 +218,7 @@ begin begin Letter := UpCase(Chr(ScanCode)); I2 := Length(CatSongs.Song); - + //Jump To Titel if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then begin @@ -252,7 +252,7 @@ begin ChangeMusic; SetScroll4; UpdateLCD; - + //Break and Exit Exit; end; @@ -664,7 +664,7 @@ var begin inherited Create; - LoadFromTheme(Theme.Song); + LoadFromTheme(Theme.Song); TextArtist := AddText(Theme.Song.TextArtist); TextTitle := AddText(Theme.Song.TextTitle); @@ -759,6 +759,9 @@ begin //ClearArray For I := low(EqualizerBands) to high(EqualizerBands) do EqualizerBands[I] := 3; + + if (Length(CatSongs.Song) > 0) then + Interaction := 0; end; procedure TScreenSong.SetScroll; @@ -1222,13 +1225,12 @@ begin //Cat Mod etc if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then - begin + begin CatSongs.ShowCategoryList; - SelectNext; //Workaround <- must be fixed sometime FixSelected; //Show Cat in Top Left Mod - HideCatTL; - end; + HideCatTL; + end; if Length(CatSongs.Song) > 0 then begin @@ -1782,4 +1784,4 @@ FixSelected; } end; -end. +end. \ No newline at end of file -- cgit v1.2.3 From 8d45ef9b08de96a0037ac9e245a84b7730228736 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 20 May 2007 09:40:48 +0000 Subject: An effort to make a workaround for the many Crashes when a Video File ist corrupted. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@225 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index cdce5984..3899a4ed 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -730,7 +730,23 @@ end; procedure TScreenSing.onShowFinish; begin // play movie (II) - if AktSong.VideoLoaded then PlaySmpeg; + + if AktSong.VideoLoaded then + begin + try + PlaySmpeg; + except + //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video + AktSong.VideoLoaded := False; + Log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); + Log.LogError('Corrupted File: ' + AktSong.Video); + try + CloseSmpeg; + except + + end; + end; + end; // play music (II) Music.Play; @@ -1039,7 +1055,19 @@ begin SingDrawBackground; // update and draw movie if ShowFinish and AktSong.VideoLoaded then begin - UpdateSmpeg; // this only draws + try + UpdateSmpeg; // this only draws + except + //If an Error occurs drawing: prevent Video from being Drawn again and Close Video + AktSong.VideoLoaded := False; + log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); + Log.LogError('Corrupted File: ' + AktSong.Video); + try + CloseSmpeg; + except + + end; + end; end; // draw static menu (FG) -- cgit v1.2.3 From 10391b4d011dc60f1585643398b772bed3bb4beb Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 26 May 2007 15:30:36 +0000 Subject: Added Workaround and Error Reporting for Errors during Cover loading. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@229 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 75 ++++++++++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 21 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 12929629..db5eb2b2 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -661,6 +661,7 @@ constructor TScreenSong.Create; var Pet: integer; I: integer; +Label CreateSongButtons; begin inherited Create; @@ -719,37 +720,69 @@ begin //Set Length of Button Array one Time Instead of one time for every Song SetButtonLength(Length(CatSongs.Song)); - for Pet := 0 to High(CatSongs.Song) do begin // creating all buttons - // new - Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 - if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then - CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' + I := 0; + CreateSongButtons: - if CatSongs.Song[Pet].Cover = '' then - AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) - else begin - // cache texture if there is a need to this - if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then begin - Texture.CreateCacheMipmap := true; - Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap - Texture.CreateCacheMipmap := false; + try + for Pet := I to High(CatSongs.Song) do begin // creating all buttons + // new + Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 - // puts this texture to the cache file - Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' - // unload full size texture - Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); + if CatSongs.Song[Pet].Cover = '' then + AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) + else begin + // cache texture if there is a need to this + if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then begin + Texture.CreateCacheMipmap := true; + Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap + Texture.CreateCacheMipmap := false; - // we should also add mipmap texture by calling createtexture and use mipmap cache as data source + // puts this texture to the cache file + Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + + // unload full size texture + Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); + + // we should also add mipmap texture by calling createtexture and use mipmap cache as data source + end; + + // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) + AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); end; + Texture.Limit := 1024*1024; + I := -1; + end; + except + //When Error is reported the First time for this Song + if (I <> Pet) then + begin + //Some Error reporting: + Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); - // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) - AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + //Change Cover to NoCover and Continue Loading + CatSongs.Song[Pet].Cover := ''; + I := Pet; + end + else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song + begin + Log.LogError('NoCover Cover is damaged!'); + try + AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); + except + Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); + Halt; + end; + I := Pet + 1; end; - Texture.Limit := 1024*1024; end; + if (I <> -1) then + GoTo CreateSongButtons; + // Randomize Patch -- cgit v1.2.3 From c7e2eee2adb177669622a9ee99072ad2b746efe5 Mon Sep 17 00:00:00 2001 From: mota23 Date: Sat, 26 May 2007 15:48:55 +0000 Subject: Changed active lyrics color back to blue. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@230 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 3899a4ed..ed79bb2f 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -403,9 +403,9 @@ begin {LyricMain.ColSR := Skin_FontHighlightR; LyricMain.ColSG := Skin_FontHighlightG; LyricMain.ColSB := Skin_FontHighlightB;1aa5dc} - LyricMain.ColSR := 96/255; //26 - LyricMain.ColSG := 192/255; //165 - LyricMain.ColSB := 96/255; //220 + LyricMain.ColSR := 5/255; //26 + LyricMain.ColSG := 163/255; //165 + LyricMain.ColSB := 210/255; //220 LyricSub.ColR := 0.4; //0.6 LyricSub.ColG := 0.4; //0.6 -- cgit v1.2.3 From 79bed9be3f06a0ce6026755fbe49bd7437bdf12e Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 27 May 2007 09:26:00 +0000 Subject: Added workaround for corrupted background Images git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@231 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index ed79bb2f..2ba7522f 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -8,9 +8,9 @@ uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UT type TScreenSing = class(TMenu) protected - paused: boolean; //Pause Mod - PauseTime: Real; - NumEmptySentences: integer; + paused: boolean; //Pause Mod + PauseTime: Real; + NumEmptySentences: integer; public //TextTime: integer; @@ -356,7 +356,12 @@ begin // set background if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then - Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background) + try + Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background); + except + log.LogError('Background could not be loaded: ' + AktSong.Path + AktSong.Background); + Tex_Background.TexNum := -1; + end else Tex_Background.TexNum := -1; -- cgit v1.2.3 From 7ee656d31524f4820b362a31fc6bc1fe0988c0dc Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 28 May 2007 18:58:08 +0000 Subject: Changed Text Spacing for a better look SelectLoadingAnimation in ScreenAdvanced hidden, because it is useless atm Changed Theme to fit the new Textspacing Fixed some Language entrys git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@232 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenOptionsAdvanced.pas | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index 4c3356d0..9cac8c5e 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -35,7 +35,9 @@ begin end; SDLK_RETURN: begin - if SelInteraction = 7 then begin + //SelectLoadAnimation Hidden because it is useless atm + //if SelInteraction = 7 then begin + if SelInteraction = 6 then begin Ini.Save; Music.PlayBack; FadeTo(@ScreenOptions); @@ -47,14 +49,18 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 6) then begin + //SelectLoadAnimation Hidden because it is useless atm + //if (SelInteraction >= 0) and (SelInteraction <= 6) then begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin Music.PlayOption; InteractInc; end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 6) then begin + //SelectLoadAnimation Hidden because it is useless atm + //if (SelInteraction >= 0) and (SelInteraction <= 6) then begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin Music.PlayOption; InteractDec; end; @@ -71,7 +77,8 @@ begin LoadFromTheme(Theme.OptionsAdvanced); - AddSelect(Theme.OptionsAdvanced.SelectLoadAnimation, Ini.LoadAnimation, ILoadAnimation); + //SelectLoadAnimation Hidden because it is useless atm + //AddSelect(Theme.OptionsAdvanced.SelectLoadAnimation, Ini.LoadAnimation, ILoadAnimation); AddSelect(Theme.OptionsAdvanced.SelectScreenFade, Ini.ScreenFade, IScreenFade); AddSelect(Theme.OptionsAdvanced.SelectEffectSing, Ini.EffectSing, IEffectSing); AddSelect(Theme.OptionsAdvanced.SelectLineBonus, Ini.LineBonus, ILineBonus); -- cgit v1.2.3 From 0a558c269217ea1eff20805e8fab8ce3ef0a2910 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 28 May 2007 19:29:24 +0000 Subject: Fixed a bug in Coverloading, that could end up in an endless loop. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@233 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 106 +++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 52 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index db5eb2b2..45c7c2de 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -718,72 +718,74 @@ begin // Songs.LoadSongList; // moved to the UltraStar unit CatSongs.Refresh; - //Set Length of Button Array one Time Instead of one time for every Song - SetButtonLength(Length(CatSongs.Song)); + if (length(CatSongs.Song) > 0) then + begin + //Set Length of Button Array one Time Instead of one time for every Song + SetButtonLength(Length(CatSongs.Song)); - I := 0; - CreateSongButtons: + I := 0; + CreateSongButtons: - try - for Pet := I to High(CatSongs.Song) do begin // creating all buttons - // new - Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 + try + for Pet := I to High(CatSongs.Song) do begin // creating all buttons + // new + Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 - if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then - CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' + if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' - if CatSongs.Song[Pet].Cover = '' then - AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) - else begin - // cache texture if there is a need to this - if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then begin - Texture.CreateCacheMipmap := true; - Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap - Texture.CreateCacheMipmap := false; + if CatSongs.Song[Pet].Cover = '' then + AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) + else begin + // cache texture if there is a need to this + if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then begin + Texture.CreateCacheMipmap := true; + Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap + Texture.CreateCacheMipmap := false; - // puts this texture to the cache file - Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + // puts this texture to the cache file + Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); - // unload full size texture - Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); + // unload full size texture + Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); - // we should also add mipmap texture by calling createtexture and use mipmap cache as data source - end; + // we should also add mipmap texture by calling createtexture and use mipmap cache as data source + end; - // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) - AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) + AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + end; + Texture.Limit := 1024*1024; + I := -1; end; - Texture.Limit := 1024*1024; - I := -1; - end; - except - //When Error is reported the First time for this Song - if (I <> Pet) then - begin - //Some Error reporting: - Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); + except + //When Error is reported the First time for this Song + if (I <> Pet) then + begin + //Some Error reporting: + Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); - //Change Cover to NoCover and Continue Loading - CatSongs.Song[Pet].Cover := ''; - I := Pet; - end - else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song - begin - Log.LogError('NoCover Cover is damaged!'); - try - AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); - except - Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); - Halt; + //Change Cover to NoCover and Continue Loading + CatSongs.Song[Pet].Cover := ''; + I := Pet; + end + else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song + begin + Log.LogError('NoCover Cover is damaged!'); + try + AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); + except + Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); + Halt; + end; + I := Pet + 1; end; - I := Pet + 1; end; - end; - - if (I <> -1) then - GoTo CreateSongButtons; + if (I <> -1) then + GoTo CreateSongButtons; + end; // Randomize Patch Randomize; -- cgit v1.2.3 From 2648bf52507205e7b00898cf2f5b6a3eb40e2229 Mon Sep 17 00:00:00 2001 From: mota23 Date: Tue, 29 May 2007 16:57:11 +0000 Subject: Added: Support for Player Name Templates. Set Names in config.ini ([NameTemplate], Name1..12=text and recall in Name-Screens with F1..F12. Fix: All 12 player- and 3 teamnames are now saved in config.ini git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@237 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenName.pas | 51 +++++++++++++++++++++++++ Game/Code/Screens/UScreenPartyPlayer.pas | 65 ++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index e2a80687..1b90c570 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -32,6 +32,57 @@ begin Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + chr(ScanCode); end; + // Templates for Names Mod + SDLK_F1: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[0]; + end; + SDLK_F2: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[1]; + end; + SDLK_F3: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[2]; + end; + SDLK_F4: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[3]; + end; + SDLK_F5: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[4]; + end; + SDLK_F6: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[5]; + end; + SDLK_F7: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[6]; + end; + SDLK_F8: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[7]; + end; + SDLK_F9: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[8]; + end; + SDLK_F10: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[9]; + end; + SDLK_F11: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[10]; + end; + SDLK_F12: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[11]; + end; + + SDLK_BACKSPACE: begin Button[Interaction].Text[0].DeleteLastL; diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index f6bcb0b7..e8607470 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -61,6 +61,56 @@ begin Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + chr(ScanCode); end; + // Templates for Names Mod + SDLK_F1: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[0]; + end; + SDLK_F2: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[1]; + end; + SDLK_F3: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[2]; + end; + SDLK_F4: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[3]; + end; + SDLK_F5: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[4]; + end; + SDLK_F6: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[5]; + end; + SDLK_F7: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[6]; + end; + SDLK_F8: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[7]; + end; + SDLK_F9: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[8]; + end; + SDLK_F10: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[9]; + end; + SDLK_F11: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[10]; + end; + SDLK_F12: + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[11]; + end; + SDLK_BACKSPACE: begin Button[Interaction].Text[0].DeleteLastL; @@ -135,6 +185,21 @@ procedure TScreenPartyPlayer.onShow; var I: integer; begin + // Templates for Names Mod + for I := 1 to 4 do + Button[I].Text[0].Text := Ini.Name[I-1]; + + for I := 6 to 9 do + Button[I].Text[0].Text := Ini.Name[I-2]; + + for I := 11 to 14 do + Button[I].Text[0].Text := Ini.Name[I-3]; + + Button[0].Text[0].Text := Ini.NameTeam[0]; + Button[5].Text[0].Text := Ini.NameTeam[1]; + Button[10].Text[0].Text := Ini.NameTeam[2]; + // Templates for Names Mod end + If (PartySession.Teams.NumTeams>=1) then begin Button[0].Visible := True; -- cgit v1.2.3 From 514ece97aaeb8eaa8bf56e224826bc5e6169ce8b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 3 Jun 2007 19:00:14 +0000 Subject: Some Code Cleanup in UScreenSong Add Procedure DeletePlaylist to TPlaylistManager Add automatic Playlist Deleting if last Song is deleted Fixed some Cover displaying Bugs when JumptoMenu is left git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@242 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 37 +++++++++++++++------------------ Game/Code/Screens/UScreenSongJumpto.pas | 1 + Game/Code/Screens/UScreenSongMenu.pas | 2 +- 3 files changed, 19 insertions(+), 21 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 45c7c2de..3924968f 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -95,6 +95,8 @@ type procedure DoJoker(Team: Byte); procedure SelectPlayers; + procedure UnLoadDetailedCover; + //Extensions procedure DrawExtensions; end; @@ -1379,13 +1381,7 @@ begin if VS > 0 then begin - CoverTime := 0; - Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture - Button[Interaction].Texture2.Alpha := 0; - - //0.5.0: unload old full size texture - if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then - Texture.UnloadTexture(Button[Interaction].Texture.Name, false); + UnLoadDetailedCover; Skip := 1; @@ -1417,13 +1413,7 @@ begin if VS > 0 then begin - CoverTime := 0; - Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture - Button[Interaction].Texture2.Alpha := 0; - - //0.5.0: unload old full size texture - if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then - Texture.UnloadTexture(Button[Interaction].Texture.Name, false); + UnLoadDetailedCover; Skip := 1; @@ -1470,12 +1460,7 @@ var Skip: integer; I: integer; begin - CoverTime := 0; - Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture - Button[Interaction].Texture2.Alpha := 0; - - if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then - Texture.UnloadTexture(Button[Interaction].Texture.Name, false); + UnLoadDetailedCover; Interaction := High(CatSongs.Song); SongTarget := 0; @@ -1809,6 +1794,18 @@ begin end; end; +//Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song +procedure TScreenSong.UnLoadDetailedCover; +begin + CoverTime := 0; + + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture + Button[Interaction].Texture2.Alpha := 0; + + if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then + Texture.UnloadTexture(Button[Interaction].Texture.Name, false); +end; + procedure TScreenSong.Refresh; begin { CatSongs.Refresh; diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 2ea94cdc..560868a5 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -97,6 +97,7 @@ begin Music.PlayBack; if (VisSongs = 0) AND (Length(Button[0].Text[0].Text) > 0) then begin + ScreenSong.UnLoadDetailedCover; Button[0].Text[0].Text := ''; CatSongs.SetFilter('', 0); SetTextFound(0); diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 2469240f..3814334c 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -414,7 +414,7 @@ begin 1: //Button 2 begin //Select New Players then Sing: - + ScreenSong.SelectPlayers; Visible := False; end; -- cgit v1.2.3 From 49ada15c935658c5d90416e26acfb360f1e7c047 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 3 Jun 2007 19:45:43 +0000 Subject: Added SongPreview Fading Song Preview Max Volume is now 70 % Need Testing because of timing git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@243 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 3924968f..ae02b2f4 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1275,6 +1275,8 @@ begin Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); Music.MoveTo(Music.Length / 4); Music.Play; + //Music Fade (Start not with max Volume) + Music.SetMusicVolume(70); SetScroll; UpdateLCD; end; @@ -1349,18 +1351,25 @@ begin // Log.LogBenchmark('SetScroll4', 5); - // 0.5.0: cover fade + // 0.5.0: cover fade and Song Fade if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin // load new texture Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); Button[Interaction].Texture.Alpha := 1; Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); Button[Interaction].Texture2.Alpha := 1; + + //Play Song + Music.SetMusicVolume(20); + Music.Play; end; CoverTime := CoverTime + TimeSkip; Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; + if (CoverTime > 1) and (CoverTime <= 3.5) then + Music.SetMusicVolume(Round((CoverTime-1)* 20)); + inherited Draw; @@ -1448,7 +1457,8 @@ begin Music.Close; if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin Music.MoveTo(Music.Length / 4); - Music.Play; + //Song Fading: Not Play Directly + //Music.Play; end; end else -- cgit v1.2.3 From d08356e3b64d8738ff9672229c1bbe963b58337c Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 6 Jun 2007 20:24:29 +0000 Subject: Fixed some Bugs in Song Fading Added Ini Values to change the Fading and the Preview Volume git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@245 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 103 ++++++++++++++++++++++++++------------ 1 file changed, 70 insertions(+), 33 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index ae02b2f4..ee05c11c 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1271,12 +1271,21 @@ begin if Length(CatSongs.Song) > 0 then begin - Music.SetLoop(false); - Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); - Music.MoveTo(Music.Length / 4); - Music.Play; - //Music Fade (Start not with max Volume) - Music.SetMusicVolume(70); + //Load Music only when Song Preview is activated + if (Ini.PreviewVolume <> 0) then + begin + Music.SetLoop(false); + Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + Music.MoveTo(Music.Length / 4); + Music.Play; + + //Set Preview Volume + Music.SetMusicVolume (Ini.PreviewVolume * 10); + {//if Music Fade is activated, Set Volume to 0 % + if (Ini.PreviewFading <> 0) then + Music.SetMusicVolume(0);} + end; + SetScroll; UpdateLCD; end; @@ -1312,6 +1321,10 @@ end; procedure TScreenSong.onHide; begin + //When Music Fading is activated, Turn Music to 100 % + If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then + Music.SetMusicVolume(100); + //When hide then Stop Music (For Party Mode Popup on Exit) if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then Music.Stop; @@ -1350,25 +1363,42 @@ begin // Log.BenchmarkEnd(5); // Log.LogBenchmark('SetScroll4', 5); + //Fading Functions, Only if Covertime is under 5 Seconds + If (CoverTime < 5) then + begin + // 0.5.0: cover fade + if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin + // load new texture + Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture.Alpha := 1; + Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture2.Alpha := 1; + end; - // 0.5.0: cover fade and Song Fade - if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin - // load new texture - Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); - Button[Interaction].Texture.Alpha := 1; - Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); - Button[Interaction].Texture2.Alpha := 1; + //Song Fade + if (CatSongs.VisibleSongs > 0) AND (Ini.PreviewVolume <> 0) AND (Not CatSongs.Song[Interaction].Main) AND (Ini.PreviewFading <> 0) then + begin + //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling + if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then + Music.Play; - //Play Song - Music.SetMusicVolume(20); - Music.Play; - end; - CoverTime := CoverTime + TimeSkip; - Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; - if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; + //Update Song Volume + if (CoverTime < Ini.PreviewFading) then + Music.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) + else + Music.SetMusicVolume(Ini.PreviewVolume * 10); + + end; - if (CoverTime > 1) and (CoverTime <= 3.5) then - Music.SetMusicVolume(Round((CoverTime-1)* 20)); + + //Update Fading Time + CoverTime := CoverTime + TimeSkip; + + //Update Fading Texture + Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; + if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; + + end; inherited Draw; @@ -1452,17 +1482,24 @@ end; //Procedure Change current played Preview procedure TScreenSong.ChangeMusic; begin - if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then - begin - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); - //Song Fading: Not Play Directly - //Music.Play; - end; - end - else - Music.Stop; + //When Music Preview is avtivated -> then Change Music + if (Ini.PreviewVolume <> 0) then + begin + if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then + begin + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal + if (Ini.PreviewVolume <> 0) then + Music.SetMusicVolume(0) + else + Music.Play; + end; + end + else + Music.Stop; + end; end; procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0 -- cgit v1.2.3 From 18579e1d865dc0fbd9c179fc5d45b1fff2b9033b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 7 Jun 2007 07:42:38 +0000 Subject: Fixed 2 Bugs in Song Preview Fading git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@247 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index ee05c11c..1a5b41b8 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1325,6 +1325,10 @@ begin If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then Music.SetMusicVolume(100); + //If Preview is deactivated: Load MUsicfile now + If (Ini.PreviewVolume = 0) then + Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + //When hide then Stop Music (For Party Mode Popup on Exit) if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then Music.Stop; @@ -1491,10 +1495,10 @@ begin if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin Music.MoveTo(Music.Length / 4); //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal - if (Ini.PreviewVolume <> 0) then - Music.SetMusicVolume(0) + if (Ini.PreviewFading = 0) then + Music.Play else - Music.Play; + Music.SetMusicVolume(0); end; end else -- cgit v1.2.3 From 4131257e42ceb88fa4fb2849b5c40011e8b5635d Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 8 Jun 2007 16:23:40 +0000 Subject: Added ability to delete a Playlist within the Menu Language Files updated git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@248 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSongMenu.pas | 55 ++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 7 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 3814334c..06b8f183 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -27,9 +27,10 @@ const SM_Playlist_Add = 64 or 2; SM_Playlist_New = 64 or 3; - SM_Playlist_Del = 64 or 5; + SM_Playlist_DelItem = 64 or 5; SM_Playlist_Load = 64 or 8 or 1; + SM_Playlist_Del = 64 or 8 or 5; SM_Party_Main = 128 or 1; @@ -42,7 +43,7 @@ var implementation -uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist; +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist, USongs; function TScreenSongMenu.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -265,10 +266,10 @@ begin Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); end; - SM_PlayList_Del: + SM_Playlist_DelItem: begin CurMenu := sMenu; - Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_DEL'); + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_DELITEM'); Button[0].Visible := True; Button[1].Visible := False; @@ -285,12 +286,15 @@ begin CurMenu := sMenu; Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_LOAD'); - Button[0].Visible := False; + //Show Delete Curent Playlist Button when Playlist is opened + Button[0].Visible := (CatSongs.CatNumShow = -3); + Button[1].Visible := False; Button[2].Visible := False; Button[3].Visible := True; SelectsS[0].Visible := True; + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_DELCURRENT'); Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_LOAD'); SetLength(ISelections, Length(PlaylistMan.Playlists)); @@ -311,6 +315,21 @@ begin end; end; + SM_Playlist_Del: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_DEL'); + + Button[0].Visible := True; + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); + end; + SM_Party_Main: begin @@ -421,7 +440,7 @@ begin 2: //Button 3 begin //Show add to Playlist Menu - MenuShow(SM_Playlist_Del); + MenuShow(SM_Playlist_DelItem); end; 3: //SelectSlide 3 @@ -488,7 +507,7 @@ begin end; end; - SM_PlayList_Del: + SM_Playlist_DelItem: begin Visible := False; Case Interaction of @@ -509,6 +528,10 @@ begin SM_Playlist_Load: begin Case Interaction of + 0: //Button 1 (Delete Playlist) + begin + MenuShow(SM_Playlist_Del); + end; 4: //Button 4 begin //Load Playlist @@ -518,6 +541,24 @@ begin end; end; + SM_Playlist_Del: + begin + Visible := False; + Case Interaction of + 0: //Button 1 + begin + //Delete + PlayListMan.DelPlaylist(PlaylistMan.CurPlayList); + Visible := False; + end; + + 4: //Button 4 + begin + MenuShow(SM_Playlist_Load); + end; + end; + end; + SM_Party_Main: begin Case Interaction of -- cgit v1.2.3 From 56980dfdb5a44e03608689d3cd479d5c1c4a6dc4 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 8 Jun 2007 18:29:33 +0000 Subject: Party Win Screen now changes the colors of the TeamBgs automaticly when Color = TeamColor Changed Deluxe Team to fit the Changes git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@249 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenPartyWin.pas | 77 +++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas index 1c4549a4..76d0420f 100644 --- a/Game/Code/Screens/UScreenPartyWin.pas +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -93,6 +93,14 @@ procedure TScreenPartyWin.onShow; var I: Integer; Placing: TeamOrderArray; + Function GetTeamColor(Team: Byte): Cardinal; + var + NameString: String; + begin + NameString := 'P' + InttoStr(Team+1) + 'Dark'; + + Result := ColorExists(NameString); + end; begin //Get Team Placing Placing := PartySession.GetTeamOrder; @@ -110,6 +118,29 @@ begin Static[StaticTeam1].Visible := True; Static[StaticTeam1BG].Visible := True; Static[StaticTeam1Deco].Visible := True; + + //Set Static Color to Team Color + If (Theme.PartyWin.StaticTeam1BG.Color = 'TeamColor') then + begin + I := GetTeamColor(Placing[0]); + if (I <> -1) then + begin + Static[StaticTeam1BG].Texture.ColR := Color[I].RGB.R; + Static[StaticTeam1BG].Texture.ColG := Color[I].RGB.G; + Static[StaticTeam1BG].Texture.ColB := Color[I].RGB.B; + end; + end; + + If (Theme.PartyWin.StaticTeam1.Color = 'TeamColor') then + begin + I := GetTeamColor(Placing[0]); + if (I <> -1) then + begin + Static[StaticTeam1].Texture.ColR := Color[I].RGB.R; + Static[StaticTeam1].Texture.ColG := Color[I].RGB.G; + Static[StaticTeam1].Texture.ColB := Color[I].RGB.B; + end; + end; end else begin @@ -130,6 +161,29 @@ begin Static[StaticTeam2].Visible := True; Static[StaticTeam2BG].Visible := True; Static[StaticTeam2Deco].Visible := True; + + //Set Static Color to Team Color + If (Theme.PartyWin.StaticTeam2BG.Color = 'TeamColor') then + begin + I := GetTeamColor(Placing[1]); + if (I <> -1) then + begin + Static[StaticTeam2BG].Texture.ColR := Color[I].RGB.R; + Static[StaticTeam2BG].Texture.ColG := Color[I].RGB.G; + Static[StaticTeam2BG].Texture.ColB := Color[I].RGB.B; + end; + end; + + If (Theme.PartyWin.StaticTeam2.Color = 'TeamColor') then + begin + I := GetTeamColor(Placing[1]); + if (I <> -1) then + begin + Static[StaticTeam2].Texture.ColR := Color[I].RGB.R; + Static[StaticTeam2].Texture.ColG := Color[I].RGB.G; + Static[StaticTeam2].Texture.ColB := Color[I].RGB.B; + end; + end; end else begin @@ -150,6 +204,29 @@ begin Static[StaticTeam3].Visible := True; Static[StaticTeam3BG].Visible := True; Static[StaticTeam3Deco].Visible := True; + + //Set Static Color to Team Color + If (Theme.PartyWin.StaticTeam3BG.Color = 'TeamColor') then + begin + I := GetTeamColor(Placing[2]); + if (I <> -1) then + begin + Static[StaticTeam3BG].Texture.ColR := Color[I].RGB.R; + Static[StaticTeam3BG].Texture.ColG := Color[I].RGB.G; + Static[StaticTeam3BG].Texture.ColB := Color[I].RGB.B; + end; + end; + + If (Theme.PartyWin.StaticTeam3.Color = 'TeamColor') then + begin + I := GetTeamColor(Placing[2]); + if (I <> -1) then + begin + Static[StaticTeam3].Texture.ColR := Color[I].RGB.R; + Static[StaticTeam3].Texture.ColG := Color[I].RGB.G; + Static[StaticTeam3].Texture.ColB := Color[I].RGB.B; + end; + end; end else begin -- cgit v1.2.3 From 6130b0841429920015301a661e5133cfd1ed3cb3 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 8 Jun 2007 18:43:34 +0000 Subject: Fixed: Up and Down now don't leave Playlist and Search Mode anymore git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@250 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 127 +++++++++++++++++--------------------- 1 file changed, 58 insertions(+), 69 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 1a5b41b8..2ce06d7a 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -381,7 +381,6 @@ begin end else if (Mode = 1) then //PartyMode -> Show Menu begin - //Is this Right? if (Ini.PartyPopup = 1) then ScreenSongMenu.MenuShow(SM_Party_Main) else @@ -427,93 +426,83 @@ begin SDLK_DOWN: begin - if (Mode = 0) then - begin -{ if Length(Songs.Song) > 0 then begin - Music.PlayChange; - InteractNext; - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then Music.Play; - SetScroll; - end;} - - //Cat Change Hack - if Ini.Tabs_at_startup = 1 then + if (Mode = 0) then + begin + //Only Change Cat when not in Playlist or Search Mode + if (CatSongs.CatNumShow > -2) then begin - I := Interaction; - if I <= 0 then I := 1; - - while not catsongs.Song[I].Main do + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then begin - Inc (I); - if (I > high(catsongs.Song)) then - I := low(catsongs.Song); - end; + I := Interaction; + if I <= 0 then I := 1; - Interaction := I; + while not catsongs.Song[I].Main do + begin + Inc (I); + if (I > high(catsongs.Song)) then + I := low(catsongs.Song); + end; - //Show Cat in Top Left Mod - ShowCatTL (Interaction); + Interaction := I; - CatSongs.ClickCategoryButton(Interaction); - SelectNext; - FixSelected; + //Show Cat in Top Left Mod + ShowCatTL (Interaction); - //Play Music: - Music.PlayChange; - ChangeMusic; + CatSongs.ClickCategoryButton(Interaction); + SelectNext; + FixSelected; - end; + //Play Music: + Music.PlayChange; + ChangeMusic; - // - //Cat Change Hack End} - end; + end; + + // + //Cat Change Hack End} + end; + end; end; SDLK_UP: begin - if (Mode = 0) then - begin -{ if Length(Songs.Song) > 0 then begin - Music.PlayChange; - InteractPrev; - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then Music.Play; - SetScroll; - end;} - //Cat Change Hack - if Ini.Tabs_at_startup = 1 then + if (Mode = 0) then + begin + //Only Change Cat when not in Playlist or Search Mode + if (CatSongs.CatNumShow > -2) then begin - I := Interaction; - I2 := 0; - if I <= 0 then I := 1; - - while not catsongs.Song[I].Main or (I2 = 0) do + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then begin - if catsongs.Song[I].Main then - Inc(I2); - Dec (I); - if (I < low(catsongs.Song)) then - I := high(catsongs.Song); - end; + I := Interaction; + I2 := 0; + if I <= 0 then I := 1; - Interaction := I; + while not catsongs.Song[I].Main or (I2 = 0) do + begin + if catsongs.Song[I].Main then + Inc(I2); + Dec (I); + if (I < low(catsongs.Song)) then + I := high(catsongs.Song); + end; - //Show Cat in Top Left Mod - ShowCatTL (I); + Interaction := I; - CatSongs.ClickCategoryButton(I); - SelectNext; - FixSelected; + //Show Cat in Top Left Mod + ShowCatTL (I); - //Play Music: - Music.PlayChange; - ChangeMusic; + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + //Play Music: + Music.PlayChange; + ChangeMusic; + end; end; - - // - //Cat Change Hack End} - end; + //Cat Change Hack End} + end; end; SDLK_RIGHT: -- cgit v1.2.3 From 141878175d76d013be3ec8fb9fd0a58dc9b0d3eb Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 9 Jun 2007 10:10:25 +0000 Subject: Added Preview Volume and Fading to Sound Options Changed Themes to Fit these changes Updated Language Files Some fixes in SelectSlide git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@251 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenOptionsSound.pas | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index c99f1ef6..fb04ab64 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -35,7 +35,7 @@ begin end; SDLK_RETURN: begin - if SelInteraction = 4 then begin + if SelInteraction = 6 then begin Ini.Save; Music.PlayBack; FadeTo(@ScreenOptions); @@ -47,14 +47,14 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin Music.PlayOption; InteractInc; end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin Music.PlayOption; InteractDec; end; @@ -76,6 +76,11 @@ begin AddSelect(Theme.OptionsSound.SelectBeatClick, Ini.BeatClick, IBeatClick); AddSelect(Theme.OptionsSound.SelectThreshold, Ini.Threshold, IThreshold); + //Song Preview + AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewVolume, Ini.PreviewVolume, IPreviewVolume); + AddSelectSlide + (Theme.OptionsSound.SelectSlidePreviewFading, Ini.PreviewFading, IPreviewFading); + AddButton(Theme.OptionsSound.ButtonExit); if (Length(Button[0].Text)=0) then AddButtonText(14, 20, Theme.Options.Description[7]); -- cgit v1.2.3 From 02a59ca2d7f440a441ddf2e2b733ff5497714611 Mon Sep 17 00:00:00 2001 From: mota23 Date: Sun, 10 Jun 2007 13:15:04 +0000 Subject: Completed Player-names. F1..F12 gets Template-Name from Ini. Alt-F1..F12 writes Template-Name to Ini. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@256 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenName.pas | 137 +++++++++++++++++++++++-------- Game/Code/Screens/UScreenPartyPlayer.pas | 137 +++++++++++++++++++++++-------- 2 files changed, 202 insertions(+), 72 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index 1b90c570..0d98e944 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -22,10 +22,15 @@ uses UGraphic, UMain, UIni, UTexture; function TScreenName.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; var I: integer; +SDL_ModState: Word; begin Result := true; If (PressedDown) Then begin // Key Down + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + case PressedKey of 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 @@ -34,53 +39,113 @@ begin // Templates for Names Mod SDLK_F1: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[0]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[0] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[0]; + end; SDLK_F2: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[1]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[1] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[1]; + end; SDLK_F3: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[2]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[2] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[2]; + end; SDLK_F4: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[3]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[3] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[3]; + end; SDLK_F5: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[4]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[4] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[4]; + end; SDLK_F6: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[5]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[5] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[5]; + end; SDLK_F7: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[6]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[6] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[6]; + end; SDLK_F8: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[7]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[7] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[7]; + end; SDLK_F9: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[8]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[8] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[8]; + end; SDLK_F10: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[9]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[9] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[9]; + end; SDLK_F11: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[10]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[10] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[10]; + end; SDLK_F12: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[11]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[11] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[11]; + end; SDLK_BACKSPACE: diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index e8607470..d6859775 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -39,6 +39,7 @@ uses UGraphic, UMain, UIni, UTexture, UParty; function TScreenPartyPlayer.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; var I, J: integer; + SDL_ModState: Word; procedure IntNext; begin repeat @@ -54,6 +55,10 @@ var begin Result := true; If (PressedDown) Then + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + begin // Key Down case PressedKey of 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: @@ -63,53 +68,113 @@ begin // Templates for Names Mod SDLK_F1: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[0]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[0] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[0]; + end; SDLK_F2: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[1]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[1] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[1]; + end; SDLK_F3: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[2]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[2] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[2]; + end; SDLK_F4: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[3]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[3] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[3]; + end; SDLK_F5: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[4]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[4] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[4]; + end; SDLK_F6: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[5]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[5] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[5]; + end; SDLK_F7: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[6]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[6] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[6]; + end; SDLK_F8: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[7]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[7] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[7]; + end; SDLK_F9: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[8]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[8] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[8]; + end; SDLK_F10: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[9]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[9] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[9]; + end; SDLK_F11: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[10]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[10] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[10]; + end; SDLK_F12: - begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[11]; - end; + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[11] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[11]; + end; SDLK_BACKSPACE: begin -- cgit v1.2.3 From 03c2049c1685ca6ec0046e422d65de1e996fc209 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 10 Jun 2007 14:40:20 +0000 Subject: Fixed a Bug in ScreenSong Equalizer that causes an Invalid Pointer Exception when US is closed. Changed Themes to fit the changes git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@258 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 2ce06d7a..87aa122e 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1533,9 +1533,10 @@ begin B:=0; Pos := 0; - Res := floor(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band + Res := ceil(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band + //Change Lengths - for I := 0 to 92 do + for I := 0 to (Res * Theme.Song.Equalizer.Bands - 1) do begin A := floor(I/Res); @@ -1589,7 +1590,7 @@ begin PosY := Theme.Song.Equalizer.Y; PosX := Theme.Song.Equalizer.X; - For I := 0 to Theme.Song.Equalizer.Bands do + For I := 0 to Theme.Song.Equalizer.Bands-1 do begin if Theme.Song.Equalizer.Direction then PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length -- cgit v1.2.3 From 3ecabca816142dcc2b7044aa637285514a4f9b2d Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 14 Jun 2007 12:52:43 +0000 Subject: No Up/Down needed anymore in Jump to Menu Type can be changed now by pressing Left/Right while Button is Selected git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@261 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSongJumpto.pas | 60 ++++++++------------------------- 1 file changed, 14 insertions(+), 46 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 560868a5..7103257d 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -38,36 +38,6 @@ implementation uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, USongs, UScreenSong, ULog; function TScreenSongJumpto.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; - function IsVisible: Boolean; - begin - Result := True; - if (Interactions[Interaction].Typ = 0) then - begin - Result := Button[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 1) then - begin - //Result := Selects[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 3) then - begin - Result := SelectsS[Interactions[Interaction].Num].Visible; - end; - end; - - Procedure SelectNext; - begin - repeat - InteractNext; - until IsVisible; - end; - - Procedure SelectPrev; - begin - repeat - InteractPrev; - until IsVisible; - end; begin Result := true; If (PressedDown) Then @@ -109,33 +79,31 @@ begin // functions like this one, called so many times SDLK_DOWN: begin - SelectNext; - Button[0].Text[0].Selected := (Interaction = 0); + {SelectNext; + Button[0].Text[0].Selected := (Interaction = 0);} end; SDLK_UP: begin - SelectPrev; - Button[0].Text[0].Selected := (Interaction = 0); + {SelectPrev; + Button[0].Text[0].Selected := (Interaction = 0); } end; SDLK_RIGHT: begin - if (Interaction=1) then - begin - InteractInc; - if (Length(Button[0].Text[0].Text) > 0) then - SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); - end; + Interaction := 1; + InteractInc; + if (Length(Button[0].Text[0].Text) > 0) then + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + Interaction := 0; end; SDLK_LEFT: begin - if (Interaction=1) then - begin - InteractDec; - if (Length(Button[0].Text[0].Text) > 0) then - SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); - end; + Interaction := 1; + InteractDec; + if (Length(Button[0].Text[0].Text) > 0) then + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + Interaction := 0; end; end; end; -- cgit v1.2.3 From 077d1c500e6a90870dfa979303cd5003feffc359 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 20 Jun 2007 18:14:10 +0000 Subject: Enabled Deco Texurechanging depending on TeamPlaylings in PartyScore Screen Changed Theme to fit the Changes git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@266 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenPartyScore.pas | 87 ++++++++++++++++++++++++++++++++- 1 file changed, 85 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index 324656c0..5c632356 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -25,6 +25,11 @@ type StaticTeam3Deco: Cardinal; TextWinner: Cardinal; + DecoTex: Array[0..5] of Integer; + DecoColor: Array[0..5] of Record + R, G, B: Real; + end; + MaxScore: Word; constructor Create; override; @@ -35,7 +40,7 @@ type implementation -uses UGraphic, UMain, UParty, UScreenSingModi, ULanguage; +uses UGraphic, UMain, UParty, UScreenSingModi, ULanguage, UTexture, USkins; function TScreenPartyScore.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -75,6 +80,9 @@ end; constructor TScreenPartyScore.Create; var I: integer; + Tex: TTexture; + R, G, B: Real; + Color: Integer; begin inherited Create; @@ -97,12 +105,50 @@ begin TextWinner := AddText (Theme.PartyScore.TextWinner); + //Load Deco Textures + if Theme.PartyScore.DecoTextures.ChangeTextures then + begin + //Get Color + LoadColor(R, G, B, Theme.PartyScore.DecoTextures.FirstColor); + Color := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + DecoColor[0].R := R; + DecoColor[0].G := G; + DecoColor[0].B := B; + + //Load Texture + Tex := Texture.LoadTexture(pchar(Skin.GetTextureFileName(Theme.PartyScore.DecoTextures.FirstTexture)), 'JPG', PChar(Theme.PartyScore.DecoTextures.FirstTyp), Color); + DecoTex[0] := Tex.TexNum; + + //Get Second Color + LoadColor(R, G, B, Theme.PartyScore.DecoTextures.SecondColor); + Color := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + DecoColor[1].R := R; + DecoColor[1].G := G; + DecoColor[1].B := B; + + //Load Second Texture + Tex := Texture.LoadTexture(pchar(Skin.GetTextureFileName(Theme.PartyScore.DecoTextures.SecondTexture)), 'JPG', PChar(Theme.PartyScore.DecoTextures.SecondTyp), Color); + DecoTex[1] := Tex.TexNum; + + //Get Third Color + LoadColor(R, G, B, Theme.PartyScore.DecoTextures.ThirdColor); + Color := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + DecoColor[2].R := R; + DecoColor[2].G := G; + DecoColor[2].B := B; + + //Load Third Texture + Tex := Texture.LoadTexture(pchar(Skin.GetTextureFileName(Theme.PartyScore.DecoTextures.ThirdTexture)), 'JPG', PChar(Theme.PartyScore.DecoTextures.ThirdTyp), Color); + DecoTex[2] := Tex.TexNum; + end; + LoadFromTheme(Theme.PartyScore); end; procedure TScreenPartyScore.onShow; var - I: Integer; + I, J: Integer; + Placings: Array [0..5] of Byte; begin //Get Maxscore MaxScore := 0; @@ -112,6 +158,16 @@ begin MaxScore := ScreenSingModi.PlayerInfo.Playerinfo[I].Score; end; + //Get Placings + for I := 0 to ScreenSingModi.PlayerInfo.NumPlayers - 1 do + begin + Placings[I] := 0; + for J := 0 to ScreenSingModi.PlayerInfo.NumPlayers - 1 do + If (ScreenSingModi.PlayerInfo.Playerinfo[J].Score > ScreenSingModi.PlayerInfo.Playerinfo[I].Score) then + Inc(Placings[I]); + end; + + //Set Static Length Static[StaticTeam1].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[0].Percentage / 100; Static[StaticTeam2].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100; @@ -133,6 +189,15 @@ begin Text[TextScoreTeam1].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[0].Score); Text[TextNameTeam1].Text := String(ScreenSingModi.TeamInfo.Teaminfo[0].Name); + //Set Deco Texture + if Theme.PartyScore.DecoTextures.ChangeTextures then + begin + Static[StaticTeam1Deco].Texture.TexNum := DecoTex[Placings[0]]; + Static[StaticTeam1Deco].Texture.ColR := DecoColor[Placings[0]].R; + Static[StaticTeam1Deco].Texture.ColG := DecoColor[Placings[0]].G; + Static[StaticTeam1Deco].Texture.ColB := DecoColor[Placings[0]].B; + end; + Text[TextScoreTeam1].Visible := True; Text[TextNameTeam1].Visible := True; Static[StaticTeam1].Visible := True; @@ -153,6 +218,15 @@ begin Text[TextScoreTeam2].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[1].Score); Text[TextNameTeam2].Text := String(ScreenSingModi.TeamInfo.Teaminfo[1].Name); + //Set Deco Texture + if Theme.PartyScore.DecoTextures.ChangeTextures then + begin + Static[StaticTeam2Deco].Texture.TexNum := DecoTex[Placings[1]]; + Static[StaticTeam2Deco].Texture.ColR := DecoColor[Placings[1]].R; + Static[StaticTeam2Deco].Texture.ColG := DecoColor[Placings[1]].G; + Static[StaticTeam2Deco].Texture.ColB := DecoColor[Placings[1]].B; + end; + Text[TextScoreTeam2].Visible := True; Text[TextNameTeam2].Visible := True; Static[StaticTeam2].Visible := True; @@ -173,6 +247,15 @@ begin Text[TextScoreTeam3].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[2].Score); Text[TextNameTeam3].Text := String(ScreenSingModi.TeamInfo.Teaminfo[2].Name); + //Set Deco Texture + if Theme.PartyScore.DecoTextures.ChangeTextures then + begin + Static[StaticTeam3Deco].Texture.TexNum := DecoTex[Placings[2]]; + Static[StaticTeam3Deco].Texture.ColR := DecoColor[Placings[2]].R; + Static[StaticTeam3Deco].Texture.ColG := DecoColor[Placings[2]].G; + Static[StaticTeam3Deco].Texture.ColB := DecoColor[Placings[2]].B; + end; + Text[TextScoreTeam3].Visible := True; Text[TextNameTeam3].Visible := True; Static[StaticTeam3].Visible := True; -- cgit v1.2.3 From e0c4de18cabd3f1f27376afe389cdd4470ee198d Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 25 Jun 2007 12:24:53 +0000 Subject: Fixed wrong sentence timings (T in Editor) when last note of a sentence and first note of the next sentence overlap. Fixed 2 Bugs in Midi Converter: Notes were added more than once to txt when the save Button is pressed multiple times Notes are added more than once when open is pressed multiple time Added sentence start calculating to Midi Converter git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@267 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditConvert.pas | 30 ++++++++++++++++++++++++++++++ Game/Code/Screens/UScreenEditSub.pas | 8 ++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index 92e8544c..f1e3ba32 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -54,8 +54,10 @@ type BPM: real; Ticks: real; Nuta: array of TNuta; + procedure AddLyric(Start: integer; Tekst: string); procedure Extract; + procedure MidiFile1MidiEvent(event: PMidiEvent); function SelectedNumber: integer; constructor Create; override; @@ -192,6 +194,7 @@ var Nu: integer; NutaTemp: TNuta; Move: integer; + Max, Min: integer; begin // song info Song.Title := ''; @@ -201,6 +204,8 @@ begin 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 @@ -265,6 +270,27 @@ begin 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 @@ -388,7 +414,11 @@ begin 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); diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index a0adef2c..8a5eaab8 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -730,8 +730,12 @@ begin 0: S := Max; 1: S := Max; 2: S := Max - 1; - 3..3: S := Max - 2; - 4..10000: S := Min + 2; // poczatek + 2 + 3: S := Max - 2; + else + if ((Max - Min) > 4) then + S := Min + 2 + else + S := Max; end; // case Czesci[0].Czesc[C].Start := S; -- cgit v1.2.3 From dce08a8771098ac1a56dd4548202454ab268e951 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 3 Jul 2007 14:56:15 +0000 Subject: Fixed a bug in EditorSub that causes a crash when the last note of a sentence was deleted. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@273 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditSub.pas | 53 ++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 12 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 8a5eaab8..9e84462d 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -882,20 +882,49 @@ var begin C := Czesci[0].Akt; - // 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; - SetLength(Czesci[0].Czesc[C].Nuta, NLen); - Dec(Czesci[0].Czesc[C].HighNut); - Dec(Czesci[0].Czesc[C].IlNut); + //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; - // me slightly modify new note - if AktNuta > Czesci[0].Czesc[C].HighNut then Dec(AktNuta); - Czesci[0].Czesc[C].Nuta[AktNuta].Color := 1; + 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); -- cgit v1.2.3 From a1612bc4ad4ebbfe166ce8006012b6cac4c0abf3 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 9 Jul 2007 16:42:38 +0000 Subject: Fixed Bug in Stat Main: Categorys was counted as Songs git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@283 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenStatMain.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index 54457a6e..b3907d41 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -170,7 +170,7 @@ begin %2:d Count of UnSung Songs %3:d Count of Songs with Video (A3) %4:s Name of the most popular Song} - A1 := Length(CatSongs.Song); + A1 := Length(Songs.Song); A2 := Database.GetTotalEntrys(2); A3 := SongswithVid; -- cgit v1.2.3 From a65e818d0a8ecac47b7710e8546897e271d0ca44 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 15 Jul 2007 17:21:12 +0000 Subject: Fixed a bug in Note Name convertation git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@297 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditSub.pas | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 9e84462d..9ca45f55 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -1291,8 +1291,18 @@ end; function TScreenEditSub.GetNoteName(Note: Integer): String; var N1, N2: Integer; begin - N1 := Note mod 12; - N2 := Note div 12; + 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'; -- cgit v1.2.3 From abf2c5300a9ffca0159199237da2f442aa3a57aa Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 15 Jul 2007 18:13:59 +0000 Subject: Fixed a bug in Party playlist selection when no playlist or category is available git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@298 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenPartyOptions.pas | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index aa8681d0..49cc8c53 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -63,11 +63,15 @@ begin 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 PlayList - //(Todo) + + //Save Num Teams: PartySession.Teams.NumTeams := NumTeams + 2; PartySession.Teams.Teaminfo[0].NumPlayers := NumPlayer1+1; @@ -76,6 +80,7 @@ begin //Save Playlist PlaylistMan.Mode := Playlist; + PlaylistMan.CurPlayList := High(Cardinal); //If Category Selected Search Category ID if Playlist = 1 then begin @@ -91,6 +96,10 @@ begin Break; end; end; + + //No Categorys or Invalid Entry + If PlaylistMan.CurPlayList = High(Cardinal) then + Exit; end else PlaylistMan.CurPlayList := Playlist2; @@ -203,11 +212,25 @@ begin 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 - SetLength(IPlaylist2, Length(PlaylistMan.Playlists)); - PlaylistMan.GetNames(IPlaylist2); + 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; -- cgit v1.2.3 From 2722fcd0ddec2fa8f7cd9af74efd54870cc94e8d Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 18 Jul 2007 20:18:27 +0000 Subject: Little hack in SongScreen that fixes problems with blending. Drawing order changed only for SongScreen: Buttons -> Statics -> Texts git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@301 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 87aa122e..3221f21e 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1340,6 +1340,7 @@ function TScreenSong.Draw: boolean; var dx: real; dt: real; + I: Integer; begin dx := SongTarget-SongCurrent; dt := TimeSkip*7; @@ -1393,7 +1394,26 @@ begin end; - inherited Draw; + //inherited Draw; + //heres a little Hack, that causes the Statics + //are Drawn after the Buttons because of some Blending Problems. + //This should cause no Problems because all Buttons on this screen + //Has Z Position. + //Draw BG + DrawBG; + + //Instead of Draw FG Procedure: + //We draw Buttons for our own + for I := 0 to Length(Button) - 1 do + Button[I].Draw; + + // Statics + for I := 0 to Length(Static) - 1 do + Static[I].Draw; + + // and texts + for I := 0 to Length(Text) - 1 do + Text[I].Draw; //Draw Equalizer -- cgit v1.2.3 From 9ea1096f3ee6102ad83982ebaedbc954c5d19b69 Mon Sep 17 00:00:00 2001 From: b1indy Date: Fri, 20 Jul 2007 21:46:24 +0000 Subject: beta version of new credits screen (still some tweaking to do) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@308 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 1140 ++++++++++++++++++++++++++++++---- 1 file changed, 1008 insertions(+), 132 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 98cdc417..43a9a3ca 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -3,15 +3,57 @@ unit UScreenCredits; interface uses - UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes, ULCD, ULight; + UMenu, SDL, UDisplay, UTexture, OpenGL12, UMusic, UFiles, SysUtils, UThemes, ULCD, ULight, UGraphicClasses; type + TCreditsStages=(InitialDelay,Intro,MainPart,Outro); + TScreenCredits = class(TMenu) public - Credits_Y: Real; + Credits_X: Real; Credits_Time: Cardinal; Credits_Alpha: Cardinal; + CTime: Cardinal; + CTime_hold: array of Cardinal; + ESC_Alpha: Integer; + + credits_entry_tex: TTexture; + credits_entry_dx_tex: TTexture; + credits_bg_tex: TTexture; + credits_bg_ovl: TTexture; +// credits_bg_logo: TTexture; + credits_bg_scrollbox_left: TTexture; + credits_blindguard: TTexture; + credits_blindy: TTexture; + credits_canni: TTexture; + credits_commandio: TTexture; + credits_lazyjoker: TTexture; + credits_mog: TTexture; + credits_mota: TTexture; + credits_skillmaster: TTexture; + credits_whiteshark: TTexture; + intro_layer01: TTexture; + intro_layer02: TTexture; + intro_layer03: TTexture; + intro_layer04: TTexture; + intro_layer05: TTexture; + intro_layer06: TTexture; + intro_layer07: TTexture; + intro_layer08: TTexture; + intro_layer09: TTexture; + outro_bg: TTexture; + outro_esc: TTexture; + outro_exd: TTexture; + + deluxe_slidein: cardinal; + + CurrentScrollText: String; + NextScrollUpdate: Real; + EndofLastScrollingPart: Cardinal; + CurrentScrollStart, CurrentScrollEnd: Integer; + + CRDTS_Stage: TCreditsStages; Fadeout: boolean; constructor Create; override; @@ -20,67 +62,60 @@ type procedure onShow; override; procedure onHide; override; procedure DrawCredits; + procedure Draw_FunkyText; end; - const Credits_Text: Array[0..52] of PChar = ( - ':SPACE:', - 'Main Idea: Corvus 5', - 'Thank you very much for this great Game', - ':SPACE:', - 'The Ultrastar Deluxe Team:', - ':SPACE:', - 'blindy:', - 'VFX Programming', - ':SPACE:', - 'commandi00:', - 'Beta Testing', - ':SPACE:', - 'Crazy Joker:', - 'Graphics', - ':SPACE:', - 'DennistheMenace:', - 'Beta Testing and great Support in "the Board"', - ':SPACE:', - 'Mog:', - 'Programming, Graphics', - ':SPACE:', - 'Mota:', - 'Programming, Idea of creating this Mod', - ':SPACE:', - 'Sawyer:', - 'Web Master, Programming', - ':SPACE:', - 'Whiteshark:', - 'Programming, Creating Release', - ':SPACE:', - ':SPACE:', - 'Thanks to', - ':SPACE:', - 'Blind Guard', - 'for supporting us and administrate this great Board', - ':SPACE:', - 'Weezl', - 'for the credits screen music', - ':SPACE:', - 'The whole Community from www.ultra-star.dl.am', - 'for supporting us, supporting the newbies', - 'and remembering us to continue work', - ':SPACE:', - 'You', - 'for using Ultrastar Deluxe', - ':SPACE:', - ':SPACE:', - 'Visit us at:', - 'http://www.ultrastardx.dl.am', - 'http://sourceforge.net/projects/ultrastardx/', - 'http://www.Ultra-Star.dl.am', - 'Please write Bug Reports and Feature Requests', - 'to help making this a better Game'); +const + Funky_Text: AnsiString = +{ 'Hey doodz, we made it! You had to wait very long cause we wanted it to be perfect. So here it is, the most perfect UltraStar you`ll ever get. We have this awesome stars, we have this awesome party mode with plugins, we have the best skins and yes we´re '+ + 'the best :P Whiteshark tried his best to fix all the bugs, and he has done an awesome job! Mota and Mog fired up their Photoshops to create this stunning skins, Blindy has brought you this massive stars and Canni did the documentation. BlindGuard hosts '+ + 'the forum, and oh my gosh he spends a lot of time fucking with all the wankers asking for mp3s. We also want to thank the people in the forum for their massive support and their patience xD Blindy and Mog also want to thank www.demoscene.tv for '+ + 'inspiration (yay Kewlerz suck, but we suck more) - also big shout outs to Einsiedler for brewing our favourite beer and dnbradio.com for the music. Big greetings from Mog to Antje too, I love you baby :X'; +} + 'So here we are, grandma deluxe has arrived. It´s Mog on the keyboard, but I speak for all of us teamers :P Took us '+ + 'longer than expected to come up with this, but hey you know good things take their time ;) As we tried to put in as '+ + 'many features as we have seen on the board (and our`s aswell), like the neat eyecandy (stars h00ray), the party mode, '+ + 'new awesome skins, fucking bugfixes (poor Whiteshark) and a hell lot of other stuff. I´m also proud to announce that '+ + 'we´re the only UltraStar with all this stuff, nice hu? ;) Maybe it´s about time to explain why it took so long, I just '+ + 'strip the part with lazy joker (has he done _anything_?) and all the other people who joined #ultra-star.dl.am on '+ + 'QuakeNet just to beg for a beta or wanted to "help" (hey I´m from a big newspaper). Actually there was a lot of code '+ + 'that had to be written up from scratch (party mode anyone?), and some of the stuff was pretty new to us (OpenGL h00ray). '+ + 'And it reallly didn´t help when people on the board didn´t stop arguing about the release date (I don´t say wankers), so '+ + 'next time some real help would be apprechiated - send us beer if you´re unskilled xD It´s almost sunset outside, time '+ + 'for the thanks then. We want to thank sourceforge for the hosting, BlindGuard for the board support (bet he has some '+ + 'grey hairs now), Wome for the tune you hear right now (thanks mate :X), Corvus5 for the work on UltraStar, our friends '+ + 'on the board (ultra-star.dl.am the place to be!), Einsiedler for the beer, the demoscene and weed for some inspiration...'; + + Timings: array[0..21] of Cardinal=( + 20, // 0 Delay vor Start + + 149, // 1 Ende erster Intro Zoom + 155, // 2 Start 2. Action im Intro + 170, // 3 Ende Separation im Intro + 271, // 4 Anfang Zoomout im Intro + 0, // 5 unused + 261, // 6 Start fade-to-white im Intro + + 271, // 7 Start Main Part + 280, // 8 Start On-Beat-Sternchen Main Part + 396, // 9 Start BlindGuard + 666, // 10 Start blindy + 936, // 11 Start Canni + 1206, // 12 Start Commandio + 1476, // 13 Start LazyJoker + 1746, // 14 Start Mog + 2016, // 15 Start Mota + 2286, // 16 Start SkillMaster + 2556, // 17 Start WhiteShark + 2826, // 18 Ende Whiteshark + 3096, // 19 Start FadeOut Mainscreen + 3366, // 20 Ende Credits Tune + 60); // 21 start flare im intro implementation -uses Dialogs,Windows, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl, ULanguage; +uses Dialogs,Windows, UGraphic, UMain, UIni, USongs, Textgl, opengl, ULanguage, Math; function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -93,25 +128,47 @@ begin FadeTo(@ScreenMain); Music.PlayBack; end; + SDLK_SPACE: + begin + setlength(CTime_hold,length(CTime_hold)+1); + CTime_hold[high(CTime_hold)]:=CTime; + end; + end;//esac end; //fi end; constructor TScreenCredits.Create; -var - I: integer; begin inherited Create; + credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0); + credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0); - AddBackground(Theme.Loading.Background.Tex); + credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', 'PNG', 'Font Black', 0); + credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0); + credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0); + credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', 'PNG', 'Font Black', 0); + credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', 'PNG', 'Font Black', 0); + credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', 'Font Black', 0); + credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', 'PNG', 'Font Black', 0); + credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', 'PNG', 'Font Black', 0); + credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', 'PNG', 'Font Black', 0); -// for I := 0 to High(Theme.Loading.Static) do -// AddStatic(Theme.Loading.Static[I]); + intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', 'PNG', 'Transparent', 0); + intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', 'PNG', 'Transparent', 0); + intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', 'PNG', 'Transparent', 0); + intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', 'PNG', 'Transparent', 0); + intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', 'PNG', 'Transparent', 0); + intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', 'PNG', 'Transparent', 0); + intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', 'PNG', 'Transparent', 0); + intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', 'PNG', 'Transparent', 0); + intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', 'PNG', 'Transparent', 0); -// for I := 0 to High(Theme.Loading.Text) do -// AddText(Theme.Loading.Text[I]); + outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0); + outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0); + outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Plain', 0); - Fadeout := false; + CRDTS_Stage:=InitialDelay; end; function TScreenCredits.Draw: boolean; @@ -121,11 +178,15 @@ end; procedure TScreenCredits.onShow; begin - Credits_Y := 600; + CRDTS_Stage:=InitialDelay; + Credits_X := 580; + deluxe_slidein := 0; Credits_Alpha := 0; //Music.SetLoop(true); Loop looped ned, so ne scheisse - Music.Open(soundpath + 'wome_-_echoes.mp3'); //danke kleinster liebster weeeetüüüüü!! - Music.Play; + Music.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! +// Music.Play; + CTime:=0; + setlength(CTime_hold,0); end; procedure TScreenCredits.onHide; @@ -133,91 +194,906 @@ begin Music.Stop; end; +Procedure TScreenCredits.Draw_FunkyText; +var + S,I, Len: Integer; + X,Y,A: Real; + visibleText: PChar; +begin + SetFontSize(10); + //Init ScrollingText + if (CTime = Timings[7]) then + begin + //Set Position of Text + Credits_X := 600; + CurrentScrollStart:=1; + CurrentScrollEnd:=1; + end; + + if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then + begin + X:=0; + visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); + for S := 0 to length(visibleText)-1 do begin + Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); + SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); + if (Credits_X+X < 15) then A:=0; + if (Credits_X+X >=15) then A:=Credits_X+X-15; + if Credits_X+X > 32 then A:=17; + glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17); + glPrintLetter(visibleText[S]); + X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + end; + if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin + Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + inc(CurrentScrollStart); + end; + visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); + if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin + inc(CurrentScrollEnd); + end; + end; + // timing hack + X:=5; + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + glColor4f(1, 1, 1, 1); + for S:=0 to high(CTime_hold) do begin + visibleText:=pchar(inttostr(CTime_hold[S])); + SetFontPos (500, X); + glPrint (Addr(visibleText[0])); + X:=X+20; + end; +end; + +procedure Start3D; +begin + glMatrixMode(GL_PROJECTION); + glPushMatrix; + glLoadIdentity; + glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity; +end; +procedure End3D; +begin + glMatrixMode(GL_PROJECTION); + glPopMatrix; + glMatrixMode(GL_MODELVIEW); +end; + procedure TScreenCredits.DrawCredits; var T,I: Cardinal; - Y: Real; + X: Real; Ver: PChar; + RuntimeStr: AnsiString; + Data: TFFTData; + j,k,l:cardinal; + f,g,h: Real; + STime:cardinal; + Delay:cardinal; + + myPixel: longword; + myColor: Cardinal; + myScale: Real; + myAngle: Real; +const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24), + (154,31),(156,58),(168,32),(203,36), + (258,34),(251,50),(274,93),(294,84), + (232,54),(278,62),(319,34),(336,92), + (347,23),(374,32),(377,58),(361,83), + (385,91),(405,91),(429,35),(423,51), + (450,32),(485,34),(444,91),(486,93)); + begin +//dis does teh muiwk y0r +Data := Music.GetFFTData; + + + T := GetTickCount div 33; if T <> Credits_Time then begin Credits_Time := T; - //Change Position - Credits_Y := Credits_Y - 1; - //Change Alpha - Inc (Credits_Alpha, 3); - end; - //If lowest Position is outside the Screen-> Show MainMenu - if (Y <= 0) then - Y := 600; - //Draw BackGround - DrawBG; - - - //Draw pulsing Credits Text - //Set Font - SetFontStyle (2); - SetFontItalic(False); - SetFontSize(9); - SetFontPos (10, 5); - glColor4f(1, 0, 0, 0.2 + Abs((Credits_Alpha mod 150)/100 - 0.75)); - glPrint ('You may press ESC now'); - - //Set Font Size for Credits - SetFontSize(12); - //Draw Version - if (Credits_Y>-35) then - begin - Ver := PChar(Language.Translate('US_VERSION')); - //Set Color - if Credits_Y > 500 then - glColor4f(1, 0.6, 0.08, (600 - Credits_Y)/100 - 0.2) - else - glColor4f(1, 0.6, 0.08, 0.8); + inc(CTime); + Credits_X := Credits_X-2; + if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then + begin +// CTime:=Timings[20]; +// CRDTS_Stage:=Outro; - SetFontPos (400 - glTextWidth(Ver)/2, Credits_Y); - glprint(Ver); + CRDTS_Stage:=Intro; + CTime:=0; + Music.Play; + + end; + if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then + begin + CRDTS_Stage:=MainPart; + end; + if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then + begin + CRDTS_Stage:=Outro; + end; end; - //Set Color + Start Pos - glColor4f(0.8, 0.8, 1, 0.8); - Y := Credits_Y + 50; + //draw background + if CRDTS_Stage=InitialDelay then + begin + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end + else + if CRDTS_Stage=Intro then + begin + Start3D; + glPushMatrix; - //Search upper Position - For I := 0 to high(Credits_Text) do - begin - if (Credits_Text[I]=':SPACE:') then //Spacer - Y := Y + 55 - else - Y := Y + 30; + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - if Y > -35 then - break; - end; + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); - //Draw Text - For T := I+1 to high(Credits_Text) do - begin - if (Credits_Text[T]=':SPACE:') then //Spacer - Y := Y + 55 - else + if CTime < Timings[1] then begin + myScale:= 0.5+0.5*(Timings[1]-CTime)/(Timings[1]); // slowly move layers together + myAngle:=cos((CTime)*pi/((Timings[1])*2)); // and make logo face towards camera + end else begin // this is the part when the logo stands still + myScale:=0.5; + myAngle:=0; + end; + if CTime > Timings[2] then begin + myScale:= 0.5+0.5*(CTime-Timings[2])/(Timings[3]-Timings[2]); // get some space between layers + myAngle:=0; + end; +// if CTime > Timings[3] then myScale:=1; // keep the space between layers + glTranslatef(0,0,-5+0.5*myScale); + if CTime > Timings[3] then myScale:=1; // keep the space between layers + if CTime > Timings[3] then begin // make logo rotate left and grow +// myScale:=(CTime-Timings[4])/(Timings[7]-Timings[4]); + glRotatef(20*sqr(CTime-Timings[3])/sqr((Timings[7]-Timings[3])/2),0,0,1); + glScalef(1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1); + end; + if CTime < Timings[2] then + glRotatef(30*myAngle,0.5*myScale+myScale,1+myScale,0); +// glScalef(0.5,0.5,0.5); + glScalef(4/3,-1,1); + glColor4f(1, 1, 1, 1); + + glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.4 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.4 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.4 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.4 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.22 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.22 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.22 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.22 * myScale); + glEnd; + gldisable(gl_texture_2d); + glDisable(GL_BLEND); + + glPopMatrix; + End3D; + + // do some sparkling effects + if (CTime < Timings[1]) and (CTime > Timings[21]) then + begin + for k:=1 to 3 do begin + l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5); + j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301); + GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0); + end; + end; + + // fade to white at end + if Ctime > Timings[6] then + begin + glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + + end; + if (CRDTS_Stage=MainPart) then + // main credits screen background, scroller, logo and girl + begin + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // draw scroller + Draw_FunkyText; + +//######################################################################### +// draw credits names + +// BlindGuard (von links oben reindrehen, nach rechts unten rausdrehen) + STime:=Timings[9]-10; + Delay:=Timings[10]-Timings[9]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + k:=CTime-STime; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(0,329,0); + if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end; + gltranslatef(223,0,0); + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + gltranslatef(223,0,0); + glrotatef((CTime-(STime+Delay-10))*-9,0,0,1); + gltranslatef(-223,0,0); + end; + glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Blindy (zoom von 0 auf volle grösse und drehung, zoom auf doppelte grösse und nach rechts oben schieben) + STime:=Timings[10]-10; + Delay:=Timings[11]-Timings[10]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + k:=CTime-STime; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+20) and (CTime<=STime+22) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+20 then begin + j:=CTime-Stime; + glscalef(j*j/400,j*j/400,j*j/400); + glrotatef(j*18.0,0,0,1); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(f*3,-f,0); + glscalef(1+j/10,1+j/10,1+j/10); + glrotatef(j*9.0,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Canni (von links reinschieben, nach rechts oben rausschieben) + STime:=Timings[11]-10; + Delay:=Timings[12]-Timings[11]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + k:=CTime-STime; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(((CTime-STime)*21.0)-210,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=(CTime-(STime+Delay-10))*21; + gltranslatef(j,-j/2,0); + end; + glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Commandio (von unten reinklappen, nach rechts oben rausklappen) + STime:=Timings[12]-10; + Delay:=Timings[13]-Timings[12]; + if CTime > STime then begin - //Set Color - if Y > 500 then - glColor4f(0.8, 0.8, 1, (600 - Y)/100 - 0.2) + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + k:=CTime-STime; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=258.0-25.8*(CTime-STime) else - glColor4f(0.8, 0.8, 1, 0.8); + f:=0; - SetFontPos (400 - glTextWidth(Credits_Text[T])/2, Y); - glprint(Credits_Text[T]); - Y := Y + 30; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end else + g:=0; + glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163+g-f*1.5, -129+f*1.5-g/2); + glTexCoord2f(0,1);glVertex2f(-163+g*1.5, 129-(g*1.5*258/326)); + glTexCoord2f(1,1); glVertex2f(163+g, 129+g/4); + glTexCoord2f(1,0);glVertex2f(163+f*1.5+g/4, -129+f*1.5-g/4); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; end; - if Y > 600 then - break; - end; +// lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing) + STime:=Timings[13]-35; + Delay:=Timings[14]-Timings[13]+5; + if CTime > STime then + begin + k:=0; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20; + ESC_Alpha:=10; + f:=CTime-STime; + if CTime <=STime+40 then j:=CTime-STime else j:=40; + if (CTime >=STime+Delay-40) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j*j/1600); + + glPushMatrix; + gltranslatef(180+(f-70),329,0); + glBindTexture(GL_TEXTURE_2D, credits_lazyjoker.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Mog (von links reinklappen, nach rechts unten rausklappen) + STime:=Timings[14]-10; + Delay:=Timings[15]-Timings[14]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + k:=CTime-STime; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) + else + f:=0; + + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end else + g:=0; + glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163+g*1.5, -129+g*1.5); + glTexCoord2f(0,1);glVertex2f(-163+g*1.2, 129+g); + glTexCoord2f(1,1); glVertex2f(163-f+g/2, 129+f*1.5+g/4); + glTexCoord2f(1,0);glVertex2f(163-f+g*1.5, -129-f*1.5); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Mota (von rechts oben reindrehen, nach links unten rausschieben und verkleinern und dabei drehen) + STime:=Timings[15]-10; + Delay:=Timings[16]-Timings[15]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + k:=CTime-STime; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(223,0,0); + glrotatef((10-(CTime-STime))*9,0,0,1); + gltranslatef(-223,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(-f*2,-f,0); + glscalef(1-j/10,1-j/10,1-j/10); + glrotatef(-j*9.0,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Skillmaster (von rechts unten reinschieben, nach rechts oben rausdrehen) + STime:=Timings[16]-10; + Delay:=Timings[17]-Timings[16]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + k:=CTime-STime; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + j:=STime+10-CTime; + f:=j*10.0; + gltranslatef(+f*2,+f/2,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(0,-223,0); + glrotatef(j*-9,0,0,1); + gltranslatef(0,223,0); + glrotatef(j*9,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// WhiteShark (von links unten reinklappen, nach rechts oben rausklappen) + STime:=Timings[17]-10; + Delay:=Timings[18]-Timings[17]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + k:=CTime-STime; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) + else + f:=0; + + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end else + g:=0; + glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2); + glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4); + glTexCoord2f(1,1); glVertex2f(163-f*1.2+g/4, 129+f/2-g/4); + glTexCoord2f(1,0);glVertex2f(163-f*1.5+g/4, -129+f*1.5+g/4); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + + +// #################################################################### +// do some twinkle stuff (kinda on beat) + if (CTime>Timings[8]) and (CTime < Timings[19]) then begin + k:=0; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then begin + l:=RandomRange(6,16); + j:=RandomRange(0,27); + GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); + end; + end; + +//################################################# +// draw the rest of the main screen (girl and logo + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(800-393, 0); + glTexCoord2f(0,600/1024);glVertex2f(800-393, 600); + glTexCoord2f(393/512,600/1024); glVertex2f(800, 600); + glTexCoord2f(393/512,0);glVertex2f(800, 0); + glEnd; +{ glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,112/128);glVertex2f(0, 112); + glTexCoord2f(497/512,112/128); glVertex2f(497, 112); + glTexCoord2f(497/512,0);glVertex2f(497, 0); + glEnd; +} + gldisable(gl_texture_2d); + glDisable(GL_BLEND); + + // fade out at end of main part + if Ctime > Timings[19] then + begin + glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + end + else + if (CRDTS_Stage=Outro) then + begin + if CTime=Timings[20] then begin + CTime:=0; + Music.Stop; + Music.Open(soundpath + 'credits-outro-tune.mp3'); + Music.Play; + Music.SetLoop(True); + end; + if CTime > 231 then begin + Music.Play; + Ctime:=0; + end; + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + // do something useful + // outro background + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); + glEnd; + + //outro overlays + glColor4f(1, 1, 1, (1+sin(CTime/15))/3+1/3); + glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,223/256);glVertex2f(0, 223); + glTexCoord2f(487/512,223/256); glVertex2f(487, 223); + glTexCoord2f(487/512,0);glVertex2f(487, 0); + glEnd; + + ESC_Alpha:=20; + if (RandomRange(0,20) > 18) and (ESC_Alpha=20) then + ESC_Alpha:=0 + else inc(ESC_Alpha); + if ESC_Alpha > 20 then ESC_Alpha:=20; + glColor4f(1, 1, 1, ESC_Alpha/20); + glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(800-310, 600-247); + glTexCoord2f(0,247/256);glVertex2f(800-310, 600); + glTexCoord2f(310/512,247/256); glVertex2f(800, 600); + glTexCoord2f(310/512,0);glVertex2f(800, 600-247); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // outro scrollers? + // ... + end; + +{ // draw credits runtime counter + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (5, 5); + glColor4f(1, 1, 1, 1); +// RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10); + RuntimeStr:='CTime: '+inttostr(CTime); + glPrint (Addr(RuntimeStr[1])); +} + // make the stars shine + GoldenRec.Draw; + //timing hack +// Draw_FunkyText; end; end. -- cgit v1.2.3 From 5e7e58283dc7ba368bed77fe3d914cdb234198bb Mon Sep 17 00:00:00 2001 From: mogguh Date: Mon, 23 Jul 2007 11:39:24 +0000 Subject: Final work on credits (done :P - fuckings to the cia readers) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@322 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 43a9a3ca..fd80f1f5 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -67,24 +67,11 @@ type const Funky_Text: AnsiString = -{ 'Hey doodz, we made it! You had to wait very long cause we wanted it to be perfect. So here it is, the most perfect UltraStar you`ll ever get. We have this awesome stars, we have this awesome party mode with plugins, we have the best skins and yes we´re '+ - 'the best :P Whiteshark tried his best to fix all the bugs, and he has done an awesome job! Mota and Mog fired up their Photoshops to create this stunning skins, Blindy has brought you this massive stars and Canni did the documentation. BlindGuard hosts '+ - 'the forum, and oh my gosh he spends a lot of time fucking with all the wankers asking for mp3s. We also want to thank the people in the forum for their massive support and their patience xD Blindy and Mog also want to thank www.demoscene.tv for '+ - 'inspiration (yay Kewlerz suck, but we suck more) - also big shout outs to Einsiedler for brewing our favourite beer and dnbradio.com for the music. Big greetings from Mog to Antje too, I love you baby :X'; -} - 'So here we are, grandma deluxe has arrived. It´s Mog on the keyboard, but I speak for all of us teamers :P Took us '+ - 'longer than expected to come up with this, but hey you know good things take their time ;) As we tried to put in as '+ - 'many features as we have seen on the board (and our`s aswell), like the neat eyecandy (stars h00ray), the party mode, '+ - 'new awesome skins, fucking bugfixes (poor Whiteshark) and a hell lot of other stuff. I´m also proud to announce that '+ - 'we´re the only UltraStar with all this stuff, nice hu? ;) Maybe it´s about time to explain why it took so long, I just '+ - 'strip the part with lazy joker (has he done _anything_?) and all the other people who joined #ultra-star.dl.am on '+ - 'QuakeNet just to beg for a beta or wanted to "help" (hey I´m from a big newspaper). Actually there was a lot of code '+ - 'that had to be written up from scratch (party mode anyone?), and some of the stuff was pretty new to us (OpenGL h00ray). '+ - 'And it reallly didn´t help when people on the board didn´t stop arguing about the release date (I don´t say wankers), so '+ - 'next time some real help would be apprechiated - send us beer if you´re unskilled xD It´s almost sunset outside, time '+ - 'for the thanks then. We want to thank sourceforge for the hosting, BlindGuard for the board support (bet he has some '+ - 'grey hairs now), Wome for the tune you hear right now (thanks mate :X), Corvus5 for the work on UltraStar, our friends '+ - 'on the board (ultra-star.dl.am the place to be!), Einsiedler for the beer, the demoscene and weed for some inspiration...'; + 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+ + 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+ + 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to '+ + 'Demoscene.tv, scene.org, KakiArts, Sourceforge,..'; + Timings: array[0..21] of Cardinal=( 20, // 0 Delay vor Start @@ -972,7 +959,7 @@ Data := Music.GetFFTData; k:=0; for j:=0 to 40 do if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then begin + if Data[k]>0.2 then begin l:=RandomRange(6,16); j:=RandomRange(0,27); GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); @@ -1025,6 +1012,7 @@ Data := Music.GetFFTData; Music.Stop; Music.Open(soundpath + 'credits-outro-tune.mp3'); Music.Play; + Music.SetVolume(20); Music.SetLoop(True); end; if CTime > 231 then begin -- cgit v1.2.3 From f38fd7c6391b47f8d4693b13c83565f791f7300c Mon Sep 17 00:00:00 2001 From: mogguh Date: Mon, 23 Jul 2007 12:23:29 +0000 Subject: Really final work on credits (done! - stop reading cia, get rl) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@323 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index fd80f1f5..b69c17aa 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -69,8 +69,8 @@ const Funky_Text: AnsiString = 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+ 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+ - 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to '+ - 'Demoscene.tv, scene.org, KakiArts, Sourceforge,..'; + 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+ + 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..'; Timings: array[0..21] of Cardinal=( -- cgit v1.2.3 From 2381fe1d1dcdde5e4a3adcdf55796c2d723b8cf7 Mon Sep 17 00:00:00 2001 From: b1indy Date: Wed, 25 Jul 2007 12:45:29 +0000 Subject: fixed some minor glitches in the credits screen (transparent texture was not totally transparent, which could be seen with now working transparency in trunk) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@330 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index b69c17aa..a0ef01af 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -15,7 +15,7 @@ type Credits_Time: Cardinal; Credits_Alpha: Cardinal; CTime: Cardinal; - CTime_hold: array of Cardinal; + CTime_hold: Cardinal; ESC_Alpha: Integer; credits_entry_tex: TTexture; @@ -55,6 +55,8 @@ type CRDTS_Stage: TCreditsStages; + myTex: glUint; + Fadeout: boolean; constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; @@ -115,12 +117,12 @@ begin FadeTo(@ScreenMain); Music.PlayBack; end; - SDLK_SPACE: +{ SDLK_SPACE: begin setlength(CTime_hold,length(CTime_hold)+1); CTime_hold[high(CTime_hold)]:=CTime; end; - +} end;//esac end; //fi end; @@ -153,7 +155,7 @@ begin outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0); outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0); - outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Plain', 0); + outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Transparent', 0); CRDTS_Stage:=InitialDelay; end; @@ -173,7 +175,7 @@ begin Music.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! // Music.Play; CTime:=0; - setlength(CTime_hold,0); +// setlength(CTime_hold,0); end; procedure TScreenCredits.onHide; @@ -220,7 +222,7 @@ begin inc(CurrentScrollEnd); end; end; - // timing hack +{ // timing hack X:=5; SetFontStyle (2); SetFontItalic(False); @@ -231,7 +233,7 @@ begin SetFontPos (500, X); glPrint (Addr(visibleText[0])); X:=X+20; - end; + end;} end; procedure Start3D; @@ -266,6 +268,8 @@ var myColor: Cardinal; myScale: Real; myAngle: Real; + + const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24), (154,31),(156,58),(168,32),(203,36), (258,34),(251,50),(274,93),(294,84), @@ -285,6 +289,7 @@ Data := Music.GetFFTData; begin Credits_Time := T; inc(CTime); + inc(CTime_hold); Credits_X := Credits_X-2; if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then begin @@ -1008,16 +1013,16 @@ Data := Music.GetFFTData; if (CRDTS_Stage=Outro) then begin if CTime=Timings[20] then begin - CTime:=0; + CTime_hold:=0; Music.Stop; Music.Open(soundpath + 'credits-outro-tune.mp3'); Music.Play; Music.SetVolume(20); Music.SetLoop(True); end; - if CTime > 231 then begin + if CTime_hold > 231 then begin Music.Play; - Ctime:=0; + Ctime_hold:=0; end; glClearColor(0,0,0,0); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); @@ -1079,9 +1084,6 @@ Data := Music.GetFFTData; } // make the stars shine GoldenRec.Draw; - - //timing hack -// Draw_FunkyText; end; end. -- cgit v1.2.3 From b7f377e62a7e941d7898c187a63dd6ed99b0798f Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 28 Jul 2007 13:29:32 +0000 Subject: experimental ffmpeg videodecoding support, frameskipping doesn't work quite right yet git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@332 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 2ba7522f..4bf405f6 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -3,7 +3,7 @@ unit UScreenSing; interface uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, ULyrics, - TextGL, OpenGL12, BASS, UThemes, ULCD, UGraphicClasses; + TextGL, OpenGL12, BASS, UThemes, ULCD, UGraphicClasses, Uffmpeg; type TScreenSing = class(TMenu) @@ -145,7 +145,7 @@ begin //stop Music Music.Pause; if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then //Video - PauseSmpeg; //Video + FFmpegTogglePause;//PauseSmpeg; //Video end else //Pause ausschalten begin @@ -153,7 +153,7 @@ begin Music.MoveTo (PauseTime);//Position of Music Music.Play; //Play Music if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then //Video - PlaySmpeg; + FFmpegTogglePause;//PlaySmpeg; //SkipSmpeg(PauseTime); Paused := false; end; @@ -222,6 +222,7 @@ begin LyricMain := TLyric.Create; LyricSub := TLyric.Create; + Uffmpeg.Init; end; procedure TScreenSing.onShow; @@ -349,8 +350,11 @@ begin // set movie if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin - OpenSmpeg(AktSong.Path + AktSong.Video); - SkipSmpeg(AktSong.VideoGAP + AktSong.Start); +{ OpenSmpeg(AktSong.Path + AktSong.Video); + SkipSmpeg(AktSong.VideoGAP + AktSong.Start);} + // todo: VideoGap and Start time verwursten + FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); + FFmpegSkip(AktSong.VideoGAP + AktSong.Start); AktSong.VideoLoaded := true; end; @@ -739,14 +743,17 @@ begin if AktSong.VideoLoaded then begin try - PlaySmpeg; + FFmpegGetFrame(Czas.Teraz); + FFmpegDrawGL; +// PlaySmpeg; except //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video AktSong.VideoLoaded := False; Log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); Log.LogError('Corrupted File: ' + AktSong.Video); try - CloseSmpeg; +// CloseSmpeg; + FFmpegClose; except end; @@ -1061,14 +1068,19 @@ begin // update and draw movie if ShowFinish and AktSong.VideoLoaded then begin try - UpdateSmpeg; // this only draws +// UpdateSmpeg; // this only draws + // todo: find a way to determine, when a new frame is needed + // toto: same for the need to skip frames + FFmpegGetFrame(Czas.Teraz); + FFmpegDrawGL; except //If an Error occurs drawing: prevent Video from being Drawn again and Close Video AktSong.VideoLoaded := False; log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); Log.LogError('Corrupted File: ' + AktSong.Video); try - CloseSmpeg; +// CloseSmpeg; + FFmpegClose; except end; @@ -1095,7 +1107,7 @@ begin end; end; end; - + // draw custom items SingDraw; // always draw @@ -1143,7 +1155,8 @@ begin end; if AktSong.VideoLoaded then begin - CloseSmpeg; +// CloseSmpeg; + FFmpegClose; AktSong.VideoLoaded := false; // to prevent drawing closed video end; -- cgit v1.2.3 From bcc359df110e8fbd6737aba1e3365f880d1413e4 Mon Sep 17 00:00:00 2001 From: b1indy Date: Wed, 22 Aug 2007 13:40:42 +0000 Subject: limit number of displayed background covers to no more than 21 - need comments on this git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@352 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 3221f21e..9d3111cb 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -4,7 +4,7 @@ interface uses UMenu, SDL, UMusic, UFiles, UTime, UDisplay, USongs, SysUtils, ULog, UThemes, UTexture, ULanguage, - ULCD, ULight, UIni; + ULCD, ULight, UIni, TextGL; type TScreenSong = class(TMenu) @@ -1185,7 +1185,7 @@ begin if (Abs(Pos) < 2.5) then {fixed Positions} begin Angle := Pi * (Pos / 5); - //Button[B].Visible := False; +// Button[B].Visible := False; Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); @@ -1208,13 +1208,16 @@ begin end else begin {Behind the Front Covers} -// Button[B].Visible := False; -// if VS/2-abs(Pos)>VS*0.4 then Button[B].Visible := False; + + // limit-bg-covers hack + if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; + if VS > 25 then VS:=25; + // end of limit-bg-covers hack if Pos < 0 then - Pos := (Pos - VS/2) /VS + Pos := (Pos - VS/2)/VS else - Pos := (Pos + VS/2) /VS; + Pos := (Pos + VS/2)/VS; Angle := pi * Pos*2; @@ -1381,7 +1384,7 @@ begin Music.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) else Music.SetMusicVolume(Ini.PreviewVolume * 10); - + end; @@ -1421,6 +1424,16 @@ begin DrawEqualizer; DrawExtensions; + + + glColor4f(1, 1, 1, 1); + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (5, 0); + glPrint(pAnsiChar(inttostr(floor(CatSongs.VisibleSongs)))); + + end; procedure TScreenSong.SelectNext; -- cgit v1.2.3 From 1c21e36f56107091ca675559c440688fd95b384f Mon Sep 17 00:00:00 2001 From: b1indy Date: Wed, 22 Aug 2007 14:58:19 +0000 Subject: fixed a bug in drawing of background covers (when style=5 (usdx theme default)) added a new style for the song covers ("slotmachine" like, style=6) - still needs adjustments git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@353 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 123 ++++++++++++++++++++++++++++++++++---- 1 file changed, 111 insertions(+), 12 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 9d3111cb..e346d59e 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -4,7 +4,7 @@ interface uses UMenu, SDL, UMusic, UFiles, UTime, UDisplay, USongs, SysUtils, ULog, UThemes, UTexture, ULanguage, - ULCD, ULight, UIni, TextGL; + ULCD, ULight, UIni; type TScreenSong = class(TMenu) @@ -69,6 +69,7 @@ type procedure SetScroll3; procedure SetScroll4; procedure SetScroll5; + procedure SetScroll6; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; function Draw: boolean; override; procedure onShow; override; @@ -806,6 +807,7 @@ begin else SetScroll4; end; + 6: SetScroll6; else SetScroll4; end; //Set Visibility of Video Icon @@ -1173,7 +1175,7 @@ begin //Change Pos of all Buttons for B := low(Button) to high(Button) do begin - Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visability + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility if Button[B].Visible then //Only Change Pos for Visible Buttons begin Pos := (CatSongs.VisibleIndex(B) - SongCurrent); @@ -1234,7 +1236,7 @@ begin Diff := (Button[B].H - Theme.Song.Cover.H)/2; - Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2 + (Theme.Song.Cover.H)*sin(Angle/2)*1.52; + Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*((Theme.Song.Cover.H)*sin(Angle/2)*1.52); end; @@ -1245,6 +1247,112 @@ begin end; end; +procedure TScreenSong.SetScroll6; // rotate (slotmachine style) +var + B: integer; + Angle: real; + Pos: Real; + VS: integer; + diff: real; + X: Real; + Wsp: real; + Z, Z2: real; +begin + VS := CatSongs.VisibleSongs; // cache Visible Songs + if VS <=5 then begin + // kolowe + for B := 0 to High(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2; + Z2 := (1 + 2*Z) / 3; + + + Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z / 2 + 0.3; + + Button[B].W := Theme.Song.Cover.H * Z2; + +// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; + Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; + Button[B].H := Button[B].W; + end; + end; + end + else begin + + //Change Pos of all Buttons + for B := low(Button) to high(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility + if Button[B].Visible then //Only Change Pos for Visible Buttons + begin + Pos := (CatSongs.VisibleIndex(B) - SongCurrent); + if (Pos < -VS/2) then + Pos := Pos + VS + else if (Pos > VS/2) then + Pos := Pos - VS; + + if (Abs(Pos) < 2.5) then {fixed Positions} + begin + Angle := Pi * (Pos / 5); +// Button[B].Visible := False; + + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); + + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Z := 0.95 - Abs(Pos) * 0.01; + + Button[B].X := (Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); + + Button[B].W := Button[B].H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + + X := Sin(Angle*1.3)*0.9; + + Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff; + end + else + begin {Behind the Front Covers} + + // limit-bg-covers hack + if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; + if VS > 25 then VS:=25; + // end of limit-bg-covers hack + + if Pos < 0 then + Pos := (Pos - VS/2)/VS + else + Pos := (Pos + VS/2)/VS; + + Angle := pi * Pos*2; + + Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); + + Button[B].W := Button[B].H; + + Button[B].X := Theme.Song.Cover.X - (Button[B].H - Theme.Song.Cover.H)*0.5; + + + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Y := Theme.Song.Cover.Y+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*(Theme.Song.Cover.H*sin(Angle/2)*1.52); + end; + end; + end; + end; +end; + + procedure TScreenSong.onShow; begin Music.Stop; @@ -1425,15 +1533,6 @@ begin DrawExtensions; - - glColor4f(1, 1, 1, 1); - SetFontStyle (2); - SetFontItalic(False); - SetFontSize(9); - SetFontPos (5, 0); - glPrint(pAnsiChar(inttostr(floor(CatSongs.VisibleSongs)))); - - end; procedure TScreenSong.SelectNext; -- cgit v1.2.3 From 789d722dace2725d78479da4edb268440a52959c Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 1 Sep 2007 10:58:56 +0000 Subject: fixed bug that caused display of wrong covers git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@355 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index e346d59e..e75ed1ab 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1159,6 +1159,7 @@ var Angle: real; Pos: Real; VS: integer; + VS_hack: integer; // visible songs for the diff: real; X: Real; begin @@ -1213,13 +1214,13 @@ begin // limit-bg-covers hack if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; - if VS > 25 then VS:=25; + if VS > 25 then VS_hack:=25 else VS_hack:=VS; // end of limit-bg-covers hack if Pos < 0 then - Pos := (Pos - VS/2)/VS + Pos := (Pos - VS_hack/2)/VS_hack else - Pos := (Pos + VS/2)/VS; + Pos := (Pos + VS_hack/2)/VS_hack; Angle := pi * Pos*2; -- cgit v1.2.3 From e5ddd8163c2fa0efefb07e08ba7d0cf392944d16 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 1 Sep 2007 12:45:08 +0000 Subject: finally really fixed the covers (i hope) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@356 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index e75ed1ab..cddf864e 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1159,9 +1159,9 @@ var Angle: real; Pos: Real; VS: integer; - VS_hack: integer; // visible songs for the diff: real; X: Real; + helper: real; begin VS := CatSongs.VisibleSongs; // cache Visible Songs {Vars @@ -1213,16 +1213,22 @@ begin begin {Behind the Front Covers} // limit-bg-covers hack - if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; - if VS > 25 then VS_hack:=25 else VS_hack:=VS; + if (abs(abs(Pos)-VS/2)>10) then Button[B].Visible:=False; // end of limit-bg-covers hack if Pos < 0 then - Pos := (Pos - VS_hack/2)/VS_hack + Pos := (Pos - VS/2)/VS else - Pos := (Pos + VS_hack/2)/VS_hack; + Pos := (Pos + VS/2)/VS; Angle := pi * Pos*2; + if VS > 24 then + begin + if Angle < 0 then helper:=-1 else helper:=1; + Angle:=2*pi-abs(Angle); + Angle:=Angle*(VS/24); + Angle:=(2*pi-Angle)*helper; + end; Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers -- cgit v1.2.3 From af7100ef908a4ee1474a607ed255c707959222f1 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 1 Sep 2007 17:42:46 +0000 Subject: ffmpeg support now with dualscreen mode git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@359 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 4bf405f6..6ce19c17 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -744,7 +744,7 @@ begin begin try FFmpegGetFrame(Czas.Teraz); - FFmpegDrawGL; + FFmpegDrawGL(ScreenAct); // PlaySmpeg; except //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video @@ -1072,7 +1072,7 @@ begin // todo: find a way to determine, when a new frame is needed // toto: same for the need to skip frames FFmpegGetFrame(Czas.Teraz); - FFmpegDrawGL; + FFmpegDrawGL(ScreenAct); except //If an Error occurs drawing: prevent Video from being Drawn again and Close Video AktSong.VideoLoaded := False; -- cgit v1.2.3 From 3043d3db91c3a541881aa951bbd4f8ccb5e3ce40 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 5 Sep 2007 12:35:19 +0000 Subject: modified ParseInput so Backspace will perform same function as ESC in most screens ( Except where text input is required, and backspace is used for text input ) This has been done, so that when used with Windows Media Center IR Remotes ( needs SDL 1.2 dll at runtime ) users can navigate throug the game without sitting in front of the PC keyboard. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@370 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 4 +++- Game/Code/Screens/UScreenEdit.pas | 4 +++- Game/Code/Screens/UScreenEditConvert.pas | 4 +++- Game/Code/Screens/UScreenEditHeader.pas | 1 + Game/Code/Screens/UScreenEditSub.pas | 8 ++++++-- Game/Code/Screens/UScreenLevel.pas | 3 ++- Game/Code/Screens/UScreenMain.pas | 3 ++- Game/Code/Screens/UScreenOpen.pas | 3 ++- Game/Code/Screens/UScreenOptions.pas | 4 +++- Game/Code/Screens/UScreenOptionsAdvanced.pas | 4 +++- Game/Code/Screens/UScreenOptionsGame.pas | 4 +++- Game/Code/Screens/UScreenOptionsGraphics.pas | 4 +++- Game/Code/Screens/UScreenOptionsLyrics.pas | 4 +++- Game/Code/Screens/UScreenOptionsRecord.pas | 3 ++- Game/Code/Screens/UScreenOptionsSound.pas | 4 +++- Game/Code/Screens/UScreenOptionsThemes.pas | 4 +++- Game/Code/Screens/UScreenPartyNewRound.pas | 4 +++- Game/Code/Screens/UScreenPartyOptions.pas | 4 +++- Game/Code/Screens/UScreenPartyPlayer.pas | 2 +- Game/Code/Screens/UScreenPartyScore.pas | 4 +++- Game/Code/Screens/UScreenPartyWin.pas | 4 +++- Game/Code/Screens/UScreenPopup.pas | 6 ++++-- Game/Code/Screens/UScreenScore.pas | 4 +++- Game/Code/Screens/UScreenSing.pas | 4 +++- Game/Code/Screens/UScreenSingModi.pas | 4 +++- Game/Code/Screens/UScreenSong.pas | 4 +++- Game/Code/Screens/UScreenSongJumpto.pas | 3 ++- Game/Code/Screens/UScreenSongMenu.pas | 4 +++- Game/Code/Screens/UScreenStatDetail.pas | 4 +++- Game/Code/Screens/UScreenStatMain.pas | 4 +++- Game/Code/Screens/UScreenTop5.pas | 5 ++++- Game/Code/Screens/UScreenWelcome.pas | 3 ++- 32 files changed, 91 insertions(+), 33 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index a0ef01af..deaa042e 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -112,7 +112,9 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin FadeTo(@ScreenMain); Music.PlayBack; diff --git a/Game/Code/Screens/UScreenEdit.pas b/Game/Code/Screens/UScreenEdit.pas index ac2964cd..93c2a5b4 100644 --- a/Game/Code/Screens/UScreenEdit.pas +++ b/Game/Code/Screens/UScreenEdit.pas @@ -32,7 +32,9 @@ begin begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Music.PlayBack; FadeTo(@ScreenMain); diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index f1e3ba32..791f8e50 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -83,7 +83,9 @@ begin Result := false; end; - SDLK_ESCAPE: + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin MidiFile.StopPlaying; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenEditHeader.pas b/Game/Code/Screens/UScreenEditHeader.pas index 35d7840f..a7105b0e 100644 --- a/Game/Code/Screens/UScreenEditHeader.pas +++ b/Game/Code/Screens/UScreenEditHeader.pas @@ -57,6 +57,7 @@ begin begin Result := false; end; + SDLK_ESCAPE : begin // Music.PlayBack; diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 9ca45f55..1d5cc66d 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -94,7 +94,9 @@ begin If (PressedDown) then begin // Key Down case PressedKey of - SDLK_ESCAPE: + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin FadeTo(@ScreenSong); end; @@ -565,7 +567,9 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of - SDLK_ESCAPE: + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin FadeTo(@ScreenSong); end; diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas index fc343042..34fc87af 100644 --- a/Game/Code/Screens/UScreenLevel.pas +++ b/Game/Code/Screens/UScreenLevel.pas @@ -29,7 +29,8 @@ begin Result := false; end; - SDLK_ESCAPE : + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Music.PlayBack; FadeTo(@ScreenName); diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 085f253d..3d591a5c 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -53,7 +53,8 @@ begin Result := false; end; - SDLK_ESCAPE : + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Result := False; end; diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index af984a21..68667d87 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -52,7 +52,8 @@ begin end; end; - SDLK_ESCAPE: + + SDLK_ESCAPE : begin //Empty Filename and go to last Screen FileName := ''; diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas index 02d42568..a1f64659 100644 --- a/Game/Code/Screens/UScreenOptions.pas +++ b/Game/Code/Screens/UScreenOptions.pas @@ -31,7 +31,9 @@ begin begin Result := false; end; - SDLK_ESCAPE: + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Ini.Save; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index 9cac8c5e..63c3aa7a 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -27,7 +27,9 @@ begin begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Ini.Save; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index 8712decc..0f69f326 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -29,7 +29,9 @@ begin begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Music.PlayBack; RefreshSongs; diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index c0641fc2..d4be6974 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -27,7 +27,9 @@ begin begin Result := false; end; - SDLK_ESCAPE: + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Ini.Save; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas index f4044933..5cadc5b9 100644 --- a/Game/Code/Screens/UScreenOptionsLyrics.pas +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -27,7 +27,9 @@ begin begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Ini.Save; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index b005492a..2ff989fa 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -32,7 +32,8 @@ begin begin Result := false; end; - SDLK_ESCAPE, SDLK_BACKSPACE: + SDLK_ESCAPE, + SDLK_BACKSPACE: begin Ini.Save; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index fb04ab64..3c3e28e4 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -27,7 +27,9 @@ begin begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Ini.Save; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index b73693c1..5b5f8877 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -30,7 +30,9 @@ begin begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Ini.Save; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index f084ee10..938aacfb 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -83,7 +83,9 @@ begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Music.PlayBack; CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 49cc8c53..493f3939 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -55,7 +55,9 @@ begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Music.PlayBack; FadeTo(@ScreenMain); diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index d6859775..e6830ee6 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -181,7 +181,7 @@ begin Button[Interaction].Text[0].DeleteLastL; end; - SDLK_ESCAPE : + SDLK_ESCAPE: begin Ini.SaveNames; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index 5c632356..6333896c 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -53,7 +53,9 @@ begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Music.PlayStart; if (PartySession.CurRound < High(PartySession.Rounds)) then diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas index 76d0420f..fecca3d1 100644 --- a/Game/Code/Screens/UScreenPartyWin.pas +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -46,7 +46,9 @@ begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Music.PlayStart; FadeTo(@ScreenMain); diff --git a/Game/Code/Screens/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas index 2a789e42..f583eb90 100644 --- a/Game/Code/Screens/UScreenPopup.pas +++ b/Game/Code/Screens/UScreenPopup.pas @@ -53,7 +53,8 @@ begin Result := false; end; - SDLK_ESCAPE : + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Display.CheckOK:=False; Display.NextScreenWithCheck:=NIL; @@ -159,7 +160,8 @@ begin Result := false; end; - SDLK_ESCAPE : + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Visible:=False; Result := false; diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index af1ccb59..2fdccf8e 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -64,7 +64,9 @@ begin Result := false; end; - SDLK_ESCAPE : + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin if (not Fadeout) then begin // Music.StopShuffle; diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 6ce19c17..8291a430 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -103,7 +103,9 @@ begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin //Record Sound Hack: //Sound[0].BufferLong diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 0b9ab893..e046e193 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -73,7 +73,9 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Finish; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index cddf864e..38266797 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -269,7 +269,9 @@ begin begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin if (Mode = 0) then begin diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 7103257d..48d23468 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -61,7 +61,8 @@ begin end; end; - SDLK_RETURN, SDLK_ESCAPE: + SDLK_RETURN, + SDLK_ESCAPE: begin Visible := False; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 06b8f183..9fe70522 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -73,7 +73,9 @@ begin Result := false; end; - SDLK_ESCAPE : + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Music.PlayBack; Visible := False; diff --git a/Game/Code/Screens/UScreenStatDetail.pas b/Game/Code/Screens/UScreenStatDetail.pas index 1461a9da..9dc6c525 100644 --- a/Game/Code/Screens/UScreenStatDetail.pas +++ b/Game/Code/Screens/UScreenStatDetail.pas @@ -47,7 +47,9 @@ begin begin Result := false; end; - SDLK_ESCAPE: + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Music.PlayBack; FadeTo(@ScreenStatMain); diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index b3907d41..86d7d561 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -34,7 +34,9 @@ begin begin Result := false; end; - SDLK_ESCAPE: + + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Ini.Save; Music.PlayBack; diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas index 4d542bf0..0f758db6 100644 --- a/Game/Code/Screens/UScreenTop5.pas +++ b/Game/Code/Screens/UScreenTop5.pas @@ -37,7 +37,10 @@ begin Result := false; end; - SDLK_ESCAPE, SDLK_RETURN: + + SDLK_ESCAPE, + SDLK_BACKSPACE : + SDLK_RETURN: begin if (not Fadeout) then begin FadeTo(@ScreenSong); diff --git a/Game/Code/Screens/UScreenWelcome.pas b/Game/Code/Screens/UScreenWelcome.pas index 79fcc2c4..35e159f8 100644 --- a/Game/Code/Screens/UScreenWelcome.pas +++ b/Game/Code/Screens/UScreenWelcome.pas @@ -25,7 +25,8 @@ begin Result := true; If (PressedDown) Then begin case PressedKey of - SDLK_ESCAPE : + SDLK_ESCAPE, + SDLK_BACKSPACE : begin Result := False; end; -- cgit v1.2.3 From addda3536d0d82714e826994b3a10c6b468c3252 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 5 Sep 2007 14:45:42 +0000 Subject: Fixed two Bugs in KeyDown Handling that causes that the code could not be compiled. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@373 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditSub.pas | 3 +-- Game/Code/Screens/UScreenTop5.pas | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 1d5cc66d..948ff2cc 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -568,8 +568,7 @@ begin begin // Key Down case PressedKey of - SDLK_ESCAPE, - SDLK_BACKSPACE : + SDLK_ESCAPE: begin FadeTo(@ScreenSong); end; diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas index 0f758db6..f9de4114 100644 --- a/Game/Code/Screens/UScreenTop5.pas +++ b/Game/Code/Screens/UScreenTop5.pas @@ -39,7 +39,7 @@ begin SDLK_ESCAPE, - SDLK_BACKSPACE : + SDLK_BACKSPACE, SDLK_RETURN: begin if (not Fadeout) then begin -- cgit v1.2.3 From 247cbdca4eb8af228fa1753f1185e85077b5befa Mon Sep 17 00:00:00 2001 From: b1indy Date: Fri, 7 Sep 2007 21:09:02 +0000 Subject: UScreenSing.pas, UScreenSingModi.pas: removed Uffmpeg and USmpeg, added UVideo UGraphic.pas: prepared for possible loading animation UGraphicClasses.pas, ULCD.pas, ULight.pas, UMain.pas, USkins.pas, UDisplay.pas, UMenuButton.pas, UMenuSelect.pas, UMenuSelectSlide.pas, UMenuStatic.pas, UScreenCredits.pas, UScreenEditSub.pas, UScreenOpen.pas, UScreenPopup.pas: some fixes to get rid of some compiler infos/warnings git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@374 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 26 +++++++++----------------- Game/Code/Screens/UScreenEditSub.pas | 2 +- Game/Code/Screens/UScreenOpen.pas | 2 +- Game/Code/Screens/UScreenPopup.pas | 10 ++++------ Game/Code/Screens/UScreenSing.pas | 4 ++-- Game/Code/Screens/UScreenSingModi.pas | 7 ++++--- 6 files changed, 21 insertions(+), 30 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index deaa042e..067414bd 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -165,6 +165,7 @@ end; function TScreenCredits.Draw: boolean; begin DrawCredits; + Draw:=true; end; procedure TScreenCredits.onShow; @@ -187,7 +188,7 @@ end; Procedure TScreenCredits.Draw_FunkyText; var - S,I, Len: Integer; + S: Integer; X,Y,A: Real; visibleText: PChar; begin @@ -208,6 +209,7 @@ begin for S := 0 to length(visibleText)-1 do begin Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); + A:=0; if (Credits_X+X < 15) then A:=0; if (Credits_X+X >=15) then A:=Credits_X+X-15; if Credits_X+X > 32 then A:=17; @@ -488,7 +490,6 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -511,7 +512,7 @@ Data := Music.GetFFTData; gltranslatef(223,0,0); if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin gltranslatef(223,0,0); - glrotatef((CTime-(STime+Delay-10))*-9,0,0,1); + glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1); gltranslatef(-223,0,0); end; glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum); @@ -541,7 +542,6 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -599,7 +599,6 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -652,7 +651,6 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -675,12 +673,11 @@ Data := Music.GetFFTData; f:=258.0-25.8*(CTime-STime) else f:=0; - + g:=0; if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin j:=CTime-(STime+Delay-10); g:=32.6*j; - end else - g:=0; + end; glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); @@ -742,7 +739,6 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -766,11 +762,11 @@ Data := Music.GetFFTData; else f:=0; + g:=0; if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin j:=CTime-(STime+Delay-10); g:=32.6*j; - end else - g:=0; + end; glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); @@ -798,7 +794,6 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -856,7 +851,6 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -882,9 +876,8 @@ Data := Music.GetFFTData; end; if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin j:=CTime-(STime+Delay-10); - f:=j*10.0; gltranslatef(0,-223,0); - glrotatef(j*-9,0,0,1); + glrotatef(integer(j)*-9,0,0,1); gltranslatef(0,223,0); glrotatef(j*9,0,0,1); end; @@ -915,7 +908,6 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 948ff2cc..6eef8509 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -2,7 +2,7 @@ unit UScreenEditSub; interface -uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, UMenuText, +uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, UMenuText, ULyrics, Math, OpenGL12, UThemes, MidiOut; type diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index 68667d87..c27ee762 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -2,7 +2,7 @@ unit UScreenOpen; interface -uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, UMenuText, +uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, UMenuText, ULyrics, Math, OpenGL12, UThemes; type diff --git a/Game/Code/Screens/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas index f583eb90..cc1b4492 100644 --- a/Game/Code/Screens/UScreenPopup.pas +++ b/Game/Code/Screens/UScreenPopup.pas @@ -19,8 +19,8 @@ type type TScreenPopupError = class(TMenu) - private - CurMenu: Byte; //Num of the cur. Shown Menu +{ private + CurMenu: Byte; //Num of the cur. Shown Menu} public Visible: Boolean; //Whether the Menu should be Drawn @@ -124,7 +124,7 @@ end; function TScreenPopupCheck.Draw: boolean; begin - inherited Draw; + Draw:=inherited Draw; end; procedure TScreenPopupCheck.onShow; @@ -207,7 +207,7 @@ end; function TScreenPopupError.Draw: boolean; begin - inherited Draw; + Draw:=inherited Draw; end; procedure TScreenPopupError.onShow; @@ -216,12 +216,10 @@ begin end; procedure TScreenPopupError.onHide; -var i: integer; begin end; procedure TScreenPopupError.ShowPopup(msg: String); -var i: integer; begin Interaction := 0; //Reset Interaction Visible := True; //Set Visible diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 8291a430..7a585cef 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -3,7 +3,7 @@ unit UScreenSing; interface uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, ULyrics, - TextGL, OpenGL12, BASS, UThemes, ULCD, UGraphicClasses, Uffmpeg; + TextGL, OpenGL12, BASS, UThemes, ULCD, UGraphicClasses, UVideo; type TScreenSing = class(TMenu) @@ -224,7 +224,7 @@ begin LyricMain := TLyric.Create; LyricSub := TLyric.Create; - Uffmpeg.Init; + UVideo.Init; end; procedure TScreenSing.onShow; diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index e046e193..0305315f 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -2,7 +2,7 @@ unit UScreenSingModi; interface -uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, ULyrics, +uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, ULyrics, TextGL, OpenGL12, BASS, UThemes, ULCD, UScreenSing, ModiSDK; type @@ -943,10 +943,11 @@ end; if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) then SingDrawBackground; + // comment by blindy: wo zum henker wird denn in diesem screen ein video abgespielt? // update and draw movie - if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin +{ if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin UpdateSmpeg; // this only draws - end; + end;} // draw static menu (FG) DrawFG; -- cgit v1.2.3 From e0b594a06c1e70df28b873b49e538ded7b3124c5 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 8 Sep 2007 09:46:16 +0000 Subject: Fixed USMPeg still in Uses from UScreenSing git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@377 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 7a585cef..deaff447 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -2,7 +2,7 @@ unit UScreenSing; interface -uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, ULyrics, +uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, ULyrics, TextGL, OpenGL12, BASS, UThemes, ULCD, UGraphicClasses, UVideo; type -- cgit v1.2.3 From 13666b8a713f7f46d1db186ba147aa91984ddb0f Mon Sep 17 00:00:00 2001 From: mogguh Date: Mon, 10 Sep 2007 13:06:56 +0000 Subject: Overall look: ScoreBGs and playerboxes (p1, p2,..) are now drawn as colorized pngs. Notes are drawn with 3 textures instead of 2: bg_glow, notebg (unsung) and note hit (sung) - these are colorized pngs - textures will come in the following commit. Known Bugs: - ScoreBGs are not yet drawn in playercolor (only affects player count > 3) - Phrasen bonus pop up, indexes are not yet filled with usable data, therefore textures are not yet loaded correctly - Linebonus not yet done git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@382 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 393 ++++++++++++++-------------------- Game/Code/Screens/UScreenSingModi.pas | 1 + 2 files changed, 162 insertions(+), 232 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index deaff447..a5f6a317 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -141,24 +141,34 @@ end; procedure TScreenSing.Pause; begin if not paused then //Pause einschalten - begin - PauseTime := Czas.Teraz; - Paused := true; - //stop Music - Music.Pause; - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then //Video - FFmpegTogglePause;//PauseSmpeg; //Video - end - else //Pause ausschalten - begin - Czas.Teraz := PauseTime; //Position of Notes - Music.MoveTo (PauseTime);//Position of Music - Music.Play; //Play Music - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then //Video - FFmpegTogglePause;//PlaySmpeg; + begin + // pause Time + PauseTime := Czas.Teraz; + Paused := true; + + // pause Music + Music.Pause; + + // pause Video + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + FFmpegTogglePause; + end + else //Pause ausschalten + begin + Czas.Teraz := PauseTime; //Position of Notes + + // Position of Music + Music.MoveTo (PauseTime); + // Play Music + Music.Play; + + // Video + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + FFmpegTogglePause; //SkipSmpeg(PauseTime); - Paused := false; - end; + + Paused := false; + end; end; //Pause Mod End @@ -171,59 +181,60 @@ begin LoadFromTheme(Theme.Sing); - // time - //TextTime := AddText(75, 14, 1, 8, 0.25, 0.25, 0.25, '00:00'); - - //TimeBar mod - StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); - TextTimeText := AddText(Theme.Sing.TextTimeText); - //eoa TimeBar mod - - StaticP1 := AddStatic(Theme.Sing.StaticP1); - StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); - TextP1 := AddText(Theme.Sing.TextP1); - TextP1Score := AddText(Theme.Sing.TextP1Score); - - //moveable singbar mod - StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar); - StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar); - StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); - StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); - StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar); - StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar); - //eoa moveable singbar - - //Added for ps3 skin - //This one is shown in 2/4P mode - StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); - StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG); - TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); - TextP1TwoPScore := AddText(Theme.Sing.TextP1TwoPScore); - - //This one is shown in 3/6P mode - StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); + //TimeBar + StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); + TextTimeText := AddText(Theme.Sing.TextTimeText); + +// 1 player | P1 + StaticP1 := AddStatic(Theme.Sing.StaticP1); + StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); + TextP1 := AddText(Theme.Sing.TextP1); + TextP1Score := AddText(Theme.Sing.TextP1Score); + StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar); + +// 2 or 4 players | P1 + StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); + StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG); + TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); + TextP1TwoPScore := AddText(Theme.Sing.TextP1TwoPScore); + StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); + + // | P2 + StaticP2R := AddStatic(Theme.Sing.StaticP2R); + StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); + TextP2R := AddText(Theme.Sing.TextP2R); + TextP2RScore := AddText(Theme.Sing.TextP2RScore); + StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); + +// 3 or 6 players | P1 + StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); StaticP1ThreePScoreBG := AddStatic(Theme.Sing.StaticP1ThreePScoreBG); - TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); - TextP1ThreePScore := AddText(Theme.Sing.TextP1ThreePScore); - //eoa - - StaticP2R := AddStatic(Theme.Sing.StaticP2R); - StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); - TextP2R := AddText(Theme.Sing.TextP2R); - TextP2RScore := AddText(Theme.Sing.TextP2RScore); - - StaticP2M := AddStatic(Theme.Sing.StaticP2M); - StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG); - TextP2M := AddText(Theme.Sing.TextP2M); - TextP2MScore := AddText(Theme.Sing.TextP2MScore); - - StaticP3R := AddStatic(Theme.Sing.StaticP3R); - StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG); - TextP3R := AddText(Theme.Sing.TextP3R); - TextP3RScore := AddText(Theme.Sing.TextP3RScore); - - LyricMain := TLyric.Create; - LyricSub := TLyric.Create; + TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); + TextP1ThreePScore := AddText(Theme.Sing.TextP1ThreePScore); + StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar); + + // | P2 + StaticP2M := AddStatic(Theme.Sing.StaticP2M); + StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG); + TextP2M := AddText(Theme.Sing.TextP2M); + TextP2MScore := AddText(Theme.Sing.TextP2MScore); + StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar); + + // | P3 + StaticP3R := AddStatic(Theme.Sing.StaticP3R); + StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG); + TextP3R := AddText(Theme.Sing.TextP3R); + TextP3RScore := AddText(Theme.Sing.TextP3RScore); + StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar); + + if ScreenAct = 2 then begin + // katze und affe + + end; + + LyricMain := TLyric.Create; + LyricSub := TLyric.Create; + UVideo.Init; end; @@ -245,44 +256,43 @@ begin SetLength(Player, PlayersPlay); // Player[0].ScoreTotalI := 0; - case PlayersPlay of 1: begin V1 := true; - V1TwoP := false; //added for ps3 skin - V1ThreeP := false; //added for ps3 skin + V1TwoP := false; + V1ThreeP := false; V2R := false; V2M := false; V3R := false; end; 2: begin V1 := false; - V1TwoP := true; //added for ps3 skin - V1ThreeP := false; //added for ps3 skin + V1TwoP := true; + V1ThreeP := false; V2R := true; V2M := false; V3R := false; end; 3: begin V1 := false; - V1TwoP := false; //added for ps3 skin - V1ThreeP := true; //added for ps3 skin + V1TwoP := false; + V1ThreeP := true; V2R := false; V2M := true; V3R := true; end; 4: begin // double screen V1 := false; - V1TwoP := true; //added for ps3 skin - V1ThreeP := false; //added for ps3 skin + V1TwoP := true; + V1ThreeP := false; V2R := true; V2M := false; V3R := false; end; 6: begin // double screen V1 := false; - V1TwoP := false; //added for ps3 skin - V1ThreeP := true; //added for ps3 skin + V1TwoP := false; + V1ThreeP := true; V2R := false; V2M := true; V3R := true; @@ -290,38 +300,40 @@ begin end; - //Added for ps3 skin //This one is shown in 1P mode - Static[StaticP1].Visible := V1; - Static[StaticP1ScoreBG].Visible := V1; - Text[TextP1].Visible := V1; - Text[TextP1Score].Visible := V1; + Static[StaticP1].Visible := V1; + Static[StaticP1ScoreBG].Visible := V1; + Text[TextP1].Visible := V1; + Text[TextP1Score].Visible := V1; + + //This one is shown in 2/4P mode - Static[StaticP1TwoP].Visible := V1TwoP; - Static[StaticP1TwoPScoreBG].Visible := V1TwoP; - Text[TextP1TwoP].Visible := V1TwoP; - Text[TextP1TwoPScore].Visible := V1TwoP; + Static[StaticP1TwoP].Visible := V1TwoP; + Static[StaticP1TwoPScoreBG].Visible := V1TwoP; + Text[TextP1TwoP].Visible := V1TwoP; + Text[TextP1TwoPScore].Visible := V1TwoP; + + Static[StaticP2R].Visible := V2R; + Static[StaticP2RScoreBG].Visible := V2R; + Text[TextP2R].Visible := V2R; + Text[TextP2RScore].Visible := V2R; + + //This one is shown in 3/6P mode - Static[StaticP1ThreeP].Visible := V1ThreeP; + Static[StaticP1ThreeP].Visible := V1ThreeP; Static[StaticP1ThreePScoreBG].Visible := V1ThreeP; - Text[TextP1ThreeP].Visible := V1ThreeP; - Text[TextP1ThreePScore].Visible := V1ThreeP; - //eoa + Text[TextP1ThreeP].Visible := V1ThreeP; + Text[TextP1ThreePScore].Visible := V1ThreeP; - Static[StaticP2R].Visible := V2R; - Static[StaticP2RScoreBG].Visible := V2R; - Text[TextP2R].Visible := V2R; - Text[TextP2RScore].Visible := V2R; + Static[StaticP2M].Visible := V2M; + Static[StaticP2MScoreBG].Visible := V2M; + Text[TextP2M].Visible := V2M; + Text[TextP2MScore].Visible := V2M; - Static[StaticP2M].Visible := V2M; - Static[StaticP2MScoreBG].Visible := V2M; - Text[TextP2M].Visible := V2M; - Text[TextP2MScore].Visible := V2M; - - Static[StaticP3R].Visible := V3R; - Static[StaticP3RScoreBG].Visible := V3R; - Text[TextP3R].Visible := V3R; - Text[TextP3RScore].Visible := V3R; + Static[StaticP3R].Visible := V3R; + Static[StaticP3RScoreBG].Visible := V3R; + Text[TextP3R].Visible := V3R; + Text[TextP3RScore].Visible := V3R; // load notes ResetSingTemp; @@ -479,21 +491,6 @@ begin GoldenRec.SentenceChange; //GoldenStarsTwinkle Mod End - {Static[StaticP2R].Visible := V2R; - Static[StaticP2RScoreBG].Visible := V2R; - Text[TextP2R].Visible := V2R; - Text[TextP2RScore].Visible := V2R; - - Static[StaticP2M].Visible := V2M; - Static[StaticP2MScoreBG].Visible := V2M; - Text[TextP2M].Visible := V2M; - Text[TextP2MScore].Visible := V2M; - - Static[StaticP3R].Visible := V3R; - Static[StaticP3RScoreBG].Visible := V3R; - Text[TextP3R].Visible := V3R; - Text[TextP3RScore].Visible := V3R;} - //Set Position of Line Bonus - PhrasenBonus if (Ini.LineBonus = 1) then //Show Line Bonus at Scores begin @@ -606,9 +603,6 @@ begin end else if (Ini.LineBonus = 2) then //Show Line Bonus at Notes begin - //SingDrawNoteLines(Nr.Left + 10*ScreenX, 120, Nr.Right + 10*ScreenX, 12); - //SingDrawNoteLines(Nr.Left + 10*ScreenX, 245, Nr.Right + 10*ScreenX, 12); - //SingDrawNoteLines(Nr.Left + 10*ScreenX, 370, Nr.Right + 10*ScreenX, 12); // positions if Ini.SingWindow = 0 then begin @@ -781,24 +775,19 @@ begin - //ScoreBG Mod - // set player colors - if PlayersPlay = 4 then begin + //ScoreBG Mod | den wirren Scheiss hier brauch mer nimmer, wir haben colorized png's - no need for wirrness also + // set player colors - macht nichts weiter als die farben des statics zu wechseln, was zu unschönen effekten bei colorized png führt +{ if PlayersPlay = 4 then begin if ScreenAct = 1 then begin LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P2Dark'); - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - - - end; if ScreenAct = 2 then begin LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, @@ -806,110 +795,57 @@ begin LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P4Dark'); - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); - - - end; end; if PlayersPlay = 6 then begin if ScreenAct = 1 then begin - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P2Dark'); LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, Static[StaticP3R].Texture.ColB, 'P3Dark'); - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); - - - end; if ScreenAct = 2 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, Static[StaticP2R].Texture.ColB, 'P5Dark'); LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, Static[StaticP3R].Texture.ColB, 'P6Dark'); - - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); - - - - - end; - end; - -//Original 0.5.0 -{ // set player colors - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - //LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - //Static[StaticP1].Texture.ColB, 'P1Dark'); -// LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - // Static[StaticP2R].Texture.ColB, 'P2Dark'); - end; - if ScreenAct = 2 then begin - LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - Static[StaticP1].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P4Dark'); end; end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - Static[StaticP1].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P3Dark'); - end; - if ScreenAct = 2 then begin - LoadColor(Static[StaticP1].Texture.ColR, Static[StaticP1].Texture.ColG, - Static[StaticP1].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P6Dark'); - end; - end; } - //end ScoreBG Mod - - + } // set player names (for 2 screens and only Singstar skin) if ScreenAct = 1 then begin - Text[TextP1].Text := 'P1'; - Text[TextP1TwoP].Text := 'P1'; //added for ps3 skin - Text[TextP1ThreeP].Text := 'P1'; //added for ps3 skin - Text[TextP2R].Text := 'P2'; - Text[TextP2M].Text := 'P2'; - Text[TextP3R].Text := 'P3'; + Text[TextP1].Text := 'P1'; + Text[TextP1TwoP].Text := 'P1'; + Text[TextP1ThreeP].Text := 'P1'; + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; end; if ScreenAct = 2 then begin @@ -928,35 +864,37 @@ begin end;} 4: begin - Text[TextP1TwoP].Text := 'P3'; - Text[TextP2R].Text := 'P4'; + Text[TextP1TwoP].Text := 'P3'; + Text[TextP2R].Text := 'P4'; end; 6: begin Text[TextP1ThreeP].Text := 'P4'; - Text[TextP2M].Text := 'P5'; - Text[TextP3R].Text := 'P6'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; end; end; // case end; // if // stereo -// weird stuff, maybe this is for "dual screen?", but where is player three then? - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; +// weird stuff, maybe this is for "dual screen?", but where is player three then? | okay, i commented the stuff out the other day - nothing was missing on screen w/ 6 players - so do we even need this stuff? +// okay this stuff appears again some lines beneath this one, I commented it out for testing what it does - seems like it's doing nothing +// but I might be wrong, so what is this stuff here doing? O.o + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; - Text[TextP1].X := Text[TextP1].X + 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; + Text[TextP1].X := Text[TextP1].X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; - Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; + Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; // end of weird stuff - for S := 1 to 1 do + for S := 1 to 1 do //wtf? Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; for T := 0 to 1 do @@ -1052,17 +990,6 @@ begin end; end; - - // beat flash -{ Flash := 1 - (Czas.MidBeat - Czas.AktBeat); - if (Czas.AktBeat + AktSong.NotesGAP) mod AktSong.Resolution = 0 then Flash := 1 - else Flash := 0; - if Czas.AktBeat < 0 then Flash := 0; - glClearColor(Flash, Flash, Flash, 1);} - - // beat sound -// if (Ini.BeatClick = 1) and (Flash = 1) and (Czas.AktBeat <> Czas.OldBeat) then Music.PlayClick; - // draw static menu (BG) DrawBG; //Draw Background @@ -1120,21 +1047,23 @@ begin // back stereo // weird stuff, maybe this is for "dual screen?", but where is player three then? - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; +// okay this stuff appears again some lines above this one, I commented it out for testing what it does - seems like it's doing nothing +// but I might be wrong, so what is this stuff here doing? O.o + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; - Text[TextP1].X := Text[TextP1].X - 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; + Text[TextP1].X := Text[TextP1].X - 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; - Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; + Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; //weird end - for S := 1 to 1 do + for S := 1 to 1 do // wtf? Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; for T := 0 to 1 do @@ -1205,7 +1134,7 @@ begin If ({(Ini.Oscilloscope = 2) and }(Czesci[0].Czesc[S].TotalNotes>0)) then begin Player[I].ScorePercentTarget := Player[I].ScorePercentTarget + floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 40 - 26); - if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0; + if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0; if Player[I].ScorePercentTarget > 99 then Player[I].ScorePercentTarget := 99; //end Singbar Mod diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 0305315f..20ad0957 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -945,6 +945,7 @@ end; // comment by blindy: wo zum henker wird denn in diesem screen ein video abgespielt? // update and draw movie + // wie wo wadd? also in der selben funktion in der uscreensing kommt des video in der zeile 995, oder was wollteste wissen? :X { if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin UpdateSmpeg; // this only draws end;} -- cgit v1.2.3 From e3fc5e2c58302159b79e0e25e183aa3e75397a41 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 18 Sep 2007 11:16:30 +0000 Subject: added switches.inc , which will contain compiler directives used ( at least ) for porting to linux. this file now contains compiler directive UseSerialPort, which is conditionally set depending on the compiler. at this point lazarus will not use the serial port ( LCD or Light ) units. however this functionality should be maintained at this point in delphi. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@390 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 38266797..2d10c9dc 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1,6 +1,7 @@ unit UScreenSong; interface +{$I switches.inc} uses UMenu, SDL, UMusic, UFiles, UTime, UDisplay, USongs, SysUtils, ULog, UThemes, UTexture, ULanguage, @@ -344,9 +345,13 @@ begin end; SDLK_RETURN: begin - if Length(Songs.Song) > 0 then begin -// PortWriteB($378, 0); - if CatSongs.Song[Interaction].Main then begin // clicked on Category Button + if Length(Songs.Song) > 0 then + begin + {$IFDEF UseSerialPort} + // PortWriteB($378, 0); + {$ENDIF} + if CatSongs.Song[Interaction].Main then + begin // clicked on Category Button //Show Cat in Top Left Mod ShowCatTL (Interaction); -- cgit v1.2.3 From 433a1b7339e2bf96f3b0bb4c98b8c799c6540027 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 18 Sep 2007 13:19:20 +0000 Subject: changes in order to compile in lazarus... minor tidy ups and removal of big old comment blocks.. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@394 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 19 +- Game/Code/Screens/UScreenEditConvert.pas | 41 ++- Game/Code/Screens/UScreenEditSub.pas | 30 +- Game/Code/Screens/UScreenMain.pas | 24 +- Game/Code/Screens/UScreenPartyNewRound.pas | 5 + Game/Code/Screens/UScreenPartyOptions.pas | 4 + Game/Code/Screens/UScreenScore.pas | 18 +- Game/Code/Screens/UScreenSingModi.pas | 479 ++--------------------------- Game/Code/Screens/UScreenSongMenu.pas | 6 +- Game/Code/Screens/UScreenStatMain.pas | 7 +- 10 files changed, 164 insertions(+), 469 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 067414bd..21e164b9 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -104,7 +104,24 @@ const implementation -uses Dialogs,Windows, UGraphic, UMain, UIni, USongs, Textgl, opengl, ULanguage, Math; +uses // Dialogs, + Windows, + UGraphic, + UMain, + UIni, + USongs, + Textgl, +// opengl, + ULanguage, + Math; + +{$IFDEF FPC} +// TODO : JB - move this to a lazarus common file for ultrastar +function RandomRange(aMin: Integer; aMax: Integer) : Integer; +begin +RandomRange := Random(aMax-aMin) + aMin ; +end; +{$ENDIF} function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index 791f8e50..cb6aef6d 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -2,7 +2,18 @@ unit UScreenEditConvert; interface -uses UMenu, SDL, MidiFile, MidiOut, ULog, USongs, UMusic, UThemes; +{$I switches.inc} + +uses UMenu, + SDL, + {$IFDEF UseMIDIPort} + MidiFile, + MidiOut, + {$ENDIF} + ULog, + USongs, + UMusic, + UThemes; type TNote = record @@ -45,10 +56,14 @@ type Sel: integer; Selected: boolean; // FileName: string; + + {$IFDEF UseMIDIPort} MidiFile: TMidiFile; MidiTrack: TMidiTrack; MidiEvent: pMidiEvent; MidiOut: TMidiOutput; + {$ENDIF} + Song: TSong; Czesc: TCzesci; BPM: real; @@ -58,7 +73,10 @@ type procedure AddLyric(Start: integer; Tekst: string); procedure Extract; + {$IFDEF UseMIDIPort} procedure MidiFile1MidiEvent(event: PMidiEvent); + {$ENDIF} + function SelectedNumber: integer; constructor Create; override; procedure onShow; override; @@ -68,7 +86,15 @@ type end; implementation -uses UGraphic, SysUtils, UDrawTexture, TextGL, UFiles, UMain, UIni, OpenGL, USkins; +uses UGraphic, + SysUtils, + UDrawTexture, + TextGL, + UFiles, + UMain, + UIni, + OpenGL12, + USkins; function TScreenEditConvert.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; var @@ -87,7 +113,9 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin + {$IFDEF UseMIDIPort} MidiFile.StopPlaying; + {$ENDIF} Music.PlayBack; FadeTo(@ScreenEdit); end; @@ -102,14 +130,18 @@ begin 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); @@ -356,7 +388,9 @@ begin // 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; @@ -380,7 +414,8 @@ begin MidiOut.Open; - if FileExists(FileName) then begin + if FileExists(FileName) then + begin MidiFile.Filename := FileName; MidiFile.ReadFile; diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 6eef8509..7184b0b6 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -2,8 +2,27 @@ unit UScreenEditSub; interface -uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, UMenuText, - ULyrics, Math, OpenGL12, UThemes, MidiOut; +{$I switches.inc} + +uses + UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + UIni, + ULog, + UTexture, + UMenuText, + ULyrics, + Math, + OpenGL12, + {$IFDEF UseMIDIPort} + MidiOut, + {$ENDIF} + UThemes; type TScreenEditSub = class(TMenu) @@ -31,7 +50,10 @@ type Click: boolean; CopySrc: integer; + {$IFDEF UseMIDIPort} MidiOut: TMidiOutput; + {$endif} + MidiStart: real; MidiStop: real; MidiTime: real; @@ -470,6 +492,7 @@ begin 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); @@ -491,11 +514,13 @@ begin 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); @@ -517,6 +542,7 @@ begin if SDL_ModState = KMOD_LCTRL then begin TransposeNote(1); end; + {$endif} end; // Golden Note Patch diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 3d591a5c..5af3d4a6 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -3,7 +3,15 @@ unit UScreenMain; interface uses - UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes, ULCD, ULight; + UMenu, + SDL, + UDisplay, + UMusic, + UFiles, + SysUtils, + UThemes, + ULCD, + ULight; type TScreenMain = class(TMenu) @@ -25,7 +33,19 @@ type implementation -uses Windows, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl, ULanguage, UParty, UDLLManager, UScreenCredits, USkins; +uses Windows, + UGraphic, + UMain, + UIni, + UTexture, + USongs, + Textgl, +// opengl, + ULanguage, + UParty, + UDLLManager, + UScreenCredits, + USkins; function TScreenMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 938aacfb..30a1f8f0 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -2,6 +2,11 @@ unit UScreenPartyNewRound; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + uses UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 493f3939..ab6bd733 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -2,6 +2,10 @@ unit UScreenPartyOptions; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + uses UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 2fdccf8e..19e934f4 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -3,7 +3,15 @@ unit UScreenScore; interface uses - UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes, ULCD, OpenGL; + UMenu, + SDL, + SysUtils, + UDisplay, + UMusic, + USongs, + UThemes, + ULCD; +// OpenGL; type TScreenScore = class(TMenu) @@ -49,11 +57,11 @@ type implementation -{{$IFDEF TRANSLATE} +//{$IFDEF TRANSLATE} uses UGraphic, UScreenSong, UMenuStatic, UTime, UMain, UIni, ULanguage; -{{$ELSE}{ -uses UGraphic, UScreenSong, UMenuStatic, UTime, UMain, UIni; -{{$ENDIF} +//{$ELSE} +//uses UGraphic, UScreenSong, UMenuStatic, UTime, UMain, UIni; +//{$ENDIF} function TScreenScore.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin Result := true; diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 20ad0957..6d3add87 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -2,8 +2,28 @@ unit UScreenSingModi; interface -uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, ULyrics, - TextGL, OpenGL12, BASS, UThemes, ULCD, UScreenSing, ModiSDK; +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + UIni, + ULog, + UTexture, + ULyrics, + TextGL, + OpenGL12, + BASS, + UThemes, + ULCD, + UScreenSing, + ModiSDK; type TScreenSingModi = class(TScreenSing) @@ -134,459 +154,10 @@ begin end; procedure TScreenSingModi.onShow; -{var - P: integer; - V1: boolean; - V2R: boolean; - V2M: boolean; - V3R: boolean; - NR: TRecR; //Line Bonus Mod } var I: Integer; begin - { Log.LogStatus('Begin', 'onShow'); - FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented - - // prepare players - SetLength(Player, PlayersPlay); -// Player[0].ScoreTotalI := 0; - - - case PlayersPlay of - 1: begin - V1 := true; - V2R := false; - V2M := false; - V3R := false; - end; - 2: begin - V1 := true; - V2R := true; - V2M := false; - V3R := false; - end; - 3: begin - V1 := true; - V2R := false; - V2M := true; - V3R := true; - end; - 4: begin // double screen - V1 := true; - V2R := true; - V2M := false; - V3R := false; - end; - 6: begin // double screen - V1 := true; - V2R := false; - V2M := true; - V3R := true; - end; - - end; - - - - Static[StaticP2R].Visible := V2R; - Static[StaticP2RScoreBG].Visible := V2R; - Text[TextP2R].Visible := V2R; - Text[TextP2RScore].Visible := V2R; - - Static[StaticP2M].Visible := V2M; - Static[StaticP2MScoreBG].Visible := V2M; - Text[TextP2M].Visible := V2M; - Text[TextP2MScore].Visible := V2M; - - Static[StaticP3R].Visible := V3R; - Static[StaticP3RScoreBG].Visible := V3R; - Text[TextP3R].Visible := V3R; - Text[TextP3RScore].Visible := V3R; - - - - // load notes - CzyscNuty; -// Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); - AktSong := CatSongs.Song[CatSongs.Selected]; - - WczytajCzesci(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName); - AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; -// AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer}{ + 20 {microphone}{ + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed - - // set movie - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin - OpenSmpeg(AktSong.Path + AktSong.Video); - SkipSmpeg(AktSong.VideoGAP + AktSong.Start); - AktSong.VideoLoaded := true; - end; - - // set background - if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then - Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background) - else - Tex_Background.TexNum := -1; - - // play music (I) - //Music.CaptureStart; - Music.MoveTo(AktSong.Start); -// Music.Play; - - // prepare timer (I) -// CountSkipTimeSet; - Czas.Teraz := AktSong.Start; - Czas.Razem := Music.Length; - if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000; - Czas.OldBeat := -1; - for P := 0 to High(Player) do - ClearScores(P); - - // main text - LyricMain.Clear; - LyricMain.X := 400; - LyricMain.Y := Skin_LyricsT; - LyricMain.Scale := 1.4; //1.4 - LyricMain.Align := 1; - - // sub text - LyricSub.Clear; - LyricSub.X := 400; - LyricSub.Y := Skin_LyricsT + 42; //40 - LyricSub.Align := 1; - - // set custom options - case Ini.LyricsFont of - 0: - begin - LyricMain.FontStyle := 0; - LyricSub.FontStyle := 0; - LyricMain.Size := 14; // 13 - LyricSub.Size := 14; // 13 - LyricMain.ColR := Skin_FontR; - LyricMain.ColG := Skin_FontG; - LyricMain.ColB := Skin_FontB; //Change für Crazy Joker - {LyricMain.ColSR := Skin_FontHighlightR; - LyricMain.ColSG := Skin_FontHighlightG; - LyricMain.ColSB := Skin_FontHighlightB;1aa5dc} { - LyricMain.ColSR := 26/255; - LyricMain.ColSG := 165/255; - LyricMain.ColSB := 220/255; - - LyricSub.ColR := 0.6; - LyricSub.ColG := 0.6; - LyricSub.ColB := 0.6; - end; - 1: - begin - LyricMain.FontStyle := 2; - LyricSub.FontStyle := 2; - LyricMain.Size := 14; - LyricSub.Size := 14; - LyricMain.ColR := 0.75; - LyricMain.ColG := 0.75; - LyricMain.ColB := 1; - LyricMain.ColSR := 0.5; - LyricMain.ColSG := 0.5; - LyricMain.ColSB := 1; - LyricSub.ColR := 0.8; - LyricSub.ColG := 0.8; - LyricSub.ColB := 0.8; - end; - 2: - begin - LyricMain.FontStyle := 3; - LyricSub.FontStyle := 3; - LyricMain.Size := 12; - LyricSub.Size := 12; - LyricMain.ColR := 0.75; - LyricMain.ColG := 0.75; - LyricMain.ColB := 1; - LyricMain.ColSR := 0.5; - LyricMain.ColSG := 0.5; - LyricMain.ColSB := 1; - LyricSub.ColR := 0.8; - LyricSub.ColG := 0.8; - LyricSub.ColB := 0.8; - end; - end; // case - - case Ini.LyricsEffect of - 0: LyricMain.Style := 1; // 0 - one selected, 1 - selected all to the current - 1: LyricMain.Style := 2; - 2: LyricMain.Style := 3; - 3: LyricMain.Style := 4; - end; // case - - // fill texts - LyricMain.AddCzesc(0); - LyricMain.Selected := -1; - LyricSub.AddCzesc(1); - LyricSub.Selected := -1; - - UpdateLCD; - - //Deactivate Pause - Paused := False; - - {Static[StaticP2R].Visible := V2R; - Static[StaticP2RScoreBG].Visible := V2R; - Text[TextP2R].Visible := V2R; - Text[TextP2RScore].Visible := V2R; - - Static[StaticP2M].Visible := V2M; - Static[StaticP2MScoreBG].Visible := V2M; - Text[TextP2M].Visible := V2M; - Text[TextP2MScore].Visible := V2M; - - Static[StaticP3R].Visible := V3R; - Static[StaticP3RScoreBG].Visible := V3R; - Text[TextP3R].Visible := V3R; - Text[TextP3RScore].Visible := V3R;} { - - //Set Position of Line Bonus - PhrasenBonus - if (Ini.LineBonus = 1) then //Show Line Bonus at Scores - begin - Case PlayersPlay of - 1: begin - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; - end; - - 2: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.X; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.X; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.X; - Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - end; - - 3: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - end; - - 4: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; - - //P4 - Player[3].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; - Player[3].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[3].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; - Player[3].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - end; - - 6: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - - //P4 - Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[3].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[3].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[3].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; - - //P5 - Player[4].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[4].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[4].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[4].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P6 - Player[5].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[5].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[5].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[5].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - end; - end; - end - else if (Ini.LineBonus = 2) then //Show Line Bonus at Notes - begin - //SingDrawNoteLines(Nr.Left + 10*ScreenX, 120, Nr.Right + 10*ScreenX, 12); - //SingDrawNoteLines(Nr.Left + 10*ScreenX, 245, Nr.Right + 10*ScreenX, 12); - //SingDrawNoteLines(Nr.Left + 10*ScreenX, 370, Nr.Right + 10*ScreenX, 12); - - // positions - if Ini.SingWindow = 0 then begin - NR.Left := 120; - end else begin - NR.Left := 20; - end; - NR.Right := 780; - - NR.Width := NR.Right - NR.Left; - NR.WMid := NR.Width / 2; - NR.Mid := NR.Left + NR.WMid; - - Case PlayersPlay of - 1: begin - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[0].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[0].LineBonus_StartY := Skin_P2_NotesB - 105; - end; - - 2: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - end; - - 3: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[0].LineBonus_TargetY := 120 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[0].LineBonus_StartY := 120 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[1].LineBonus_TargetY := 245 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[1].LineBonus_StartY := 245 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[2].LineBonus_TargetY := 370 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[2].LineBonus_StartY := 370 + 28; - end; - - 4: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[2].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[2].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P4 - Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[3].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[3].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - end; - - 6: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[0].LineBonus_TargetY := 120 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[0].LineBonus_StartY := 120 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[1].LineBonus_TargetY := 245 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[1].LineBonus_StartY := 245 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[2].LineBonus_TargetY := 370 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[2].LineBonus_StartY := 370 + 28; - - //P4 - Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[3].LineBonus_TargetY := 120 - 65 + 28; - Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[3].LineBonus_StartY := 120 + 28; - - //P5 - Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[4].LineBonus_TargetY := 245 - 65 + 28; - Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[4].LineBonus_StartY := 245 + 28; - - //P6 - Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 87); - Player[5].LineBonus_TargetY := 370 - 65 + 28; - Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 87); - Player[5].LineBonus_StartY := 370 + 28; - end; - end; - end; - //Set Position of Line Bonus - PhrasenBonus End - //Set Num of Empty Sentences for Phrasen Bonus - NumEmptySentences := 0; - for P := low(Czesci[0].Czesc) to high(Czesci[0].Czesc) do - if Czesci[0].Czesc[P].TotalNotes = 0 then Inc(NumEmptySentences); - - Log.LogStatus('End', 'onShow'); } - PlayersPlay := TeamInfo.NumTeams; if DLLMan.Selected.LoadSong then //Start with Song @@ -602,9 +173,9 @@ begin PlayerInfo.NumPlayers := PlayersPlay; for I := 0 to PlayerInfo.NumPlayers-1 do begin - PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); - PlayerInfo.Playerinfo[I].Score:= 0; - PlayerInfo.Playerinfo[I].Bar := 50; + PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); + PlayerInfo.Playerinfo[I].Score := 0; + PlayerInfo.Playerinfo[I].Bar := 50; PlayerInfo.Playerinfo[I].Enabled := True; end; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 9fe70522..41432356 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} + uses UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; @@ -612,4 +616,4 @@ begin end; end. - \ No newline at end of file + diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index 86d7d561..f7961727 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -2,6 +2,11 @@ unit UScreenStatMain; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + uses UMenu, SDL, SysUtils, UDisplay, UMusic, UIni, UThemes; @@ -223,4 +228,4 @@ begin Button[I].Texture.ScaleW := Progress; end; -end. \ No newline at end of file +end. -- cgit v1.2.3 From 62c82114318ed04ce42617fa9ce2e179834dbda4 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 19 Sep 2007 11:44:10 +0000 Subject: added UCommon ( in classes ) for lazarus... common functions needed for lazarus ( and others ) can be put in here. also this now compiles on lazarus.. ( dosnt link yet... but I dont get any critical compiler errors ) tested to compile in my delphi, and basic functionality is fine. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@395 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 12 ++---------- Game/Code/Screens/UScreenEditConvert.pas | 14 +++++++++++++- Game/Code/Screens/UScreenEditSub.pas | 12 ++++++++++-- Game/Code/Screens/UScreenScore.pas | 14 ++++++++++---- Game/Code/Screens/UScreenSing.pas | 10 ++++++++-- Game/Code/Screens/UScreenSong.pas | 7 ++++--- Game/Code/Screens/UScreenTop5.pas | 13 +++++++++---- 7 files changed, 56 insertions(+), 26 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 21e164b9..3b1efc6e 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -104,24 +104,16 @@ const implementation -uses // Dialogs, - Windows, +uses Windows, UGraphic, UMain, UIni, USongs, Textgl, -// opengl, ULanguage, + UCommon, Math; -{$IFDEF FPC} -// TODO : JB - move this to a lazarus common file for ultrastar -function RandomRange(aMin: Integer; aMax: Integer) : Integer; -begin -RandomRange := Random(aMax-aMin) + aMin ; -end; -{$ENDIF} function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index cb6aef6d..762f84c2 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -2,6 +2,10 @@ unit UScreenEditConvert; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + {$I switches.inc} uses UMenu, @@ -353,11 +357,13 @@ begin 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 @@ -407,6 +413,7 @@ var 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 @@ -486,6 +493,7 @@ begin end; Interaction := 0; +{$ENDIF} end; function TScreenEditConvert.Draw: boolean; @@ -552,7 +560,9 @@ begin end; // playing line - X := 60+MidiFile.GetCurrentTime/MidiFile.GetTrackLength*730; + {$IFDEF UseMIDIPort} + X := 60 + MidiFile.GetCurrentTime/MidiFile.GetTrackLength*730; + {$ENDIF} DrawLine(X, Y, X, Bottom, 0.3, 0.3, 0.3); @@ -560,8 +570,10 @@ 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 7184b0b6..3843fbf4 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -1169,11 +1169,12 @@ begin 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; @@ -1224,11 +1225,13 @@ begin 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)); @@ -1236,13 +1239,16 @@ begin 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 + 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; @@ -1312,8 +1318,10 @@ end; procedure TScreenEditSub.onHide; begin + {$IFDEF UseMIDIPort} MidiOut.Close; MidiOut.Free; + {$ENDIF} //Music.SetVolume(100); end; diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 19e934f4..42edf4c9 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} + uses UMenu, SDL, @@ -274,7 +278,7 @@ begin Text[TextName[PP]].Text := Ini.Name[P]; - {{$IFDEF TRANSLATE} + //{$IFDEF TRANSLATE} case (Player[P].ScoreTotalI) of 0..2000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_TONE_DEAF'); 2010..4000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_AMATEUR'); @@ -284,7 +288,7 @@ begin 9010..9800: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_SUPERSTAR'); 9810..10000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_ULTRASTAR'); end; - {{$ELSE}{ + (* {$ELSE}{ case (Player[P].ScoreTotalI) of 0..2000: Text[TextScore[PP]].Text := 'Tone Deaf'; 2010..4000: Text[TextScore[PP]].Text := 'Amateur'; @@ -294,7 +298,7 @@ begin 9010..9800: Text[TextScore[PP]].Text := 'Superstar'; 9810..10000: Text[TextScore[PP]].Text := 'Ultrastar'; end; - {$ENDIF} + {$ENDIF} *) S := IntToStr(Player[P].ScoreI); while (Length(S)<4) do S := '0' + S; @@ -313,10 +317,12 @@ begin Text[TextTotalScore[PP]].Text := S; // Level bar length -{ Lev := ((Round(Player[P].Punkty) div 10) * 10) / 10000; +(* + Lev := ((Round(Player[P].Punkty) div 10) * 10) / 10000; Static[StaticLevel[PP]].Texture.H := Round(Static[StaticBackLevel[PP]].Texture.H * Lev); Static[StaticLevel[PP]].Texture.Y := Static[StaticBackLevel[PP]].Texture.Y + Static[StaticBackLevel[PP]].Texture.H - Static[StaticLevel[PP]].Texture.H; Static[StaticLevelRound[PP]].Texture.Y := Static[StaticLevel[PP]].Texture.Y - Static[StaticLevelRound[PP]].Texture.H;} +*) // doesn't align too much... (to fix) // hint: play with wrapping textures // resolution: setting TexY1 and TexY2 to 0.1 and 0.9 diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index a5f6a317..1dd31ae9 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -2,6 +2,11 @@ unit UScreenSing; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, ULyrics, TextGL, OpenGL12, BASS, UThemes, ULCD, UGraphicClasses, UVideo; @@ -364,8 +369,9 @@ begin // set movie if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin -{ OpenSmpeg(AktSong.Path + AktSong.Video); - SkipSmpeg(AktSong.VideoGAP + AktSong.Start);} +(* OpenSmpeg(AktSong.Path + AktSong.Video); + SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*) + // todo: VideoGap and Start time verwursten FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); FFmpegSkip(AktSong.VideoGAP + AktSong.Start); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 2d10c9dc..7b16c315 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1078,7 +1078,8 @@ begin end; end; -{procedure TScreenSong.SetScroll4; // rotate +(* +procedure TScreenSong.SetScroll4; // rotate var B: integer; Wsp: real; @@ -1158,7 +1159,7 @@ begin else Button[B].Visible := False; end; end; -end; } +end; *) procedure TScreenSong.SetScroll5; // rotate var @@ -2003,4 +2004,4 @@ FixSelected; } end; -end. \ No newline at end of file +end. diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas index f9de4114..4971d12a 100644 --- a/Game/Code/Screens/UScreenTop5.pas +++ b/Game/Code/Screens/UScreenTop5.pas @@ -2,6 +2,11 @@ unit UScreenTop5; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + uses UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes, ULCD; @@ -131,7 +136,7 @@ function TScreenTop5.Draw: boolean; C: integer;} begin // Singstar - let it be...... with 6 statics -{ if PlayersPlay = 6 then begin +(* if PlayersPlay = 6 then begin for Item := 4 to 6 do begin if ScreenAct = 1 then P := Item-4; if ScreenAct = 2 then P := Item-1; @@ -152,10 +157,10 @@ begin Static[StaticBoxLightest[Item]].Texture.ColG, Static[StaticBoxLightest[Item]].Texture.ColB, 'P4Dark'); - end;} + end; } -{ end; - end;} + end; + end; *) inherited Draw; end; -- cgit v1.2.3 From db82b7e30a1b58b56fdb4bfc6089b47200ca1da1 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Sep 2007 06:36:58 +0000 Subject: Ultrastar-DX now compiles in linux (using lazarus) Bass etc is commented out.. but it compiles, and im working through the runtime errors. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@408 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 2197 +++++++++--------- Game/Code/Screens/UScreenMain.pas | 554 ++--- Game/Code/Screens/UScreenSing.pas | 2492 ++++++++++---------- Game/Code/Screens/UScreenSingModi.pas | 1334 +++++------ Game/Code/Screens/UScreenSong.pas | 4047 +++++++++++++++++---------------- Game/Code/Screens/UScreenSongMenu.pas | 1251 +++++----- Game/Code/Screens/UScreenStatMain.pas | 516 +++-- 7 files changed, 6265 insertions(+), 6126 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 3b1efc6e..b931f461 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -1,1092 +1,1105 @@ -unit UScreenCredits; - -interface - -uses - UMenu, SDL, UDisplay, UTexture, OpenGL12, UMusic, UFiles, SysUtils, UThemes, ULCD, ULight, UGraphicClasses; - -type - TCreditsStages=(InitialDelay,Intro,MainPart,Outro); - - TScreenCredits = class(TMenu) - public - - Credits_X: Real; - Credits_Time: Cardinal; - Credits_Alpha: Cardinal; - CTime: Cardinal; - CTime_hold: Cardinal; - ESC_Alpha: Integer; - - credits_entry_tex: TTexture; - credits_entry_dx_tex: TTexture; - credits_bg_tex: TTexture; - credits_bg_ovl: TTexture; -// credits_bg_logo: TTexture; - credits_bg_scrollbox_left: TTexture; - credits_blindguard: TTexture; - credits_blindy: TTexture; - credits_canni: TTexture; - credits_commandio: TTexture; - credits_lazyjoker: TTexture; - credits_mog: TTexture; - credits_mota: TTexture; - credits_skillmaster: TTexture; - credits_whiteshark: TTexture; - intro_layer01: TTexture; - intro_layer02: TTexture; - intro_layer03: TTexture; - intro_layer04: TTexture; - intro_layer05: TTexture; - intro_layer06: TTexture; - intro_layer07: TTexture; - intro_layer08: TTexture; - intro_layer09: TTexture; - outro_bg: TTexture; - outro_esc: TTexture; - outro_exd: TTexture; - - deluxe_slidein: cardinal; - - CurrentScrollText: String; - NextScrollUpdate: Real; - EndofLastScrollingPart: Cardinal; - CurrentScrollStart, CurrentScrollEnd: Integer; - - CRDTS_Stage: TCreditsStages; - - myTex: glUint; - - Fadeout: boolean; - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure onShow; override; - procedure onHide; override; - procedure DrawCredits; - procedure Draw_FunkyText; - end; - -const - Funky_Text: AnsiString = - 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+ - 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+ - 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+ - 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..'; - - - Timings: array[0..21] of Cardinal=( - 20, // 0 Delay vor Start - - 149, // 1 Ende erster Intro Zoom - 155, // 2 Start 2. Action im Intro - 170, // 3 Ende Separation im Intro - 271, // 4 Anfang Zoomout im Intro - 0, // 5 unused - 261, // 6 Start fade-to-white im Intro - - 271, // 7 Start Main Part - 280, // 8 Start On-Beat-Sternchen Main Part - - 396, // 9 Start BlindGuard - 666, // 10 Start blindy - 936, // 11 Start Canni - 1206, // 12 Start Commandio - 1476, // 13 Start LazyJoker - 1746, // 14 Start Mog - 2016, // 15 Start Mota - 2286, // 16 Start SkillMaster - 2556, // 17 Start WhiteShark - 2826, // 18 Ende Whiteshark - 3096, // 19 Start FadeOut Mainscreen - 3366, // 20 Ende Credits Tune - 60); // 21 start flare im intro - -implementation - -uses Windows, - UGraphic, - UMain, - UIni, - USongs, - Textgl, - ULanguage, - UCommon, - Math; - - -function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then - begin // Key Down - case PressedKey of - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - FadeTo(@ScreenMain); - Music.PlayBack; - end; -{ SDLK_SPACE: - begin - setlength(CTime_hold,length(CTime_hold)+1); - CTime_hold[high(CTime_hold)]:=CTime; - end; -} - end;//esac - end; //fi -end; - -constructor TScreenCredits.Create; -begin - inherited Create; - credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0); - credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0); - - credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', 'PNG', 'Font Black', 0); - credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0); - credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0); - credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', 'PNG', 'Font Black', 0); - credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', 'PNG', 'Font Black', 0); - credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', 'Font Black', 0); - credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', 'PNG', 'Font Black', 0); - credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', 'PNG', 'Font Black', 0); - credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', 'PNG', 'Font Black', 0); - - intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', 'PNG', 'Transparent', 0); - intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', 'PNG', 'Transparent', 0); - intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', 'PNG', 'Transparent', 0); - intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', 'PNG', 'Transparent', 0); - intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', 'PNG', 'Transparent', 0); - intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', 'PNG', 'Transparent', 0); - intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', 'PNG', 'Transparent', 0); - intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', 'PNG', 'Transparent', 0); - intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', 'PNG', 'Transparent', 0); - - outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0); - outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0); - outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Transparent', 0); - - CRDTS_Stage:=InitialDelay; -end; - -function TScreenCredits.Draw: boolean; -begin - DrawCredits; - Draw:=true; -end; - -procedure TScreenCredits.onShow; -begin - CRDTS_Stage:=InitialDelay; - Credits_X := 580; - deluxe_slidein := 0; - Credits_Alpha := 0; - //Music.SetLoop(true); Loop looped ned, so ne scheisse - Music.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! -// Music.Play; - CTime:=0; -// setlength(CTime_hold,0); -end; - -procedure TScreenCredits.onHide; -begin - Music.Stop; -end; - -Procedure TScreenCredits.Draw_FunkyText; -var - S: Integer; - X,Y,A: Real; - visibleText: PChar; -begin - SetFontSize(10); - //Init ScrollingText - if (CTime = Timings[7]) then - begin - //Set Position of Text - Credits_X := 600; - CurrentScrollStart:=1; - CurrentScrollEnd:=1; - end; - - if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then - begin - X:=0; - visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); - for S := 0 to length(visibleText)-1 do begin - Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); - SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); - A:=0; - if (Credits_X+X < 15) then A:=0; - if (Credits_X+X >=15) then A:=Credits_X+X-15; - if Credits_X+X > 32 then A:=17; - glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17); - glPrintLetter(visibleText[S]); - X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; - end; - if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin - Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; - inc(CurrentScrollStart); - end; - visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); - if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin - inc(CurrentScrollEnd); - end; - end; -{ // timing hack - X:=5; - SetFontStyle (2); - SetFontItalic(False); - SetFontSize(9); - glColor4f(1, 1, 1, 1); - for S:=0 to high(CTime_hold) do begin - visibleText:=pchar(inttostr(CTime_hold[S])); - SetFontPos (500, X); - glPrint (Addr(visibleText[0])); - X:=X+20; - end;} -end; - -procedure Start3D; -begin - glMatrixMode(GL_PROJECTION); - glPushMatrix; - glLoadIdentity; - glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity; -end; -procedure End3D; -begin - glMatrixMode(GL_PROJECTION); - glPopMatrix; - glMatrixMode(GL_MODELVIEW); -end; - -procedure TScreenCredits.DrawCredits; -var - T,I: Cardinal; - X: Real; - Ver: PChar; - RuntimeStr: AnsiString; - Data: TFFTData; - j,k,l:cardinal; - f,g,h: Real; - STime:cardinal; - Delay:cardinal; - - myPixel: longword; - myColor: Cardinal; - myScale: Real; - myAngle: Real; - - -const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24), - (154,31),(156,58),(168,32),(203,36), - (258,34),(251,50),(274,93),(294,84), - (232,54),(278,62),(319,34),(336,92), - (347,23),(374,32),(377,58),(361,83), - (385,91),(405,91),(429,35),(423,51), - (450,32),(485,34),(444,91),(486,93)); - -begin -//dis does teh muiwk y0r -Data := Music.GetFFTData; - - - - T := GetTickCount div 33; - if T <> Credits_Time then - begin - Credits_Time := T; - inc(CTime); - inc(CTime_hold); - Credits_X := Credits_X-2; - if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then - begin -// CTime:=Timings[20]; -// CRDTS_Stage:=Outro; - - CRDTS_Stage:=Intro; - CTime:=0; - Music.Play; - - end; - if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then - begin - CRDTS_Stage:=MainPart; - end; - if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then - begin - CRDTS_Stage:=Outro; - end; - end; - - //draw background - if CRDTS_Stage=InitialDelay then - begin - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - end - else - if CRDTS_Stage=Intro then - begin - Start3D; - glPushMatrix; - - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - if CTime < Timings[1] then begin - myScale:= 0.5+0.5*(Timings[1]-CTime)/(Timings[1]); // slowly move layers together - myAngle:=cos((CTime)*pi/((Timings[1])*2)); // and make logo face towards camera - end else begin // this is the part when the logo stands still - myScale:=0.5; - myAngle:=0; - end; - if CTime > Timings[2] then begin - myScale:= 0.5+0.5*(CTime-Timings[2])/(Timings[3]-Timings[2]); // get some space between layers - myAngle:=0; - end; -// if CTime > Timings[3] then myScale:=1; // keep the space between layers - glTranslatef(0,0,-5+0.5*myScale); - if CTime > Timings[3] then myScale:=1; // keep the space between layers - if CTime > Timings[3] then begin // make logo rotate left and grow -// myScale:=(CTime-Timings[4])/(Timings[7]-Timings[4]); - glRotatef(20*sqr(CTime-Timings[3])/sqr((Timings[7]-Timings[3])/2),0,0,1); - glScalef(1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1); - end; - if CTime < Timings[2] then - glRotatef(30*myAngle,0.5*myScale+myScale,1+myScale,0); -// glScalef(0.5,0.5,0.5); - glScalef(4/3,-1,1); - glColor4f(1, 1, 1, 1); - - glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.4 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.4 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.4 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.4 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.3 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.3 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.3 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.3 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.2 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.2 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.2 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.2 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.1 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.1 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.1 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.1 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.1 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.1 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.1 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.1 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.2 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.2 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.2 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.2 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.3 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.3 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.3 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.3 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.22 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.22 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.22 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.22 * myScale); - glEnd; - gldisable(gl_texture_2d); - glDisable(GL_BLEND); - - glPopMatrix; - End3D; - - // do some sparkling effects - if (CTime < Timings[1]) and (CTime > Timings[21]) then - begin - for k:=1 to 3 do begin - l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5); - j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301); - GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0); - end; - end; - - // fade to white at end - if Ctime > Timings[6] then - begin - glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6])); - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glVertex2f(0,0); - glVertex2f(0,600); - glVertex2f(800,600); - glVertex2f(800,0); - glEnd; - glDisable(GL_BLEND); - end; - - end; - if (CRDTS_Stage=MainPart) then - // main credits screen background, scroller, logo and girl - begin - - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,600/1024);glVertex2f(0, 600); - glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); - glTexCoord2f(800/1024,0);glVertex2f(800, 0); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - // draw scroller - Draw_FunkyText; - -//######################################################################### -// draw credits names - -// BlindGuard (von links oben reindrehen, nach rechts unten rausdrehen) - STime:=Timings[9]-10; - Delay:=Timings[10]-Timings[9]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(0,329,0); - if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end; - gltranslatef(223,0,0); - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - gltranslatef(223,0,0); - glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1); - gltranslatef(-223,0,0); - end; - glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Blindy (zoom von 0 auf volle grösse und drehung, zoom auf doppelte grösse und nach rechts oben schieben) - STime:=Timings[10]-10; - Delay:=Timings[11]-Timings[10]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+20) and (CTime<=STime+22) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+20 then begin - j:=CTime-Stime; - glscalef(j*j/400,j*j/400,j*j/400); - glrotatef(j*18.0,0,0,1); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - f:=j*10.0; - gltranslatef(f*3,-f,0); - glscalef(1+j/10,1+j/10,1+j/10); - glrotatef(j*9.0,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Canni (von links reinschieben, nach rechts oben rausschieben) - STime:=Timings[11]-10; - Delay:=Timings[12]-Timings[11]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - gltranslatef(((CTime-STime)*21.0)-210,0,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=(CTime-(STime+Delay-10))*21; - gltranslatef(j,-j/2,0); - end; - glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Commandio (von unten reinklappen, nach rechts oben rausklappen) - STime:=Timings[12]-10; - Delay:=Timings[13]-Timings[12]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=258.0-25.8*(CTime-STime) - else - f:=0; - g:=0; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end; - glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163+g-f*1.5, -129+f*1.5-g/2); - glTexCoord2f(0,1);glVertex2f(-163+g*1.5, 129-(g*1.5*258/326)); - glTexCoord2f(1,1); glVertex2f(163+g, 129+g/4); - glTexCoord2f(1,0);glVertex2f(163+f*1.5+g/4, -129+f*1.5-g/4); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing) - STime:=Timings[13]-35; - Delay:=Timings[14]-Timings[13]+5; - if CTime > STime then - begin - k:=0; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20; - ESC_Alpha:=10; - f:=CTime-STime; - if CTime <=STime+40 then j:=CTime-STime else j:=40; - if (CTime >=STime+Delay-40) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j*j/1600); - - glPushMatrix; - gltranslatef(180+(f-70),329,0); - glBindTexture(GL_TEXTURE_2D, credits_lazyjoker.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Mog (von links reinklappen, nach rechts unten rausklappen) - STime:=Timings[14]-10; - Delay:=Timings[15]-Timings[14]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=326.0-32.6*(CTime-STime) - else - f:=0; - - g:=0; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end; - glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163+g*1.5, -129+g*1.5); - glTexCoord2f(0,1);glVertex2f(-163+g*1.2, 129+g); - glTexCoord2f(1,1); glVertex2f(163-f+g/2, 129+f*1.5+g/4); - glTexCoord2f(1,0);glVertex2f(163-f+g*1.5, -129-f*1.5); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Mota (von rechts oben reindrehen, nach links unten rausschieben und verkleinern und dabei drehen) - STime:=Timings[15]-10; - Delay:=Timings[16]-Timings[15]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - gltranslatef(223,0,0); - glrotatef((10-(CTime-STime))*9,0,0,1); - gltranslatef(-223,0,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - f:=j*10.0; - gltranslatef(-f*2,-f,0); - glscalef(1-j/10,1-j/10,1-j/10); - glrotatef(-j*9.0,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Skillmaster (von rechts unten reinschieben, nach rechts oben rausdrehen) - STime:=Timings[16]-10; - Delay:=Timings[17]-Timings[16]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - j:=STime+10-CTime; - f:=j*10.0; - gltranslatef(+f*2,+f/2,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - gltranslatef(0,-223,0); - glrotatef(integer(j)*-9,0,0,1); - gltranslatef(0,223,0); - glrotatef(j*9,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// WhiteShark (von links unten reinklappen, nach rechts oben rausklappen) - STime:=Timings[17]-10; - Delay:=Timings[18]-Timings[17]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=326.0-32.6*(CTime-STime) - else - f:=0; - - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end else - g:=0; - glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2); - glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4); - glTexCoord2f(1,1); glVertex2f(163-f*1.2+g/4, 129+f/2-g/4); - glTexCoord2f(1,0);glVertex2f(163-f*1.5+g/4, -129+f*1.5+g/4); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - - -// #################################################################### -// do some twinkle stuff (kinda on beat) - if (CTime>Timings[8]) and (CTime < Timings[19]) then begin - k:=0; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.2 then begin - l:=RandomRange(6,16); - j:=RandomRange(0,27); - GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); - end; - end; - -//################################################# -// draw the rest of the main screen (girl and logo - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(800-393, 0); - glTexCoord2f(0,600/1024);glVertex2f(800-393, 600); - glTexCoord2f(393/512,600/1024); glVertex2f(800, 600); - glTexCoord2f(393/512,0);glVertex2f(800, 0); - glEnd; -{ glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,112/128);glVertex2f(0, 112); - glTexCoord2f(497/512,112/128); glVertex2f(497, 112); - glTexCoord2f(497/512,0);glVertex2f(497, 0); - glEnd; -} - gldisable(gl_texture_2d); - glDisable(GL_BLEND); - - // fade out at end of main part - if Ctime > Timings[19] then - begin - glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19])); - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glVertex2f(0,0); - glVertex2f(0,600); - glVertex2f(800,600); - glVertex2f(800,0); - glEnd; - glDisable(GL_BLEND); - end; - end - else - if (CRDTS_Stage=Outro) then - begin - if CTime=Timings[20] then begin - CTime_hold:=0; - Music.Stop; - Music.Open(soundpath + 'credits-outro-tune.mp3'); - Music.Play; - Music.SetVolume(20); - Music.SetLoop(True); - end; - if CTime_hold > 231 then begin - Music.Play; - Ctime_hold:=0; - end; - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - - // do something useful - // outro background - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,600/1024);glVertex2f(0, 600); - glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); - glTexCoord2f(800/1024,0);glVertex2f(800, 0); - glEnd; - - //outro overlays - glColor4f(1, 1, 1, (1+sin(CTime/15))/3+1/3); - glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,223/256);glVertex2f(0, 223); - glTexCoord2f(487/512,223/256); glVertex2f(487, 223); - glTexCoord2f(487/512,0);glVertex2f(487, 0); - glEnd; - - ESC_Alpha:=20; - if (RandomRange(0,20) > 18) and (ESC_Alpha=20) then - ESC_Alpha:=0 - else inc(ESC_Alpha); - if ESC_Alpha > 20 then ESC_Alpha:=20; - glColor4f(1, 1, 1, ESC_Alpha/20); - glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(800-310, 600-247); - glTexCoord2f(0,247/256);glVertex2f(800-310, 600); - glTexCoord2f(310/512,247/256); glVertex2f(800, 600); - glTexCoord2f(310/512,0);glVertex2f(800, 600-247); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - // outro scrollers? - // ... - end; - -{ // draw credits runtime counter - SetFontStyle (2); - SetFontItalic(False); - SetFontSize(9); - SetFontPos (5, 5); - glColor4f(1, 1, 1, 1); -// RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10); - RuntimeStr:='CTime: '+inttostr(CTime); - glPrint (Addr(RuntimeStr[1])); -} - // make the stars shine - GoldenRec.Draw; -end; - -end. +unit UScreenCredits; + +interface + +uses + UMenu, + SDL, + UDisplay, + UTexture, + OpenGL12, + UMusic, + UFiles, + SysUtils, + UThemes, + ULCD, + ULight, + UGraphicClasses; + +type + TCreditsStages=(InitialDelay,Intro,MainPart,Outro); + + TScreenCredits = class(TMenu) + public + + Credits_X: Real; + Credits_Time: Cardinal; + Credits_Alpha: Cardinal; + CTime: Cardinal; + CTime_hold: Cardinal; + ESC_Alpha: Integer; + + credits_entry_tex: TTexture; + credits_entry_dx_tex: TTexture; + credits_bg_tex: TTexture; + credits_bg_ovl: TTexture; +// credits_bg_logo: TTexture; + credits_bg_scrollbox_left: TTexture; + credits_blindguard: TTexture; + credits_blindy: TTexture; + credits_canni: TTexture; + credits_commandio: TTexture; + credits_lazyjoker: TTexture; + credits_mog: TTexture; + credits_mota: TTexture; + credits_skillmaster: TTexture; + credits_whiteshark: TTexture; + intro_layer01: TTexture; + intro_layer02: TTexture; + intro_layer03: TTexture; + intro_layer04: TTexture; + intro_layer05: TTexture; + intro_layer06: TTexture; + intro_layer07: TTexture; + intro_layer08: TTexture; + intro_layer09: TTexture; + outro_bg: TTexture; + outro_esc: TTexture; + outro_exd: TTexture; + + deluxe_slidein: cardinal; + + CurrentScrollText: String; + NextScrollUpdate: Real; + EndofLastScrollingPart: Cardinal; + CurrentScrollStart, CurrentScrollEnd: Integer; + + CRDTS_Stage: TCreditsStages; + + myTex: glUint; + + Fadeout: boolean; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure DrawCredits; + procedure Draw_FunkyText; + end; + +const + Funky_Text: AnsiString = + 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+ + 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+ + 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+ + 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..'; + + + Timings: array[0..21] of Cardinal=( + 20, // 0 Delay vor Start + + 149, // 1 Ende erster Intro Zoom + 155, // 2 Start 2. Action im Intro + 170, // 3 Ende Separation im Intro + 271, // 4 Anfang Zoomout im Intro + 0, // 5 unused + 261, // 6 Start fade-to-white im Intro + + 271, // 7 Start Main Part + 280, // 8 Start On-Beat-Sternchen Main Part + + 396, // 9 Start BlindGuard + 666, // 10 Start blindy + 936, // 11 Start Canni + 1206, // 12 Start Commandio + 1476, // 13 Start LazyJoker + 1746, // 14 Start Mog + 2016, // 15 Start Mota + 2286, // 16 Start SkillMaster + 2556, // 17 Start WhiteShark + 2826, // 18 Ende Whiteshark + 3096, // 19 Start FadeOut Mainscreen + 3366, // 20 Ende Credits Tune + 60); // 21 start flare im intro + +implementation + +uses {$IFDEF win32} + windows, + {$ELSE} + lclintf, + {$ENDIF} + UGraphic, + UMain, + UIni, + USongs, + Textgl, + ULanguage, + UCommon, + Math; + + +function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + FadeTo(@ScreenMain); + Music.PlayBack; + end; +{ SDLK_SPACE: + begin + setlength(CTime_hold,length(CTime_hold)+1); + CTime_hold[high(CTime_hold)]:=CTime; + end; +} + end;//esac + end; //fi +end; + +constructor TScreenCredits.Create; +begin + inherited Create; + credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0); + credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0); + + credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', 'PNG', 'Font Black', 0); + credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0); + credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0); + credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', 'PNG', 'Font Black', 0); + credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', 'PNG', 'Font Black', 0); + credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', 'Font Black', 0); + credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', 'PNG', 'Font Black', 0); + credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', 'PNG', 'Font Black', 0); + credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', 'PNG', 'Font Black', 0); + + intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', 'PNG', 'Transparent', 0); + intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', 'PNG', 'Transparent', 0); + intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', 'PNG', 'Transparent', 0); + intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', 'PNG', 'Transparent', 0); + intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', 'PNG', 'Transparent', 0); + intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', 'PNG', 'Transparent', 0); + intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', 'PNG', 'Transparent', 0); + intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', 'PNG', 'Transparent', 0); + intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', 'PNG', 'Transparent', 0); + + outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0); + outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0); + outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Transparent', 0); + + CRDTS_Stage:=InitialDelay; +end; + +function TScreenCredits.Draw: boolean; +begin + DrawCredits; + Draw:=true; +end; + +procedure TScreenCredits.onShow; +begin + CRDTS_Stage:=InitialDelay; + Credits_X := 580; + deluxe_slidein := 0; + Credits_Alpha := 0; + //Music.SetLoop(true); Loop looped ned, so ne scheisse + Music.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! +// Music.Play; + CTime:=0; +// setlength(CTime_hold,0); +end; + +procedure TScreenCredits.onHide; +begin + Music.Stop; +end; + +Procedure TScreenCredits.Draw_FunkyText; +var + S: Integer; + X,Y,A: Real; + visibleText: PChar; +begin + SetFontSize(10); + //Init ScrollingText + if (CTime = Timings[7]) then + begin + //Set Position of Text + Credits_X := 600; + CurrentScrollStart:=1; + CurrentScrollEnd:=1; + end; + + if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then + begin + X:=0; + visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); + for S := 0 to length(visibleText)-1 do begin + Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); + SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); + A:=0; + if (Credits_X+X < 15) then A:=0; + if (Credits_X+X >=15) then A:=Credits_X+X-15; + if Credits_X+X > 32 then A:=17; + glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17); + glPrintLetter(visibleText[S]); + X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + end; + if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin + Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + inc(CurrentScrollStart); + end; + visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); + if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin + inc(CurrentScrollEnd); + end; + end; +{ // timing hack + X:=5; + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + glColor4f(1, 1, 1, 1); + for S:=0 to high(CTime_hold) do begin + visibleText:=pchar(inttostr(CTime_hold[S])); + SetFontPos (500, X); + glPrint (Addr(visibleText[0])); + X:=X+20; + end;} +end; + +procedure Start3D; +begin + glMatrixMode(GL_PROJECTION); + glPushMatrix; + glLoadIdentity; + glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity; +end; +procedure End3D; +begin + glMatrixMode(GL_PROJECTION); + glPopMatrix; + glMatrixMode(GL_MODELVIEW); +end; + +procedure TScreenCredits.DrawCredits; +var + T,I: Cardinal; + X: Real; + Ver: PChar; + RuntimeStr: AnsiString; + Data: TFFTData; + j,k,l:cardinal; + f,g,h: Real; + STime:cardinal; + Delay:cardinal; + + myPixel: longword; + myColor: Cardinal; + myScale: Real; + myAngle: Real; + + +const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24), + (154,31),(156,58),(168,32),(203,36), + (258,34),(251,50),(274,93),(294,84), + (232,54),(278,62),(319,34),(336,92), + (347,23),(374,32),(377,58),(361,83), + (385,91),(405,91),(429,35),(423,51), + (450,32),(485,34),(444,91),(486,93)); + +begin + //dis does teh muiwk y0r + Data := Music.GetFFTData; + + T := GetTickCount div 33; + if T <> Credits_Time then + begin + Credits_Time := T; + inc(CTime); + inc(CTime_hold); + Credits_X := Credits_X-2; + if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then + begin +// CTime:=Timings[20]; +// CRDTS_Stage:=Outro; + + CRDTS_Stage:=Intro; + CTime:=0; + Music.Play; + + end; + if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then + begin + CRDTS_Stage:=MainPart; + end; + if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then + begin + CRDTS_Stage:=Outro; + end; + end; + + //draw background + if CRDTS_Stage=InitialDelay then + begin + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end + else + if CRDTS_Stage=Intro then + begin + Start3D; + glPushMatrix; + + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + if CTime < Timings[1] then begin + myScale:= 0.5+0.5*(Timings[1]-CTime)/(Timings[1]); // slowly move layers together + myAngle:=cos((CTime)*pi/((Timings[1])*2)); // and make logo face towards camera + end else begin // this is the part when the logo stands still + myScale:=0.5; + myAngle:=0; + end; + if CTime > Timings[2] then begin + myScale:= 0.5+0.5*(CTime-Timings[2])/(Timings[3]-Timings[2]); // get some space between layers + myAngle:=0; + end; +// if CTime > Timings[3] then myScale:=1; // keep the space between layers + glTranslatef(0,0,-5+0.5*myScale); + if CTime > Timings[3] then myScale:=1; // keep the space between layers + if CTime > Timings[3] then begin // make logo rotate left and grow +// myScale:=(CTime-Timings[4])/(Timings[7]-Timings[4]); + glRotatef(20*sqr(CTime-Timings[3])/sqr((Timings[7]-Timings[3])/2),0,0,1); + glScalef(1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1); + end; + if CTime < Timings[2] then + glRotatef(30*myAngle,0.5*myScale+myScale,1+myScale,0); +// glScalef(0.5,0.5,0.5); + glScalef(4/3,-1,1); + glColor4f(1, 1, 1, 1); + + glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.4 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.4 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.4 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.4 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.22 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.22 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.22 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.22 * myScale); + glEnd; + gldisable(gl_texture_2d); + glDisable(GL_BLEND); + + glPopMatrix; + End3D; + + // do some sparkling effects + if (CTime < Timings[1]) and (CTime > Timings[21]) then + begin + for k:=1 to 3 do begin + l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5); + j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301); + GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0); + end; + end; + + // fade to white at end + if Ctime > Timings[6] then + begin + glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + + end; + if (CRDTS_Stage=MainPart) then + // main credits screen background, scroller, logo and girl + begin + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // draw scroller + Draw_FunkyText; + +//######################################################################### +// draw credits names + +// BlindGuard (von links oben reindrehen, nach rechts unten rausdrehen) + STime:=Timings[9]-10; + Delay:=Timings[10]-Timings[9]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(0,329,0); + if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end; + gltranslatef(223,0,0); + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + gltranslatef(223,0,0); + glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1); + gltranslatef(-223,0,0); + end; + glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Blindy (zoom von 0 auf volle grösse und drehung, zoom auf doppelte grösse und nach rechts oben schieben) + STime:=Timings[10]-10; + Delay:=Timings[11]-Timings[10]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+20) and (CTime<=STime+22) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+20 then begin + j:=CTime-Stime; + glscalef(j*j/400,j*j/400,j*j/400); + glrotatef(j*18.0,0,0,1); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(f*3,-f,0); + glscalef(1+j/10,1+j/10,1+j/10); + glrotatef(j*9.0,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Canni (von links reinschieben, nach rechts oben rausschieben) + STime:=Timings[11]-10; + Delay:=Timings[12]-Timings[11]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(((CTime-STime)*21.0)-210,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=(CTime-(STime+Delay-10))*21; + gltranslatef(j,-j/2,0); + end; + glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Commandio (von unten reinklappen, nach rechts oben rausklappen) + STime:=Timings[12]-10; + Delay:=Timings[13]-Timings[12]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=258.0-25.8*(CTime-STime) + else + f:=0; + g:=0; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end; + glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163+g-f*1.5, -129+f*1.5-g/2); + glTexCoord2f(0,1);glVertex2f(-163+g*1.5, 129-(g*1.5*258/326)); + glTexCoord2f(1,1); glVertex2f(163+g, 129+g/4); + glTexCoord2f(1,0);glVertex2f(163+f*1.5+g/4, -129+f*1.5-g/4); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing) + STime:=Timings[13]-35; + Delay:=Timings[14]-Timings[13]+5; + if CTime > STime then + begin + k:=0; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20; + ESC_Alpha:=10; + f:=CTime-STime; + if CTime <=STime+40 then j:=CTime-STime else j:=40; + if (CTime >=STime+Delay-40) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j*j/1600); + + glPushMatrix; + gltranslatef(180+(f-70),329,0); + glBindTexture(GL_TEXTURE_2D, credits_lazyjoker.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Mog (von links reinklappen, nach rechts unten rausklappen) + STime:=Timings[14]-10; + Delay:=Timings[15]-Timings[14]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) + else + f:=0; + + g:=0; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end; + glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163+g*1.5, -129+g*1.5); + glTexCoord2f(0,1);glVertex2f(-163+g*1.2, 129+g); + glTexCoord2f(1,1); glVertex2f(163-f+g/2, 129+f*1.5+g/4); + glTexCoord2f(1,0);glVertex2f(163-f+g*1.5, -129-f*1.5); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Mota (von rechts oben reindrehen, nach links unten rausschieben und verkleinern und dabei drehen) + STime:=Timings[15]-10; + Delay:=Timings[16]-Timings[15]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(223,0,0); + glrotatef((10-(CTime-STime))*9,0,0,1); + gltranslatef(-223,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(-f*2,-f,0); + glscalef(1-j/10,1-j/10,1-j/10); + glrotatef(-j*9.0,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Skillmaster (von rechts unten reinschieben, nach rechts oben rausdrehen) + STime:=Timings[16]-10; + Delay:=Timings[17]-Timings[16]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + j:=STime+10-CTime; + f:=j*10.0; + gltranslatef(+f*2,+f/2,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + gltranslatef(0,-223,0); + glrotatef(integer(j)*-9,0,0,1); + gltranslatef(0,223,0); + glrotatef(j*9,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// WhiteShark (von links unten reinklappen, nach rechts oben rausklappen) + STime:=Timings[17]-10; + Delay:=Timings[18]-Timings[17]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) + else + f:=0; + + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end else + g:=0; + glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2); + glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4); + glTexCoord2f(1,1); glVertex2f(163-f*1.2+g/4, 129+f/2-g/4); + glTexCoord2f(1,0);glVertex2f(163-f*1.5+g/4, -129+f*1.5+g/4); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + + +// #################################################################### +// do some twinkle stuff (kinda on beat) + if (CTime>Timings[8]) and (CTime < Timings[19]) then begin + k:=0; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.2 then begin + l:=RandomRange(6,16); + j:=RandomRange(0,27); + GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); + end; + end; + +//################################################# +// draw the rest of the main screen (girl and logo + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(800-393, 0); + glTexCoord2f(0,600/1024);glVertex2f(800-393, 600); + glTexCoord2f(393/512,600/1024); glVertex2f(800, 600); + glTexCoord2f(393/512,0);glVertex2f(800, 0); + glEnd; +{ glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,112/128);glVertex2f(0, 112); + glTexCoord2f(497/512,112/128); glVertex2f(497, 112); + glTexCoord2f(497/512,0);glVertex2f(497, 0); + glEnd; +} + gldisable(gl_texture_2d); + glDisable(GL_BLEND); + + // fade out at end of main part + if Ctime > Timings[19] then + begin + glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + end + else + if (CRDTS_Stage=Outro) then + begin + if CTime=Timings[20] then begin + CTime_hold:=0; + Music.Stop; + Music.Open(soundpath + 'credits-outro-tune.mp3'); + Music.Play; + Music.SetVolume(20); + Music.SetLoop(True); + end; + if CTime_hold > 231 then begin + Music.Play; + Ctime_hold:=0; + end; + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + // do something useful + // outro background + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); + glEnd; + + //outro overlays + glColor4f(1, 1, 1, (1+sin(CTime/15))/3+1/3); + glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,223/256);glVertex2f(0, 223); + glTexCoord2f(487/512,223/256); glVertex2f(487, 223); + glTexCoord2f(487/512,0);glVertex2f(487, 0); + glEnd; + + ESC_Alpha:=20; + if (RandomRange(0,20) > 18) and (ESC_Alpha=20) then + ESC_Alpha:=0 + else inc(ESC_Alpha); + if ESC_Alpha > 20 then ESC_Alpha:=20; + glColor4f(1, 1, 1, ESC_Alpha/20); + glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(800-310, 600-247); + glTexCoord2f(0,247/256);glVertex2f(800-310, 600); + glTexCoord2f(310/512,247/256); glVertex2f(800, 600); + glTexCoord2f(310/512,0);glVertex2f(800, 600-247); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // outro scrollers? + // ... + end; + +{ // draw credits runtime counter + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (5, 5); + glColor4f(1, 1, 1, 1); +// RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10); + RuntimeStr:='CTime: '+inttostr(CTime); + glPrint (Addr(RuntimeStr[1])); +} + // make the stars shine + GoldenRec.Draw; +end; + +end. diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 5af3d4a6..7bcc9e65 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -1,276 +1,278 @@ -unit UScreenMain; - -interface - -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 Windows, - 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; - Music.PlayStart; - FadeTo(@ScreenCredits); - end; - end; - SDLK_M: - begin - if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then - begin - Music.PlayStart; - FadeTo(@ScreenPartyOptions); - end; - end; - - SDLK_S: - begin - Music.PlayStart; - FadeTo(@ScreenStatMain); - end; - - SDLK_E: - begin - Music.PlayStart; - FadeTo(@ScreenEdit); - end; - - SDLK_RETURN: - begin - //Solo - if (Interaction = 0) then - begin - if (Length(Songs.Song) >= 1) then - begin - Music.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 - Music.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 - Music.PlayStart; - FadeTo(@ScreenStatMain); - end; - - //Editor - if Interaction = 3 then begin - Music.PlayStart; - FadeTo(@ScreenEdit); - end; - - //Options - if Interaction = 4 then begin - Music.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 + +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; + Music.PlayStart; + FadeTo(@ScreenCredits); + end; + end; + SDLK_M: + begin + if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then + begin + Music.PlayStart; + FadeTo(@ScreenPartyOptions); + end; + end; + + SDLK_S: + begin + Music.PlayStart; + FadeTo(@ScreenStatMain); + end; + + SDLK_E: + begin + Music.PlayStart; + FadeTo(@ScreenEdit); + end; + + SDLK_RETURN: + begin + //Solo + if (Interaction = 0) then + begin + if (Length(Songs.Song) >= 1) then + begin + Music.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 + Music.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 + Music.PlayStart; + FadeTo(@ScreenStatMain); + end; + + //Editor + if Interaction = 3 then begin + Music.PlayStart; + FadeTo(@ScreenEdit); + end; + + //Options + if Interaction = 4 then begin + Music.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/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 1dd31ae9..343a2e6d 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1,1236 +1,1256 @@ -unit UScreenSing; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - -uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, ULyrics, - TextGL, OpenGL12, BASS, UThemes, ULCD, UGraphicClasses, UVideo; - -type - TScreenSing = class(TMenu) - protected - paused: boolean; //Pause Mod - PauseTime: Real; - NumEmptySentences: integer; - public - //TextTime: integer; - - //TimeBar mod - StaticTimeProgress: integer; - TextTimeText: integer; - //eoa TimeBar mod - - StaticP1: integer; - StaticP1ScoreBG: integer; - TextP1: integer; - TextP1Score: integer; - - //moveable singbar mod - StaticP1SingBar: integer; - StaticP1ThreePSingBar: integer; - StaticP1TwoPSingBar: integer; - StaticP2RSingBar: integer; - StaticP2MSingBar: integer; - StaticP3SingBar: integer; - //eoa moveable singbar - - //Added for ps3 skin - //shown when game is in 2/4 player modus - StaticP1TwoP: integer; - StaticP1TwoPScoreBG: integer; - TextP1TwoP: integer; - TextP1TwoPScore: integer; - //shown when game is in 3/6 player modus - StaticP1ThreeP: integer; - StaticP1ThreePScoreBG: integer; - TextP1ThreeP: integer; - TextP1ThreePScore: integer; - //eoa - - StaticP2R: integer; - StaticP2RScoreBG: integer; - TextP2R: integer; - TextP2RScore: integer; - - StaticP2M: integer; - StaticP2MScoreBG: integer; - TextP2M: integer; - TextP2MScore: integer; - - StaticP3R: integer; - StaticP3RScoreBG: integer; - TextP3R: integer; - TextP3RScore: integer; - - Tex_Background: TTexture; - FadeOut: boolean; - LyricMain: TLyric; - LyricSub: TLyric; - - constructor Create; override; - procedure onShow; override; - procedure onShowFinish; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure Finish; virtual; - procedure UpdateLCD; - procedure Pause; //Pause Mod(Toggles Pause) - - //OnSentenceEnd for LineBonus + Singbar - procedure onSentenceEnd(S: Cardinal); - //OnSentenceChange (for Golden Notes) - procedure onSentenceChange(S: Cardinal); - end; - -implementation -uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math; - -// Method for input parsing. If False is returned, GetNextWindow -// should be checked to know the next window to load; -function TScreenSing.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then - begin // Key Down - case PressedKey of - SDLK_Q: - begin - //When not ask before Exit then Finish now - if (Ini.AskbeforeDel <> 1) then - Finish - //else just Pause and let the Popup make the Work - else if not paused then - Pause; - - Result := false; - end; - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - //Record Sound Hack: - //Sound[0].BufferLong - - Finish; - Music.PlayBack; - FadeTo(@ScreenScore); - end; - - SDLK_P://Pause Mod - begin - Pause; - end; - - SDLK_RETURN: - begin - 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 : - begin - end; - SDLK_UP : - begin - end; - end; - end; -end; - -//Pause Mod -procedure TScreenSing.Pause; -begin - if not paused then //Pause einschalten - begin - // pause Time - PauseTime := Czas.Teraz; - Paused := true; - - // pause Music - Music.Pause; - - // pause Video - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then - FFmpegTogglePause; - end - else //Pause ausschalten - begin - Czas.Teraz := PauseTime; //Position of Notes - - // Position of Music - Music.MoveTo (PauseTime); - // Play Music - Music.Play; - - // Video - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then - FFmpegTogglePause; - //SkipSmpeg(PauseTime); - - Paused := false; - end; -end; -//Pause Mod End - -constructor TScreenSing.Create; -var - I: integer; - P: integer; -begin - inherited Create; - - LoadFromTheme(Theme.Sing); - - //TimeBar - StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); - TextTimeText := AddText(Theme.Sing.TextTimeText); - -// 1 player | P1 - StaticP1 := AddStatic(Theme.Sing.StaticP1); - StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); - TextP1 := AddText(Theme.Sing.TextP1); - TextP1Score := AddText(Theme.Sing.TextP1Score); - StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar); - -// 2 or 4 players | P1 - StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); - StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG); - TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); - TextP1TwoPScore := AddText(Theme.Sing.TextP1TwoPScore); - StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); - - // | P2 - StaticP2R := AddStatic(Theme.Sing.StaticP2R); - StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); - TextP2R := AddText(Theme.Sing.TextP2R); - TextP2RScore := AddText(Theme.Sing.TextP2RScore); - StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); - -// 3 or 6 players | P1 - StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); - StaticP1ThreePScoreBG := AddStatic(Theme.Sing.StaticP1ThreePScoreBG); - TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); - TextP1ThreePScore := AddText(Theme.Sing.TextP1ThreePScore); - StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar); - - // | P2 - StaticP2M := AddStatic(Theme.Sing.StaticP2M); - StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG); - TextP2M := AddText(Theme.Sing.TextP2M); - TextP2MScore := AddText(Theme.Sing.TextP2MScore); - StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar); - - // | P3 - StaticP3R := AddStatic(Theme.Sing.StaticP3R); - StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG); - TextP3R := AddText(Theme.Sing.TextP3R); - TextP3RScore := AddText(Theme.Sing.TextP3RScore); - StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar); - - if ScreenAct = 2 then begin - // katze und affe - - end; - - LyricMain := TLyric.Create; - LyricSub := TLyric.Create; - - UVideo.Init; -end; - -procedure TScreenSing.onShow; -var - P: integer; - V1: boolean; - V1TwoP: boolean; //added for ps3 skin - V1ThreeP: boolean; //added for ps3 skin - V2R: boolean; - V2M: boolean; - V3R: boolean; - NR: TRecR; //Line Bonus Mod -begin - Log.LogStatus('Begin', 'onShow'); - FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented - - // prepare players - SetLength(Player, PlayersPlay); -// Player[0].ScoreTotalI := 0; - - case PlayersPlay of - 1: begin - V1 := true; - V1TwoP := false; - V1ThreeP := false; - V2R := false; - V2M := false; - V3R := false; - end; - 2: begin - V1 := false; - V1TwoP := true; - V1ThreeP := false; - V2R := true; - V2M := false; - V3R := false; - end; - 3: begin - V1 := false; - V1TwoP := false; - V1ThreeP := true; - V2R := false; - V2M := true; - V3R := true; - end; - 4: begin // double screen - V1 := false; - V1TwoP := true; - V1ThreeP := false; - V2R := true; - V2M := false; - V3R := false; - end; - 6: begin // double screen - V1 := false; - V1TwoP := false; - V1ThreeP := true; - V2R := false; - V2M := true; - V3R := true; - end; - - end; - - //This one is shown in 1P mode - Static[StaticP1].Visible := V1; - Static[StaticP1ScoreBG].Visible := V1; - Text[TextP1].Visible := V1; - Text[TextP1Score].Visible := V1; - - - //This one is shown in 2/4P mode - Static[StaticP1TwoP].Visible := V1TwoP; - Static[StaticP1TwoPScoreBG].Visible := V1TwoP; - Text[TextP1TwoP].Visible := V1TwoP; - Text[TextP1TwoPScore].Visible := V1TwoP; - - Static[StaticP2R].Visible := V2R; - Static[StaticP2RScoreBG].Visible := V2R; - Text[TextP2R].Visible := V2R; - Text[TextP2RScore].Visible := V2R; - - - //This one is shown in 3/6P mode - Static[StaticP1ThreeP].Visible := V1ThreeP; - Static[StaticP1ThreePScoreBG].Visible := V1ThreeP; - Text[TextP1ThreeP].Visible := V1ThreeP; - Text[TextP1ThreePScore].Visible := V1ThreeP; - - Static[StaticP2M].Visible := V2M; - Static[StaticP2MScoreBG].Visible := V2M; - Text[TextP2M].Visible := V2M; - Text[TextP2MScore].Visible := V2M; - - Static[StaticP3R].Visible := V3R; - Static[StaticP3RScoreBG].Visible := V3R; - Text[TextP3R].Visible := V3R; - Text[TextP3RScore].Visible := V3R; - - // load notes - ResetSingTemp; -// Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); - AktSong := CatSongs.Song[CatSongs.Selected]; - try - if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName) then - begin - //Error Loading Song -> Go back to Song Screen and Show some Error Message - FadeTo(@ScreenSong); - //Select New Song in Party Mode - if ScreenSong.Mode = 1 then - ScreenSong.SelectRandomSong; - ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); - Exit; - end; - except - //Error Loading Song -> Go back to Song Screen and Show some Error Message - FadeTo(@ScreenSong); - //Select New Song in Party Mode - if ScreenSong.Mode = 1 then - ScreenSong.SelectRandomSong; - ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); - Exit; - end; - AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; -// AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed - - // set movie - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin -(* OpenSmpeg(AktSong.Path + AktSong.Video); - SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*) - - // todo: VideoGap and Start time verwursten - FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); - FFmpegSkip(AktSong.VideoGAP + AktSong.Start); - AktSong.VideoLoaded := true; - end; - - // set background - if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then - try - Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background); - except - log.LogError('Background could not be loaded: ' + AktSong.Path + AktSong.Background); - Tex_Background.TexNum := -1; - end - else - Tex_Background.TexNum := -1; - - - - // play music (I) - Music.CaptureStart; - Music.MoveTo(AktSong.Start); -// Music.Play; - - // prepare timer (I) -// CountSkipTimeSet; - Czas.Teraz := AktSong.Start; - Czas.Razem := Music.Length; - if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000; - Czas.OldBeat := -1; - for P := 0 to High(Player) do - ClearScores(P); - - // main text - LyricMain.Clear; - LyricMain.X := 400; - LyricMain.Y := Skin_LyricsT; - LyricMain.Scale := 1.4; //1.4 - LyricMain.Align := 1; - - // sub text - LyricSub.Clear; - LyricSub.X := 400; - LyricSub.Y := Skin_LyricsT + 35; //42 //40 - LyricSub.Align := 1; - - // set custom options - case Ini.LyricsFont of - 0: - begin - LyricMain.FontStyle := 0; - LyricSub.FontStyle := 0; - LyricMain.Size := 14; // 13 - LyricSub.Size := 14; // 13 - LyricMain.ColR := Skin_FontR; - LyricMain.ColG := Skin_FontG; - LyricMain.ColB := Skin_FontB; //Change für Crazy Joker - {LyricMain.ColSR := Skin_FontHighlightR; - LyricMain.ColSG := Skin_FontHighlightG; - LyricMain.ColSB := Skin_FontHighlightB;1aa5dc} - LyricMain.ColSR := 5/255; //26 - LyricMain.ColSG := 163/255; //165 - LyricMain.ColSB := 210/255; //220 - - LyricSub.ColR := 0.4; //0.6 - LyricSub.ColG := 0.4; //0.6 - LyricSub.ColB := 0.4; //0.6 - end; - 1: - begin - LyricMain.FontStyle := 2; - LyricSub.FontStyle := 2; - LyricMain.Size := 14; - LyricSub.Size := 14; - LyricMain.ColR := 0.75; - LyricMain.ColG := 0.75; - LyricMain.ColB := 1; - LyricMain.ColSR := 0.5; - LyricMain.ColSG := 0.5; - LyricMain.ColSB := 1; - LyricSub.ColR := 0.8; - LyricSub.ColG := 0.8; - LyricSub.ColB := 0.8; - end; - 2: - begin - LyricMain.FontStyle := 3; - LyricSub.FontStyle := 3; - LyricMain.Size := 12; - LyricSub.Size := 12; - LyricMain.ColR := 0.75; - LyricMain.ColG := 0.75; - LyricMain.ColB := 1; - LyricMain.ColSR := 0.5; - LyricMain.ColSG := 0.5; - LyricMain.ColSB := 1; - LyricSub.ColR := 0.8; - LyricSub.ColG := 0.8; - LyricSub.ColB := 0.8; - end; - end; // case - - case Ini.LyricsEffect of - 0: LyricMain.Style := 1; // 0 - one selected, 1 - selected all to the current - 1: LyricMain.Style := 2; - 2: LyricMain.Style := 3; - 3: LyricMain.Style := 4; - end; // case - - // fill texts - LyricMain.AddCzesc(0); - LyricMain.Selected := -1; - LyricSub.AddCzesc(1); - LyricSub.Selected := -1; - - UpdateLCD; - - //Deactivate Pause - Paused := False; - - //Kill all Stars not Killed yet - //GoldenStarsTwinkle Mod - GoldenRec.SentenceChange; - //GoldenStarsTwinkle Mod End - - //Set Position of Line Bonus - PhrasenBonus - if (Ini.LineBonus = 1) then //Show Line Bonus at Scores - begin - Case PlayersPlay of - 1: begin - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; - end; - - 2: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.X; - Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.X; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.X; - Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - end; - - 3: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - end; - - 4: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; - - //P4 - Player[3].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; - Player[3].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[3].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; - Player[3].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - end; - - 6: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - - //P4 - Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[3].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; - Player[3].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[3].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; - - //P5 - Player[4].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[4].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[4].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[4].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P6 - Player[5].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[5].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[5].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[5].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - end; - end; - end - else if (Ini.LineBonus = 2) then //Show Line Bonus at Notes - begin - - // positions - if Ini.SingWindow = 0 then begin - NR.Left := 120; - end else begin - NR.Left := 20; - end; - NR.Right := 780; - - NR.Width := NR.Right - NR.Left; - NR.WMid := NR.Width / 2; - NR.Mid := NR.Left + NR.WMid; - - Case PlayersPlay of - 1: begin - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := Skin_P2_NotesB - 105; - end; - - 2: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - end; - - 3: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := 120 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := 120 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := 245 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := 245 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_TargetY := 370 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_StartY := 370 + 28; - end; - - 4: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P4 - Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - end; - - 6: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := 120 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := 120 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := 245 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := 245 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_TargetY := 370 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_StartY := 370 + 28; - - //P4 - Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_TargetY := 120 - 65 + 28; - Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_StartY := 120 + 28; - - //P5 - Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[4].LineBonus_TargetY := 245 - 65 + 28; - Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[4].LineBonus_StartY := 245 + 28; - - //P6 - Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[5].LineBonus_TargetY := 370 - 65 + 28; - Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[5].LineBonus_StartY := 370 + 28; - end; - end; - end; - //Set Position of Line Bonus - PhrasenBonus End - //Set Num of Empty Sentences for Phrasen Bonus - NumEmptySentences := 0; - for P := low(Czesci[0].Czesc) to high(Czesci[0].Czesc) do - if Czesci[0].Czesc[P].TotalNotes = 0 then Inc(NumEmptySentences); - - Log.LogStatus('End', 'onShow'); -end; - -procedure TScreenSing.onShowFinish; -begin - // play movie (II) - - if AktSong.VideoLoaded then - begin - try - FFmpegGetFrame(Czas.Teraz); - FFmpegDrawGL(ScreenAct); -// PlaySmpeg; - except - //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video - AktSong.VideoLoaded := False; - Log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); - Log.LogError('Corrupted File: ' + AktSong.Video); - try -// CloseSmpeg; - FFmpegClose; - except - - end; - end; - end; - - // play music (II) - Music.Play; - - // prepare timer (II) - CountSkipTimeSet; -end; - -function TScreenSing.Draw: boolean; -var - Min: integer; - Sec: integer; - Tekst: string; - Flash: real; - S: integer; - T: integer; -begin - - - - //ScoreBG Mod | den wirren Scheiss hier brauch mer nimmer, wir haben colorized png's - no need for wirrness also - // set player colors - macht nichts weiter als die farben des statics zu wechseln, was zu unschönen effekten bei colorized png führt -{ if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - end; - if ScreenAct = 2 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P4Dark'); - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P3Dark'); - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); - end; - if ScreenAct = 2 then begin - - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P6Dark'); - - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); - end; - end; - } - - // set player names (for 2 screens and only Singstar skin) - if ScreenAct = 1 then begin - Text[TextP1].Text := 'P1'; - Text[TextP1TwoP].Text := 'P1'; - Text[TextP1ThreeP].Text := 'P1'; - Text[TextP2R].Text := 'P2'; - Text[TextP2M].Text := 'P2'; - Text[TextP3R].Text := 'P3'; - end; - - if ScreenAct = 2 then begin - case PlayersPlay of -{ 1: begin - Text[TextP1].Text := 'P2'; - end; - 2: begin - Text[TextP1].Text := 'P3'; - Text[TextP2R].Text := 'P4'; - end; - 3: begin - Text[TextP1].Text := 'P4'; - Text[TextP2M].Text := 'P5'; - Text[TextP3R].Text := 'P6'; - end;} - - 4: begin - Text[TextP1TwoP].Text := 'P3'; - Text[TextP2R].Text := 'P4'; - end; - 6: begin - Text[TextP1ThreeP].Text := 'P4'; - Text[TextP2M].Text := 'P5'; - Text[TextP3R].Text := 'P6'; - end; - end; // case - end; // if - - // stereo - -// weird stuff, maybe this is for "dual screen?", but where is player three then? | okay, i commented the stuff out the other day - nothing was missing on screen w/ 6 players - so do we even need this stuff? -// okay this stuff appears again some lines beneath this one, I commented it out for testing what it does - seems like it's doing nothing -// but I might be wrong, so what is this stuff here doing? O.o - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; - - Text[TextP1].X := Text[TextP1].X + 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; - - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; - Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; - - Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; -// end of weird stuff - - for S := 1 to 1 do //wtf? - Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X + 10*ScreenX; - - // update static menu with time ... - Min := Round(Czas.Teraz) div 60; - Sec := Round(Czas.Teraz) mod 60; - Text[TextTimeText].Text := ''; - if Min < 10 then Text[TextTimeText].Text := '0'; - Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':'; - if Sec < 10 then Text[TextTimeText].Text := Text[TextTimeText].Text + '0'; - Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec); - - // .. and scores - if PlayersPlay = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; - end; - - if PlayersPlay = 2 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - - if PlayersPlay = 3 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[4].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[5].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - end; - - // draw static menu (BG) - DrawBG; - //Draw Background - SingDrawBackground; - // update and draw movie - if ShowFinish and AktSong.VideoLoaded then begin - try -// UpdateSmpeg; // this only draws - // todo: find a way to determine, when a new frame is needed - // toto: same for the need to skip frames - FFmpegGetFrame(Czas.Teraz); - FFmpegDrawGL(ScreenAct); - except - //If an Error occurs drawing: prevent Video from being Drawn again and Close Video - AktSong.VideoLoaded := False; - log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); - Log.LogError('Corrupted File: ' + AktSong.Video); - try -// CloseSmpeg; - FFmpegClose; - except - - end; - end; - end; - - // draw static menu (FG) - DrawFG; - - // check for music finish -// Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(AktSong.Finish)); - if ShowFinish then begin - if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin - //Pause Mod: - if not Paused then - Sing(Self); // analyze song - end else begin -// Log.LogError('End'); - if not FadeOut then begin -// Log.LogError('End2'); - Finish; - FadeOut := true; - FadeTo(@ScreenScore); - end; - end; - end; - - // draw custom items - SingDraw; // always draw - -//GoldenNoteStarsTwinkle Mod - GoldenRec.SpawnRec; -//GoldenNoteStarsTwinkle Mod - - // back stereo - -// weird stuff, maybe this is for "dual screen?", but where is player three then? -// okay this stuff appears again some lines above this one, I commented it out for testing what it does - seems like it's doing nothing -// but I might be wrong, so what is this stuff here doing? O.o - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; - - Text[TextP1].X := Text[TextP1].X - 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; - - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; - Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; - - Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; -//weird end - - for S := 1 to 1 do // wtf? - Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X - 10*ScreenX; - -end; - -procedure TScreenSing.Finish; -begin - Music.CaptureStop; - Music.Stop; - - if Ini.SavePlayback = 1 then begin - Log.BenchmarkStart(0); - Log.LogVoice(0); - Log.LogVoice(1); - Log.LogVoice(2); - Log.BenchmarkEnd(0); - Log.LogBenchmark('Creating files', 0); - end; - - if AktSong.VideoLoaded then begin -// CloseSmpeg; - FFmpegClose; - AktSong.VideoLoaded := false; // to prevent drawing closed video - end; - - SetFontItalic (False); -end; - -procedure TScreenSing.UpdateLCD; -var - T: string; -begin - LCD.HideCursor; - LCD.Clear; - - T := LyricMain.Text; - if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; - LCD.AddTextBR(T); - - T := LyricSub.Text; - if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; - LCD.AddTextBR(T); -end; - -procedure TScreenSing.onSentenceEnd(S: Cardinal); -var -I: Integer; -A: Real; -B: integer; //Max Points for Notes -begin - - //Check for Empty Sentence - if (Czesci[0].Czesc[S].TotalNotes<=0) then - exit; - - //Set Max Note Points - if (Ini.LineBonus > 0) then - B := 9000 - else - B := 10000; - - for I := 0 to High(Player) do begin - A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2; - - //SingBar Mod - If ({(Ini.Oscilloscope = 2) and }(Czesci[0].Czesc[S].TotalNotes>0)) then - begin - Player[I].ScorePercentTarget := Player[I].ScorePercentTarget + floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 40 - 26); - if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0; - if Player[I].ScorePercentTarget > 99 then Player[I].ScorePercentTarget := 99; - - //end Singbar Mod - end; - - //PhrasenBonus - Line Bonus Mod - - //Generate Steps 0 to 8 - A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); - - If (Ini.LineBonus > 0) then - begin - - //Generate Text - if A >= 8 then - Player[I].LineBonus_Text := Theme.Sing.LineBonusText[8] - else - Player[I].LineBonus_Text := Theme.Sing.LineBonusText[Floor(A)]; - - //PhrasenBonus give Points - Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8); - Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10; - //Update Total Score - Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; - - //Color - Case Floor(A) of - 0: begin - Player[I].LineBonus_Color.R := 1; - Player[I].LineBonus_Color.G := 0; - Player[I].LineBonus_Color.B := 0; - end; - 1..3: begin - Player[I].LineBonus_Color.R := 1; - Player[I].LineBonus_Color.G := (A * 0.25); - Player[I].LineBonus_Color.B := 0; - end; - 4: begin - Player[I].LineBonus_Color.R := 1; - Player[I].LineBonus_Color.G := 1; - Player[I].LineBonus_Color.B := 0; - end; - 5..7: begin - Player[I].LineBonus_Color.R := 1-((a-4)*0.25); - Player[I].LineBonus_Color.G := 1; - Player[I].LineBonus_Color.B := 0; - end; - 8: begin - Player[I].LineBonus_Color.R := 0; - Player[I].LineBonus_Color.G := 1; - Player[I].LineBonus_Color.B := 0; - end; - End; //Case - //Player[I].LineBonus_Color.B := 0; - //Player[I].LineBonus_Color.R := (8-A)/8; - //Player[I].LineBonus_Color.G := A/10; - - Player[I].LineBonus_PosX := Player[I].LineBonus_StartX; - Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; - Player[I].LineBonus_Alpha := 0.92; - Player[I].LineBonus_Visible := True; - Player[I].LineBonus_Age := 1; - end; - //PhrasenBonus - Line Bonus Mod End// } - - //PerfectLineTwinkle Mod (effect) Pt.1 - If (Ini.EffectSing=1) then - begin - if A >= 8 then Player[I].LastSentencePerfect := True - else Player[I].LastSentencePerfect := False; - end; - //PerfectLineTwinkle Mod end - - //Refresh LastScore - Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; - - end; - - //PerfectLineTwinkle Mod (effect) Pt.2 - if Ini.EffectSing=1 then - GoldenRec.SpawnPerfectLineTwinkle; - //PerfectLineTwinkle Mod end -end; - -//Called on Sentence Change S= New Current Sentence -procedure TScreenSing.onSentenceChange(S: Cardinal); -begin - //GoldenStarsTwinkle Mod - GoldenRec.SentenceChange; - //GoldenStarsTwinkle Mod End -end; - -end. +unit UScreenSing; + +interface + +{$I switches.inc} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +uses UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + UIni, + ULog, + UTexture, + ULyrics, + TextGL, + OpenGL12, + {$IFDEF useBASS} + bass, + {$ENDIF} + UThemes, + ULCD, + UGraphicClasses, + UVideo; + +type + TScreenSing = class(TMenu) + protected + paused: boolean; //Pause Mod + PauseTime: Real; + NumEmptySentences: integer; + public + //TextTime: integer; + + //TimeBar mod + StaticTimeProgress: integer; + TextTimeText: integer; + //eoa TimeBar mod + + StaticP1: integer; + StaticP1ScoreBG: integer; + TextP1: integer; + TextP1Score: integer; + + //moveable singbar mod + StaticP1SingBar: integer; + StaticP1ThreePSingBar: integer; + StaticP1TwoPSingBar: integer; + StaticP2RSingBar: integer; + StaticP2MSingBar: integer; + StaticP3SingBar: integer; + //eoa moveable singbar + + //Added for ps3 skin + //shown when game is in 2/4 player modus + StaticP1TwoP: integer; + StaticP1TwoPScoreBG: integer; + TextP1TwoP: integer; + TextP1TwoPScore: integer; + //shown when game is in 3/6 player modus + StaticP1ThreeP: integer; + StaticP1ThreePScoreBG: integer; + TextP1ThreeP: integer; + TextP1ThreePScore: integer; + //eoa + + StaticP2R: integer; + StaticP2RScoreBG: integer; + TextP2R: integer; + TextP2RScore: integer; + + StaticP2M: integer; + StaticP2MScoreBG: integer; + TextP2M: integer; + TextP2MScore: integer; + + StaticP3R: integer; + StaticP3RScoreBG: integer; + TextP3R: integer; + TextP3RScore: integer; + + Tex_Background: TTexture; + FadeOut: boolean; + LyricMain: TLyric; + LyricSub: TLyric; + + constructor Create; override; + procedure onShow; override; + procedure onShowFinish; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure Finish; virtual; + procedure UpdateLCD; + procedure Pause; //Pause Mod(Toggles Pause) + + //OnSentenceEnd for LineBonus + Singbar + procedure onSentenceEnd(S: Cardinal); + //OnSentenceChange (for Golden Notes) + procedure onSentenceChange(S: Cardinal); + end; + +implementation +uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math; + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenSing.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_Q: + begin + //When not ask before Exit then Finish now + if (Ini.AskbeforeDel <> 1) then + Finish + //else just Pause and let the Popup make the Work + else if not paused then + Pause; + + Result := false; + end; + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + //Record Sound Hack: + //Sound[0].BufferLong + + Finish; + Music.PlayBack; + FadeTo(@ScreenScore); + end; + + SDLK_P://Pause Mod + begin + Pause; + end; + + SDLK_RETURN: + begin + 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 : + begin + end; + SDLK_UP : + begin + end; + end; + end; +end; + +//Pause Mod +procedure TScreenSing.Pause; +begin + if not paused then //Pause einschalten + begin + // pause Time + PauseTime := Czas.Teraz; + Paused := true; + + // pause Music + Music.Pause; + + // pause Video + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + FFmpegTogglePause; + end + else //Pause ausschalten + begin + Czas.Teraz := PauseTime; //Position of Notes + + // Position of Music + Music.MoveTo (PauseTime); + // Play Music + Music.Play; + + // Video + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + FFmpegTogglePause; + //SkipSmpeg(PauseTime); + + Paused := false; + end; +end; +//Pause Mod End + +constructor TScreenSing.Create; +var + I: integer; + P: integer; +begin + inherited Create; + + LoadFromTheme(Theme.Sing); + + //TimeBar + StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); + TextTimeText := AddText(Theme.Sing.TextTimeText); + +// 1 player | P1 + StaticP1 := AddStatic(Theme.Sing.StaticP1); + StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); + TextP1 := AddText(Theme.Sing.TextP1); + TextP1Score := AddText(Theme.Sing.TextP1Score); + StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar); + +// 2 or 4 players | P1 + StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); + StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG); + TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); + TextP1TwoPScore := AddText(Theme.Sing.TextP1TwoPScore); + StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); + + // | P2 + StaticP2R := AddStatic(Theme.Sing.StaticP2R); + StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); + TextP2R := AddText(Theme.Sing.TextP2R); + TextP2RScore := AddText(Theme.Sing.TextP2RScore); + StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); + +// 3 or 6 players | P1 + StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); + StaticP1ThreePScoreBG := AddStatic(Theme.Sing.StaticP1ThreePScoreBG); + TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); + TextP1ThreePScore := AddText(Theme.Sing.TextP1ThreePScore); + StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar); + + // | P2 + StaticP2M := AddStatic(Theme.Sing.StaticP2M); + StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG); + TextP2M := AddText(Theme.Sing.TextP2M); + TextP2MScore := AddText(Theme.Sing.TextP2MScore); + StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar); + + // | P3 + StaticP3R := AddStatic(Theme.Sing.StaticP3R); + StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG); + TextP3R := AddText(Theme.Sing.TextP3R); + TextP3RScore := AddText(Theme.Sing.TextP3RScore); + StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar); + + if ScreenAct = 2 then begin + // katze und affe + + end; + + LyricMain := TLyric.Create; + LyricSub := TLyric.Create; + + UVideo.Init; +end; + +procedure TScreenSing.onShow; +var + P: integer; + V1: boolean; + V1TwoP: boolean; //added for ps3 skin + V1ThreeP: boolean; //added for ps3 skin + V2R: boolean; + V2M: boolean; + V3R: boolean; + NR: TRecR; //Line Bonus Mod +begin + Log.LogStatus('Begin', 'onShow'); + FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented + + // prepare players + SetLength(Player, PlayersPlay); +// Player[0].ScoreTotalI := 0; + + case PlayersPlay of + 1: begin + V1 := true; + V1TwoP := false; + V1ThreeP := false; + V2R := false; + V2M := false; + V3R := false; + end; + 2: begin + V1 := false; + V1TwoP := true; + V1ThreeP := false; + V2R := true; + V2M := false; + V3R := false; + end; + 3: begin + V1 := false; + V1TwoP := false; + V1ThreeP := true; + V2R := false; + V2M := true; + V3R := true; + end; + 4: begin // double screen + V1 := false; + V1TwoP := true; + V1ThreeP := false; + V2R := true; + V2M := false; + V3R := false; + end; + 6: begin // double screen + V1 := false; + V1TwoP := false; + V1ThreeP := true; + V2R := false; + V2M := true; + V3R := true; + end; + + end; + + //This one is shown in 1P mode + Static[StaticP1].Visible := V1; + Static[StaticP1ScoreBG].Visible := V1; + Text[TextP1].Visible := V1; + Text[TextP1Score].Visible := V1; + + + //This one is shown in 2/4P mode + Static[StaticP1TwoP].Visible := V1TwoP; + Static[StaticP1TwoPScoreBG].Visible := V1TwoP; + Text[TextP1TwoP].Visible := V1TwoP; + Text[TextP1TwoPScore].Visible := V1TwoP; + + Static[StaticP2R].Visible := V2R; + Static[StaticP2RScoreBG].Visible := V2R; + Text[TextP2R].Visible := V2R; + Text[TextP2RScore].Visible := V2R; + + + //This one is shown in 3/6P mode + Static[StaticP1ThreeP].Visible := V1ThreeP; + Static[StaticP1ThreePScoreBG].Visible := V1ThreeP; + Text[TextP1ThreeP].Visible := V1ThreeP; + Text[TextP1ThreePScore].Visible := V1ThreeP; + + Static[StaticP2M].Visible := V2M; + Static[StaticP2MScoreBG].Visible := V2M; + Text[TextP2M].Visible := V2M; + Text[TextP2MScore].Visible := V2M; + + Static[StaticP3R].Visible := V3R; + Static[StaticP3RScoreBG].Visible := V3R; + Text[TextP3R].Visible := V3R; + Text[TextP3RScore].Visible := V3R; + + // load notes + ResetSingTemp; +// Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); + AktSong := CatSongs.Song[CatSongs.Selected]; + try + if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName) then + begin + //Error Loading Song -> Go back to Song Screen and Show some Error Message + FadeTo(@ScreenSong); + //Select New Song in Party Mode + if ScreenSong.Mode = 1 then + ScreenSong.SelectRandomSong; + ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); + Exit; + end; + except + //Error Loading Song -> Go back to Song Screen and Show some Error Message + FadeTo(@ScreenSong); + //Select New Song in Party Mode + if ScreenSong.Mode = 1 then + ScreenSong.SelectRandomSong; + ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); + Exit; + end; + AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; +// AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed + + // set movie + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin +(* OpenSmpeg(AktSong.Path + AktSong.Video); + SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*) + + // todo: VideoGap and Start time verwursten + FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); + FFmpegSkip(AktSong.VideoGAP + AktSong.Start); + AktSong.VideoLoaded := true; + end; + + // set background + if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then + try + Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background); + except + log.LogError('Background could not be loaded: ' + AktSong.Path + AktSong.Background); + Tex_Background.TexNum := -1; + end + else + Tex_Background.TexNum := -1; + + + + // play music (I) + Music.CaptureStart; + Music.MoveTo(AktSong.Start); +// Music.Play; + + // prepare timer (I) +// CountSkipTimeSet; + Czas.Teraz := AktSong.Start; + Czas.Razem := Music.Length; + if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000; + Czas.OldBeat := -1; + for P := 0 to High(Player) do + ClearScores(P); + + // main text + LyricMain.Clear; + LyricMain.X := 400; + LyricMain.Y := Skin_LyricsT; + LyricMain.Scale := 1.4; //1.4 + LyricMain.Align := 1; + + // sub text + LyricSub.Clear; + LyricSub.X := 400; + LyricSub.Y := Skin_LyricsT + 35; //42 //40 + LyricSub.Align := 1; + + // set custom options + case Ini.LyricsFont of + 0: + begin + LyricMain.FontStyle := 0; + LyricSub.FontStyle := 0; + LyricMain.Size := 14; // 13 + LyricSub.Size := 14; // 13 + LyricMain.ColR := Skin_FontR; + LyricMain.ColG := Skin_FontG; + LyricMain.ColB := Skin_FontB; //Change für Crazy Joker + {LyricMain.ColSR := Skin_FontHighlightR; + LyricMain.ColSG := Skin_FontHighlightG; + LyricMain.ColSB := Skin_FontHighlightB;1aa5dc} + LyricMain.ColSR := 5/255; //26 + LyricMain.ColSG := 163/255; //165 + LyricMain.ColSB := 210/255; //220 + + LyricSub.ColR := 0.4; //0.6 + LyricSub.ColG := 0.4; //0.6 + LyricSub.ColB := 0.4; //0.6 + end; + 1: + begin + LyricMain.FontStyle := 2; + LyricSub.FontStyle := 2; + LyricMain.Size := 14; + LyricSub.Size := 14; + LyricMain.ColR := 0.75; + LyricMain.ColG := 0.75; + LyricMain.ColB := 1; + LyricMain.ColSR := 0.5; + LyricMain.ColSG := 0.5; + LyricMain.ColSB := 1; + LyricSub.ColR := 0.8; + LyricSub.ColG := 0.8; + LyricSub.ColB := 0.8; + end; + 2: + begin + LyricMain.FontStyle := 3; + LyricSub.FontStyle := 3; + LyricMain.Size := 12; + LyricSub.Size := 12; + LyricMain.ColR := 0.75; + LyricMain.ColG := 0.75; + LyricMain.ColB := 1; + LyricMain.ColSR := 0.5; + LyricMain.ColSG := 0.5; + LyricMain.ColSB := 1; + LyricSub.ColR := 0.8; + LyricSub.ColG := 0.8; + LyricSub.ColB := 0.8; + end; + end; // case + + case Ini.LyricsEffect of + 0: LyricMain.Style := 1; // 0 - one selected, 1 - selected all to the current + 1: LyricMain.Style := 2; + 2: LyricMain.Style := 3; + 3: LyricMain.Style := 4; + end; // case + + // fill texts + LyricMain.AddCzesc(0); + LyricMain.Selected := -1; + LyricSub.AddCzesc(1); + LyricSub.Selected := -1; + + UpdateLCD; + + //Deactivate Pause + Paused := False; + + //Kill all Stars not Killed yet + //GoldenStarsTwinkle Mod + GoldenRec.SentenceChange; + //GoldenStarsTwinkle Mod End + + //Set Position of Line Bonus - PhrasenBonus + if (Ini.LineBonus = 1) then //Show Line Bonus at Scores + begin + Case PlayersPlay of + 1: begin + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + end; + + 2: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.X; + Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.X; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.X; + Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + end; + + 3: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + end; + + 4: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; + + //P4 + Player[3].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; + Player[3].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[3].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; + Player[3].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + end; + + 6: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + + //P4 + Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[3].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[3].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[3].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; + + //P5 + Player[4].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[4].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[4].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[4].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P6 + Player[5].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[5].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[5].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[5].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + end; + end; + end + else if (Ini.LineBonus = 2) then //Show Line Bonus at Notes + begin + + // positions + if Ini.SingWindow = 0 then begin + NR.Left := 120; + end else begin + NR.Left := 20; + end; + NR.Right := 780; + + NR.Width := NR.Right - NR.Left; + NR.WMid := NR.Width / 2; + NR.Mid := NR.Left + NR.WMid; + + Case PlayersPlay of + 1: begin + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := Skin_P2_NotesB - 105; + end; + + 2: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + end; + + 3: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := 120 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := 120 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := 245 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := 245 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_TargetY := 370 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_StartY := 370 + 28; + end; + + 4: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P4 + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + end; + + 6: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := 120 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := 120 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := 245 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := 245 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_TargetY := 370 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_StartY := 370 + 28; + + //P4 + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_TargetY := 120 - 65 + 28; + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_StartY := 120 + 28; + + //P5 + Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[4].LineBonus_TargetY := 245 - 65 + 28; + Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[4].LineBonus_StartY := 245 + 28; + + //P6 + Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[5].LineBonus_TargetY := 370 - 65 + 28; + Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[5].LineBonus_StartY := 370 + 28; + end; + end; + end; + //Set Position of Line Bonus - PhrasenBonus End + //Set Num of Empty Sentences for Phrasen Bonus + NumEmptySentences := 0; + for P := low(Czesci[0].Czesc) to high(Czesci[0].Czesc) do + if Czesci[0].Czesc[P].TotalNotes = 0 then Inc(NumEmptySentences); + + Log.LogStatus('End', 'onShow'); +end; + +procedure TScreenSing.onShowFinish; +begin + // play movie (II) + + if AktSong.VideoLoaded then + begin + try + FFmpegGetFrame(Czas.Teraz); + FFmpegDrawGL(ScreenAct); +// PlaySmpeg; + except + //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video + AktSong.VideoLoaded := False; + Log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); + Log.LogError('Corrupted File: ' + AktSong.Video); + try +// CloseSmpeg; + FFmpegClose; + except + + end; + end; + end; + + // play music (II) + Music.Play; + + // prepare timer (II) + CountSkipTimeSet; +end; + +function TScreenSing.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + Flash: real; + S: integer; + T: integer; +begin + + + + //ScoreBG Mod | den wirren Scheiss hier brauch mer nimmer, wir haben colorized png's - no need for wirrness also + // set player colors - macht nichts weiter als die farben des statics zu wechseln, was zu unschönen effekten bei colorized png führt +{ if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P4Dark'); + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P3Dark'); + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); + end; + if ScreenAct = 2 then begin + + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P6Dark'); + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); + end; + end; + } + + // set player names (for 2 screens and only Singstar skin) + if ScreenAct = 1 then begin + Text[TextP1].Text := 'P1'; + Text[TextP1TwoP].Text := 'P1'; + Text[TextP1ThreeP].Text := 'P1'; + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; + end; + + if ScreenAct = 2 then begin + case PlayersPlay of +{ 1: begin + Text[TextP1].Text := 'P2'; + end; + 2: begin + Text[TextP1].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 3: begin + Text[TextP1].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end;} + + 4: begin + Text[TextP1TwoP].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 6: begin + Text[TextP1ThreeP].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end; + end; // case + end; // if + + // stereo + +// weird stuff, maybe this is for "dual screen?", but where is player three then? | okay, i commented the stuff out the other day - nothing was missing on screen w/ 6 players - so do we even need this stuff? +// okay this stuff appears again some lines beneath this one, I commented it out for testing what it does - seems like it's doing nothing +// but I might be wrong, so what is this stuff here doing? O.o + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + + Text[TextP1].X := Text[TextP1].X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; + + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; + Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + + Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; +// end of weird stuff + + for S := 1 to 1 do //wtf? + Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X + 10*ScreenX; + + // update static menu with time ... + Min := Round(Czas.Teraz) div 60; + Sec := Round(Czas.Teraz) mod 60; + Text[TextTimeText].Text := ''; + if Min < 10 then Text[TextTimeText].Text := '0'; + Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':'; + if Sec < 10 then Text[TextTimeText].Text := Text[TextTimeText].Text + '0'; + Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec); + + // .. and scores + if PlayersPlay = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + end; + + if PlayersPlay = 2 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + + if PlayersPlay = 3 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[4].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[5].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + end; + + // draw static menu (BG) + DrawBG; + //Draw Background + SingDrawBackground; + // update and draw movie + if ShowFinish and AktSong.VideoLoaded then begin + try +// UpdateSmpeg; // this only draws + // todo: find a way to determine, when a new frame is needed + // toto: same for the need to skip frames + FFmpegGetFrame(Czas.Teraz); + FFmpegDrawGL(ScreenAct); + except + //If an Error occurs drawing: prevent Video from being Drawn again and Close Video + AktSong.VideoLoaded := False; + log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); + Log.LogError('Corrupted File: ' + AktSong.Video); + try +// CloseSmpeg; + FFmpegClose; + except + + end; + end; + end; + + // draw static menu (FG) + DrawFG; + + // check for music finish +// Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(AktSong.Finish)); + if ShowFinish then begin + if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + //Pause Mod: + if not Paused then + Sing(Self); // analyze song + end else begin +// Log.LogError('End'); + if not FadeOut then begin +// Log.LogError('End2'); + Finish; + FadeOut := true; + FadeTo(@ScreenScore); + end; + end; + end; + + // draw custom items + SingDraw; // always draw + +//GoldenNoteStarsTwinkle Mod + GoldenRec.SpawnRec; +//GoldenNoteStarsTwinkle Mod + + // back stereo + +// weird stuff, maybe this is for "dual screen?", but where is player three then? +// okay this stuff appears again some lines above this one, I commented it out for testing what it does - seems like it's doing nothing +// but I might be wrong, so what is this stuff here doing? O.o + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; + + Text[TextP1].X := Text[TextP1].X - 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; + + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; + Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; + + Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; +//weird end + + for S := 1 to 1 do // wtf? + Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X - 10*ScreenX; + +end; + +procedure TScreenSing.Finish; +begin + Music.CaptureStop; + Music.Stop; + + if Ini.SavePlayback = 1 then begin + Log.BenchmarkStart(0); + Log.LogVoice(0); + Log.LogVoice(1); + Log.LogVoice(2); + Log.BenchmarkEnd(0); + Log.LogBenchmark('Creating files', 0); + end; + + if AktSong.VideoLoaded then begin +// CloseSmpeg; + FFmpegClose; + AktSong.VideoLoaded := false; // to prevent drawing closed video + end; + + SetFontItalic (False); +end; + +procedure TScreenSing.UpdateLCD; +var + T: string; +begin + LCD.HideCursor; + LCD.Clear; + + T := LyricMain.Text; + if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; + LCD.AddTextBR(T); + + T := LyricSub.Text; + if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; + LCD.AddTextBR(T); +end; + +procedure TScreenSing.onSentenceEnd(S: Cardinal); +var +I: Integer; +A: Real; +B: integer; //Max Points for Notes +begin + + //Check for Empty Sentence + if (Czesci[0].Czesc[S].TotalNotes<=0) then + exit; + + //Set Max Note Points + if (Ini.LineBonus > 0) then + B := 9000 + else + B := 10000; + + for I := 0 to High(Player) do begin + A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2; + + //SingBar Mod + If ({(Ini.Oscilloscope = 2) and }(Czesci[0].Czesc[S].TotalNotes>0)) then + begin + Player[I].ScorePercentTarget := Player[I].ScorePercentTarget + floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 40 - 26); + if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0; + if Player[I].ScorePercentTarget > 99 then Player[I].ScorePercentTarget := 99; + + //end Singbar Mod + end; + + //PhrasenBonus - Line Bonus Mod + + //Generate Steps 0 to 8 + A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); + + If (Ini.LineBonus > 0) then + begin + + //Generate Text + if A >= 8 then + Player[I].LineBonus_Text := Theme.Sing.LineBonusText[8] + else + Player[I].LineBonus_Text := Theme.Sing.LineBonusText[Floor(A)]; + + //PhrasenBonus give Points + Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8); + Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10; + //Update Total Score + Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; + + //Color + Case Floor(A) of + 0: begin + Player[I].LineBonus_Color.R := 1; + Player[I].LineBonus_Color.G := 0; + Player[I].LineBonus_Color.B := 0; + end; + 1..3: begin + Player[I].LineBonus_Color.R := 1; + Player[I].LineBonus_Color.G := (A * 0.25); + Player[I].LineBonus_Color.B := 0; + end; + 4: begin + Player[I].LineBonus_Color.R := 1; + Player[I].LineBonus_Color.G := 1; + Player[I].LineBonus_Color.B := 0; + end; + 5..7: begin + Player[I].LineBonus_Color.R := 1-((a-4)*0.25); + Player[I].LineBonus_Color.G := 1; + Player[I].LineBonus_Color.B := 0; + end; + 8: begin + Player[I].LineBonus_Color.R := 0; + Player[I].LineBonus_Color.G := 1; + Player[I].LineBonus_Color.B := 0; + end; + End; //Case + //Player[I].LineBonus_Color.B := 0; + //Player[I].LineBonus_Color.R := (8-A)/8; + //Player[I].LineBonus_Color.G := A/10; + + Player[I].LineBonus_PosX := Player[I].LineBonus_StartX; + Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; + Player[I].LineBonus_Alpha := 0.92; + Player[I].LineBonus_Visible := True; + Player[I].LineBonus_Age := 1; + end; + //PhrasenBonus - Line Bonus Mod End// } + + //PerfectLineTwinkle Mod (effect) Pt.1 + If (Ini.EffectSing=1) then + begin + if A >= 8 then Player[I].LastSentencePerfect := True + else Player[I].LastSentencePerfect := False; + end; + //PerfectLineTwinkle Mod end + + //Refresh LastScore + Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; + + end; + + //PerfectLineTwinkle Mod (effect) Pt.2 + if Ini.EffectSing=1 then + GoldenRec.SpawnPerfectLineTwinkle; + //PerfectLineTwinkle Mod end +end; + +//Called on Sentence Change S= New Current Sentence +procedure TScreenSing.onSentenceChange(S: Cardinal); +begin + //GoldenStarsTwinkle Mod + GoldenRec.SentenceChange; + //GoldenStarsTwinkle Mod End +end; + +end. diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 6d3add87..455d7b40 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -1,665 +1,669 @@ -unit UScreenSingModi; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -uses UMenu, - UMusic, - SDL, - SysUtils, - UFiles, - UTime, - USongs, - UIni, - ULog, - UTexture, - ULyrics, - TextGL, - OpenGL12, - BASS, - UThemes, - ULCD, - UScreenSing, - ModiSDK; - -type - TScreenSingModi = class(TScreenSing) - protected - //paused: boolean; //Pause Mod - //PauseTime: Real; - //NumEmptySentences: integer; - public - //TextTime: integer; - - //StaticP1: integer; - //StaticP1ScoreBG: integer; - //TextP1: integer; - //TextP1Score: integer; - - //StaticP2R: integer; - //StaticP2RScoreBG: integer; - //TextP2R: integer; - //TextP2RScore: integer; - - //StaticP2M: integer; - //StaticP2MScoreBG: integer; - //TextP2M: integer; - //TextP2MScore: integer; - - //StaticP3R: integer; - //StaticP3RScoreBG: integer; - //TextP3R: integer; - //TextP3RScore: integer; - - //Tex_Background: TTexture; - //FadeOut: boolean; - //LyricMain: TLyric; - //LyricSub: TLyric; - Winner: Byte; //Who Wins - PlayerInfo: TPlayerInfo; - TeamInfo: TTeamInfo; - - constructor Create; override; - procedure onShow; override; - //procedure onShowFinish; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure Finish; override; - //procedure UpdateLCD; - //procedure Pause; //Pause Mod(Toggles Pause) - end; - -//Procedured for Plugin -function LoadTex (const Name, Typ: PChar): TsmallTexture; stdcall; -//function Translate (const Name: PChar): PChar; stdcall; -procedure Print (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text -function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound -procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound - -//Utilys -function ToSentences(Const Czeski: TCzesci): TSentences; - -implementation -uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math, UDLLManager, USkins, UGraphicClasses; - -// Method for input parsing. If False is returned, GetNextWindow -// should be checked to know the next window to load; -function TScreenSingModi.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then - begin // Key Down - case PressedKey of - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - Finish; - Music.PlayBack; - FadeTo(@ScreenPartyScore); - end; - - else - Result := inherited ParseInput(PressedKey, ScanCode, PressedDown); - end; - end; -end; - -constructor TScreenSingModi.Create; -begin - inherited Create; - -end; - -function ToSentences(Const Czeski: TCzesci): TSentences; -var - I, J: Integer; -begin - Result.Akt := Czeski.Akt; - Result.High := Czeski.High; - Result.Ilosc := Czeski.Ilosc; - Result.Resolution := Czeski.Resolution; - Result.NotesGAP := Czeski.NotesGAP; - Result.TotalLength := Czeski.Wartosc; - - SetLength(Result.Sentence, Length(Czeski.Czesc)); - for I := low(Result.Sentence) to high(Result.Sentence) do - begin - Result.Sentence[I].Start := Czeski.Czesc[I].Start; - Result.Sentence[I].StartNote := Czeski.Czesc[I].StartNote; - Result.Sentence[I].Lyric := Czeski.Czesc[I].Lyric; - Result.Sentence[I].LyricWidth := Czeski.Czesc[I].LyricWidth; - Result.Sentence[I].Koniec := Czeski.Czesc[I].Koniec; - Result.Sentence[I].BaseNote := Czeski.Czesc[I].BaseNote; - Result.Sentence[I].HighNote := Czeski.Czesc[I].HighNut; - Result.Sentence[I].IlNut := Czeski.Czesc[I].IlNut; - Result.Sentence[I].TotalNotes := Czeski.Czesc[I].TotalNotes; - - SetLength(Result.Sentence[I].Note, Length(Czeski.Czesc[I].Nuta)); - for J := low(Result.Sentence[I].Note) to high(Result.Sentence[I].Note) do - begin - Result.Sentence[I].Note[J].Color := Czeski.Czesc[I].Nuta[J].Color; - Result.Sentence[I].Note[J].Start := Czeski.Czesc[I].Nuta[J].Start; - Result.Sentence[I].Note[J].Length := Czeski.Czesc[I].Nuta[J].Dlugosc; - Result.Sentence[I].Note[J].Ton := Czeski.Czesc[I].Nuta[J].Ton; - Result.Sentence[I].Note[J].TonGamy := Czeski.Czesc[I].Nuta[J].TonGamy; - //Result.Sentence[I].Note[J].Text := Czeski.Czesc[I].Nuta[J].Tekst; - Result.Sentence[I].Note[J].FreeStyle := Czeski.Czesc[I].Nuta[J].FreeStyle; - Result.Sentence[I].Note[J].Typ := Czeski.Czesc[I].Nuta[J].Wartosc; - end; - end; -end; - -procedure TScreenSingModi.onShow; -var - I: Integer; -begin - - PlayersPlay := TeamInfo.NumTeams; - - if DLLMan.Selected.LoadSong then //Start with Song - begin - inherited; - end - else //Start Without Song - begin - Music.CaptureStart; - end; - -//Set Playerinfo - PlayerInfo.NumPlayers := PlayersPlay; - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); - PlayerInfo.Playerinfo[I].Score := 0; - PlayerInfo.Playerinfo[I].Bar := 50; - PlayerInfo.Playerinfo[I].Enabled := True; - end; - - for I := PlayerInfo.NumPlayers to high(PlayerInfo.Playerinfo) do - begin - PlayerInfo.Playerinfo[I].Score:= 0; - PlayerInfo.Playerinfo[I].Bar := 0; - PlayerInfo.Playerinfo[I].Enabled := False; - end; - - Case PlayersPlay of - 1: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; - end; - 2,4: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1TwoPScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; - PlayerInfo.Playerinfo[2].PosX := Static[StaticP1TwoPScoreBG].Texture.X; - PlayerInfo.Playerinfo[2].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; - PlayerInfo.Playerinfo[1].PosX := Static[StaticP2RScoreBG].Texture.X; - PlayerInfo.Playerinfo[1].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; - PlayerInfo.Playerinfo[3].PosX := Static[StaticP2RScoreBG].Texture.X; - PlayerInfo.Playerinfo[3].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; - end; - 3,6: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ThreePScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; - PlayerInfo.Playerinfo[3].PosX := Static[StaticP1ThreePScoreBG].Texture.X; - PlayerInfo.Playerinfo[3].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; - PlayerInfo.Playerinfo[1].PosX := Static[StaticP2MScoreBG].Texture.X; - PlayerInfo.Playerinfo[1].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; - PlayerInfo.Playerinfo[4].PosX := Static[StaticP2MScoreBG].Texture.X; - PlayerInfo.Playerinfo[4].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; - PlayerInfo.Playerinfo[2].PosX := Static[StaticP3RScoreBG].Texture.X; - PlayerInfo.Playerinfo[2].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; - PlayerInfo.Playerinfo[5].PosX := Static[StaticP3RScoreBG].Texture.X; - PlayerInfo.Playerinfo[5].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; - end; - end; - - // play music (I) - //Music.CaptureStart; - //Music.MoveTo(AktSong.Start); - - //Init Plugin - if not DLLMan.PluginInit(TeamInfo, PlayerInfo, ToSentences(Czesci[0]), LoadTex, Print, LoadSound, PlaySound) then - begin - //Fehler - Log.LogError('Could not Init Plugin'); - Halt; - end; - - // Set Background (Little Workaround, maybe change sometime) - if (DLLMan.Selected.LoadBack) AND (DLLMan.Selected.LoadSong) then - ScreenSing.Tex_Background := Tex_Background; - - Winner := 0; - - //Set Score Visibility - if PlayersPlay = 1 then begin - Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; - Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; - end; - - if (PlayersPlay = 2) OR (PlayersPlay = 4) then begin - Text[TextP1TwoPScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP1TwoPScoreBG].Visible := DLLMan.Selected.ShowScore; - - Text[TextP2RScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP2RScoreBG].Visible := DLLMan.Selected.ShowScore; - end; - - if (PlayersPlay = 3) OR (PlayersPlay = 6) then begin - Text[TextP1ThreePScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP1ThreePScoreBG].Visible := DLLMan.Selected.ShowScore; - - Text[TextP2MScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP2MScoreBG].Visible := DLLMan.Selected.ShowScore; - - Text[TextP3RScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP3RScoreBG].Visible := DLLMan.Selected.ShowScore; - end; -end; - -function TScreenSingModi.Draw: boolean; -var - Min: integer; - Sec: integer; - Tekst: string; - S, I: integer; - T: integer; -begin -//Set Playerinfo - PlayerInfo.NumPlayers := PlayersPlay; - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - PlayerInfo.Playerinfo[I].Name := PChar(Player[I].Name); - if PlayerInfo.Playerinfo[I].Enabled then - begin - if (Player[I].ScoreTotalI<=10000) then - PlayerInfo.Playerinfo[I].Score:= Player[I].ScoreTotalI; - PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; - end; - end; - -//Show Score -if DLLMan.Selected.ShowScore then -begin - //ScoreBG Mod - // set player colors - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - - - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - - - - end; - if ScreenAct = 2 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P4Dark'); - - - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); - - - - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P3Dark'); - - - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); - - - - end; - if ScreenAct = 2 then begin - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P6Dark'); - - - - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); - - - - - end; - end; - //end ScoreBG Mod - -// set player names (for 2 screens and only Singstar skin) - if ScreenAct = 1 then begin - Text[TextP1].Text := 'P1'; - Text[TextP1TwoP].Text := 'P1'; // added for ps3 skin - Text[TextP1ThreeP].Text := 'P1'; // added for ps3 skin - Text[TextP2R].Text := 'P2'; - Text[TextP2M].Text := 'P2'; - Text[TextP3R].Text := 'P3'; - end; - - if ScreenAct = 2 then begin - case PlayersPlay of - 4: begin - Text[TextP1TwoP].Text := 'P3'; - Text[TextP2R].Text := 'P4'; - end; - 6: begin - Text[TextP1ThreeP].Text := 'P4'; - Text[TextP2M].Text := 'P5'; - Text[TextP3R].Text := 'P6'; - end; - end; // case - end; // if - - - // stereo <- and where iss P2M? or P3? - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; - - Text[TextP1].X := Text[TextP1].X + 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; - Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; - - Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; - - // .. and scores - if PlayersPlay = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; - end; - - if PlayersPlay = 2 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - - if PlayersPlay = 3 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[4].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[5].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - end; - -end; //ShowScore - - for S := 1 to 1 do - Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X + 10*ScreenX; - -if DLLMan.Selected.LoadSong then -begin - // update static menu with time ... - Min := Round(Czas.Teraz) div 60; - Sec := Round(Czas.Teraz) mod 60; - Text[TextTimeText].Text := ''; - if Min < 10 then Text[TextTimeText].Text := '0'; - Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':'; - if Sec < 10 then Text[TextTimeText].Text := Text[TextTimeText].Text + '0'; - Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec); -end; - - // draw static menu (BG) - DrawBG; - - //Draw Background - if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) then - SingDrawBackground; - - // comment by blindy: wo zum henker wird denn in diesem screen ein video abgespielt? - // update and draw movie - // wie wo wadd? also in der selben funktion in der uscreensing kommt des video in der zeile 995, oder was wollteste wissen? :X -{ if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin - UpdateSmpeg; // this only draws - end;} - - // draw static menu (FG) - DrawFG; - - if ShowFinish then begin - if DllMan.Selected.LoadSong then - begin - if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin - //Pause Mod: - if not Paused then - Sing(Self); // analyze song - end else begin - if not FadeOut then begin - Finish; - FadeOut := true; - FadeTo(@ScreenPartyScore); - end; - end; - end; - end; - - // draw custom items - SingModiDraw(PlayerInfo); // always draw - - //GoldenNoteStarsTwinkle Mod - GoldenRec.SpawnRec; - //GoldenNoteStarsTwinkle Mod - - //Update PlayerInfo - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - if PlayerInfo.Playerinfo[I].Enabled then - begin - PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; - PlayerInfo.Playerinfo[I].Score := Player[I].ScoreTotalI; - end; - end; - - if ((ShowFinish) AND (NOT Paused)) then - begin - if not DLLMan.PluginDraw(Playerinfo, Czesci[0].Akt) then - begin - if not FadeOut then begin - Finish; - FadeOut := true; - FadeTo(@ScreenPartyScore); - end; - end; - end; - - //Change PlayerInfo/Changeables - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - if (Player[I].ScoreTotalI <> PlayerInfo.Playerinfo[I].Score) then - begin - //Player[I].ScoreTotal := Player[I].ScoreTotal + (PlayerInfo.Playerinfo[I].Score - Player[I].ScoreTotalI); - Player[I].ScoreTotalI := PlayerInfo.Playerinfo[I].Score; - end; - if (PlayerInfo.Playerinfo[I].Bar <> Player[I].ScorePercent) then - Player[I].ScorePercentTarget := PlayerInfo.Playerinfo[I].Bar; - end; - - // back stereo - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; - - Text[TextP1].X := Text[TextP1].X - 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; - - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; - Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; - - Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; - - - for S := 1 to 1 do - Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X - 10*ScreenX; - - -end; - -procedure TScreenSingModi.Finish; -begin -inherited Finish; - -Winner := DllMan.PluginFinish(PlayerInfo); - -//Log.LogError('Winner: ' + InttoStr(Winner)); - -//DLLMan.UnLoadPlugin; -end; - -function LoadTex (const Name, Typ: PChar): TsmallTexture; stdcall; -var - Texname, EXT: String; - Tex: TTexture; -begin - //Get texture Name - TexName := Skin.GetTextureFileName(String(Name)); - //Get File Typ - Ext := ExtractFileExt(TexName); - if (uppercase(Ext) = '.JPG') then - Ext := 'JPG' - else - Ext := 'BMP'; - - Tex := Texture.LoadTexture(PChar(TexName), PChar(Ext), Typ, 0); - - Result.TexNum := Tex.TexNum; - Result.W := Tex.W; - Result.H := Tex.H; -end; -{ -function Translate (const Name: PChar): PChar; stdcall; -begin - Result := PChar(Language.Translate(String(Name))); -end; } - -procedure Print (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text -begin - SetFontItalic ((Style and 128) = 128); - SetFontStyle(Style and 7); - SetFontSize(Size); - SetFontPos (X, Y); - glPrint (PChar(Language.Translate(String(Text)))); -end; - -function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound -begin - Result := Music.LoadCustomSound(String(Name)); -end; - -procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound -begin - Music.PlayCustomSound(Index); -end; - -end. +unit UScreenSingModi; + +interface + +{$I switches.inc} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + UIni, + ULog, + UTexture, + ULyrics, + TextGL, + OpenGL12, + {$IFDEF useBASS} + bass, + {$ENDIF} + UThemes, + ULCD, + UScreenSing, + ModiSDK; + +type + TScreenSingModi = class(TScreenSing) + protected + //paused: boolean; //Pause Mod + //PauseTime: Real; + //NumEmptySentences: integer; + public + //TextTime: integer; + + //StaticP1: integer; + //StaticP1ScoreBG: integer; + //TextP1: integer; + //TextP1Score: integer; + + //StaticP2R: integer; + //StaticP2RScoreBG: integer; + //TextP2R: integer; + //TextP2RScore: integer; + + //StaticP2M: integer; + //StaticP2MScoreBG: integer; + //TextP2M: integer; + //TextP2MScore: integer; + + //StaticP3R: integer; + //StaticP3RScoreBG: integer; + //TextP3R: integer; + //TextP3RScore: integer; + + //Tex_Background: TTexture; + //FadeOut: boolean; + //LyricMain: TLyric; + //LyricSub: TLyric; + Winner: Byte; //Who Wins + PlayerInfo: TPlayerInfo; + TeamInfo: TTeamInfo; + + constructor Create; override; + procedure onShow; override; + //procedure onShowFinish; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure Finish; override; + //procedure UpdateLCD; + //procedure Pause; //Pause Mod(Toggles Pause) + end; + +//Procedured for Plugin +function LoadTex (const Name, Typ: PChar): TsmallTexture; stdcall; +//function Translate (const Name: PChar): PChar; stdcall; +procedure Print (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text +function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound +procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound + +//Utilys +function ToSentences(Const Czeski: TCzesci): TSentences; + +implementation +uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math, UDLLManager, USkins, UGraphicClasses; + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenSingModi.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + Finish; + Music.PlayBack; + FadeTo(@ScreenPartyScore); + end; + + else + Result := inherited ParseInput(PressedKey, ScanCode, PressedDown); + end; + end; +end; + +constructor TScreenSingModi.Create; +begin + inherited Create; + +end; + +function ToSentences(Const Czeski: TCzesci): TSentences; +var + I, J: Integer; +begin + Result.Akt := Czeski.Akt; + Result.High := Czeski.High; + Result.Ilosc := Czeski.Ilosc; + Result.Resolution := Czeski.Resolution; + Result.NotesGAP := Czeski.NotesGAP; + Result.TotalLength := Czeski.Wartosc; + + SetLength(Result.Sentence, Length(Czeski.Czesc)); + for I := low(Result.Sentence) to high(Result.Sentence) do + begin + Result.Sentence[I].Start := Czeski.Czesc[I].Start; + Result.Sentence[I].StartNote := Czeski.Czesc[I].StartNote; + Result.Sentence[I].Lyric := Czeski.Czesc[I].Lyric; + Result.Sentence[I].LyricWidth := Czeski.Czesc[I].LyricWidth; + Result.Sentence[I].Koniec := Czeski.Czesc[I].Koniec; + Result.Sentence[I].BaseNote := Czeski.Czesc[I].BaseNote; + Result.Sentence[I].HighNote := Czeski.Czesc[I].HighNut; + Result.Sentence[I].IlNut := Czeski.Czesc[I].IlNut; + Result.Sentence[I].TotalNotes := Czeski.Czesc[I].TotalNotes; + + SetLength(Result.Sentence[I].Note, Length(Czeski.Czesc[I].Nuta)); + for J := low(Result.Sentence[I].Note) to high(Result.Sentence[I].Note) do + begin + Result.Sentence[I].Note[J].Color := Czeski.Czesc[I].Nuta[J].Color; + Result.Sentence[I].Note[J].Start := Czeski.Czesc[I].Nuta[J].Start; + Result.Sentence[I].Note[J].Length := Czeski.Czesc[I].Nuta[J].Dlugosc; + Result.Sentence[I].Note[J].Ton := Czeski.Czesc[I].Nuta[J].Ton; + Result.Sentence[I].Note[J].TonGamy := Czeski.Czesc[I].Nuta[J].TonGamy; + //Result.Sentence[I].Note[J].Text := Czeski.Czesc[I].Nuta[J].Tekst; + Result.Sentence[I].Note[J].FreeStyle := Czeski.Czesc[I].Nuta[J].FreeStyle; + Result.Sentence[I].Note[J].Typ := Czeski.Czesc[I].Nuta[J].Wartosc; + end; + end; +end; + +procedure TScreenSingModi.onShow; +var + I: Integer; +begin + + PlayersPlay := TeamInfo.NumTeams; + + if DLLMan.Selected.LoadSong then //Start with Song + begin + inherited; + end + else //Start Without Song + begin + Music.CaptureStart; + end; + +//Set Playerinfo + PlayerInfo.NumPlayers := PlayersPlay; + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); + PlayerInfo.Playerinfo[I].Score := 0; + PlayerInfo.Playerinfo[I].Bar := 50; + PlayerInfo.Playerinfo[I].Enabled := True; + end; + + for I := PlayerInfo.NumPlayers to high(PlayerInfo.Playerinfo) do + begin + PlayerInfo.Playerinfo[I].Score:= 0; + PlayerInfo.Playerinfo[I].Bar := 0; + PlayerInfo.Playerinfo[I].Enabled := False; + end; + + Case PlayersPlay of + 1: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; + end; + 2,4: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1TwoPScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; + PlayerInfo.Playerinfo[2].PosX := Static[StaticP1TwoPScoreBG].Texture.X; + PlayerInfo.Playerinfo[2].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; + PlayerInfo.Playerinfo[1].PosX := Static[StaticP2RScoreBG].Texture.X; + PlayerInfo.Playerinfo[1].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; + PlayerInfo.Playerinfo[3].PosX := Static[StaticP2RScoreBG].Texture.X; + PlayerInfo.Playerinfo[3].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; + end; + 3,6: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ThreePScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; + PlayerInfo.Playerinfo[3].PosX := Static[StaticP1ThreePScoreBG].Texture.X; + PlayerInfo.Playerinfo[3].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; + PlayerInfo.Playerinfo[1].PosX := Static[StaticP2MScoreBG].Texture.X; + PlayerInfo.Playerinfo[1].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; + PlayerInfo.Playerinfo[4].PosX := Static[StaticP2MScoreBG].Texture.X; + PlayerInfo.Playerinfo[4].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; + PlayerInfo.Playerinfo[2].PosX := Static[StaticP3RScoreBG].Texture.X; + PlayerInfo.Playerinfo[2].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; + PlayerInfo.Playerinfo[5].PosX := Static[StaticP3RScoreBG].Texture.X; + PlayerInfo.Playerinfo[5].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; + end; + end; + + // play music (I) + //Music.CaptureStart; + //Music.MoveTo(AktSong.Start); + + //Init Plugin + if not DLLMan.PluginInit(TeamInfo, PlayerInfo, ToSentences(Czesci[0]), LoadTex, Print, LoadSound, PlaySound) then + begin + //Fehler + Log.LogError('Could not Init Plugin'); + Halt; + end; + + // Set Background (Little Workaround, maybe change sometime) + if (DLLMan.Selected.LoadBack) AND (DLLMan.Selected.LoadSong) then + ScreenSing.Tex_Background := Tex_Background; + + Winner := 0; + + //Set Score Visibility + if PlayersPlay = 1 then begin + Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; + end; + + if (PlayersPlay = 2) OR (PlayersPlay = 4) then begin + Text[TextP1TwoPScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1TwoPScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP2RScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP2RScoreBG].Visible := DLLMan.Selected.ShowScore; + end; + + if (PlayersPlay = 3) OR (PlayersPlay = 6) then begin + Text[TextP1ThreePScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1ThreePScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP2MScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP2MScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP3RScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP3RScoreBG].Visible := DLLMan.Selected.ShowScore; + end; +end; + +function TScreenSingModi.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + S, I: integer; + T: integer; +begin +//Set Playerinfo + PlayerInfo.NumPlayers := PlayersPlay; + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + PlayerInfo.Playerinfo[I].Name := PChar(Player[I].Name); + if PlayerInfo.Playerinfo[I].Enabled then + begin + if (Player[I].ScoreTotalI<=10000) then + PlayerInfo.Playerinfo[I].Score:= Player[I].ScoreTotalI; + PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; + end; + end; + +//Show Score +if DLLMan.Selected.ShowScore then +begin + //ScoreBG Mod + // set player colors + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + + + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P4Dark'); + + + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); + + + + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P3Dark'); + + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P6Dark'); + + + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); + + + + + end; + end; + //end ScoreBG Mod + +// set player names (for 2 screens and only Singstar skin) + if ScreenAct = 1 then begin + Text[TextP1].Text := 'P1'; + Text[TextP1TwoP].Text := 'P1'; // added for ps3 skin + Text[TextP1ThreeP].Text := 'P1'; // added for ps3 skin + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; + end; + + if ScreenAct = 2 then begin + case PlayersPlay of + 4: begin + Text[TextP1TwoP].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 6: begin + Text[TextP1ThreeP].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end; + end; // case + end; // if + + + // stereo <- and where iss P2M? or P3? + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + + Text[TextP1].X := Text[TextP1].X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; + Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + + Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; + + // .. and scores + if PlayersPlay = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + end; + + if PlayersPlay = 2 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + + if PlayersPlay = 3 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[4].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[5].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + end; + +end; //ShowScore + + for S := 1 to 1 do + Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X + 10*ScreenX; + +if DLLMan.Selected.LoadSong then +begin + // update static menu with time ... + Min := Round(Czas.Teraz) div 60; + Sec := Round(Czas.Teraz) mod 60; + Text[TextTimeText].Text := ''; + if Min < 10 then Text[TextTimeText].Text := '0'; + Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':'; + if Sec < 10 then Text[TextTimeText].Text := Text[TextTimeText].Text + '0'; + Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec); +end; + + // draw static menu (BG) + DrawBG; + + //Draw Background + if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) then + SingDrawBackground; + + // comment by blindy: wo zum henker wird denn in diesem screen ein video abgespielt? + // update and draw movie + // wie wo wadd? also in der selben funktion in der uscreensing kommt des video in der zeile 995, oder was wollteste wissen? :X +{ if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin + UpdateSmpeg; // this only draws + end;} + + // draw static menu (FG) + DrawFG; + + if ShowFinish then begin + if DllMan.Selected.LoadSong then + begin + if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + //Pause Mod: + if not Paused then + Sing(Self); // analyze song + end else begin + if not FadeOut then begin + Finish; + FadeOut := true; + FadeTo(@ScreenPartyScore); + end; + end; + end; + end; + + // draw custom items + SingModiDraw(PlayerInfo); // always draw + + //GoldenNoteStarsTwinkle Mod + GoldenRec.SpawnRec; + //GoldenNoteStarsTwinkle Mod + + //Update PlayerInfo + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + if PlayerInfo.Playerinfo[I].Enabled then + begin + PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; + PlayerInfo.Playerinfo[I].Score := Player[I].ScoreTotalI; + end; + end; + + if ((ShowFinish) AND (NOT Paused)) then + begin + if not DLLMan.PluginDraw(Playerinfo, Czesci[0].Akt) then + begin + if not FadeOut then begin + Finish; + FadeOut := true; + FadeTo(@ScreenPartyScore); + end; + end; + end; + + //Change PlayerInfo/Changeables + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + if (Player[I].ScoreTotalI <> PlayerInfo.Playerinfo[I].Score) then + begin + //Player[I].ScoreTotal := Player[I].ScoreTotal + (PlayerInfo.Playerinfo[I].Score - Player[I].ScoreTotalI); + Player[I].ScoreTotalI := PlayerInfo.Playerinfo[I].Score; + end; + if (PlayerInfo.Playerinfo[I].Bar <> Player[I].ScorePercent) then + Player[I].ScorePercentTarget := PlayerInfo.Playerinfo[I].Bar; + end; + + // back stereo + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; + + Text[TextP1].X := Text[TextP1].X - 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; + + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; + Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; + + Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; + + + for S := 1 to 1 do + Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X - 10*ScreenX; + + +end; + +procedure TScreenSingModi.Finish; +begin +inherited Finish; + +Winner := DllMan.PluginFinish(PlayerInfo); + +//Log.LogError('Winner: ' + InttoStr(Winner)); + +//DLLMan.UnLoadPlugin; +end; + +function LoadTex (const Name, Typ: PChar): TsmallTexture; stdcall; +var + Texname, EXT: String; + Tex: TTexture; +begin + //Get texture Name + TexName := Skin.GetTextureFileName(String(Name)); + //Get File Typ + Ext := ExtractFileExt(TexName); + if (uppercase(Ext) = '.JPG') then + Ext := 'JPG' + else + Ext := 'BMP'; + + Tex := Texture.LoadTexture(PChar(TexName), PChar(Ext), Typ, 0); + + Result.TexNum := Tex.TexNum; + Result.W := Tex.W; + Result.H := Tex.H; +end; +{ +function Translate (const Name: PChar): PChar; stdcall; +begin + Result := PChar(Language.Translate(String(Name))); +end; } + +procedure Print (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text +begin + SetFontItalic ((Style and 128) = 128); + SetFontStyle(Style and 7); + SetFontSize(Size); + SetFontPos (X, Y); + glPrint (PChar(Language.Translate(String(Text)))); +end; + +function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound +begin + Result := Music.LoadCustomSound(String(Name)); +end; + +procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound +begin + Music.PlayCustomSound(Index); +end; + +end. diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 7b16c315..569645d4 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1,2007 +1,2040 @@ -unit UScreenSong; - -interface -{$I switches.inc} - -uses - UMenu, SDL, UMusic, UFiles, UTime, UDisplay, USongs, SysUtils, ULog, UThemes, UTexture, ULanguage, - ULCD, ULight, UIni; - -type - TScreenSong = class(TMenu) - public - TextArtist: integer; - TextTitle: integer; - TextNumber: integer; - - //Video Icon Mod - VideoIcon: Cardinal; - - TextCat: integer; - StaticCat: integer; - - SongCurrent: real; - SongTarget: real; - - HighSpeed: boolean; - CoverFull: boolean; - CoverTime: real; - CoverX: integer; - CoverY: integer; - CoverW: integer; - is_jump: boolean; // Jump to Song Mod - is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title - - EqualizerBands: array of Byte; - EqualizerTime: Cardinal; - EqualizerTime2: Byte; - - //Party Mod - Mode: Byte; //0 = Standard, 1= Go to PartyMode after Selection + Change to Random Song at Show - //party Statics (Joker) - StaticTeam1Joker1: Cardinal; - StaticTeam1Joker2: Cardinal; - StaticTeam1Joker3: Cardinal; - StaticTeam1Joker4: Cardinal; - StaticTeam1Joker5: Cardinal; - - StaticTeam2Joker1: Cardinal; - StaticTeam2Joker2: Cardinal; - StaticTeam2Joker3: Cardinal; - StaticTeam2Joker4: Cardinal; - StaticTeam2Joker5: Cardinal; - - StaticTeam3Joker1: Cardinal; - StaticTeam3Joker2: Cardinal; - StaticTeam3Joker3: Cardinal; - StaticTeam3Joker4: Cardinal; - StaticTeam3Joker5: Cardinal; - - StaticParty: Array of Cardinal; - TextParty: Array of Cardinal; - StaticNonParty: Array of Cardinal; - TextNonParty: Array of Cardinal; - - - constructor Create; override; - procedure SetScroll; - procedure SetScroll1; - procedure SetScroll2; - procedure SetScroll3; - procedure SetScroll4; - procedure SetScroll5; - procedure SetScroll6; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure onShow; override; - procedure onHide; override; - procedure SelectNext; - procedure SelectPrev; - procedure UpdateLCD; - procedure SkipTo(Target: Cardinal); - procedure FixSelected; //Show Wrong Song when Tabs on Fix - procedure FixSelected2; //Show Wrong Song when Tabs on Fix - procedure ShowCatTL(Cat: Integer);// Show Cat in Top left - procedure ShowCatTLCustom(Caption: String);// Show Custom Text in Top left - procedure HideCatTL;// Show Cat in Tob left - procedure Refresh; //Refresh Song Sorting - procedure DrawEqualizer; - procedure ChangeMusic; - //Party Mode - procedure SelectRandomSong; - procedure SetJoker; - procedure SetStatics; - //procedures for Menu - procedure StartSong; - procedure OpenEditor; - procedure DoJoker(Team: Byte); - procedure SelectPlayers; - - procedure UnLoadDetailedCover; - - //Extensions - procedure DrawExtensions; - end; - -implementation -uses UGraphic, UMain, UCovers, math, OpenGL12, Windows, USkins, UDLLManager, UParty, UPlaylist, UScreenSongMenu; - -// ***** Public methods ****** // - -//Show Wrong Song when Tabs on Fix -procedure TScreenSong.FixSelected; -var I, I2: Integer; - begin - if CatSongs.VisibleSongs > 0 then - begin - I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do - begin - if CatSongs.Song[I].Visible then - inc(I2); - - if I = Interaction - 1 then - break; - end; - - SongCurrent := I2; - SongTarget := I2; - end; - end; - -procedure TScreenSong.FixSelected2; -var I, I2: Integer; - begin - if CatSongs.VisibleSongs > 0 then - begin - I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do - begin - if CatSongs.Song[I].Visible then - inc(I2); - - if I = Interaction - 1 then - break; - end; - - SongTarget := I2; - end; - end; -//Show Wrong Song when Tabs on Fix End - - procedure TScreenSong.ShowCatTLCustom(Caption: String);// Show Custom Text in Top left - begin - Text[TextCat].Text := Caption; - Text[TextCat].Visible := true; - Static[StaticCat].Visible := False; - end; - - //Show Cat in Top Left Mod - procedure TScreenSong.ShowCatTL(Cat: Integer); - begin - //Change - Text[TextCat].Text := CatSongs.Song[Cat].Artist; - //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover); - //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); - - Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); - //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false); - //Button[Cat]. - //Cover - - - //Show - Text[TextCat].Visible := true; - Static[StaticCat].Visible := True; - end; - - procedure TScreenSong.HideCatTL; - begin - //Hide - //Text[TextCat].Visible := false; - Static[StaticCat].Visible := false; - //New -> Show Text specified in Theme - Text[TextCat].Visible := True; - Text[TextCat].Text := Theme.Song.TextCat.Text; - end; - //Show Cat in Top Left Mod End - - -// Method for input parsing. If False is returned, GetNextWindow -// should be checked to know the next window to load; -function TScreenSong.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -var - I: integer; - I2: integer; - HS: integer; - SDL_ModState: Word; - Letter: Char; -begin - Result := true; - - //Song Screen Extensions (Jumpto + Menu) - if (ScreenSongMenu.Visible) then - begin - Result := ScreenSongMenu.ParseInput(PressedKey, ScanCode, PressedDown); - Exit; - end - else if (ScreenSongJumpto.Visible) then - begin - Result := ScreenSongJumpto.ParseInput(PressedKey, ScanCode, PressedDown); - Exit; - end; - - If (PressedDown) Then - begin // Key Down - - SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT - + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); - - //Jump to Artist/Titel - if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then - begin - Letter := UpCase(Chr(ScanCode)); - I2 := Length(CatSongs.Song); - - //Jump To Titel - if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then - begin - For I := 1 to high(CatSongs.Song) do - begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then - begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - - Music.PlayChange; - - ChangeMusic; - SetScroll4; - UpdateLCD; - //Break and Exit - Exit; - end; - end; - end - //Jump to Artist - else if (SDL_ModState = KMOD_LALT) then - begin - For I := 1 to high(CatSongs.Song) do - begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Artist[1]) = Letter) then - begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - - Music.PlayChange; - - ChangeMusic; - SetScroll4; - UpdateLCD; - - //Break and Exit - Exit; - end; - end; - end; - Exit; - end; - - case PressedKey of - SDLK_Q: - begin - Result := false; - end; - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - if (Mode = 0) then - begin - //On Escape goto Cat-List Hack - if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then - begin - //Find Category - I := Interaction; - while not catsongs.Song[I].Main do - begin - Dec (I); - if (I < low(catsongs.Song)) then - break; - end; - if (I<= 1) then - Interaction := high(catsongs.Song) - else - Interaction := I - 1; - - //Stop Music - Music.Stop; - - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - HideCatTL; - - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - //SelectPrev; - //CatSongs.Song[0].Visible := False; - end - else - begin - //On Escape goto Cat-List Hack End - //Tabs off and in Search or Playlist -> Go back to Song view - if (CatSongs.CatNumShow < -1) then - begin - //Atm: Set Empty Filter - CatSongs.SetFilter('', 0); - - //Show Cat in Top Left Mod - HideCatTL; - Interaction := 0; - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - - ChangeMusic; - end - else - begin - Music.Stop; - Music.PlayBack; - - FadeTo(@ScreenMain); - end; - - end; - end - //When in party Mode then Ask before Close - else if (Mode = 1) then - begin - Music.PlayBack; - CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); - end; - end; - SDLK_RETURN: - begin - if Length(Songs.Song) > 0 then - begin - {$IFDEF UseSerialPort} - // PortWriteB($378, 0); - {$ENDIF} - if CatSongs.Song[Interaction].Main then - begin // clicked on Category Button - - //Show Cat in Top Left Mod - ShowCatTL (Interaction); - - //I := CatSongs.VisibleIndex(Interaction); - CatSongs.ClickCategoryButton(Interaction); - {I2 := CatSongs.VisibleIndex(Interaction); - SongCurrent := SongCurrent - I + I2; - SongTarget := SongTarget - I + I2; } - -// if I<>I2 then beep; - // SetScroll4; - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - - //Play Music: - ChangeMusic; - - end else begin // clicked on song - if (Mode = 0) then //Normal Mode -> Start Song - begin - //Do the Action that is specified in Ini - case Ini.OnSongClick of - 0: StartSong; - 1: SelectPlayers; - 2:begin - If (CatSongs.CatNumShow = -3) then - ScreenSongMenu.MenuShow(SM_Playlist) - else - ScreenSongMenu.MenuShow(SM_Main); - end; - end; - end - else if (Mode = 1) then //PartyMode -> Show Menu - begin - if (Ini.PartyPopup = 1) then - ScreenSongMenu.MenuShow(SM_Party_Main) - else - ScreenSong.StartSong; - end; - end; - end; - end; - - SDLK_M: //Show SongMenu - begin - if (Length(Songs.Song) > 0) then begin - if (Mode = 0) then begin - if not CatSongs.Song[Interaction].Main then begin // clicked on Song - if CatSongs.CatNumShow = -3 then - ScreenSongMenu.MenuShow(SM_Playlist) - else - ScreenSongMenu.MenuShow(SM_Main); - end - else - begin - ScreenSongMenu.MenuShow(SM_Playlist_Load); - end; - end //Party Mode -> Show Party Menu - else ScreenSongMenu.MenuShow(SM_Party_Main); - end; - end; - - SDLK_P: //Show Playlist Menu - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin - ScreenSongMenu.MenuShow(SM_Playlist_Load); - end; - end; - - SDLK_J: //Show Jumpto Menu - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then - begin - ScreenSongJumpto.Visible := True; - end; - end; - - SDLK_DOWN: - begin - if (Mode = 0) then - begin - //Only Change Cat when not in Playlist or Search Mode - if (CatSongs.CatNumShow > -2) then - begin - //Cat Change Hack - if Ini.Tabs_at_startup = 1 then - begin - I := Interaction; - if I <= 0 then I := 1; - - while not catsongs.Song[I].Main do - begin - Inc (I); - if (I > high(catsongs.Song)) then - I := low(catsongs.Song); - end; - - Interaction := I; - - //Show Cat in Top Left Mod - ShowCatTL (Interaction); - - CatSongs.ClickCategoryButton(Interaction); - SelectNext; - FixSelected; - - //Play Music: - Music.PlayChange; - ChangeMusic; - - end; - - // - //Cat Change Hack End} - end; - end; - end; - SDLK_UP: - begin - if (Mode = 0) then - begin - //Only Change Cat when not in Playlist or Search Mode - if (CatSongs.CatNumShow > -2) then - begin - //Cat Change Hack - if Ini.Tabs_at_startup = 1 then - begin - I := Interaction; - I2 := 0; - if I <= 0 then I := 1; - - while not catsongs.Song[I].Main or (I2 = 0) do - begin - if catsongs.Song[I].Main then - Inc(I2); - Dec (I); - if (I < low(catsongs.Song)) then - I := high(catsongs.Song); - end; - - Interaction := I; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - FixSelected; - - //Play Music: - Music.PlayChange; - ChangeMusic; - end; - end; - //Cat Change Hack End} - end; - end; - - SDLK_RIGHT: - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin - Music.PlayChange; - SelectNext; -// InteractNext; -// SongTarget := Interaction; - ChangeMusic; - SetScroll4; - UpdateLCD; - Light.LightOne(1, 200); - end; - end; - - SDLK_LEFT: - begin - if (Length(Songs.Song) > 0)AND (Mode = 0) then begin - Music.PlayChange; - SelectPrev; - ChangeMusic; - SetScroll4; - UpdateLCD; - Light.LightOne(0, 200); - end; - end; - - SDLK_E: - begin - OpenEditor; - end; - - SDLK_R: - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin - - if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category - begin - I2 := 0; //Count Cats - for I:= low(CatSongs.Song) to high (CatSongs.Song) do - if CatSongs.Song[I].Main then Inc(I2); - - I2 := Random (I2)+1; //Zufall - - //Find Cat: - for I:= low(CatSongs.Song) to high (CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - Dec(I2); - if (I2<=0) then - begin - //Show Cat in Top Left Mod - ShowCatTL (I); - - Interaction := I; - - CatSongs.ShowCategoryList; - CatSongs.ClickCategoryButton(I); - SelectNext; - FixSelected; - break; - end; - end; - - - end - else if (SDL_ModState = KMOD_LCTRL) AND (Ini.Tabs_at_startup = 1) then //random in All Categorys - begin - repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; - - //Search Cat - for I := I2 downto low(CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - break; - end; - //In I ist jetzt die Kategorie in I2 der Song - - //Choose Cat - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - - //Fix: Not Existing Song selected: - //if (I+1=I2) then Inc(I2); - - //Choose Song - SkipTo(I2-I); - - end - else //Random in one Category - begin - SkipTo(Random(CatSongs.VisibleSongs)); - end; - Music.PlayChange; - - ChangeMusic; - SetScroll4; - UpdateLCD; - end; - end; - - SDLK_1: - begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[0].Joker); - SelectRandomSong; - SetJoker; - end; - end; - - SDLK_2: - begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[1].Joker); - SelectRandomSong; - SetJoker; - end; - end; - - SDLK_3: - begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[2].Joker); - SelectRandomSong; - SetJoker; - end; - end; - end; - end; -end; - -constructor TScreenSong.Create; -var - Pet: integer; - I: integer; -Label CreateSongButtons; -begin - inherited Create; - - LoadFromTheme(Theme.Song); - - TextArtist := AddText(Theme.Song.TextArtist); - TextTitle := AddText(Theme.Song.TextTitle); - TextNumber := AddText(Theme.Song.TextNumber); - - //Show Cat in Top Left mod - TextCat := AddText(Theme.Song.TextCat); - StaticCat := AddStatic(Theme.Song.StaticCat); - - //Show Video Icon Mod - VideoIcon := AddStatic(Theme.Song.VideoIcon); - - //Party Mode - StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1); - StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2); - StaticTeam1Joker3 := AddStatic(Theme.Song.StaticTeam1Joker3); - StaticTeam1Joker4 := AddStatic(Theme.Song.StaticTeam1Joker4); - StaticTeam1Joker5 := AddStatic(Theme.Song.StaticTeam1Joker5); - - StaticTeam2Joker1 := AddStatic(Theme.Song.StaticTeam2Joker1); - StaticTeam2Joker2 := AddStatic(Theme.Song.StaticTeam2Joker2); - StaticTeam2Joker3 := AddStatic(Theme.Song.StaticTeam2Joker3); - StaticTeam2Joker4 := AddStatic(Theme.Song.StaticTeam2Joker4); - StaticTeam2Joker5 := AddStatic(Theme.Song.StaticTeam2Joker5); - - StaticTeam3Joker1 := AddStatic(Theme.Song.StaticTeam3Joker1); - StaticTeam3Joker2 := AddStatic(Theme.Song.StaticTeam3Joker2); - StaticTeam3Joker3 := AddStatic(Theme.Song.StaticTeam3Joker3); - StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); - StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); - - //Load Party or NonParty specific Statics and Texts - SetLength(StaticParty, Length(Theme.Song.StaticParty)); - for I := 0 to High(Theme.Song.StaticParty) do - StaticParty[I] := AddStatic(Theme.Song.StaticParty[I]); - - SetLength(TextParty, Length(Theme.Song.TextParty)); - for I := 0 to High(Theme.Song.TextParty) do - TextParty[I] := AddText(Theme.Song.TextParty[I]); - - SetLength(StaticNonParty, Length(Theme.Song.StaticNonParty)); - for I := 0 to High(Theme.Song.StaticNonParty) do - StaticNonParty[I] := AddStatic(Theme.Song.StaticNonParty[I]); - - SetLength(TextNonParty, Length(Theme.Song.TextNonParty)); - for I := 0 to High(Theme.Song.TextNonParty) do - TextNonParty[I] := AddText(Theme.Song.TextNonParty[I]); - - // Song List -// Songs.LoadSongList; // moved to the UltraStar unit - CatSongs.Refresh; - - if (length(CatSongs.Song) > 0) then - begin - //Set Length of Button Array one Time Instead of one time for every Song - SetButtonLength(Length(CatSongs.Song)); - - I := 0; - CreateSongButtons: - - try - for Pet := I to High(CatSongs.Song) do begin // creating all buttons - // new - Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 - - if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then - CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' - - if CatSongs.Song[Pet].Cover = '' then - AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) - else begin - // cache texture if there is a need to this - if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then begin - Texture.CreateCacheMipmap := true; - Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap - Texture.CreateCacheMipmap := false; - - // puts this texture to the cache file - Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); - - // unload full size texture - Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); - - // we should also add mipmap texture by calling createtexture and use mipmap cache as data source - end; - - // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) - AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); - end; - Texture.Limit := 1024*1024; - I := -1; - end; - except - //When Error is reported the First time for this Song - if (I <> Pet) then - begin - //Some Error reporting: - Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); - - //Change Cover to NoCover and Continue Loading - CatSongs.Song[Pet].Cover := ''; - I := Pet; - end - else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song - begin - Log.LogError('NoCover Cover is damaged!'); - try - AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); - except - Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); - Halt; - end; - I := Pet + 1; - end; - end; - - if (I <> -1) then - GoTo CreateSongButtons; - - end; - - // Randomize Patch - Randomize; - //Equalizer - SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); - //ClearArray - For I := low(EqualizerBands) to high(EqualizerBands) do - EqualizerBands[I] := 3; - - if (Length(CatSongs.Song) > 0) then - Interaction := 0; -end; - -procedure TScreenSong.SetScroll; -var - VS, B: Integer; -begin - VS := CatSongs.VisibleSongs; - if VS > 0 then - begin - //Set Positions - Case Theme.Song.Cover.Style of - 3: SetScroll3; - 5:begin - if VS > 5 then - SetScroll5 - else - SetScroll4; - end; - 6: SetScroll6; - else SetScroll4; - end; - //Set Visibility of Video Icon - Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> ''); - - //Set Texts: - Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; - Text[TextTitle].Text := CatSongs.Song[Interaction].Title; - if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then - begin - Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); - Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; - end - else if (CatSongs.CatNumShow = -2) then - Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) - else if (CatSongs.CatNumShow = -3) then - Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) - else if (Ini.Tabs_at_startup = 1) then - Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) - else - Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); - end - else - begin - Text[TextNumber].Text := '0/0'; - Text[TextArtist].Text := ''; - Text[TextTitle].Text := ''; - for B := 0 to High(Button) do - Button[B].Visible := False; - - end; -end; - -procedure TScreenSong.SetScroll1; -var - B: integer; // button - BMin: integer; // button min - BMax: integer; // button max - Src: integer; -// Dst: integer; - Count: integer; // Dst is not used. Count is used. - Ready: boolean; - - VisCount: integer; // count of visible (or selectable) buttons - VisInt: integer; // visible position of interacted button - Typ: integer; // 0 when all songs fits the screen - Placed: integer; // number of placed visible buttons -begin -// Src := 0; -// Dst := -1; - Count := 1; - Typ := 0; - Ready := false; - Placed := 0; - - VisCount := 0; - for B := 0 to High(Button) do - if CatSongs.Song[B].Visible then Inc(VisCount); - - VisInt := 0; - for B := 0 to Interaction-1 do - if CatSongs.Song[B].Visible then Inc(VisInt); - - - if VisCount <= 6 then begin - Typ := 0; - end else begin - if VisInt <= 3 then begin - Typ := 1; - Count := 7; - Ready := true; - end; - - if (VisCount - VisInt) <= 3 then begin - Typ := 2; - Count := 7; - Ready := true; - end; - - if not Ready then begin - Typ := 3; - Src := Interaction; - end; - end; - - - - // hide all buttons - for B := 0 to High(Button) do begin - Button[B].Visible := false; - Button[B].Selectable := CatSongs.Song[B].Visible; - end; - -{ for B := Src to Dst do begin -// Button[B].Visible := true; - Button[B].Visible := CatSongs.Song[B].Visible; - Button[B].Selectable := Button[B].Visible; - Button[B].Y := 140 + (B-Src) * 60; - end;} - - - if Typ = 0 then begin - for B := 0 to High(Button) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (Placed) * 60; - Inc(Placed); - end; - end; - end; - - if Typ = 1 then begin - B := 0; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Inc(B); - end; - end; - - if Typ = 2 then begin - B := High(Button); - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (6-Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Dec(B); - end; - end; - - if Typ = 3 then begin - B := Src; - Count := 4; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (3+Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Inc(B); - end; - - B := Src-1; - Placed := 0; - Count := 3; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (2-Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Dec(B); - end; - - end; - - if Length(Button) > 0 then - Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture -end; - -procedure TScreenSong.SetScroll2; -var - B: integer; - Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu - Wsp2: real; -begin - // liniowe - for B := 0 to High(Button) do - Button[B].X := 300 + (B - Interaction) * 260; - - if Length(Button) >= 3 then begin - if Interaction = 0 then - Button[High(Button)].X := 300 - 260; - - if Interaction = High(Button) then - Button[0].X := 300 + 260; - end; - - // kolowe -{ for B := 0 to High(Button) do begin - Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. - Wsp2 := Wsp / Length(Button); - Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); -// Button[B].Y := 140 + 50 * ; - end;} -end; - -procedure TScreenSong.SetScroll3; // with slide -var - B: integer; - Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu - Wsp2: real; -begin - SongTarget := Interaction; - - // liniowe - for B := 0 to High(Button) do - begin - Button[B].X := 300 + (B - SongCurrent) * 260; - if (Button[B].X < -Button[B].W) OR (Button[B].X > 800) then - Button[B].Visible := False - else - Button[B].Visible := True; - end; - -{ if Length(Button) >= 3 then begin - if Interaction = 0 then - Button[High(Button)].X := 300 - 260; - - if Interaction = High(Button) then - Button[0].X := 300 + 260; - end;} - - // kolowe -{ for B := 0 to High(Button) do begin - Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. - Wsp2 := Wsp / Length(Button); - Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); -// Button[B].Y := 140 + 50 * ; - end;} -end; - -procedure TScreenSong.SetScroll4; // rotate -var - B: integer; - Wsp: real; - Z, Z2: real; - VS: integer; -begin - VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important - - // kolowe - for B := 0 to High(Button) do begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2; - Z2 := (1 + 2*Z) / 3; - - - Button[B].X := Theme.Song.Cover.X + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - Button[B].Z := Z / 2 + 0.3; - - Button[B].W := Theme.Song.Cover.H * Z2; - -// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; - Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; - Button[B].H := Button[B].W; - end; - end; -end; - -(* -procedure TScreenSong.SetScroll4; // rotate -var - B: integer; - Wsp: real; - Z: real; - Z2, Z3: real; - VS: integer; - function modreal (const X, Y: real):real; - begin - Result := Frac(x / y) * y; - if Result < -3 then - Result := Result + Y - else if Result > 3 then - Result := Result - Y; - end; -begin - VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important - Z3 := 1; - if VS < 12 then - Z2 := VS - else - Z2 := 12; - - // kolowe - for B := 0 to High(Button) do begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - if ((ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)>-3) AND (ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)<3)) then - begin - if CatSongs.VisibleIndex(B)> SongCurrent then - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2 - else - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2; - - Z3 := 2; - Z := (1 + cos(Wsp)) / 2; - //Z2 := (1 + 2*Z) / 3; - //Z2 := (0.5 + Z/2); - //Z2 := sin(Wsp); - - //Z2 := Power (Z2,Z3); - - Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); - - //Button[B].X := Theme.Song.CoverX + ({Theme.Song.CoverX + Theme.Song.CoverW/2 + Theme.Song.CoverW*0.18 * VS {CatSongs.VisibleSongs {Length(Button) * sin(Wsp) {- Theme.Song.CoverX - Theme.Song.CoverW) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - if (sin(Wsp)<0) then - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W - else //*Theme.Song.CoverW*0.004*Z3 - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; - Button[B].Z := Z-0.00001; - -// Button[B].Y := {50 + 140 + 50 - 50 * Z2; - // Button[B].Y := (Theme.Song.CoverY + 40 + 50 - 50 * Z2); - Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); - Button[B].H := Button[B].W; - Button[B].Visible := True; - end - {else if (((CatSongs.VisibleIndex(B) - SongCurrent)>-3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) OR ((round (CatSongs.VisibleIndex(B) - SongCurrent) mod VS > -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) then - begin - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / 12 ;// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2 -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); - - if (sin(Wsp)<0) then - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W - else - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; - - Button[B].Z := Z; - - Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); - - Button[B].H := Button[B].W; - Button[B].Visible := True; - end - else Button[B].Visible := False; - end; - end; -end; *) - -procedure TScreenSong.SetScroll5; // rotate -var - B: integer; - Angle: real; - Pos: Real; - VS: integer; - diff: real; - X: Real; - helper: real; -begin - VS := CatSongs.VisibleSongs; // cache Visible Songs - {Vars - Theme.Song.CoverW: Radius des Kreises - Theme.Song.CoverX: X Pos Linke Kante des gewählten Covers - Theme.Song.CoverX: Y Pos Obere Kante des gewählten Covers - Theme.Song.CoverH: Höhe der Cover - - (CatSongs.VisibleIndex(B) - SongCurrent)/VS = Abstand zum MIttleren Cover in % - } - - //Change Pos of all Buttons - for B := low(Button) to high(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility - if Button[B].Visible then //Only Change Pos for Visible Buttons - begin - Pos := (CatSongs.VisibleIndex(B) - SongCurrent); - if (Pos < -VS/2) then - Pos := Pos + VS - else if (Pos > VS/2) then - Pos := Pos - VS; - - if (Abs(Pos) < 2.5) then {fixed Positions} - begin - Angle := Pi * (Pos / 5); -// Button[B].Visible := False; - - Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); - -// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Z := 0.95 - Abs(Pos) * 0.01; - - Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); - - Button[B].W := Button[B].H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - - X := Sin(Angle*1.3)*0.9; - - Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Diff; - - end - else - begin {Behind the Front Covers} - - // limit-bg-covers hack - if (abs(abs(Pos)-VS/2)>10) then Button[B].Visible:=False; - // end of limit-bg-covers hack - - if Pos < 0 then - Pos := (Pos - VS/2)/VS - else - Pos := (Pos + VS/2)/VS; - - Angle := pi * Pos*2; - if VS > 24 then - begin - if Angle < 0 then helper:=-1 else helper:=1; - Angle:=2*pi-abs(Angle); - Angle:=Angle*(VS/24); - Angle:=(2*pi-Angle)*helper; - end; - - Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); - - Button[B].W := Button[B].H; - - Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; - -// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*((Theme.Song.Cover.H)*sin(Angle/2)*1.52); - - end; - - //Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field -// Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); - - end; - end; -end; - -procedure TScreenSong.SetScroll6; // rotate (slotmachine style) -var - B: integer; - Angle: real; - Pos: Real; - VS: integer; - diff: real; - X: Real; - Wsp: real; - Z, Z2: real; -begin - VS := CatSongs.VisibleSongs; // cache Visible Songs - if VS <=5 then begin - // kolowe - for B := 0 to High(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2; - Z2 := (1 + 2*Z) / 3; - - - Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - Button[B].Z := Z / 2 + 0.3; - - Button[B].W := Theme.Song.Cover.H * Z2; - -// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; - Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; - Button[B].H := Button[B].W; - end; - end; - end - else begin - - //Change Pos of all Buttons - for B := low(Button) to high(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility - if Button[B].Visible then //Only Change Pos for Visible Buttons - begin - Pos := (CatSongs.VisibleIndex(B) - SongCurrent); - if (Pos < -VS/2) then - Pos := Pos + VS - else if (Pos > VS/2) then - Pos := Pos - VS; - - if (Abs(Pos) < 2.5) then {fixed Positions} - begin - Angle := Pi * (Pos / 5); -// Button[B].Visible := False; - - Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); - - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Z := 0.95 - Abs(Pos) * 0.01; - - Button[B].X := (Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); - - Button[B].W := Button[B].H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - - X := Sin(Angle*1.3)*0.9; - - Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff; - end - else - begin {Behind the Front Covers} - - // limit-bg-covers hack - if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; - if VS > 25 then VS:=25; - // end of limit-bg-covers hack - - if Pos < 0 then - Pos := (Pos - VS/2)/VS - else - Pos := (Pos + VS/2)/VS; - - Angle := pi * Pos*2; - - Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); - - Button[B].W := Button[B].H; - - Button[B].X := Theme.Song.Cover.X - (Button[B].H - Theme.Song.Cover.H)*0.5; - - - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Y := Theme.Song.Cover.Y+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*(Theme.Song.Cover.H*sin(Angle/2)*1.52); - end; - end; - end; - end; -end; - - -procedure TScreenSong.onShow; -begin - Music.Stop; - - if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; - if Ini.Players = 4 then PlayersPlay := 6; - - //Cat Mod etc - if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then - begin - CatSongs.ShowCategoryList; - FixSelected; - //Show Cat in Top Left Mod - HideCatTL; - end; - - - if Length(CatSongs.Song) > 0 then begin - //Load Music only when Song Preview is activated - if (Ini.PreviewVolume <> 0) then - begin - Music.SetLoop(false); - Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); - Music.MoveTo(Music.Length / 4); - Music.Play; - - //Set Preview Volume - Music.SetMusicVolume (Ini.PreviewVolume * 10); - {//if Music Fade is activated, Set Volume to 0 % - if (Ini.PreviewFading <> 0) then - Music.SetMusicVolume(0);} - end; - - SetScroll; - UpdateLCD; - end; - - //Playlist Mode - if (Mode = 0) then - begin - //If Playlist Shown -> Select Next automatically - if (CatSongs.CatNumShow = -3) then - begin - SelectNext; - ChangeMusic; - end; - end - //Party Mode - else if (Mode = 1) then - begin - - SelectRandomSong; - //Show Menu directly in PartyMode - //But only if selected in Options - if (Ini.PartyPopup = 1) then - begin - ScreenSongMenu.MenuShow(SM_Party_Main); - end; - - - end; - - SetJoker; - SetStatics; -end; - -procedure TScreenSong.onHide; -begin - //When Music Fading is activated, Turn Music to 100 % - If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then - Music.SetMusicVolume(100); - - //If Preview is deactivated: Load MUsicfile now - If (Ini.PreviewVolume = 0) then - Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); - - //When hide then Stop Music (For Party Mode Popup on Exit) - if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then - Music.Stop; -end; - -procedure TScreenSong.DrawExtensions; -begin - //Draw Song Menu - if (ScreenSongMenu.Visible) then - begin - ScreenSongMenu.Draw; - end - else if (ScreenSongJumpto.Visible) then - begin - ScreenSongJumpto.Draw; - end -end; - -function TScreenSong.Draw: boolean; -var - dx: real; - dt: real; - I: Integer; -begin - dx := SongTarget-SongCurrent; - dt := TimeSkip*7; - if dt > 1 then dt := 1; - SongCurrent := SongCurrent + dx*dt; - -{ if SongCurrent > Catsongs.VisibleSongs then begin - SongCurrent := SongCurrent - Catsongs.VisibleSongs; - SongTarget := SongTarget - Catsongs.VisibleSongs; - end;} - -// Log.BenchmarkStart(5); - SetScroll; -// Log.BenchmarkEnd(5); -// Log.LogBenchmark('SetScroll4', 5); - - //Fading Functions, Only if Covertime is under 5 Seconds - If (CoverTime < 5) then - begin - // 0.5.0: cover fade - if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin - // load new texture - Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); - Button[Interaction].Texture.Alpha := 1; - Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); - Button[Interaction].Texture2.Alpha := 1; - end; - - //Song Fade - if (CatSongs.VisibleSongs > 0) AND (Ini.PreviewVolume <> 0) AND (Not CatSongs.Song[Interaction].Main) AND (Ini.PreviewFading <> 0) then - begin - //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling - if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then - Music.Play; - - //Update Song Volume - if (CoverTime < Ini.PreviewFading) then - Music.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) - else - Music.SetMusicVolume(Ini.PreviewVolume * 10); - - end; - - - //Update Fading Time - CoverTime := CoverTime + TimeSkip; - - //Update Fading Texture - Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; - if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; - - end; - - //inherited Draw; - //heres a little Hack, that causes the Statics - //are Drawn after the Buttons because of some Blending Problems. - //This should cause no Problems because all Buttons on this screen - //Has Z Position. - //Draw BG - DrawBG; - - //Instead of Draw FG Procedure: - //We draw Buttons for our own - for I := 0 to Length(Button) - 1 do - Button[I].Draw; - - // Statics - for I := 0 to Length(Static) - 1 do - Static[I].Draw; - - // and texts - for I := 0 to Length(Text) - 1 do - Text[I].Draw; - - - //Draw Equalizer - if Theme.Song.Equalizer.Visible then - DrawEqualizer; - - DrawExtensions; - -end; - -procedure TScreenSong.SelectNext; -var - Skip: integer; - I: integer; - VS: Integer; -begin - VS := CatSongs.VisibleSongs; - - if VS > 0 then - begin - UnLoadDetailedCover; - - Skip := 1; - - // this 1 could be changed by CatSongs.FindNextVisible - while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); - - SongTarget := SongTarget + 1;//Skip; - - Interaction := (Interaction + Skip) mod Length(Interactions); - - // try to keep all at the beginning - if SongTarget > VS-1 then begin - SongTarget := SongTarget - VS; - SongCurrent := SongCurrent - VS; - end; - - end; - // Interaction -> Button, ktorego okladke przeczytamy - // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture -end; - -procedure TScreenSong.SelectPrev; -var - Skip: integer; - I: integer; - VS: Integer; -begin - VS := CatSongs.VisibleSongs; - - if VS > 0 then - begin - UnLoadDetailedCover; - - Skip := 1; - - while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); - SongTarget := SongTarget - 1;//Skip; - - Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); - - // try to keep all at the beginning - if SongTarget < 0 then begin - SongTarget := SongTarget + CatSongs.VisibleSongs; - SongCurrent := SongCurrent + CatSongs.VisibleSongs; - end; - - // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture - end; -end; - -procedure TScreenSong.UpdateLCD; -begin - LCD.HideCursor; - LCD.Clear; - LCD.WriteText(1, Text[TextArtist].Text); - LCD.WriteText(2, Text[TextTitle].Text); -end; - -//Procedure Change current played Preview -procedure TScreenSong.ChangeMusic; -begin - //When Music Preview is avtivated -> then Change Music - if (Ini.PreviewVolume <> 0) then - begin - if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then - begin - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); - //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal - if (Ini.PreviewFading = 0) then - Music.Play - else - Music.SetMusicVolume(0); - end; - end - else - Music.Stop; - end; -end; - -procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0 -var - Skip: integer; - I: integer; -begin - UnLoadDetailedCover; - - Interaction := High(CatSongs.Song); - SongTarget := 0; - - for I := 1 to Target+1 do - SelectNext; - - FixSelected2; -end; - -procedure TScreenSong.DrawEqualizer; -var - Data: TFFTData; //Audio Data - I, J: Integer; - Res: byte; - A, B: Integer; - PosX, PosY: Integer; - Pos: Real; -begin -if (not Music.Finished) AND (Theme.Song.Equalizer.Length > 0) then -begin - - - A := GetTickCount div 44; - - if (A <> EqualizerTime) then - begin - EqualizerTime := A; - Data := Music.GetFFTData; - - B:=0; - Pos := 0; - Res := ceil(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band - - //Change Lengths - for I := 0 to (Res * Theme.Song.Equalizer.Bands - 1) do - begin - A := floor(I/Res); - - if (A<>B) then //Band changed - begin - if (Pos <= Theme.Song.Equalizer.Length) then - begin - if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then - EqualizerBands[B] := EqualizerBands[B] - 1 - else - EqualizerBands[B] := floor(Pos); - end - else - EqualizerBands[B] := 1; - - B := A; - Pos := 0; - end; - - if I > 35 then - Data[i] := Data[i] * 8 - else if I > 11 then - Data[i] := Data[i] * 4.5 - else - Data[i] := Data[i] * 1.1; - - if (Data[i] >= 1) then - Data[i] := 0.9999999999999; - - if Data[i]*Theme.Song.Equalizer.Length > Pos then - Pos := Data[i]*Theme.Song.Equalizer.Length; - end; - - //Change Last Band - if (EqualizerBands[B] <= Theme.Song.Equalizer.Length) then - begin - if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then - EqualizerBands[B] := EqualizerBands[B] - 1 - else - EqualizerBands[B] := floor(Pos) - end - else - EqualizerBands[B] := 1; - end; - - //Draw every Channel - glColor4f(Theme.Song.Equalizer.ColR, Theme.Song.Equalizer.ColG, Theme.Song.Equalizer.ColB, Theme.Song.Equalizer.Alpha); //Set Color - glDisable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - - PosY := Theme.Song.Equalizer.Y; - PosX := Theme.Song.Equalizer.X; - - For I := 0 to Theme.Song.Equalizer.Bands-1 do - begin - if Theme.Song.Equalizer.Direction then - PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length - else - PosX := Theme.Song.Equalizer.X; - //Draw for every visible quad - for J := 1 to EqualizerBands[I] do - begin - glBegin(GL_QUADS); - glVertex3f(PosX, PosY, Theme.Song.Equalizer.Z); - glVertex3f(PosX, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); - glVertex3f(PosX+Theme.Song.Equalizer.W, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); - glVertex3f(PosX+Theme.Song.Equalizer.W, PosY, Theme.Song.Equalizer.Z); - glEnd; - - if Theme.Song.Equalizer.Direction then //Vertically - PosY := PosY - Theme.Song.Equalizer.H - Theme.Song.Equalizer.Space - else //Horizontally - PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space; - end; - if Theme.Song.Equalizer.Direction then //Horizontally - PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space - else //Vertically - PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space; - end; -end; -end; - -Procedure TScreenSong.SelectRandomSong; -var - I, I2: Integer; -begin - Case PlaylistMan.Mode of - 0: //All Songs Just Select Random Song - begin - //When Tabs are activated then use Tab Method - if (Ini.Tabs_at_startup = 1) then - begin - repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; - - //Search Cat - for I := I2 downto low(CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - break; - end; - //In I ist jetzt die Kategorie in I2 der Song - //I is the CatNum, I2 is the No of the Song within this Cat - - //Choose Cat - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - - //Choose Song - SkipTo(I2-I); - end - //When Tabs are deactivated use easy Method - else - SkipTo(Random(CatSongs.VisibleSongs)); - end; - 1: //One Category Select Category and Select Random Song - begin - CatSongs.ShowCategoryList; - CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); - ShowCatTL(PlaylistMan.CurPlayList); - - SelectNext; - FixSelected2; - - SkipTo(Random(CatSongs.VisibleSongs)); - end; - 2: //Playlist: Select Playlist and Select Random Song - begin - PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); - - SkipTo(Random(CatSongs.VisibleSongs)); - FixSelected2; - end; - end; - - Music.PlayChange; - ChangeMusic; - SetScroll; - UpdateLCD; -end; - -procedure TScreenSong.SetJoker; -begin - //If Party Mode - if Mode = 1 then //Show Joker that are available - begin - if (PartySession.Teams.NumTeams >= 1) then - begin - Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1); - Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2); - Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3); - Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4); - Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5); - end - else - begin - Static[StaticTeam1Joker1].Visible := False; - Static[StaticTeam1Joker2].Visible := False; - Static[StaticTeam1Joker3].Visible := False; - Static[StaticTeam1Joker4].Visible := False; - Static[StaticTeam1Joker5].Visible := False; - end; - - if (PartySession.Teams.NumTeams >= 2) then - begin - Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1); - Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2); - Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3); - Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4); - Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5); - end - else - begin - Static[StaticTeam2Joker1].Visible := False; - Static[StaticTeam2Joker2].Visible := False; - Static[StaticTeam2Joker3].Visible := False; - Static[StaticTeam2Joker4].Visible := False; - Static[StaticTeam2Joker5].Visible := False; - end; - - if (PartySession.Teams.NumTeams >= 3) then - begin - Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1); - Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2); - Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3); - Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4); - Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5); - end - else - begin - Static[StaticTeam3Joker1].Visible := False; - Static[StaticTeam3Joker2].Visible := False; - Static[StaticTeam3Joker3].Visible := False; - Static[StaticTeam3Joker4].Visible := False; - Static[StaticTeam3Joker5].Visible := False; - end; - end - else - begin //Hide all - Static[StaticTeam1Joker1].Visible := False; - Static[StaticTeam1Joker2].Visible := False; - Static[StaticTeam1Joker3].Visible := False; - Static[StaticTeam1Joker4].Visible := False; - Static[StaticTeam1Joker5].Visible := False; - - Static[StaticTeam2Joker1].Visible := False; - Static[StaticTeam2Joker2].Visible := False; - Static[StaticTeam2Joker3].Visible := False; - Static[StaticTeam2Joker4].Visible := False; - Static[StaticTeam2Joker5].Visible := False; - - Static[StaticTeam3Joker1].Visible := False; - Static[StaticTeam3Joker2].Visible := False; - Static[StaticTeam3Joker3].Visible := False; - Static[StaticTeam3Joker4].Visible := False; - Static[StaticTeam3Joker5].Visible := False; - end; -end; - -procedure TScreenSong.SetStatics; -var - I: Integer; - Visible: Boolean; -begin - //Set Visibility of Party Statics and Text - Visible := (Mode = 1); - - For I := 0 to high(StaticParty) do - Static[StaticParty[I]].Visible := Visible; - - For I := 0 to high(TextParty) do - Text[TextParty[I]].Visible := Visible; - - //Set Visibility of Non Party Statics and Text - Visible := not Visible; - - For I := 0 to high(StaticNonParty) do - Static[StaticNonParty[I]].Visible := Visible; - - For I := 0 to high(TextNonParty) do - Text[TextNonParty[I]].Visible := Visible; -end; - -//Procedures for Menu - -procedure TScreenSong.StartSong; -begin - CatSongs.Selected := Interaction; - Music.Stop; - //Party Mode - if (Mode = 1) then - begin - FadeTo(@ScreenSingModi); - end - else - begin - FadeTo(@ScreenSing); - end; -end; - -procedure TScreenSong.SelectPlayers; -begin - CatSongs.Selected := Interaction; - Music.Stop; - - ScreenName.Goto_SingScreen := True; - FadeTo(@ScreenName); -end; - -procedure TScreenSong.OpenEditor; -begin - if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin - Music.Stop; - Music.PlayStart; - ScreenEditSub.Path := CatSongs.Song[Interaction].Path; - ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName; - FadeTo(@ScreenEditSub); - end; -end; - -//Team No of Team (0-5) -procedure TScreenSong.DoJoker (Team: Byte); -begin - if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[Team].Joker); - SelectRandomSong; - SetJoker; - end; -end; - -//Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song -procedure TScreenSong.UnLoadDetailedCover; -begin - CoverTime := 0; - - Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture - Button[Interaction].Texture2.Alpha := 0; - - if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then - Texture.UnloadTexture(Button[Interaction].Texture.Name, false); -end; - -procedure TScreenSong.Refresh; -begin { -CatSongs.Refresh; -CatSongs.ShowCategoryList; -Interaction := 0; -SelectNext; -FixSelected; } - -end; - -end. +unit UScreenSong; + +interface +{$I switches.inc} + +uses + UMenu, + SDL, + UMusic, + UFiles, + UTime, + UDisplay, + USongs, + SysUtils, + ULog, + UThemes, + UTexture, + ULanguage, + ULCD, + ULight, + UIni; + +type + TScreenSong = class(TMenu) + public + TextArtist: integer; + TextTitle: integer; + TextNumber: integer; + + //Video Icon Mod + VideoIcon: Cardinal; + + TextCat: integer; + StaticCat: integer; + + SongCurrent: real; + SongTarget: real; + + HighSpeed: boolean; + CoverFull: boolean; + CoverTime: real; + CoverX: integer; + CoverY: integer; + CoverW: integer; + is_jump: boolean; // Jump to Song Mod + is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title + + EqualizerBands: array of Byte; + EqualizerTime: Cardinal; + EqualizerTime2: Byte; + + //Party Mod + Mode: Byte; //0 = Standard, 1= Go to PartyMode after Selection + Change to Random Song at Show + //party Statics (Joker) + StaticTeam1Joker1: Cardinal; + StaticTeam1Joker2: Cardinal; + StaticTeam1Joker3: Cardinal; + StaticTeam1Joker4: Cardinal; + StaticTeam1Joker5: Cardinal; + + StaticTeam2Joker1: Cardinal; + StaticTeam2Joker2: Cardinal; + StaticTeam2Joker3: Cardinal; + StaticTeam2Joker4: Cardinal; + StaticTeam2Joker5: Cardinal; + + StaticTeam3Joker1: Cardinal; + StaticTeam3Joker2: Cardinal; + StaticTeam3Joker3: Cardinal; + StaticTeam3Joker4: Cardinal; + StaticTeam3Joker5: Cardinal; + + StaticParty: Array of Cardinal; + TextParty: Array of Cardinal; + StaticNonParty: Array of Cardinal; + TextNonParty: Array of Cardinal; + + + constructor Create; override; + procedure SetScroll; + procedure SetScroll1; + procedure SetScroll2; + procedure SetScroll3; + procedure SetScroll4; + procedure SetScroll5; + procedure SetScroll6; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure SelectNext; + procedure SelectPrev; + procedure UpdateLCD; + procedure SkipTo(Target: Cardinal); + procedure FixSelected; //Show Wrong Song when Tabs on Fix + procedure FixSelected2; //Show Wrong Song when Tabs on Fix + procedure ShowCatTL(Cat: Integer);// Show Cat in Top left + procedure ShowCatTLCustom(Caption: String);// Show Custom Text in Top left + procedure HideCatTL;// Show Cat in Tob left + procedure Refresh; //Refresh Song Sorting + procedure DrawEqualizer; + procedure ChangeMusic; + //Party Mode + procedure SelectRandomSong; + procedure SetJoker; + procedure SetStatics; + //procedures for Menu + procedure StartSong; + procedure OpenEditor; + procedure DoJoker(Team: Byte); + procedure SelectPlayers; + + procedure UnLoadDetailedCover; + + //Extensions + procedure DrawExtensions; + end; + +implementation +uses UGraphic, + UMain, + UCovers, + math, + OpenGL12, + {$IFDEF win32} + windows, + {$ELSE} + lclintf, + {$ENDIF} + USkins, + UDLLManager, + UParty, + UPlaylist, + UScreenSongMenu; + +// ***** Public methods ****** // + +//Show Wrong Song when Tabs on Fix +procedure TScreenSong.FixSelected; +var I, I2: Integer; + begin + if CatSongs.VisibleSongs > 0 then + begin + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); + + if I = Interaction - 1 then + break; + end; + + SongCurrent := I2; + SongTarget := I2; + end; + end; + +procedure TScreenSong.FixSelected2; +var I, I2: Integer; + begin + if CatSongs.VisibleSongs > 0 then + begin + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); + + if I = Interaction - 1 then + break; + end; + + SongTarget := I2; + end; + end; +//Show Wrong Song when Tabs on Fix End + + procedure TScreenSong.ShowCatTLCustom(Caption: String);// Show Custom Text in Top left + begin + Text[TextCat].Text := Caption; + Text[TextCat].Visible := true; + Static[StaticCat].Visible := False; + end; + + //Show Cat in Top Left Mod + procedure TScreenSong.ShowCatTL(Cat: Integer); + begin + //Change + Text[TextCat].Text := CatSongs.Song[Cat].Artist; + //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover); + //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); + + Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); + //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false); + //Button[Cat]. + //Cover + + + //Show + Text[TextCat].Visible := true; + Static[StaticCat].Visible := True; + end; + + procedure TScreenSong.HideCatTL; + begin + //Hide + //Text[TextCat].Visible := false; + Static[StaticCat].Visible := false; + //New -> Show Text specified in Theme + Text[TextCat].Visible := True; + Text[TextCat].Text := Theme.Song.TextCat.Text; + end; + //Show Cat in Top Left Mod End + + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenSong.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var + I: integer; + I2: integer; + HS: integer; + SDL_ModState: Word; + Letter: Char; +begin + Result := true; + + //Song Screen Extensions (Jumpto + Menu) + if (ScreenSongMenu.Visible) then + begin + Result := ScreenSongMenu.ParseInput(PressedKey, ScanCode, PressedDown); + Exit; + end + else if (ScreenSongJumpto.Visible) then + begin + Result := ScreenSongJumpto.ParseInput(PressedKey, ScanCode, PressedDown); + Exit; + end; + + If (PressedDown) Then + begin // Key Down + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + + //Jump to Artist/Titel + if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then + begin + Letter := UpCase(Chr(ScanCode)); + I2 := Length(CatSongs.Song); + + //Jump To Titel + if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then + begin + For I := 1 to high(CatSongs.Song) do + begin + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + + Music.PlayChange; + + ChangeMusic; + SetScroll4; + UpdateLCD; + //Break and Exit + Exit; + end; + end; + end + //Jump to Artist + else if (SDL_ModState = KMOD_LALT) then + begin + For I := 1 to high(CatSongs.Song) do + begin + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Artist[1]) = Letter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + + Music.PlayChange; + + ChangeMusic; + SetScroll4; + UpdateLCD; + + //Break and Exit + Exit; + end; + end; + end; + Exit; + end; + + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + if (Mode = 0) then + begin + //On Escape goto Cat-List Hack + if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then + begin + //Find Category + I := Interaction; + while not catsongs.Song[I].Main do + begin + Dec (I); + if (I < low(catsongs.Song)) then + break; + end; + if (I<= 1) then + Interaction := high(catsongs.Song) + else + Interaction := I - 1; + + //Stop Music + Music.Stop; + + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + HideCatTL; + + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + //SelectPrev; + //CatSongs.Song[0].Visible := False; + end + else + begin + //On Escape goto Cat-List Hack End + //Tabs off and in Search or Playlist -> Go back to Song view + if (CatSongs.CatNumShow < -1) then + begin + //Atm: Set Empty Filter + CatSongs.SetFilter('', 0); + + //Show Cat in Top Left Mod + HideCatTL; + Interaction := 0; + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + + ChangeMusic; + end + else + begin + Music.Stop; + Music.PlayBack; + + FadeTo(@ScreenMain); + end; + + end; + end + //When in party Mode then Ask before Close + else if (Mode = 1) then + begin + Music.PlayBack; + CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); + end; + end; + SDLK_RETURN: + begin + if Length(Songs.Song) > 0 then + begin + {$IFDEF UseSerialPort} + // PortWriteB($378, 0); + {$ENDIF} + if CatSongs.Song[Interaction].Main then + begin // clicked on Category Button + + //Show Cat in Top Left Mod + ShowCatTL (Interaction); + + //I := CatSongs.VisibleIndex(Interaction); + CatSongs.ClickCategoryButton(Interaction); + {I2 := CatSongs.VisibleIndex(Interaction); + SongCurrent := SongCurrent - I + I2; + SongTarget := SongTarget - I + I2; } + +// if I<>I2 then beep; + // SetScroll4; + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + + //Play Music: + ChangeMusic; + + end else begin // clicked on song + if (Mode = 0) then //Normal Mode -> Start Song + begin + //Do the Action that is specified in Ini + case Ini.OnSongClick of + 0: StartSong; + 1: SelectPlayers; + 2:begin + If (CatSongs.CatNumShow = -3) then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end; + end; + end + else if (Mode = 1) then //PartyMode -> Show Menu + begin + if (Ini.PartyPopup = 1) then + ScreenSongMenu.MenuShow(SM_Party_Main) + else + ScreenSong.StartSong; + end; + end; + end; + end; + + SDLK_M: //Show SongMenu + begin + if (Length(Songs.Song) > 0) then begin + if (Mode = 0) then begin + if not CatSongs.Song[Interaction].Main then begin // clicked on Song + if CatSongs.CatNumShow = -3 then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end + else + begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); + end; + end //Party Mode -> Show Party Menu + else ScreenSongMenu.MenuShow(SM_Party_Main); + end; + end; + + SDLK_P: //Show Playlist Menu + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); + end; + end; + + SDLK_J: //Show Jumpto Menu + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then + begin + ScreenSongJumpto.Visible := True; + end; + end; + + SDLK_DOWN: + begin + if (Mode = 0) then + begin + //Only Change Cat when not in Playlist or Search Mode + if (CatSongs.CatNumShow > -2) then + begin + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then + begin + I := Interaction; + if I <= 0 then I := 1; + + while not catsongs.Song[I].Main do + begin + Inc (I); + if (I > high(catsongs.Song)) then + I := low(catsongs.Song); + end; + + Interaction := I; + + //Show Cat in Top Left Mod + ShowCatTL (Interaction); + + CatSongs.ClickCategoryButton(Interaction); + SelectNext; + FixSelected; + + //Play Music: + Music.PlayChange; + ChangeMusic; + + end; + + // + //Cat Change Hack End} + end; + end; + end; + SDLK_UP: + begin + if (Mode = 0) then + begin + //Only Change Cat when not in Playlist or Search Mode + if (CatSongs.CatNumShow > -2) then + begin + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then + begin + I := Interaction; + I2 := 0; + if I <= 0 then I := 1; + + while not catsongs.Song[I].Main or (I2 = 0) do + begin + if catsongs.Song[I].Main then + Inc(I2); + Dec (I); + if (I < low(catsongs.Song)) then + I := high(catsongs.Song); + end; + + Interaction := I; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + + //Play Music: + Music.PlayChange; + ChangeMusic; + end; + end; + //Cat Change Hack End} + end; + end; + + SDLK_RIGHT: + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + Music.PlayChange; + SelectNext; +// InteractNext; +// SongTarget := Interaction; + ChangeMusic; + SetScroll4; + UpdateLCD; + Light.LightOne(1, 200); + end; + end; + + SDLK_LEFT: + begin + if (Length(Songs.Song) > 0)AND (Mode = 0) then begin + Music.PlayChange; + SelectPrev; + ChangeMusic; + SetScroll4; + UpdateLCD; + Light.LightOne(0, 200); + end; + end; + + SDLK_E: + begin + OpenEditor; + end; + + SDLK_R: + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + + if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category + begin + I2 := 0; //Count Cats + for I:= low(CatSongs.Song) to high (CatSongs.Song) do + if CatSongs.Song[I].Main then Inc(I2); + + I2 := Random (I2)+1; //Zufall + + //Find Cat: + for I:= low(CatSongs.Song) to high (CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + Dec(I2); + if (I2<=0) then + begin + //Show Cat in Top Left Mod + ShowCatTL (I); + + Interaction := I; + + CatSongs.ShowCategoryList; + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + break; + end; + end; + + + end + else if (SDL_ModState = KMOD_LCTRL) AND (Ini.Tabs_at_startup = 1) then //random in All Categorys + begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; + + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + + //Choose Cat + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Fix: Not Existing Song selected: + //if (I+1=I2) then Inc(I2); + + //Choose Song + SkipTo(I2-I); + + end + else //Random in one Category + begin + SkipTo(Random(CatSongs.VisibleSongs)); + end; + Music.PlayChange; + + ChangeMusic; + SetScroll4; + UpdateLCD; + end; + end; + + SDLK_1: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[0].Joker); + SelectRandomSong; + SetJoker; + end; + end; + + SDLK_2: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[1].Joker); + SelectRandomSong; + SetJoker; + end; + end; + + SDLK_3: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[2].Joker); + SelectRandomSong; + SetJoker; + end; + end; + end; + end; +end; + +constructor TScreenSong.Create; +var + Pet: integer; + I: integer; +Label CreateSongButtons; +begin + inherited Create; + + LoadFromTheme(Theme.Song); + + TextArtist := AddText(Theme.Song.TextArtist); + TextTitle := AddText(Theme.Song.TextTitle); + TextNumber := AddText(Theme.Song.TextNumber); + + //Show Cat in Top Left mod + TextCat := AddText(Theme.Song.TextCat); + StaticCat := AddStatic(Theme.Song.StaticCat); + + //Show Video Icon Mod + VideoIcon := AddStatic(Theme.Song.VideoIcon); + + //Party Mode + StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1); + StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2); + StaticTeam1Joker3 := AddStatic(Theme.Song.StaticTeam1Joker3); + StaticTeam1Joker4 := AddStatic(Theme.Song.StaticTeam1Joker4); + StaticTeam1Joker5 := AddStatic(Theme.Song.StaticTeam1Joker5); + + StaticTeam2Joker1 := AddStatic(Theme.Song.StaticTeam2Joker1); + StaticTeam2Joker2 := AddStatic(Theme.Song.StaticTeam2Joker2); + StaticTeam2Joker3 := AddStatic(Theme.Song.StaticTeam2Joker3); + StaticTeam2Joker4 := AddStatic(Theme.Song.StaticTeam2Joker4); + StaticTeam2Joker5 := AddStatic(Theme.Song.StaticTeam2Joker5); + + StaticTeam3Joker1 := AddStatic(Theme.Song.StaticTeam3Joker1); + StaticTeam3Joker2 := AddStatic(Theme.Song.StaticTeam3Joker2); + StaticTeam3Joker3 := AddStatic(Theme.Song.StaticTeam3Joker3); + StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); + StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); + + //Load Party or NonParty specific Statics and Texts + SetLength(StaticParty, Length(Theme.Song.StaticParty)); + for I := 0 to High(Theme.Song.StaticParty) do + StaticParty[I] := AddStatic(Theme.Song.StaticParty[I]); + + SetLength(TextParty, Length(Theme.Song.TextParty)); + for I := 0 to High(Theme.Song.TextParty) do + TextParty[I] := AddText(Theme.Song.TextParty[I]); + + SetLength(StaticNonParty, Length(Theme.Song.StaticNonParty)); + for I := 0 to High(Theme.Song.StaticNonParty) do + StaticNonParty[I] := AddStatic(Theme.Song.StaticNonParty[I]); + + SetLength(TextNonParty, Length(Theme.Song.TextNonParty)); + for I := 0 to High(Theme.Song.TextNonParty) do + TextNonParty[I] := AddText(Theme.Song.TextNonParty[I]); + + // Song List +// Songs.LoadSongList; // moved to the UltraStar unit + CatSongs.Refresh; + + if (length(CatSongs.Song) > 0) then + begin + //Set Length of Button Array one Time Instead of one time for every Song + SetButtonLength(Length(CatSongs.Song)); + + I := 0; + CreateSongButtons: + + try + for Pet := I to High(CatSongs.Song) do begin // creating all buttons + // new + Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 + + if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' + + if CatSongs.Song[Pet].Cover = '' then + AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) + else begin + // cache texture if there is a need to this + if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then begin + Texture.CreateCacheMipmap := true; + Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap + Texture.CreateCacheMipmap := false; + + // puts this texture to the cache file + Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + + // unload full size texture + Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); + + // we should also add mipmap texture by calling createtexture and use mipmap cache as data source + end; + + // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) + AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + end; + Texture.Limit := 1024*1024; + I := -1; + end; + except + //When Error is reported the First time for this Song + if (I <> Pet) then + begin + //Some Error reporting: + Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); + + //Change Cover to NoCover and Continue Loading + CatSongs.Song[Pet].Cover := ''; + I := Pet; + end + else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song + begin + Log.LogError('NoCover Cover is damaged!'); + try + AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); + except + {$IFDEF win32} + Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); + {$ELSE} + // TODO : JB_linux - better handle this message and display to user.. + writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'); + Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' ); + {$ENDIF} + Halt; + end; + I := Pet + 1; + end; + end; + + if (I <> -1) then + GoTo CreateSongButtons; + + end; + + // Randomize Patch + Randomize; + //Equalizer + SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); + //ClearArray + For I := low(EqualizerBands) to high(EqualizerBands) do + EqualizerBands[I] := 3; + + if (Length(CatSongs.Song) > 0) then + Interaction := 0; +end; + +procedure TScreenSong.SetScroll; +var + VS, B: Integer; +begin + VS := CatSongs.VisibleSongs; + if VS > 0 then + begin + //Set Positions + Case Theme.Song.Cover.Style of + 3: SetScroll3; + 5:begin + if VS > 5 then + SetScroll5 + else + SetScroll4; + end; + 6: SetScroll6; + else SetScroll4; + end; + //Set Visibility of Video Icon + Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> ''); + + //Set Texts: + Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; + Text[TextTitle].Text := CatSongs.Song[Interaction].Title; + if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then + begin + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); + Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; + end + else if (CatSongs.CatNumShow = -2) then + Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) + else if (CatSongs.CatNumShow = -3) then + Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) + else if (Ini.Tabs_at_startup = 1) then + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) + else + Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); + end + else + begin + Text[TextNumber].Text := '0/0'; + Text[TextArtist].Text := ''; + Text[TextTitle].Text := ''; + for B := 0 to High(Button) do + Button[B].Visible := False; + + end; +end; + +procedure TScreenSong.SetScroll1; +var + B: integer; // button + BMin: integer; // button min + BMax: integer; // button max + Src: integer; +// Dst: integer; + Count: integer; // Dst is not used. Count is used. + Ready: boolean; + + VisCount: integer; // count of visible (or selectable) buttons + VisInt: integer; // visible position of interacted button + Typ: integer; // 0 when all songs fits the screen + Placed: integer; // number of placed visible buttons +begin +// Src := 0; +// Dst := -1; + Count := 1; + Typ := 0; + Ready := false; + Placed := 0; + + VisCount := 0; + for B := 0 to High(Button) do + if CatSongs.Song[B].Visible then Inc(VisCount); + + VisInt := 0; + for B := 0 to Interaction-1 do + if CatSongs.Song[B].Visible then Inc(VisInt); + + + if VisCount <= 6 then begin + Typ := 0; + end else begin + if VisInt <= 3 then begin + Typ := 1; + Count := 7; + Ready := true; + end; + + if (VisCount - VisInt) <= 3 then begin + Typ := 2; + Count := 7; + Ready := true; + end; + + if not Ready then begin + Typ := 3; + Src := Interaction; + end; + end; + + + + // hide all buttons + for B := 0 to High(Button) do begin + Button[B].Visible := false; + Button[B].Selectable := CatSongs.Song[B].Visible; + end; + +{ for B := Src to Dst do begin +// Button[B].Visible := true; + Button[B].Visible := CatSongs.Song[B].Visible; + Button[B].Selectable := Button[B].Visible; + Button[B].Y := 140 + (B-Src) * 60; + end;} + + + if Typ = 0 then begin + for B := 0 to High(Button) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (Placed) * 60; + Inc(Placed); + end; + end; + end; + + if Typ = 1 then begin + B := 0; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Inc(B); + end; + end; + + if Typ = 2 then begin + B := High(Button); + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (6-Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Dec(B); + end; + end; + + if Typ = 3 then begin + B := Src; + Count := 4; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (3+Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Inc(B); + end; + + B := Src-1; + Placed := 0; + Count := 3; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (2-Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Dec(B); + end; + + end; + + if Length(Button) > 0 then + Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture +end; + +procedure TScreenSong.SetScroll2; +var + B: integer; + Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu + Wsp2: real; +begin + // liniowe + for B := 0 to High(Button) do + Button[B].X := 300 + (B - Interaction) * 260; + + if Length(Button) >= 3 then begin + if Interaction = 0 then + Button[High(Button)].X := 300 - 260; + + if Interaction = High(Button) then + Button[0].X := 300 + 260; + end; + + // kolowe +{ for B := 0 to High(Button) do begin + Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. + Wsp2 := Wsp / Length(Button); + Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); +// Button[B].Y := 140 + 50 * ; + end;} +end; + +procedure TScreenSong.SetScroll3; // with slide +var + B: integer; + Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu + Wsp2: real; +begin + SongTarget := Interaction; + + // liniowe + for B := 0 to High(Button) do + begin + Button[B].X := 300 + (B - SongCurrent) * 260; + if (Button[B].X < -Button[B].W) OR (Button[B].X > 800) then + Button[B].Visible := False + else + Button[B].Visible := True; + end; + +{ if Length(Button) >= 3 then begin + if Interaction = 0 then + Button[High(Button)].X := 300 - 260; + + if Interaction = High(Button) then + Button[0].X := 300 + 260; + end;} + + // kolowe +{ for B := 0 to High(Button) do begin + Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. + Wsp2 := Wsp / Length(Button); + Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); +// Button[B].Y := 140 + 50 * ; + end;} +end; + +procedure TScreenSong.SetScroll4; // rotate +var + B: integer; + Wsp: real; + Z, Z2: real; + VS: integer; +begin + VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important + + // kolowe + for B := 0 to High(Button) do begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2; + Z2 := (1 + 2*Z) / 3; + + + Button[B].X := Theme.Song.Cover.X + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z / 2 + 0.3; + + Button[B].W := Theme.Song.Cover.H * Z2; + +// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; + Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; + Button[B].H := Button[B].W; + end; + end; +end; + +(* +procedure TScreenSong.SetScroll4; // rotate +var + B: integer; + Wsp: real; + Z: real; + Z2, Z3: real; + VS: integer; + function modreal (const X, Y: real):real; + begin + Result := Frac(x / y) * y; + if Result < -3 then + Result := Result + Y + else if Result > 3 then + Result := Result - Y; + end; +begin + VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important + Z3 := 1; + if VS < 12 then + Z2 := VS + else + Z2 := 12; + + // kolowe + for B := 0 to High(Button) do begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + if ((ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)>-3) AND (ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)<3)) then + begin + if CatSongs.VisibleIndex(B)> SongCurrent then + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2 + else + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2; + + Z3 := 2; + Z := (1 + cos(Wsp)) / 2; + //Z2 := (1 + 2*Z) / 3; + //Z2 := (0.5 + Z/2); + //Z2 := sin(Wsp); + + //Z2 := Power (Z2,Z3); + + Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); + + //Button[B].X := Theme.Song.CoverX + ({Theme.Song.CoverX + Theme.Song.CoverW/2 + Theme.Song.CoverW*0.18 * VS {CatSongs.VisibleSongs {Length(Button) * sin(Wsp) {- Theme.Song.CoverX - Theme.Song.CoverW) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + if (sin(Wsp)<0) then + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W + else //*Theme.Song.CoverW*0.004*Z3 + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; + Button[B].Z := Z-0.00001; + +// Button[B].Y := {50 + 140 + 50 - 50 * Z2; + // Button[B].Y := (Theme.Song.CoverY + 40 + 50 - 50 * Z2); + Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); + Button[B].H := Button[B].W; + Button[B].Visible := True; + end + {else if (((CatSongs.VisibleIndex(B) - SongCurrent)>-3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) OR ((round (CatSongs.VisibleIndex(B) - SongCurrent) mod VS > -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) then + begin + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / 12 ;// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2 -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); + + if (sin(Wsp)<0) then + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W + else + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; + + Button[B].Z := Z; + + Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); + + Button[B].H := Button[B].W; + Button[B].Visible := True; + end + else Button[B].Visible := False; + end; + end; +end; *) + +procedure TScreenSong.SetScroll5; // rotate +var + B: integer; + Angle: real; + Pos: Real; + VS: integer; + diff: real; + X: Real; + helper: real; +begin + VS := CatSongs.VisibleSongs; // cache Visible Songs + {Vars + Theme.Song.CoverW: Radius des Kreises + Theme.Song.CoverX: X Pos Linke Kante des gewählten Covers + Theme.Song.CoverX: Y Pos Obere Kante des gewählten Covers + Theme.Song.CoverH: Höhe der Cover + + (CatSongs.VisibleIndex(B) - SongCurrent)/VS = Abstand zum MIttleren Cover in % + } + + //Change Pos of all Buttons + for B := low(Button) to high(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility + if Button[B].Visible then //Only Change Pos for Visible Buttons + begin + Pos := (CatSongs.VisibleIndex(B) - SongCurrent); + if (Pos < -VS/2) then + Pos := Pos + VS + else if (Pos > VS/2) then + Pos := Pos - VS; + + if (Abs(Pos) < 2.5) then {fixed Positions} + begin + Angle := Pi * (Pos / 5); +// Button[B].Visible := False; + + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); + +// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Z := 0.95 - Abs(Pos) * 0.01; + + Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); + + Button[B].W := Button[B].H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + + X := Sin(Angle*1.3)*0.9; + + Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Diff; + + end + else + begin {Behind the Front Covers} + + // limit-bg-covers hack + if (abs(abs(Pos)-VS/2)>10) then Button[B].Visible:=False; + // end of limit-bg-covers hack + + if Pos < 0 then + Pos := (Pos - VS/2)/VS + else + Pos := (Pos + VS/2)/VS; + + Angle := pi * Pos*2; + if VS > 24 then + begin + if Angle < 0 then helper:=-1 else helper:=1; + Angle:=2*pi-abs(Angle); + Angle:=Angle*(VS/24); + Angle:=(2*pi-Angle)*helper; + end; + + Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); + + Button[B].W := Button[B].H; + + Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; + +// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*((Theme.Song.Cover.H)*sin(Angle/2)*1.52); + + end; + + //Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field +// Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); + + end; + end; +end; + +procedure TScreenSong.SetScroll6; // rotate (slotmachine style) +var + B: integer; + Angle: real; + Pos: Real; + VS: integer; + diff: real; + X: Real; + Wsp: real; + Z, Z2: real; +begin + VS := CatSongs.VisibleSongs; // cache Visible Songs + if VS <=5 then begin + // kolowe + for B := 0 to High(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2; + Z2 := (1 + 2*Z) / 3; + + + Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z / 2 + 0.3; + + Button[B].W := Theme.Song.Cover.H * Z2; + +// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; + Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; + Button[B].H := Button[B].W; + end; + end; + end + else begin + + //Change Pos of all Buttons + for B := low(Button) to high(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility + if Button[B].Visible then //Only Change Pos for Visible Buttons + begin + Pos := (CatSongs.VisibleIndex(B) - SongCurrent); + if (Pos < -VS/2) then + Pos := Pos + VS + else if (Pos > VS/2) then + Pos := Pos - VS; + + if (Abs(Pos) < 2.5) then {fixed Positions} + begin + Angle := Pi * (Pos / 5); +// Button[B].Visible := False; + + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); + + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Z := 0.95 - Abs(Pos) * 0.01; + + Button[B].X := (Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); + + Button[B].W := Button[B].H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + + X := Sin(Angle*1.3)*0.9; + + Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff; + end + else + begin {Behind the Front Covers} + + // limit-bg-covers hack + if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; + if VS > 25 then VS:=25; + // end of limit-bg-covers hack + + if Pos < 0 then + Pos := (Pos - VS/2)/VS + else + Pos := (Pos + VS/2)/VS; + + Angle := pi * Pos*2; + + Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); + + Button[B].W := Button[B].H; + + Button[B].X := Theme.Song.Cover.X - (Button[B].H - Theme.Song.Cover.H)*0.5; + + + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Y := Theme.Song.Cover.Y+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*(Theme.Song.Cover.H*sin(Angle/2)*1.52); + end; + end; + end; + end; +end; + + +procedure TScreenSong.onShow; +begin + Music.Stop; + + if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; + if Ini.Players = 4 then PlayersPlay := 6; + + //Cat Mod etc + if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then + begin + CatSongs.ShowCategoryList; + FixSelected; + //Show Cat in Top Left Mod + HideCatTL; + end; + + + if Length(CatSongs.Song) > 0 then begin + //Load Music only when Song Preview is activated + if (Ini.PreviewVolume <> 0) then + begin + Music.SetLoop(false); + Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + Music.MoveTo(Music.Length / 4); + Music.Play; + + //Set Preview Volume + Music.SetMusicVolume (Ini.PreviewVolume * 10); + {//if Music Fade is activated, Set Volume to 0 % + if (Ini.PreviewFading <> 0) then + Music.SetMusicVolume(0);} + end; + + SetScroll; + UpdateLCD; + end; + + //Playlist Mode + if (Mode = 0) then + begin + //If Playlist Shown -> Select Next automatically + if (CatSongs.CatNumShow = -3) then + begin + SelectNext; + ChangeMusic; + end; + end + //Party Mode + else if (Mode = 1) then + begin + + SelectRandomSong; + //Show Menu directly in PartyMode + //But only if selected in Options + if (Ini.PartyPopup = 1) then + begin + ScreenSongMenu.MenuShow(SM_Party_Main); + end; + + + end; + + SetJoker; + SetStatics; +end; + +procedure TScreenSong.onHide; +begin + //When Music Fading is activated, Turn Music to 100 % + If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then + Music.SetMusicVolume(100); + + //If Preview is deactivated: Load MUsicfile now + If (Ini.PreviewVolume = 0) then + Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + + //When hide then Stop Music (For Party Mode Popup on Exit) + if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then + Music.Stop; +end; + +procedure TScreenSong.DrawExtensions; +begin + //Draw Song Menu + if (ScreenSongMenu.Visible) then + begin + ScreenSongMenu.Draw; + end + else if (ScreenSongJumpto.Visible) then + begin + ScreenSongJumpto.Draw; + end +end; + +function TScreenSong.Draw: boolean; +var + dx: real; + dt: real; + I: Integer; +begin + dx := SongTarget-SongCurrent; + dt := TimeSkip*7; + if dt > 1 then dt := 1; + SongCurrent := SongCurrent + dx*dt; + +{ if SongCurrent > Catsongs.VisibleSongs then begin + SongCurrent := SongCurrent - Catsongs.VisibleSongs; + SongTarget := SongTarget - Catsongs.VisibleSongs; + end;} + +// Log.BenchmarkStart(5); + SetScroll; +// Log.BenchmarkEnd(5); +// Log.LogBenchmark('SetScroll4', 5); + + //Fading Functions, Only if Covertime is under 5 Seconds + If (CoverTime < 5) then + begin + // 0.5.0: cover fade + if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin + // load new texture + Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture.Alpha := 1; + Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture2.Alpha := 1; + end; + + //Song Fade + if (CatSongs.VisibleSongs > 0) AND (Ini.PreviewVolume <> 0) AND (Not CatSongs.Song[Interaction].Main) AND (Ini.PreviewFading <> 0) then + begin + //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling + if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then + Music.Play; + + //Update Song Volume + if (CoverTime < Ini.PreviewFading) then + Music.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) + else + Music.SetMusicVolume(Ini.PreviewVolume * 10); + + end; + + + //Update Fading Time + CoverTime := CoverTime + TimeSkip; + + //Update Fading Texture + Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; + if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; + + end; + + //inherited Draw; + //heres a little Hack, that causes the Statics + //are Drawn after the Buttons because of some Blending Problems. + //This should cause no Problems because all Buttons on this screen + //Has Z Position. + //Draw BG + DrawBG; + + //Instead of Draw FG Procedure: + //We draw Buttons for our own + for I := 0 to Length(Button) - 1 do + Button[I].Draw; + + // Statics + for I := 0 to Length(Static) - 1 do + Static[I].Draw; + + // and texts + for I := 0 to Length(Text) - 1 do + Text[I].Draw; + + + //Draw Equalizer + if Theme.Song.Equalizer.Visible then + DrawEqualizer; + + DrawExtensions; + +end; + +procedure TScreenSong.SelectNext; +var + Skip: integer; + I: integer; + VS: Integer; +begin + VS := CatSongs.VisibleSongs; + + if VS > 0 then + begin + UnLoadDetailedCover; + + Skip := 1; + + // this 1 could be changed by CatSongs.FindNextVisible + while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); + + SongTarget := SongTarget + 1;//Skip; + + Interaction := (Interaction + Skip) mod Length(Interactions); + + // try to keep all at the beginning + if SongTarget > VS-1 then begin + SongTarget := SongTarget - VS; + SongCurrent := SongCurrent - VS; + end; + + end; + // Interaction -> Button, ktorego okladke przeczytamy + // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture +end; + +procedure TScreenSong.SelectPrev; +var + Skip: integer; + I: integer; + VS: Integer; +begin + VS := CatSongs.VisibleSongs; + + if VS > 0 then + begin + UnLoadDetailedCover; + + Skip := 1; + + while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); + SongTarget := SongTarget - 1;//Skip; + + Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); + + // try to keep all at the beginning + if SongTarget < 0 then begin + SongTarget := SongTarget + CatSongs.VisibleSongs; + SongCurrent := SongCurrent + CatSongs.VisibleSongs; + end; + + // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture + end; +end; + +procedure TScreenSong.UpdateLCD; +begin + LCD.HideCursor; + LCD.Clear; + LCD.WriteText(1, Text[TextArtist].Text); + LCD.WriteText(2, Text[TextTitle].Text); +end; + +//Procedure Change current played Preview +procedure TScreenSong.ChangeMusic; +begin + //When Music Preview is avtivated -> then Change Music + if (Ini.PreviewVolume <> 0) then + begin + if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then + begin + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal + if (Ini.PreviewFading = 0) then + Music.Play + else + Music.SetMusicVolume(0); + end; + end + else + Music.Stop; + end; +end; + +procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0 +var + Skip: integer; + I: integer; +begin + UnLoadDetailedCover; + + Interaction := High(CatSongs.Song); + SongTarget := 0; + + for I := 1 to Target+1 do + SelectNext; + + FixSelected2; +end; + +procedure TScreenSong.DrawEqualizer; +var + Data: TFFTData; //Audio Data + I, J: Integer; + Res: byte; + A, B: Integer; + PosX, PosY: Integer; + Pos: Real; +begin +if (not Music.Finished) AND (Theme.Song.Equalizer.Length > 0) then +begin + + + A := GetTickCount div 44; + + if (A <> EqualizerTime) then + begin + EqualizerTime := A; + Data := Music.GetFFTData; + + B:=0; + Pos := 0; + Res := ceil(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band + + //Change Lengths + for I := 0 to (Res * Theme.Song.Equalizer.Bands - 1) do + begin + A := floor(I/Res); + + if (A<>B) then //Band changed + begin + if (Pos <= Theme.Song.Equalizer.Length) then + begin + if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then + EqualizerBands[B] := EqualizerBands[B] - 1 + else + EqualizerBands[B] := floor(Pos); + end + else + EqualizerBands[B] := 1; + + B := A; + Pos := 0; + end; + + if I > 35 then + Data[i] := Data[i] * 8 + else if I > 11 then + Data[i] := Data[i] * 4.5 + else + Data[i] := Data[i] * 1.1; + + if (Data[i] >= 1) then + Data[i] := 0.9999999999999; + + if Data[i]*Theme.Song.Equalizer.Length > Pos then + Pos := Data[i]*Theme.Song.Equalizer.Length; + end; + + //Change Last Band + if (EqualizerBands[B] <= Theme.Song.Equalizer.Length) then + begin + if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then + EqualizerBands[B] := EqualizerBands[B] - 1 + else + EqualizerBands[B] := floor(Pos) + end + else + EqualizerBands[B] := 1; + end; + + //Draw every Channel + glColor4f(Theme.Song.Equalizer.ColR, Theme.Song.Equalizer.ColG, Theme.Song.Equalizer.ColB, Theme.Song.Equalizer.Alpha); //Set Color + glDisable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + + PosY := Theme.Song.Equalizer.Y; + PosX := Theme.Song.Equalizer.X; + + For I := 0 to Theme.Song.Equalizer.Bands-1 do + begin + if Theme.Song.Equalizer.Direction then + PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length + else + PosX := Theme.Song.Equalizer.X; + //Draw for every visible quad + for J := 1 to EqualizerBands[I] do + begin + glBegin(GL_QUADS); + glVertex3f(PosX, PosY, Theme.Song.Equalizer.Z); + glVertex3f(PosX, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); + glVertex3f(PosX+Theme.Song.Equalizer.W, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); + glVertex3f(PosX+Theme.Song.Equalizer.W, PosY, Theme.Song.Equalizer.Z); + glEnd; + + if Theme.Song.Equalizer.Direction then //Vertically + PosY := PosY - Theme.Song.Equalizer.H - Theme.Song.Equalizer.Space + else //Horizontally + PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space; + end; + if Theme.Song.Equalizer.Direction then //Horizontally + PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space + else //Vertically + PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space; + end; +end; +end; + +Procedure TScreenSong.SelectRandomSong; +var + I, I2: Integer; +begin + Case PlaylistMan.Mode of + 0: //All Songs Just Select Random Song + begin + //When Tabs are activated then use Tab Method + if (Ini.Tabs_at_startup = 1) then + begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; + + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + //I is the CatNum, I2 is the No of the Song within this Cat + + //Choose Cat + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Choose Song + SkipTo(I2-I); + end + //When Tabs are deactivated use easy Method + else + SkipTo(Random(CatSongs.VisibleSongs)); + end; + 1: //One Category Select Category and Select Random Song + begin + CatSongs.ShowCategoryList; + CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); + ShowCatTL(PlaylistMan.CurPlayList); + + SelectNext; + FixSelected2; + + SkipTo(Random(CatSongs.VisibleSongs)); + end; + 2: //Playlist: Select Playlist and Select Random Song + begin + PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); + + SkipTo(Random(CatSongs.VisibleSongs)); + FixSelected2; + end; + end; + + Music.PlayChange; + ChangeMusic; + SetScroll; + UpdateLCD; +end; + +procedure TScreenSong.SetJoker; +begin + //If Party Mode + if Mode = 1 then //Show Joker that are available + begin + if (PartySession.Teams.NumTeams >= 1) then + begin + Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1); + Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2); + Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3); + Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4); + Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5); + end + else + begin + Static[StaticTeam1Joker1].Visible := False; + Static[StaticTeam1Joker2].Visible := False; + Static[StaticTeam1Joker3].Visible := False; + Static[StaticTeam1Joker4].Visible := False; + Static[StaticTeam1Joker5].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 2) then + begin + Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1); + Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2); + Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3); + Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4); + Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5); + end + else + begin + Static[StaticTeam2Joker1].Visible := False; + Static[StaticTeam2Joker2].Visible := False; + Static[StaticTeam2Joker3].Visible := False; + Static[StaticTeam2Joker4].Visible := False; + Static[StaticTeam2Joker5].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 3) then + begin + Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1); + Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2); + Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3); + Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4); + Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5); + end + else + begin + Static[StaticTeam3Joker1].Visible := False; + Static[StaticTeam3Joker2].Visible := False; + Static[StaticTeam3Joker3].Visible := False; + Static[StaticTeam3Joker4].Visible := False; + Static[StaticTeam3Joker5].Visible := False; + end; + end + else + begin //Hide all + Static[StaticTeam1Joker1].Visible := False; + Static[StaticTeam1Joker2].Visible := False; + Static[StaticTeam1Joker3].Visible := False; + Static[StaticTeam1Joker4].Visible := False; + Static[StaticTeam1Joker5].Visible := False; + + Static[StaticTeam2Joker1].Visible := False; + Static[StaticTeam2Joker2].Visible := False; + Static[StaticTeam2Joker3].Visible := False; + Static[StaticTeam2Joker4].Visible := False; + Static[StaticTeam2Joker5].Visible := False; + + Static[StaticTeam3Joker1].Visible := False; + Static[StaticTeam3Joker2].Visible := False; + Static[StaticTeam3Joker3].Visible := False; + Static[StaticTeam3Joker4].Visible := False; + Static[StaticTeam3Joker5].Visible := False; + end; +end; + +procedure TScreenSong.SetStatics; +var + I: Integer; + Visible: Boolean; +begin + //Set Visibility of Party Statics and Text + Visible := (Mode = 1); + + For I := 0 to high(StaticParty) do + Static[StaticParty[I]].Visible := Visible; + + For I := 0 to high(TextParty) do + Text[TextParty[I]].Visible := Visible; + + //Set Visibility of Non Party Statics and Text + Visible := not Visible; + + For I := 0 to high(StaticNonParty) do + Static[StaticNonParty[I]].Visible := Visible; + + For I := 0 to high(TextNonParty) do + Text[TextNonParty[I]].Visible := Visible; +end; + +//Procedures for Menu + +procedure TScreenSong.StartSong; +begin + CatSongs.Selected := Interaction; + Music.Stop; + //Party Mode + if (Mode = 1) then + begin + FadeTo(@ScreenSingModi); + end + else + begin + FadeTo(@ScreenSing); + end; +end; + +procedure TScreenSong.SelectPlayers; +begin + CatSongs.Selected := Interaction; + Music.Stop; + + ScreenName.Goto_SingScreen := True; + FadeTo(@ScreenName); +end; + +procedure TScreenSong.OpenEditor; +begin + if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin + Music.Stop; + Music.PlayStart; + ScreenEditSub.Path := CatSongs.Song[Interaction].Path; + ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName; + FadeTo(@ScreenEditSub); + end; +end; + +//Team No of Team (0-5) +procedure TScreenSong.DoJoker (Team: Byte); +begin + if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[Team].Joker); + SelectRandomSong; + SetJoker; + end; +end; + +//Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song +procedure TScreenSong.UnLoadDetailedCover; +begin + CoverTime := 0; + + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture + Button[Interaction].Texture2.Alpha := 0; + + if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then + Texture.UnloadTexture(Button[Interaction].Texture.Name, false); +end; + +procedure TScreenSong.Refresh; +begin { +CatSongs.Refresh; +CatSongs.ShowCategoryList; +Interaction := 0; +SelectNext; +FixSelected; } + +end; + +end. diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 41432356..ce331e2f 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -1,619 +1,632 @@ -unit UScreenSongMenu; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -uses - UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; - -type - TScreenSongMenu = class(TMenu) - private - CurMenu: Byte; //Num of the cur. Shown Menu - public - Visible: Boolean; //Whether the Menu should be Drawn - - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - procedure onShow; override; - function Draw: boolean; override; - procedure MenuShow(sMenu: Byte); - procedure HandleReturn; - end; - -const - SM_Main = 1; - - SM_PlayList = 64 or 1; - SM_Playlist_Add = 64 or 2; - SM_Playlist_New = 64 or 3; - - SM_Playlist_DelItem = 64 or 5; - - SM_Playlist_Load = 64 or 8 or 1; - SM_Playlist_Del = 64 or 8 or 5; - - - SM_Party_Main = 128 or 1; - SM_Party_Joker = 128 or 2; - -var - ISelections: Array of String; - SelectValue: Integer; - - -implementation - -uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist, USongs; - -function TScreenSongMenu.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then - begin // Key Down - if (CurMenu = SM_Playlist_New) AND (Interaction=0) then - begin - case PressedKey of - 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 - Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + chr(ScanCode); - exit; - end; - - SDLK_BACKSPACE: - begin - Button[Interaction].Text[0].DeleteLastL; - exit; - end; - end; - end; - - case PressedKey of - SDLK_Q: - begin - Result := false; - end; - - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - Music.PlayBack; - Visible := False; - end; - - SDLK_RETURN: - begin - HandleReturn; - end; - - SDLK_DOWN: InteractNext; - SDLK_UP: InteractPrev; - - SDLK_RIGHT: - begin - if (Interaction=3) then - InteractInc; - end; - SDLK_LEFT: - begin - if (Interaction=3) then - InteractDec; - end; - - SDLK_1: - begin //Jocker - //Joker spielen - case CurMenu of - SM_Party_Main: - begin - ScreenSong.DoJoker(0) - end; - end; - end; - SDLK_2: - begin //Jocker - //Joker spielen - case CurMenu of - SM_Party_Main: - begin - ScreenSong.DoJoker(1) - end; - end; - end; - SDLK_3: - begin //Jocker - //Joker spielen - case CurMenu of - SM_Party_Main: - begin - ScreenSong.DoJoker(2) - end; - end; - end; - - - end; - end; -end; - -constructor TScreenSongMenu.Create; -var - I: integer; -begin - inherited Create; - - //Create Dummy SelectSlide Entrys - SetLength(ISelections, 1); - ISelections[0] := 'Dummy'; - - - AddText(Theme.SongMenu.TextMenu); - - LoadFromTheme(Theme.SongMenu); - - AddButton(Theme.SongMenu.Button1); - if (Length(Button[0].Text) = 0) then - AddButtonText(14, 20, 'Button 1'); - - AddButton(Theme.SongMenu.Button2); - if (Length(Button[1].Text) = 0) then - AddButtonText(14, 20, 'Button 2'); - - AddButton(Theme.SongMenu.Button3); - if (Length(Button[2].Text) = 0) then - AddButtonText(14, 20, 'Button 3'); - - AddSelectSlide(Theme.SongMenu.SelectSlide3, SelectValue, ISelections); - - AddButton(Theme.SongMenu.Button4); - if (Length(Button[3].Text) = 0) then - AddButtonText(14, 20, 'Button 4'); - - - Interaction := 0; -end; - -function TScreenSongMenu.Draw: boolean; -begin - inherited Draw; -end; - -procedure TScreenSongMenu.onShow; -begin - -end; - -procedure TScreenSongMenu.MenuShow(sMenu: Byte); -begin - Interaction := 0; //Reset Interaction - Visible := True; //Set Visible - Case sMenu of - SM_Main: - begin - CurMenu := sMenu; - Text[0].Text := Language.Translate('SONG_MENU_NAME_MAIN'); - - Button[0].Visible := True; - Button[1].Visible := True; - Button[2].Visible := True; - Button[3].Visible := True; - SelectsS[0].Visible := False; - - Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY'); - Button[1].Text[0].Text := Language.Translate('SONG_MENU_CHANGEPLAYERS'); - Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD'); - Button[3].Text[0].Text := Language.Translate('SONG_MENU_EDIT'); - end; - - SM_PlayList: - begin - CurMenu := sMenu; - Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST'); - - Button[0].Visible := True; - Button[1].Visible := True; - Button[2].Visible := True; - Button[3].Visible := True; - SelectsS[0].Visible := False; - - Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY'); - Button[1].Text[0].Text := Language.Translate('SONG_MENU_CHANGEPLAYERS'); - Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_DEL'); - Button[3].Text[0].Text := Language.Translate('SONG_MENU_EDIT'); - end; - - SM_Playlist_Add: - begin - CurMenu := sMenu; - Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_ADD'); - - Button[0].Visible := True; - Button[1].Visible := False; - Button[2].Visible := False; - Button[3].Visible := True; - SelectsS[0].Visible := True; - - Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD_NEW'); - Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD_EXISTING'); - - SetLength(ISelections, Length(PlaylistMan.Playlists)); - PlaylistMan.GetNames(ISelections); - - if (Length(ISelections)>=1) then - begin - UpdateSelectSlideOptions(Theme.SongMenu.SelectSlide3, 0, ISelections, SelectValue); - end - else - begin - Button[3].Visible := False; - SelectsS[0].Visible := False; - Button[2].Visible := True; - Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING'); - end; - end; - - SM_Playlist_New: - begin - CurMenu := sMenu; - Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_NEW'); - - Button[0].Visible := True; - Button[1].Visible := False; - Button[2].Visible := True; - Button[3].Visible := True; - SelectsS[0].Visible := False; - - Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NEW_UNNAMED'); - Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NEW_CREATE'); - Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); - end; - - SM_Playlist_DelItem: - begin - CurMenu := sMenu; - Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_DELITEM'); - - Button[0].Visible := True; - Button[1].Visible := False; - Button[2].Visible := False; - Button[3].Visible := True; - SelectsS[0].Visible := False; - - Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES'); - Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); - end; - - SM_Playlist_Load: - begin - CurMenu := sMenu; - Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_LOAD'); - - //Show Delete Curent Playlist Button when Playlist is opened - Button[0].Visible := (CatSongs.CatNumShow = -3); - - Button[1].Visible := False; - Button[2].Visible := False; - Button[3].Visible := True; - SelectsS[0].Visible := True; - - Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_DELCURRENT'); - Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_LOAD'); - - SetLength(ISelections, Length(PlaylistMan.Playlists)); - PlaylistMan.GetNames(ISelections); - - if (Length(ISelections)>=1) then - begin - UpdateSelectSlideOptions(Theme.SongMenu.SelectSlide3, 0, ISelections, SelectValue); - Interaction := 3; - end - else - begin - Button[3].Visible := False; - SelectsS[0].Visible := False; - Button[2].Visible := True; - Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING'); - Interaction := 2; - end; - end; - - SM_Playlist_Del: - begin - CurMenu := sMenu; - Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_DEL'); - - Button[0].Visible := True; - Button[1].Visible := False; - Button[2].Visible := False; - Button[3].Visible := True; - SelectsS[0].Visible := False; - - Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES'); - Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); - end; - - - SM_Party_Main: - begin - CurMenu := sMenu; - Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_MAIN'); - - Button[0].Visible := True; - Button[1].Visible := False; - Button[2].Visible := False; - Button[3].Visible := True; - SelectsS[0].Visible := False; - - Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY'); - //Button[1].Text[0].Text := Language.Translate('SONG_MENU_JOKER'); - //Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYMODI'); - Button[3].Text[0].Text := Language.Translate('SONG_MENU_JOKER'); - end; - - SM_Party_Joker: - begin - CurMenu := sMenu; - Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_JOKER'); - - Button[0].Visible := (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0); - Button[1].Visible := (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0); - Button[2].Visible := (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0); - Button[3].Visible := True; - SelectsS[0].Visible := False; - - Button[0].Text[0].Text := String(PartySession.Teams.Teaminfo[0].Name); - Button[1].Text[0].Text := String(PartySession.Teams.Teaminfo[1].Name); - Button[2].Text[0].Text := String(PartySession.Teams.Teaminfo[2].Name); - Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); - - //Set right Interaction - if (not Button[0].Visible) then - begin - if (not Button[1].Visible) then - begin - if (not Button[2].Visible) then - begin - Interaction := 4; - end - else Interaction := 2; - end - else Interaction := 1; - end; - - end; - end; -end; - -procedure TScreenSongMenu.HandleReturn; -begin - Case CurMenu of - SM_Main: - begin - Case Interaction of - 0: //Button 1 - begin - ScreenSong.StartSong; - Visible := False; - end; - - 1: //Button 2 - begin - //Select New Players then Sing: - ScreenSong.SelectPlayers; - Visible := False; - end; - - 2: //Button 3 - begin - //Show add to Playlist Menu - MenuShow(SM_Playlist_Add); - end; - - 3: //SelectSlide 3 - begin - //Dummy - end; - - 4: //Button 4 - begin - ScreenSong.OpenEditor; - Visible := False; - end; - end; - end; - - SM_PlayList: - begin - Visible := False; - Case Interaction of - 0: //Button 1 - begin - ScreenSong.StartSong; - Visible := False; - end; - - 1: //Button 2 - begin - //Select New Players then Sing: - ScreenSong.SelectPlayers; - Visible := False; - end; - - 2: //Button 3 - begin - //Show add to Playlist Menu - MenuShow(SM_Playlist_DelItem); - end; - - 3: //SelectSlide 3 - begin - //Dummy - end; - - 4: //Button 4 - begin - ScreenSong.OpenEditor; - Visible := False; - end; - end; - end; - - SM_Playlist_Add: - begin - Case Interaction of - 0: //Button 1 - begin - MenuShow(SM_Playlist_New); - end; - - 3: //SelectSlide 3 - begin - //Dummy - end; - - 4: //Button 4 - begin - PlaylistMan.AddItem(ScreenSong.Interaction, SelectValue); - Visible := False; - end; - end; - end; - - SM_Playlist_New: - begin - Case Interaction of - 0: //Button 1 - begin - //Nothing, Button for Entering Name - end; - - 2: //Button 3 - begin - //Create Playlist and Add Song - PlaylistMan.AddItem( - ScreenSong.Interaction, - PlaylistMan.AddPlaylist(Button[0].Text[0].Text)); - Visible := False; - end; - - 3: //SelectSlide 3 - begin - //Cancel -> Go back to Add screen - MenuShow(SM_Playlist_Add); - end; - - 4: //Button 4 - begin - Visible := False; - end; - end; - end; - - SM_Playlist_DelItem: - begin - Visible := False; - Case Interaction of - 0: //Button 1 - begin - //Delete - PlayListMan.DelItem(PlayListMan.GetIndexbySongID(ScreenSong.Interaction)); - Visible := False; - end; - - 4: //Button 4 - begin - MenuShow(SM_Playlist); - end; - end; - end; - - SM_Playlist_Load: - begin - Case Interaction of - 0: //Button 1 (Delete Playlist) - begin - MenuShow(SM_Playlist_Del); - end; - 4: //Button 4 - begin - //Load Playlist - PlaylistMan.SetPlayList(SelectValue); - Visible := False; - end; - end; - end; - - SM_Playlist_Del: - begin - Visible := False; - Case Interaction of - 0: //Button 1 - begin - //Delete - PlayListMan.DelPlaylist(PlaylistMan.CurPlayList); - Visible := False; - end; - - 4: //Button 4 - begin - MenuShow(SM_Playlist_Load); - end; - end; - end; - - SM_Party_Main: - begin - Case Interaction of - 0: //Button 1 - begin - //Start Singing - ScreenSong.StartSong; - Visible := False; - end; - - 4: //Button 4 - begin - //Joker - MenuShow(SM_Party_Joker); - end; - end; - end; - - SM_Party_Joker: - begin - Visible := False; - Case Interaction of - 0: //Button 1 - begin - //Joker Team 1 - ScreenSong.DoJoker(0); - end; - - 1: //Button 2 - begin - //Joker Team 2 - ScreenSong.DoJoker(1); - end; - - 2: //Button 3 - begin - //Joker Team 3 - ScreenSong.DoJoker(2); - end; - - 4: //Button 4 - begin - //Cancel... (Fo back to old Menu) - MenuShow(SM_Party_Main); - end; - end; - end; - end; -end; - -end. - +unit UScreenSongMenu; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses + UMenu, + SDL, + UDisplay, + UMusic, + UFiles, + SysUtils, + UThemes; + +type + TScreenSongMenu = class(TMenu) + private + CurMenu: Byte; //Num of the cur. Shown Menu + public + Visible: Boolean; //Whether the Menu should be Drawn + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + function Draw: boolean; override; + procedure MenuShow(sMenu: Byte); + procedure HandleReturn; + end; + +const + SM_Main = 1; + + SM_PlayList = 64 or 1; + SM_Playlist_Add = 64 or 2; + SM_Playlist_New = 64 or 3; + + SM_Playlist_DelItem = 64 or 5; + + SM_Playlist_Load = 64 or 8 or 1; + SM_Playlist_Del = 64 or 8 or 5; + + + SM_Party_Main = 128 or 1; + SM_Party_Joker = 128 or 2; + +var + ISelections: Array of String; + SelectValue: Integer; + + +implementation + +uses UGraphic, + UMain, + UIni, + UTexture, + ULanguage, + UParty, + UPlaylist, + USongs; + +function TScreenSongMenu.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + if (CurMenu = SM_Playlist_New) AND (Interaction=0) then + begin + case PressedKey of + 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 + Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + chr(ScanCode); + exit; + end; + + SDLK_BACKSPACE: + begin + Button[Interaction].Text[0].DeleteLastL; + exit; + end; + end; + end; + + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + Music.PlayBack; + Visible := False; + end; + + SDLK_RETURN: + begin + HandleReturn; + end; + + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; + + SDLK_RIGHT: + begin + if (Interaction=3) then + InteractInc; + end; + SDLK_LEFT: + begin + if (Interaction=3) then + InteractDec; + end; + + SDLK_1: + begin //Jocker + //Joker spielen + case CurMenu of + SM_Party_Main: + begin + ScreenSong.DoJoker(0) + end; + end; + end; + SDLK_2: + begin //Jocker + //Joker spielen + case CurMenu of + SM_Party_Main: + begin + ScreenSong.DoJoker(1) + end; + end; + end; + SDLK_3: + begin //Jocker + //Joker spielen + case CurMenu of + SM_Party_Main: + begin + ScreenSong.DoJoker(2) + end; + end; + end; + + + end; + end; +end; + +constructor TScreenSongMenu.Create; +var + I: integer; +begin + inherited Create; + + //Create Dummy SelectSlide Entrys + SetLength(ISelections, 1); + ISelections[0] := 'Dummy'; + + + AddText(Theme.SongMenu.TextMenu); + + LoadFromTheme(Theme.SongMenu); + + AddButton(Theme.SongMenu.Button1); + if (Length(Button[0].Text) = 0) then + AddButtonText(14, 20, 'Button 1'); + + AddButton(Theme.SongMenu.Button2); + if (Length(Button[1].Text) = 0) then + AddButtonText(14, 20, 'Button 2'); + + AddButton(Theme.SongMenu.Button3); + if (Length(Button[2].Text) = 0) then + AddButtonText(14, 20, 'Button 3'); + + AddSelectSlide(Theme.SongMenu.SelectSlide3, SelectValue, ISelections); + + AddButton(Theme.SongMenu.Button4); + if (Length(Button[3].Text) = 0) then + AddButtonText(14, 20, 'Button 4'); + + + Interaction := 0; +end; + +function TScreenSongMenu.Draw: boolean; +begin + inherited Draw; +end; + +procedure TScreenSongMenu.onShow; +begin + +end; + +procedure TScreenSongMenu.MenuShow(sMenu: Byte); +begin + Interaction := 0; //Reset Interaction + Visible := True; //Set Visible + Case sMenu of + SM_Main: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_MAIN'); + + Button[0].Visible := True; + Button[1].Visible := True; + Button[2].Visible := True; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY'); + Button[1].Text[0].Text := Language.Translate('SONG_MENU_CHANGEPLAYERS'); + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_EDIT'); + end; + + SM_PlayList: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST'); + + Button[0].Visible := True; + Button[1].Visible := True; + Button[2].Visible := True; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY'); + Button[1].Text[0].Text := Language.Translate('SONG_MENU_CHANGEPLAYERS'); + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_DEL'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_EDIT'); + end; + + SM_Playlist_Add: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_ADD'); + + Button[0].Visible := True; + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := True; + SelectsS[0].Visible := True; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD_NEW'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD_EXISTING'); + + SetLength(ISelections, Length(PlaylistMan.Playlists)); + PlaylistMan.GetNames(ISelections); + + if (Length(ISelections)>=1) then + begin + UpdateSelectSlideOptions(Theme.SongMenu.SelectSlide3, 0, ISelections, SelectValue); + end + else + begin + Button[3].Visible := False; + SelectsS[0].Visible := False; + Button[2].Visible := True; + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING'); + end; + end; + + SM_Playlist_New: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_NEW'); + + Button[0].Visible := True; + Button[1].Visible := False; + Button[2].Visible := True; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NEW_UNNAMED'); + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NEW_CREATE'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); + end; + + SM_Playlist_DelItem: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_DELITEM'); + + Button[0].Visible := True; + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); + end; + + SM_Playlist_Load: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_LOAD'); + + //Show Delete Curent Playlist Button when Playlist is opened + Button[0].Visible := (CatSongs.CatNumShow = -3); + + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := True; + SelectsS[0].Visible := True; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_DELCURRENT'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_LOAD'); + + SetLength(ISelections, Length(PlaylistMan.Playlists)); + PlaylistMan.GetNames(ISelections); + + if (Length(ISelections)>=1) then + begin + UpdateSelectSlideOptions(Theme.SongMenu.SelectSlide3, 0, ISelections, SelectValue); + Interaction := 3; + end + else + begin + Button[3].Visible := False; + SelectsS[0].Visible := False; + Button[2].Visible := True; + Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING'); + Interaction := 2; + end; + end; + + SM_Playlist_Del: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_DEL'); + + Button[0].Visible := True; + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); + end; + + + SM_Party_Main: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_MAIN'); + + Button[0].Visible := True; + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY'); + //Button[1].Text[0].Text := Language.Translate('SONG_MENU_JOKER'); + //Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYMODI'); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_JOKER'); + end; + + SM_Party_Joker: + begin + CurMenu := sMenu; + Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_JOKER'); + + Button[0].Visible := (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0); + Button[1].Visible := (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0); + Button[2].Visible := (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0); + Button[3].Visible := True; + SelectsS[0].Visible := False; + + Button[0].Text[0].Text := String(PartySession.Teams.Teaminfo[0].Name); + Button[1].Text[0].Text := String(PartySession.Teams.Teaminfo[1].Name); + Button[2].Text[0].Text := String(PartySession.Teams.Teaminfo[2].Name); + Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); + + //Set right Interaction + if (not Button[0].Visible) then + begin + if (not Button[1].Visible) then + begin + if (not Button[2].Visible) then + begin + Interaction := 4; + end + else Interaction := 2; + end + else Interaction := 1; + end; + + end; + end; +end; + +procedure TScreenSongMenu.HandleReturn; +begin + Case CurMenu of + SM_Main: + begin + Case Interaction of + 0: //Button 1 + begin + ScreenSong.StartSong; + Visible := False; + end; + + 1: //Button 2 + begin + //Select New Players then Sing: + ScreenSong.SelectPlayers; + Visible := False; + end; + + 2: //Button 3 + begin + //Show add to Playlist Menu + MenuShow(SM_Playlist_Add); + end; + + 3: //SelectSlide 3 + begin + //Dummy + end; + + 4: //Button 4 + begin + ScreenSong.OpenEditor; + Visible := False; + end; + end; + end; + + SM_PlayList: + begin + Visible := False; + Case Interaction of + 0: //Button 1 + begin + ScreenSong.StartSong; + Visible := False; + end; + + 1: //Button 2 + begin + //Select New Players then Sing: + ScreenSong.SelectPlayers; + Visible := False; + end; + + 2: //Button 3 + begin + //Show add to Playlist Menu + MenuShow(SM_Playlist_DelItem); + end; + + 3: //SelectSlide 3 + begin + //Dummy + end; + + 4: //Button 4 + begin + ScreenSong.OpenEditor; + Visible := False; + end; + end; + end; + + SM_Playlist_Add: + begin + Case Interaction of + 0: //Button 1 + begin + MenuShow(SM_Playlist_New); + end; + + 3: //SelectSlide 3 + begin + //Dummy + end; + + 4: //Button 4 + begin + PlaylistMan.AddItem(ScreenSong.Interaction, SelectValue); + Visible := False; + end; + end; + end; + + SM_Playlist_New: + begin + Case Interaction of + 0: //Button 1 + begin + //Nothing, Button for Entering Name + end; + + 2: //Button 3 + begin + //Create Playlist and Add Song + PlaylistMan.AddItem( + ScreenSong.Interaction, + PlaylistMan.AddPlaylist(Button[0].Text[0].Text)); + Visible := False; + end; + + 3: //SelectSlide 3 + begin + //Cancel -> Go back to Add screen + MenuShow(SM_Playlist_Add); + end; + + 4: //Button 4 + begin + Visible := False; + end; + end; + end; + + SM_Playlist_DelItem: + begin + Visible := False; + Case Interaction of + 0: //Button 1 + begin + //Delete + PlayListMan.DelItem(PlayListMan.GetIndexbySongID(ScreenSong.Interaction)); + Visible := False; + end; + + 4: //Button 4 + begin + MenuShow(SM_Playlist); + end; + end; + end; + + SM_Playlist_Load: + begin + Case Interaction of + 0: //Button 1 (Delete Playlist) + begin + MenuShow(SM_Playlist_Del); + end; + 4: //Button 4 + begin + //Load Playlist + PlaylistMan.SetPlayList(SelectValue); + Visible := False; + end; + end; + end; + + SM_Playlist_Del: + begin + Visible := False; + Case Interaction of + 0: //Button 1 + begin + //Delete + PlayListMan.DelPlaylist(PlaylistMan.CurPlayList); + Visible := False; + end; + + 4: //Button 4 + begin + MenuShow(SM_Playlist_Load); + end; + end; + end; + + SM_Party_Main: + begin + Case Interaction of + 0: //Button 1 + begin + //Start Singing + ScreenSong.StartSong; + Visible := False; + end; + + 4: //Button 4 + begin + //Joker + MenuShow(SM_Party_Joker); + end; + end; + end; + + SM_Party_Joker: + begin + Visible := False; + Case Interaction of + 0: //Button 1 + begin + //Joker Team 1 + ScreenSong.DoJoker(0); + end; + + 1: //Button 2 + begin + //Joker Team 2 + ScreenSong.DoJoker(1); + end; + + 2: //Button 3 + begin + //Joker Team 3 + ScreenSong.DoJoker(2); + end; + + 4: //Button 4 + begin + //Cancel... (Fo back to old Menu) + MenuShow(SM_Party_Main); + end; + end; + end; + end; +end; + +end. + diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index f7961727..223ad2b2 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -1,231 +1,285 @@ -unit UScreenStatMain; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - -uses - UMenu, SDL, SysUtils, UDisplay, UMusic, UIni, UThemes; - -type - TScreenStatMain = class(TMenu) - private - //Some Stat Value that don't need to be calculated 2 times - SongswithVid: Cardinal; - public - TextOverview: integer; - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - procedure onShow; override; - procedure SetAnimationProgress(Progress: real); override; - - procedure SetOverview; - end; - -implementation - -uses UGraphic, UDataBase, USongs, ULanguage, windows, ULog; - -function TScreenStatMain.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 - Ini.Save; - Music.PlayBack; - FadeTo(@ScreenMain); - end; - SDLK_RETURN: - begin - //Exit Button Pressed - if Interaction = 4 then begin - Music.PlayBack; - FadeTo(@ScreenMain); - end - else //One of the Stats Buttons Pressed - begin - Music.PlayBack; - ScreenStatDetail.Typ := Interaction; - FadeTo(@ScreenStatDetail); - end; - end; - SDLK_LEFT: - begin - InteractPrev; - end; - SDLK_RIGHT: - begin - InteractNext; - end; - SDLK_UP: - begin - InteractPrev; - end; - SDLK_DOWN: - begin - InteractNext; - end; - end; - end; -end; - -constructor TScreenStatMain.Create; -var - I: integer; -begin - inherited Create; - - TextOverview := AddText(Theme.StatMain.TextOverview); - - LoadFromTheme(Theme.StatMain); - - AddButton(Theme.StatMain.ButtonScores); - if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.StatDetail.Description[0]); - - AddButton(Theme.StatMain.ButtonSingers); - if (Length(Button[1].Text)=0) then - AddButtonText(14, 20, Theme.StatDetail.Description[1]); - - AddButton(Theme.StatMain.ButtonSongs); - if (Length(Button[2].Text)=0) then - AddButtonText(14, 20, Theme.StatDetail.Description[2]); - - AddButton(Theme.StatMain.ButtonBands); - if (Length(Button[3].Text)=0) then - AddButtonText(14, 20, Theme.StatDetail.Description[3]); - - AddButton(Theme.StatMain.ButtonExit); - if (Length(Button[4].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[4]); - - Interaction := 0; - - //Set Songs with Vid - SongswithVid := 0; - For I := 0 to high(Songs.Song) do - if (Songs.Song[I].Video <> '') then - Inc(SongswithVid); -end; - -procedure TScreenStatMain.onShow; -begin - //Set Overview Text: - SetOverview; -end; - -procedure TScreenStatMain.SetOverview; -var - Overview, Formatstr: String; - I: Integer; - //Some Vars to Save Attributes to - A1, A2, A3: Integer; - A4, A5: String; - Result1, Result2: AStatResult; - ResetTime: TSystemTime; - function GetFileCreation(Filename: String): TSystemTime; - var - FindData: TWin32FindData; - Handle: THandle; - begin - Handle := FindFirstFile(PChar(Filename), FindData); - if Handle <> INVALID_HANDLE_VALUE then - begin - FileTimeToSystemTime(FindData.ftCreationTime, Result); - Windows.FindClose(Handle); - end; - end; -begin - //Song Overview - - //Introduction - Formatstr := Language.Translate ('STAT_OVERVIEW_INTRO'); - {Format: - %0:d Ultrastar Version - %1:d Day of Reset (A1) - %2:d Month of Reset (A2) - %3:d Year of Reset (A3)} - - ResetTime := GetFileCreation(Database.Filename); - - A1 := ResetTime.wDay; - A2 := ResetTime.wMonth; - A3 := ResetTime.wYear; - try - Overview := Format(Formatstr, [Language.Translate('US_VERSION'), A1, A2, A3]); - except - on E: EConvertError do - Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_INTRO": ' + E.Message); - end; - - Formatstr := Language.Translate ('STAT_OVERVIEW_SONG'); - {Format: - %0:d Count Songs (A1) - %1:d Count of Sung Songs (A2) - %2:d Count of UnSung Songs - %3:d Count of Songs with Video (A3) - %4:s Name of the most popular Song} - A1 := Length(Songs.Song); - A2 := Database.GetTotalEntrys(2); - - A3 := SongswithVid; - - SetLength(Result1, 1); - Database.GetStats(Result1, 2, 1, 0, False); - A4 := Result1[0].Artist; - A5 := Result1[0].Title; - - try - Overview := Overview + '\n \n' + Format(Formatstr, [A1, A2, A1-A2, A3, A4, A5]); - except - on E: EConvertError do - Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_SONG": ' + E.Message); - end; - - //Player Overview - Formatstr := Language.Translate ('STAT_OVERVIEW_PLAYER'); - {Format: - %0:d Count Players (A1) - %1:s Best Player (Result) - %2:d Best Players Score - %3:s Best Score Player (Result2) - %4:d Best Score} - A1 := Database.GetTotalEntrys(1); - - SetLength(Result1, 1); - Database.GetStats(Result1, 1, 1, 0, False); - - SetLength(Result2, 1); - Database.GetStats(Result2, 0, 1, 0, False); - - try - Overview := Overview + '\n \n' + Format(Formatstr, [A1, Result1[0].Player, Result1[0].AverageScore, Result2[0].Singer, Result2[0].Score]); - except - on E: EConvertError do - Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_PLAYER": ' + E.Message); - end; - - Text[0].Text := Overview; -end; - - -procedure TScreenStatMain.SetAnimationProgress(Progress: real); -var I: Integer; -begin - For I := 0 to high(Button) do - Button[I].Texture.ScaleW := Progress; -end; - -end. +unit UScreenStatMain; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +uses + UMenu, + SDL, + SysUtils, + UDisplay, + UMusic, + UIni, + UThemes; + +type + TScreenStatMain = class(TMenu) + private + //Some Stat Value that don't need to be calculated 2 times + SongswithVid: Cardinal; + public + TextOverview: integer; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + + procedure SetOverview; + end; + +implementation + +uses UGraphic, + UDataBase, + USongs, + ULanguage, + UCommon, + {$IFDEF win32} + windows, + {$ELSE} + sysconst, + {$ENDIF} + ULog; + +function TScreenStatMain.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 + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenMain); + end; + SDLK_RETURN: + begin + //Exit Button Pressed + if Interaction = 4 then begin + Music.PlayBack; + FadeTo(@ScreenMain); + end + else //One of the Stats Buttons Pressed + begin + Music.PlayBack; + ScreenStatDetail.Typ := Interaction; + FadeTo(@ScreenStatDetail); + end; + end; + SDLK_LEFT: + begin + InteractPrev; + end; + SDLK_RIGHT: + begin + InteractNext; + end; + SDLK_UP: + begin + InteractPrev; + end; + SDLK_DOWN: + begin + InteractNext; + end; + end; + end; +end; + +constructor TScreenStatMain.Create; +var + I: integer; +begin + inherited Create; + + TextOverview := AddText(Theme.StatMain.TextOverview); + + LoadFromTheme(Theme.StatMain); + + AddButton(Theme.StatMain.ButtonScores); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.StatDetail.Description[0]); + + AddButton(Theme.StatMain.ButtonSingers); + if (Length(Button[1].Text)=0) then + AddButtonText(14, 20, Theme.StatDetail.Description[1]); + + AddButton(Theme.StatMain.ButtonSongs); + if (Length(Button[2].Text)=0) then + AddButtonText(14, 20, Theme.StatDetail.Description[2]); + + AddButton(Theme.StatMain.ButtonBands); + if (Length(Button[3].Text)=0) then + AddButtonText(14, 20, Theme.StatDetail.Description[3]); + + AddButton(Theme.StatMain.ButtonExit); + if (Length(Button[4].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[4]); + + Interaction := 0; + + //Set Songs with Vid + SongswithVid := 0; + For I := 0 to high(Songs.Song) do + if (Songs.Song[I].Video <> '') then + Inc(SongswithVid); +end; + +procedure TScreenStatMain.onShow; +begin + //Set Overview Text: + SetOverview; +end; + +procedure TScreenStatMain.SetOverview; +type + TwSystemTime = record + wYear, + wMonth, + wDayOfWeek, + wDay, + wHour, + wMinute, + wSecond, + wMilliseconds: Word; + end; +var + Overview, Formatstr: String; + I: Integer; + //Some Vars to Save Attributes to + A1, A2, A3: Integer; + A4, A5: String; + Result1, Result2: AStatResult; + ResetTime: TSystemTime; + + {$IFDEF win32} + function GetFileCreation(Filename: String): TSystemTime; + var + FindData: TWin32FindData; + Handle: THandle; + begin + Handle := FindFirstFile(PChar(Filename), FindData); + if Handle <> INVALID_HANDLE_VALUE then + begin + FileTimeToSystemTime(FindData.ftCreationTime, Result); + windows.FindClose(Handle); + end; + end; + + {$ELSE} + + function GetFileCreation(Filename: String): TSystemTime; + Var + F,D : Longint; + Begin + F:=FileCreate( Filename ); + try + D:=FileGetDate(F); + DateTimeToSystemTime( FileDateToDateTime(D) , result); + finally + FileClose(F); + end; + end; + {$ENDIF} + +begin + //Song Overview + + //Introduction + Formatstr := Language.Translate ('STAT_OVERVIEW_INTRO'); + (*Format: + %0:d Ultrastar Version + %1:d Day of Reset (A1) + %2:d Month of Reset (A2) + %3:d Year of Reset (A3)*) + + ResetTime := GetFileCreation(Database.Filename); + + {$IFDEF win32} + A1 := ResetTime.wDay; + A2 := ResetTime.wMonth; + A3 := ResetTime.wYear; + {$ELSE} + A1 := ResetTime.Day; + A2 := ResetTime.Month; + A3 := ResetTime.Year; + {$ENDIF} + + + try + Overview := Format(Formatstr, [Language.Translate('US_VERSION'), A1, A2, A3]); + except + on E: EConvertError do + Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_INTRO": ' + E.Message); + end; + + Formatstr := Language.Translate ('STAT_OVERVIEW_SONG'); + {Format: + %0:d Count Songs (A1) + %1:d Count of Sung Songs (A2) + %2:d Count of UnSung Songs + %3:d Count of Songs with Video (A3) + %4:s Name of the most popular Song} + A1 := Length(Songs.Song); + A2 := Database.GetTotalEntrys(2); + + A3 := SongswithVid; + + SetLength(Result1, 1); + Database.GetStats(Result1, 2, 1, 0, False); + A4 := Result1[0].Artist; + A5 := Result1[0].Title; + + try + Overview := Overview + '\n \n' + Format(Formatstr, [A1, A2, A1-A2, A3, A4, A5]); + except + on E: EConvertError do + Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_SONG": ' + E.Message); + end; + + //Player Overview + Formatstr := Language.Translate ('STAT_OVERVIEW_PLAYER'); + {Format: + %0:d Count Players (A1) + %1:s Best Player (Result) + %2:d Best Players Score + %3:s Best Score Player (Result2) + %4:d Best Score} + A1 := Database.GetTotalEntrys(1); + + SetLength(Result1, 1); + Database.GetStats(Result1, 1, 1, 0, False); + + SetLength(Result2, 1); + Database.GetStats(Result2, 0, 1, 0, False); + + try + Overview := Overview + '\n \n' + Format(Formatstr, [A1, Result1[0].Player, Result1[0].AverageScore, Result2[0].Singer, Result2[0].Score]); + except + on E: EConvertError do + Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_PLAYER": ' + E.Message); + end; + + Text[0].Text := Overview; +end; + + +procedure TScreenStatMain.SetAnimationProgress(Progress: real); +var I: Integer; +begin + For I := 0 to high(Button) do + Button[I].Texture.ScaleW := Progress; +end; + +end. -- cgit v1.2.3 From 26d8c209beba866f111a9d047bf1a70fe245b75d Mon Sep 17 00:00:00 2001 From: b1indy Date: Thu, 20 Sep 2007 07:19:45 +0000 Subject: new lyrics stuff; it's broken (lyrics don't show) and in "debug" mode (weird stuff going on in the singscreen) but i'm tired of editing conflicts git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@412 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditSub.pas | 2 +- Game/Code/Screens/UScreenSing.pas | 2557 +++++++++++++++++----------------- 2 files changed, 1302 insertions(+), 1257 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 3843fbf4..93a4892a 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -16,7 +16,7 @@ uses ULog, UTexture, UMenuText, - ULyrics, + ULyrics.bak, Math, OpenGL12, {$IFDEF UseMIDIPort} diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 343a2e6d..ff6bfe20 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1,1256 +1,1301 @@ -unit UScreenSing; - -interface - -{$I switches.inc} - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - -uses UMenu, - UMusic, - SDL, - SysUtils, - UFiles, - UTime, - USongs, - UIni, - ULog, - UTexture, - ULyrics, - TextGL, - OpenGL12, - {$IFDEF useBASS} - bass, - {$ENDIF} - UThemes, - ULCD, - UGraphicClasses, - UVideo; - -type - TScreenSing = class(TMenu) - protected - paused: boolean; //Pause Mod - PauseTime: Real; - NumEmptySentences: integer; - public - //TextTime: integer; - - //TimeBar mod - StaticTimeProgress: integer; - TextTimeText: integer; - //eoa TimeBar mod - - StaticP1: integer; - StaticP1ScoreBG: integer; - TextP1: integer; - TextP1Score: integer; - - //moveable singbar mod - StaticP1SingBar: integer; - StaticP1ThreePSingBar: integer; - StaticP1TwoPSingBar: integer; - StaticP2RSingBar: integer; - StaticP2MSingBar: integer; - StaticP3SingBar: integer; - //eoa moveable singbar - - //Added for ps3 skin - //shown when game is in 2/4 player modus - StaticP1TwoP: integer; - StaticP1TwoPScoreBG: integer; - TextP1TwoP: integer; - TextP1TwoPScore: integer; - //shown when game is in 3/6 player modus - StaticP1ThreeP: integer; - StaticP1ThreePScoreBG: integer; - TextP1ThreeP: integer; - TextP1ThreePScore: integer; - //eoa - - StaticP2R: integer; - StaticP2RScoreBG: integer; - TextP2R: integer; - TextP2RScore: integer; - - StaticP2M: integer; - StaticP2MScoreBG: integer; - TextP2M: integer; - TextP2MScore: integer; - - StaticP3R: integer; - StaticP3RScoreBG: integer; - TextP3R: integer; - TextP3RScore: integer; - - Tex_Background: TTexture; - FadeOut: boolean; - LyricMain: TLyric; - LyricSub: TLyric; - - constructor Create; override; - procedure onShow; override; - procedure onShowFinish; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure Finish; virtual; - procedure UpdateLCD; - procedure Pause; //Pause Mod(Toggles Pause) - - //OnSentenceEnd for LineBonus + Singbar - procedure onSentenceEnd(S: Cardinal); - //OnSentenceChange (for Golden Notes) - procedure onSentenceChange(S: Cardinal); - end; - -implementation -uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math; - -// Method for input parsing. If False is returned, GetNextWindow -// should be checked to know the next window to load; -function TScreenSing.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then - begin // Key Down - case PressedKey of - SDLK_Q: - begin - //When not ask before Exit then Finish now - if (Ini.AskbeforeDel <> 1) then - Finish - //else just Pause and let the Popup make the Work - else if not paused then - Pause; - - Result := false; - end; - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - //Record Sound Hack: - //Sound[0].BufferLong - - Finish; - Music.PlayBack; - FadeTo(@ScreenScore); - end; - - SDLK_P://Pause Mod - begin - Pause; - end; - - SDLK_RETURN: - begin - 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 : - begin - end; - SDLK_UP : - begin - end; - end; - end; -end; - -//Pause Mod -procedure TScreenSing.Pause; -begin - if not paused then //Pause einschalten - begin - // pause Time - PauseTime := Czas.Teraz; - Paused := true; - - // pause Music - Music.Pause; - - // pause Video - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then - FFmpegTogglePause; - end - else //Pause ausschalten - begin - Czas.Teraz := PauseTime; //Position of Notes - - // Position of Music - Music.MoveTo (PauseTime); - // Play Music - Music.Play; - - // Video - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then - FFmpegTogglePause; - //SkipSmpeg(PauseTime); - - Paused := false; - end; -end; -//Pause Mod End - -constructor TScreenSing.Create; -var - I: integer; - P: integer; -begin - inherited Create; - - LoadFromTheme(Theme.Sing); - - //TimeBar - StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); - TextTimeText := AddText(Theme.Sing.TextTimeText); - -// 1 player | P1 - StaticP1 := AddStatic(Theme.Sing.StaticP1); - StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); - TextP1 := AddText(Theme.Sing.TextP1); - TextP1Score := AddText(Theme.Sing.TextP1Score); - StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar); - -// 2 or 4 players | P1 - StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); - StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG); - TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); - TextP1TwoPScore := AddText(Theme.Sing.TextP1TwoPScore); - StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); - - // | P2 - StaticP2R := AddStatic(Theme.Sing.StaticP2R); - StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); - TextP2R := AddText(Theme.Sing.TextP2R); - TextP2RScore := AddText(Theme.Sing.TextP2RScore); - StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); - -// 3 or 6 players | P1 - StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); - StaticP1ThreePScoreBG := AddStatic(Theme.Sing.StaticP1ThreePScoreBG); - TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); - TextP1ThreePScore := AddText(Theme.Sing.TextP1ThreePScore); - StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar); - - // | P2 - StaticP2M := AddStatic(Theme.Sing.StaticP2M); - StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG); - TextP2M := AddText(Theme.Sing.TextP2M); - TextP2MScore := AddText(Theme.Sing.TextP2MScore); - StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar); - - // | P3 - StaticP3R := AddStatic(Theme.Sing.StaticP3R); - StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG); - TextP3R := AddText(Theme.Sing.TextP3R); - TextP3RScore := AddText(Theme.Sing.TextP3RScore); - StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar); - - if ScreenAct = 2 then begin - // katze und affe - - end; - - LyricMain := TLyric.Create; - LyricSub := TLyric.Create; - - UVideo.Init; -end; - -procedure TScreenSing.onShow; -var - P: integer; - V1: boolean; - V1TwoP: boolean; //added for ps3 skin - V1ThreeP: boolean; //added for ps3 skin - V2R: boolean; - V2M: boolean; - V3R: boolean; - NR: TRecR; //Line Bonus Mod -begin - Log.LogStatus('Begin', 'onShow'); - FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented - - // prepare players - SetLength(Player, PlayersPlay); -// Player[0].ScoreTotalI := 0; - - case PlayersPlay of - 1: begin - V1 := true; - V1TwoP := false; - V1ThreeP := false; - V2R := false; - V2M := false; - V3R := false; - end; - 2: begin - V1 := false; - V1TwoP := true; - V1ThreeP := false; - V2R := true; - V2M := false; - V3R := false; - end; - 3: begin - V1 := false; - V1TwoP := false; - V1ThreeP := true; - V2R := false; - V2M := true; - V3R := true; - end; - 4: begin // double screen - V1 := false; - V1TwoP := true; - V1ThreeP := false; - V2R := true; - V2M := false; - V3R := false; - end; - 6: begin // double screen - V1 := false; - V1TwoP := false; - V1ThreeP := true; - V2R := false; - V2M := true; - V3R := true; - end; - - end; - - //This one is shown in 1P mode - Static[StaticP1].Visible := V1; - Static[StaticP1ScoreBG].Visible := V1; - Text[TextP1].Visible := V1; - Text[TextP1Score].Visible := V1; - - - //This one is shown in 2/4P mode - Static[StaticP1TwoP].Visible := V1TwoP; - Static[StaticP1TwoPScoreBG].Visible := V1TwoP; - Text[TextP1TwoP].Visible := V1TwoP; - Text[TextP1TwoPScore].Visible := V1TwoP; - - Static[StaticP2R].Visible := V2R; - Static[StaticP2RScoreBG].Visible := V2R; - Text[TextP2R].Visible := V2R; - Text[TextP2RScore].Visible := V2R; - - - //This one is shown in 3/6P mode - Static[StaticP1ThreeP].Visible := V1ThreeP; - Static[StaticP1ThreePScoreBG].Visible := V1ThreeP; - Text[TextP1ThreeP].Visible := V1ThreeP; - Text[TextP1ThreePScore].Visible := V1ThreeP; - - Static[StaticP2M].Visible := V2M; - Static[StaticP2MScoreBG].Visible := V2M; - Text[TextP2M].Visible := V2M; - Text[TextP2MScore].Visible := V2M; - - Static[StaticP3R].Visible := V3R; - Static[StaticP3RScoreBG].Visible := V3R; - Text[TextP3R].Visible := V3R; - Text[TextP3RScore].Visible := V3R; - - // load notes - ResetSingTemp; -// Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); - AktSong := CatSongs.Song[CatSongs.Selected]; - try - if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName) then - begin - //Error Loading Song -> Go back to Song Screen and Show some Error Message - FadeTo(@ScreenSong); - //Select New Song in Party Mode - if ScreenSong.Mode = 1 then - ScreenSong.SelectRandomSong; - ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); - Exit; - end; - except - //Error Loading Song -> Go back to Song Screen and Show some Error Message - FadeTo(@ScreenSong); - //Select New Song in Party Mode - if ScreenSong.Mode = 1 then - ScreenSong.SelectRandomSong; - ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); - Exit; - end; - AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; -// AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed - - // set movie - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin -(* OpenSmpeg(AktSong.Path + AktSong.Video); - SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*) - - // todo: VideoGap and Start time verwursten - FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); - FFmpegSkip(AktSong.VideoGAP + AktSong.Start); - AktSong.VideoLoaded := true; - end; - - // set background - if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then - try - Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background); - except - log.LogError('Background could not be loaded: ' + AktSong.Path + AktSong.Background); - Tex_Background.TexNum := -1; - end - else - Tex_Background.TexNum := -1; - - - - // play music (I) - Music.CaptureStart; - Music.MoveTo(AktSong.Start); -// Music.Play; - - // prepare timer (I) -// CountSkipTimeSet; - Czas.Teraz := AktSong.Start; - Czas.Razem := Music.Length; - if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000; - Czas.OldBeat := -1; - for P := 0 to High(Player) do - ClearScores(P); - - // main text - LyricMain.Clear; - LyricMain.X := 400; - LyricMain.Y := Skin_LyricsT; - LyricMain.Scale := 1.4; //1.4 - LyricMain.Align := 1; - - // sub text - LyricSub.Clear; - LyricSub.X := 400; - LyricSub.Y := Skin_LyricsT + 35; //42 //40 - LyricSub.Align := 1; - - // set custom options - case Ini.LyricsFont of - 0: - begin - LyricMain.FontStyle := 0; - LyricSub.FontStyle := 0; - LyricMain.Size := 14; // 13 - LyricSub.Size := 14; // 13 - LyricMain.ColR := Skin_FontR; - LyricMain.ColG := Skin_FontG; - LyricMain.ColB := Skin_FontB; //Change für Crazy Joker - {LyricMain.ColSR := Skin_FontHighlightR; - LyricMain.ColSG := Skin_FontHighlightG; - LyricMain.ColSB := Skin_FontHighlightB;1aa5dc} - LyricMain.ColSR := 5/255; //26 - LyricMain.ColSG := 163/255; //165 - LyricMain.ColSB := 210/255; //220 - - LyricSub.ColR := 0.4; //0.6 - LyricSub.ColG := 0.4; //0.6 - LyricSub.ColB := 0.4; //0.6 - end; - 1: - begin - LyricMain.FontStyle := 2; - LyricSub.FontStyle := 2; - LyricMain.Size := 14; - LyricSub.Size := 14; - LyricMain.ColR := 0.75; - LyricMain.ColG := 0.75; - LyricMain.ColB := 1; - LyricMain.ColSR := 0.5; - LyricMain.ColSG := 0.5; - LyricMain.ColSB := 1; - LyricSub.ColR := 0.8; - LyricSub.ColG := 0.8; - LyricSub.ColB := 0.8; - end; - 2: - begin - LyricMain.FontStyle := 3; - LyricSub.FontStyle := 3; - LyricMain.Size := 12; - LyricSub.Size := 12; - LyricMain.ColR := 0.75; - LyricMain.ColG := 0.75; - LyricMain.ColB := 1; - LyricMain.ColSR := 0.5; - LyricMain.ColSG := 0.5; - LyricMain.ColSB := 1; - LyricSub.ColR := 0.8; - LyricSub.ColG := 0.8; - LyricSub.ColB := 0.8; - end; - end; // case - - case Ini.LyricsEffect of - 0: LyricMain.Style := 1; // 0 - one selected, 1 - selected all to the current - 1: LyricMain.Style := 2; - 2: LyricMain.Style := 3; - 3: LyricMain.Style := 4; - end; // case - - // fill texts - LyricMain.AddCzesc(0); - LyricMain.Selected := -1; - LyricSub.AddCzesc(1); - LyricSub.Selected := -1; - - UpdateLCD; - - //Deactivate Pause - Paused := False; - - //Kill all Stars not Killed yet - //GoldenStarsTwinkle Mod - GoldenRec.SentenceChange; - //GoldenStarsTwinkle Mod End - - //Set Position of Line Bonus - PhrasenBonus - if (Ini.LineBonus = 1) then //Show Line Bonus at Scores - begin - Case PlayersPlay of - 1: begin - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; - end; - - 2: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.X; - Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.X; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.X; - Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - end; - - 3: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - end; - - 4: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; - - //P4 - Player[3].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; - Player[3].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[3].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; - Player[3].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - end; - - 6: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - - //P4 - Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[3].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; - Player[3].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[3].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; - - //P5 - Player[4].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[4].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[4].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[4].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P6 - Player[5].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[5].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[5].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[5].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - end; - end; - end - else if (Ini.LineBonus = 2) then //Show Line Bonus at Notes - begin - - // positions - if Ini.SingWindow = 0 then begin - NR.Left := 120; - end else begin - NR.Left := 20; - end; - NR.Right := 780; - - NR.Width := NR.Right - NR.Left; - NR.WMid := NR.Width / 2; - NR.Mid := NR.Left + NR.WMid; - - Case PlayersPlay of - 1: begin - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := Skin_P2_NotesB - 105; - end; - - 2: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - end; - - 3: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := 120 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := 120 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := 245 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := 245 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_TargetY := 370 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_StartY := 370 + 28; - end; - - 4: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P4 - Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - end; - - 6: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := 120 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := 120 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := 245 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := 245 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_TargetY := 370 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_StartY := 370 + 28; - - //P4 - Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_TargetY := 120 - 65 + 28; - Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_StartY := 120 + 28; - - //P5 - Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[4].LineBonus_TargetY := 245 - 65 + 28; - Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[4].LineBonus_StartY := 245 + 28; - - //P6 - Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[5].LineBonus_TargetY := 370 - 65 + 28; - Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[5].LineBonus_StartY := 370 + 28; - end; - end; - end; - //Set Position of Line Bonus - PhrasenBonus End - //Set Num of Empty Sentences for Phrasen Bonus - NumEmptySentences := 0; - for P := low(Czesci[0].Czesc) to high(Czesci[0].Czesc) do - if Czesci[0].Czesc[P].TotalNotes = 0 then Inc(NumEmptySentences); - - Log.LogStatus('End', 'onShow'); -end; - -procedure TScreenSing.onShowFinish; -begin - // play movie (II) - - if AktSong.VideoLoaded then - begin - try - FFmpegGetFrame(Czas.Teraz); - FFmpegDrawGL(ScreenAct); -// PlaySmpeg; - except - //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video - AktSong.VideoLoaded := False; - Log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); - Log.LogError('Corrupted File: ' + AktSong.Video); - try -// CloseSmpeg; - FFmpegClose; - except - - end; - end; - end; - - // play music (II) - Music.Play; - - // prepare timer (II) - CountSkipTimeSet; -end; - -function TScreenSing.Draw: boolean; -var - Min: integer; - Sec: integer; - Tekst: string; - Flash: real; - S: integer; - T: integer; -begin - - - - //ScoreBG Mod | den wirren Scheiss hier brauch mer nimmer, wir haben colorized png's - no need for wirrness also - // set player colors - macht nichts weiter als die farben des statics zu wechseln, was zu unschönen effekten bei colorized png führt -{ if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - end; - if ScreenAct = 2 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P4Dark'); - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P3Dark'); - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); - end; - if ScreenAct = 2 then begin - - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P6Dark'); - - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); - end; - end; - } - - // set player names (for 2 screens and only Singstar skin) - if ScreenAct = 1 then begin - Text[TextP1].Text := 'P1'; - Text[TextP1TwoP].Text := 'P1'; - Text[TextP1ThreeP].Text := 'P1'; - Text[TextP2R].Text := 'P2'; - Text[TextP2M].Text := 'P2'; - Text[TextP3R].Text := 'P3'; - end; - - if ScreenAct = 2 then begin - case PlayersPlay of -{ 1: begin - Text[TextP1].Text := 'P2'; - end; - 2: begin - Text[TextP1].Text := 'P3'; - Text[TextP2R].Text := 'P4'; - end; - 3: begin - Text[TextP1].Text := 'P4'; - Text[TextP2M].Text := 'P5'; - Text[TextP3R].Text := 'P6'; - end;} - - 4: begin - Text[TextP1TwoP].Text := 'P3'; - Text[TextP2R].Text := 'P4'; - end; - 6: begin - Text[TextP1ThreeP].Text := 'P4'; - Text[TextP2M].Text := 'P5'; - Text[TextP3R].Text := 'P6'; - end; - end; // case - end; // if - - // stereo - -// weird stuff, maybe this is for "dual screen?", but where is player three then? | okay, i commented the stuff out the other day - nothing was missing on screen w/ 6 players - so do we even need this stuff? -// okay this stuff appears again some lines beneath this one, I commented it out for testing what it does - seems like it's doing nothing -// but I might be wrong, so what is this stuff here doing? O.o - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; - - Text[TextP1].X := Text[TextP1].X + 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; - - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; - Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; - - Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; -// end of weird stuff - - for S := 1 to 1 do //wtf? - Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X + 10*ScreenX; - - // update static menu with time ... - Min := Round(Czas.Teraz) div 60; - Sec := Round(Czas.Teraz) mod 60; - Text[TextTimeText].Text := ''; - if Min < 10 then Text[TextTimeText].Text := '0'; - Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':'; - if Sec < 10 then Text[TextTimeText].Text := Text[TextTimeText].Text + '0'; - Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec); - - // .. and scores - if PlayersPlay = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; - end; - - if PlayersPlay = 2 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - - if PlayersPlay = 3 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[4].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[5].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - end; - - // draw static menu (BG) - DrawBG; - //Draw Background - SingDrawBackground; - // update and draw movie - if ShowFinish and AktSong.VideoLoaded then begin - try -// UpdateSmpeg; // this only draws - // todo: find a way to determine, when a new frame is needed - // toto: same for the need to skip frames - FFmpegGetFrame(Czas.Teraz); - FFmpegDrawGL(ScreenAct); - except - //If an Error occurs drawing: prevent Video from being Drawn again and Close Video - AktSong.VideoLoaded := False; - log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); - Log.LogError('Corrupted File: ' + AktSong.Video); - try -// CloseSmpeg; - FFmpegClose; - except - - end; - end; - end; - - // draw static menu (FG) - DrawFG; - - // check for music finish -// Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(AktSong.Finish)); - if ShowFinish then begin - if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin - //Pause Mod: - if not Paused then - Sing(Self); // analyze song - end else begin -// Log.LogError('End'); - if not FadeOut then begin -// Log.LogError('End2'); - Finish; - FadeOut := true; - FadeTo(@ScreenScore); - end; - end; - end; - - // draw custom items - SingDraw; // always draw - -//GoldenNoteStarsTwinkle Mod - GoldenRec.SpawnRec; -//GoldenNoteStarsTwinkle Mod - - // back stereo - -// weird stuff, maybe this is for "dual screen?", but where is player three then? -// okay this stuff appears again some lines above this one, I commented it out for testing what it does - seems like it's doing nothing -// but I might be wrong, so what is this stuff here doing? O.o - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; - - Text[TextP1].X := Text[TextP1].X - 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; - - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; - Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; - - Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; -//weird end - - for S := 1 to 1 do // wtf? - Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X - 10*ScreenX; - -end; - -procedure TScreenSing.Finish; -begin - Music.CaptureStop; - Music.Stop; - - if Ini.SavePlayback = 1 then begin - Log.BenchmarkStart(0); - Log.LogVoice(0); - Log.LogVoice(1); - Log.LogVoice(2); - Log.BenchmarkEnd(0); - Log.LogBenchmark('Creating files', 0); - end; - - if AktSong.VideoLoaded then begin -// CloseSmpeg; - FFmpegClose; - AktSong.VideoLoaded := false; // to prevent drawing closed video - end; - - SetFontItalic (False); -end; - -procedure TScreenSing.UpdateLCD; -var - T: string; -begin - LCD.HideCursor; - LCD.Clear; - - T := LyricMain.Text; - if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; - LCD.AddTextBR(T); - - T := LyricSub.Text; - if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; - LCD.AddTextBR(T); -end; - -procedure TScreenSing.onSentenceEnd(S: Cardinal); -var -I: Integer; -A: Real; -B: integer; //Max Points for Notes -begin - - //Check for Empty Sentence - if (Czesci[0].Czesc[S].TotalNotes<=0) then - exit; - - //Set Max Note Points - if (Ini.LineBonus > 0) then - B := 9000 - else - B := 10000; - - for I := 0 to High(Player) do begin - A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2; - - //SingBar Mod - If ({(Ini.Oscilloscope = 2) and }(Czesci[0].Czesc[S].TotalNotes>0)) then - begin - Player[I].ScorePercentTarget := Player[I].ScorePercentTarget + floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 40 - 26); - if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0; - if Player[I].ScorePercentTarget > 99 then Player[I].ScorePercentTarget := 99; - - //end Singbar Mod - end; - - //PhrasenBonus - Line Bonus Mod - - //Generate Steps 0 to 8 - A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); - - If (Ini.LineBonus > 0) then - begin - - //Generate Text - if A >= 8 then - Player[I].LineBonus_Text := Theme.Sing.LineBonusText[8] - else - Player[I].LineBonus_Text := Theme.Sing.LineBonusText[Floor(A)]; - - //PhrasenBonus give Points - Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8); - Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10; - //Update Total Score - Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; - - //Color - Case Floor(A) of - 0: begin - Player[I].LineBonus_Color.R := 1; - Player[I].LineBonus_Color.G := 0; - Player[I].LineBonus_Color.B := 0; - end; - 1..3: begin - Player[I].LineBonus_Color.R := 1; - Player[I].LineBonus_Color.G := (A * 0.25); - Player[I].LineBonus_Color.B := 0; - end; - 4: begin - Player[I].LineBonus_Color.R := 1; - Player[I].LineBonus_Color.G := 1; - Player[I].LineBonus_Color.B := 0; - end; - 5..7: begin - Player[I].LineBonus_Color.R := 1-((a-4)*0.25); - Player[I].LineBonus_Color.G := 1; - Player[I].LineBonus_Color.B := 0; - end; - 8: begin - Player[I].LineBonus_Color.R := 0; - Player[I].LineBonus_Color.G := 1; - Player[I].LineBonus_Color.B := 0; - end; - End; //Case - //Player[I].LineBonus_Color.B := 0; - //Player[I].LineBonus_Color.R := (8-A)/8; - //Player[I].LineBonus_Color.G := A/10; - - Player[I].LineBonus_PosX := Player[I].LineBonus_StartX; - Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; - Player[I].LineBonus_Alpha := 0.92; - Player[I].LineBonus_Visible := True; - Player[I].LineBonus_Age := 1; - end; - //PhrasenBonus - Line Bonus Mod End// } - - //PerfectLineTwinkle Mod (effect) Pt.1 - If (Ini.EffectSing=1) then - begin - if A >= 8 then Player[I].LastSentencePerfect := True - else Player[I].LastSentencePerfect := False; - end; - //PerfectLineTwinkle Mod end - - //Refresh LastScore - Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; - - end; - - //PerfectLineTwinkle Mod (effect) Pt.2 - if Ini.EffectSing=1 then - GoldenRec.SpawnPerfectLineTwinkle; - //PerfectLineTwinkle Mod end -end; - -//Called on Sentence Change S= New Current Sentence -procedure TScreenSing.onSentenceChange(S: Cardinal); -begin - //GoldenStarsTwinkle Mod - GoldenRec.SentenceChange; - //GoldenStarsTwinkle Mod End -end; - -end. +unit UScreenSing; + +interface + +{$I switches.inc} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +uses UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + UIni, + ULog, + UTexture, + ULyrics, + TextGL, + OpenGL12, + {$IFDEF useBASS} + bass, + {$ENDIF} + UThemes, + ULCD, + UGraphicClasses, + UVideo; + +type + TScreenSing = class(TMenu) + protected + paused: boolean; //Pause Mod + PauseTime: Real; + NumEmptySentences: integer; + public + //TextTime: integer; + + //TimeBar mod + StaticTimeProgress: integer; + TextTimeText: integer; + //eoa TimeBar mod + + StaticP1: integer; + StaticP1ScoreBG: integer; + TextP1: integer; + TextP1Score: integer; + + //moveable singbar mod + StaticP1SingBar: integer; + StaticP1ThreePSingBar: integer; + StaticP1TwoPSingBar: integer; + StaticP2RSingBar: integer; + StaticP2MSingBar: integer; + StaticP3SingBar: integer; + //eoa moveable singbar + + //Added for ps3 skin + //shown when game is in 2/4 player modus + StaticP1TwoP: integer; + StaticP1TwoPScoreBG: integer; + TextP1TwoP: integer; + TextP1TwoPScore: integer; + //shown when game is in 3/6 player modus + StaticP1ThreeP: integer; + StaticP1ThreePScoreBG: integer; + TextP1ThreeP: integer; + TextP1ThreePScore: integer; + //eoa + + StaticP2R: integer; + StaticP2RScoreBG: integer; + TextP2R: integer; + TextP2RScore: integer; + + StaticP2M: integer; + StaticP2MScoreBG: integer; + TextP2M: integer; + TextP2MScore: integer; + + StaticP3R: integer; + StaticP3RScoreBG: integer; + TextP3R: integer; + TextP3RScore: integer; + + Tex_Background: TTexture; + FadeOut: boolean; +// LyricMain: TLyric; +// LyricSub: TLyric; + Lyrics: TLyricEngine; + + constructor Create; override; + procedure onShow; override; + procedure onShowFinish; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure Finish; virtual; + procedure UpdateLCD; + procedure Pause; //Pause Mod(Toggles Pause) + + //OnSentenceEnd for LineBonus + Singbar + procedure onSentenceEnd(S: Cardinal); + //OnSentenceChange (for Golden Notes) + procedure onSentenceChange(S: Cardinal); + end; + +implementation +uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math; + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenSing.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_Q: + begin + //When not ask before Exit then Finish now + if (Ini.AskbeforeDel <> 1) then + Finish + //else just Pause and let the Popup make the Work + else if not paused then + Pause; + + Result := false; + end; + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + //Record Sound Hack: + //Sound[0].BufferLong + + Finish; + Music.PlayBack; + FadeTo(@ScreenScore); + end; + + SDLK_P://Pause Mod + begin + Pause; + end; + + SDLK_RETURN: + begin + 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 : + begin + end; + SDLK_UP : + begin + end; + end; + end; +end; + +//Pause Mod +procedure TScreenSing.Pause; +begin + if not paused then //Pause einschalten + begin + // pause Time + PauseTime := Czas.Teraz; + Paused := true; + + // pause Music + Music.Pause; + + // pause Video + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + FFmpegTogglePause; + end + else //Pause ausschalten + begin + Czas.Teraz := PauseTime; //Position of Notes + + // Position of Music + Music.MoveTo (PauseTime); + // Play Music + Music.Play; + + // Video + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + FFmpegTogglePause; + //SkipSmpeg(PauseTime); + + Paused := false; + end; +end; +//Pause Mod End + +constructor TScreenSing.Create; +var + I: integer; + P: integer; +begin + inherited Create; + + LoadFromTheme(Theme.Sing); + + //TimeBar + StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); + TextTimeText := AddText(Theme.Sing.TextTimeText); + +// 1 player | P1 + StaticP1 := AddStatic(Theme.Sing.StaticP1); + StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); + TextP1 := AddText(Theme.Sing.TextP1); + TextP1Score := AddText(Theme.Sing.TextP1Score); + StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar); + +// 2 or 4 players | P1 + StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); + StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG); + TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); + TextP1TwoPScore := AddText(Theme.Sing.TextP1TwoPScore); + StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); + + // | P2 + StaticP2R := AddStatic(Theme.Sing.StaticP2R); + StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); + TextP2R := AddText(Theme.Sing.TextP2R); + TextP2RScore := AddText(Theme.Sing.TextP2RScore); + StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); + +// 3 or 6 players | P1 + StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); + StaticP1ThreePScoreBG := AddStatic(Theme.Sing.StaticP1ThreePScoreBG); + TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); + TextP1ThreePScore := AddText(Theme.Sing.TextP1ThreePScore); + StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar); + + // | P2 + StaticP2M := AddStatic(Theme.Sing.StaticP2M); + StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG); + TextP2M := AddText(Theme.Sing.TextP2M); + TextP2MScore := AddText(Theme.Sing.TextP2MScore); + StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar); + + // | P3 + StaticP3R := AddStatic(Theme.Sing.StaticP3R); + StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG); + TextP3R := AddText(Theme.Sing.TextP3R); + TextP3RScore := AddText(Theme.Sing.TextP3RScore); + StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar); + + if ScreenAct = 2 then begin + // katze und affe + + end; + + Lyrics := TLyricEngine.Create(80,Skin_LyricsT,640,12,80,Skin_LyricsT+36,640,12); + + UVideo.Init; +end; + +procedure TScreenSing.onShow; +var + P: integer; + V1: boolean; + V1TwoP: boolean; //added for ps3 skin + V1ThreeP: boolean; //added for ps3 skin + V2R: boolean; + V2M: boolean; + V3R: boolean; + NR: TRecR; //Line Bonus Mod +begin + Log.LogStatus('Begin', 'onShow'); + FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented + + // prepare players + SetLength(Player, PlayersPlay); +// Player[0].ScoreTotalI := 0; + + case PlayersPlay of + 1: begin + V1 := true; + V1TwoP := false; + V1ThreeP := false; + V2R := false; + V2M := false; + V3R := false; + end; + 2: begin + V1 := false; + V1TwoP := true; + V1ThreeP := false; + V2R := true; + V2M := false; + V3R := false; + end; + 3: begin + V1 := false; + V1TwoP := false; + V1ThreeP := true; + V2R := false; + V2M := true; + V3R := true; + end; + 4: begin // double screen + V1 := false; + V1TwoP := true; + V1ThreeP := false; + V2R := true; + V2M := false; + V3R := false; + end; + 6: begin // double screen + V1 := false; + V1TwoP := false; + V1ThreeP := true; + V2R := false; + V2M := true; + V3R := true; + end; + + end; + + //This one is shown in 1P mode + Static[StaticP1].Visible := V1; + Static[StaticP1ScoreBG].Visible := V1; + Text[TextP1].Visible := V1; + Text[TextP1Score].Visible := V1; + + + //This one is shown in 2/4P mode + Static[StaticP1TwoP].Visible := V1TwoP; + Static[StaticP1TwoPScoreBG].Visible := V1TwoP; + Text[TextP1TwoP].Visible := V1TwoP; + Text[TextP1TwoPScore].Visible := V1TwoP; + + Static[StaticP2R].Visible := V2R; + Static[StaticP2RScoreBG].Visible := V2R; + Text[TextP2R].Visible := V2R; + Text[TextP2RScore].Visible := V2R; + + + //This one is shown in 3/6P mode + Static[StaticP1ThreeP].Visible := V1ThreeP; + Static[StaticP1ThreePScoreBG].Visible := V1ThreeP; + Text[TextP1ThreeP].Visible := V1ThreeP; + Text[TextP1ThreePScore].Visible := V1ThreeP; + + Static[StaticP2M].Visible := V2M; + Static[StaticP2MScoreBG].Visible := V2M; + Text[TextP2M].Visible := V2M; + Text[TextP2MScore].Visible := V2M; + + Static[StaticP3R].Visible := V3R; + Static[StaticP3RScoreBG].Visible := V3R; + Text[TextP3R].Visible := V3R; + Text[TextP3RScore].Visible := V3R; + + // load notes + ResetSingTemp; +// Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); + AktSong := CatSongs.Song[CatSongs.Selected]; + try + if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName) then + begin + //Error Loading Song -> Go back to Song Screen and Show some Error Message + FadeTo(@ScreenSong); + //Select New Song in Party Mode + if ScreenSong.Mode = 1 then + ScreenSong.SelectRandomSong; + ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); + Exit; + end; + except + //Error Loading Song -> Go back to Song Screen and Show some Error Message + FadeTo(@ScreenSong); + //Select New Song in Party Mode + if ScreenSong.Mode = 1 then + ScreenSong.SelectRandomSong; + ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); + Exit; + end; + AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; +// AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed + + // set movie + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin +(* OpenSmpeg(AktSong.Path + AktSong.Video); + SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*) + + // todo: VideoGap and Start time verwursten + FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); + FFmpegSkip(AktSong.VideoGAP + AktSong.Start); + AktSong.VideoLoaded := true; + end; + + // set background + if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then + try + Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background); + except + log.LogError('Background could not be loaded: ' + AktSong.Path + AktSong.Background); + Tex_Background.TexNum := -1; + end + else + Tex_Background.TexNum := -1; + + + + // play music (I) + Music.CaptureStart; + Music.MoveTo(AktSong.Start); +// Music.Play; + + // prepare timer (I) +// CountSkipTimeSet; + Czas.Teraz := AktSong.Start; + Czas.Razem := Music.Length; + if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000; + Czas.OldBeat := -1; + for P := 0 to High(Player) do + ClearScores(P); + + // main text + Lyrics.Clear (AktSong.BPM[0].BPM, AktSong.Resolution); + + // set custom options + case Ini.LyricsFont of + 0: + begin + Lyrics.UpperLineSize := 14; + Lyrics.LowerLineSize := 14; + Lyrics.FontStyle := 0; + + Lyrics.LineColor_en.R := Skin_FontR; + Lyrics.LineColor_en.G := Skin_FontG; + Lyrics.LineColor_en.B := Skin_FontB; + Lyrics.LineColor_en.A := 1; + + Lyrics.LineColor_dis.R := 0.4; + Lyrics.LineColor_dis.G := 0.4; + Lyrics.LineColor_dis.B := 0.4; + Lyrics.LineColor_dis.A := 1; + + Lyrics.LineColor_akt.R := 5/256; + Lyrics.LineColor_akt.G := 163/256; + Lyrics.LineColor_akt.B := 210/256; + Lyrics.LineColor_akt.A := 1; + +{ LyricSub.FontStyle := 0; + LyricMain.Size := 14; // 13 + LyricSub.Size := 14; // 13 + LyricMain.ColR := Skin_FontR; + LyricMain.ColG := Skin_FontG; + LyricMain.ColB := Skin_FontB; //Change für Crazy Joker + {LyricMain.ColSR := Skin_FontHighlightR; + LyricMain.ColSG := Skin_FontHighlightG; + LyricMain.ColSB := Skin_FontHighlightB;1aa5dc}{ + LyricMain.ColSR := 5/255; //26 + LyricMain.ColSG := 163/255; //165 + LyricMain.ColSB := 210/255; //220 + + LyricSub.ColR := 0.4; //0.6 + LyricSub.ColG := 0.4; //0.6 + LyricSub.ColB := 0.4; //0.6 } + end; + 1: + begin + { LyricMain.FontStyle := 2; + LyricSub.FontStyle := 2; + LyricMain.Size := 14; + LyricSub.Size := 14; + LyricMain.ColR := 0.75; + LyricMain.ColG := 0.75; + LyricMain.ColB := 1; + LyricMain.ColSR := 0.5; + LyricMain.ColSG := 0.5; + LyricMain.ColSB := 1; + LyricSub.ColR := 0.8; + LyricSub.ColG := 0.8; + LyricSub.ColB := 0.8; } + + Lyrics.UpperLineSize := 14; + Lyrics.LowerLineSize := 14; + Lyrics.FontStyle := 2; + + Lyrics.LineColor_en.R := 0.75; + Lyrics.LineColor_en.G := 0.75; + Lyrics.LineColor_en.B := 1; + Lyrics.LineColor_en.A := 1; + + Lyrics.LineColor_dis.R := 0.8; + Lyrics.LineColor_dis.G := 0.8; + Lyrics.LineColor_dis.B := 0.8; + Lyrics.LineColor_dis.A := 1; + + Lyrics.LineColor_akt.R := 0.5; + Lyrics.LineColor_akt.G := 0.5; + Lyrics.LineColor_akt.B := 1; + Lyrics.LineColor_akt.A := 1; + end; + 2: + begin + Lyrics.UpperLineSize := 12; + Lyrics.LowerLineSize := 12; + Lyrics.FontStyle := 3; + + Lyrics.LineColor_en.R := 0.75; + Lyrics.LineColor_en.G := 0.75; + Lyrics.LineColor_en.B := 1; + Lyrics.LineColor_en.A := 1; + + Lyrics.LineColor_dis.R := 0.8; + Lyrics.LineColor_dis.G := 0.8; + Lyrics.LineColor_dis.B := 0.8; + Lyrics.LineColor_dis.A := 1; + + Lyrics.LineColor_akt.R := 0.5; + Lyrics.LineColor_akt.G := 0.5; + Lyrics.LineColor_akt.B := 1; + Lyrics.LineColor_akt.A := 1; +{ LyricSub.FontStyle := 3; + LyricMain.Size := 12; + LyricSub.Size := 12; + LyricMain.ColR := 0.75; + LyricMain.ColG := 0.75; + LyricMain.ColB := 1; + LyricMain.ColSR := 0.5; + LyricMain.ColSG := 0.5; + LyricMain.ColSB := 1; + LyricSub.ColR := 0.8; + LyricSub.ColG := 0.8; + LyricSub.ColB := 0.8;} + end; + end; // case + + case Ini.LyricsEffect of + 0: Lyrics.HoverEffekt := 1; // 0 - one selected, 1 - selected all to the current + 1: Lyrics.HoverEffekt := 2; + 2: Lyrics.HoverEffekt := 3; + 3: Lyrics.HoverEffekt := 4; + end; // case + + // Add Lines to Lyrics + While (not Lyrics.LineinQueue) AND (Lyrics.LineCounter <= High(Czesci[0].Czesc)) do + Lyrics.AddLine(@Czesci[0].Czesc[Lyrics.LineCounter]); + + UpdateLCD; + + //Deactivate Pause + Paused := False; + + //Kill all Stars not Killed yet + //GoldenStarsTwinkle Mod + GoldenRec.SentenceChange; + //GoldenStarsTwinkle Mod End + + //Set Position of Line Bonus - PhrasenBonus + if (Ini.LineBonus = 1) then //Show Line Bonus at Scores + begin + Case PlayersPlay of + 1: begin + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + end; + + 2: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.X; + Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.X; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.X; + Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + end; + + 3: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + end; + + 4: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; + + //P4 + Player[3].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; + Player[3].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[3].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; + Player[3].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + end; + + 6: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + + //P4 + Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[3].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[3].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[3].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; + + //P5 + Player[4].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[4].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[4].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[4].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P6 + Player[5].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[5].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[5].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[5].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + end; + end; + end + else if (Ini.LineBonus = 2) then //Show Line Bonus at Notes + begin + + // positions + if Ini.SingWindow = 0 then begin + NR.Left := 120; + end else begin + NR.Left := 20; + end; + NR.Right := 780; + + NR.Width := NR.Right - NR.Left; + NR.WMid := NR.Width / 2; + NR.Mid := NR.Left + NR.WMid; + + Case PlayersPlay of + 1: begin + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := Skin_P2_NotesB - 105; + end; + + 2: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + end; + + 3: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := 120 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := 120 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := 245 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := 245 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_TargetY := 370 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_StartY := 370 + 28; + end; + + 4: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P4 + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + end; + + 6: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := 120 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := 120 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := 245 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := 245 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_TargetY := 370 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_StartY := 370 + 28; + + //P4 + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_TargetY := 120 - 65 + 28; + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_StartY := 120 + 28; + + //P5 + Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[4].LineBonus_TargetY := 245 - 65 + 28; + Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[4].LineBonus_StartY := 245 + 28; + + //P6 + Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[5].LineBonus_TargetY := 370 - 65 + 28; + Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[5].LineBonus_StartY := 370 + 28; + end; + end; + end; + //Set Position of Line Bonus - PhrasenBonus End + //Set Num of Empty Sentences for Phrasen Bonus + NumEmptySentences := 0; + for P := low(Czesci[0].Czesc) to high(Czesci[0].Czesc) do + if Czesci[0].Czesc[P].TotalNotes = 0 then Inc(NumEmptySentences); + + Log.LogStatus('End', 'onShow'); +end; + +procedure TScreenSing.onShowFinish; +begin + // play movie (II) + + if AktSong.VideoLoaded then + begin + try + FFmpegGetFrame(Czas.Teraz); + FFmpegDrawGL(ScreenAct); +// PlaySmpeg; + except + //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video + AktSong.VideoLoaded := False; + Log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); + Log.LogError('Corrupted File: ' + AktSong.Video); + try +// CloseSmpeg; + FFmpegClose; + except + + end; + end; + end; + + // play music (II) + Music.Play; + + // prepare timer (II) + CountSkipTimeSet; +end; + +function TScreenSing.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + Flash: real; + S: integer; + T: integer; +begin + + + + //ScoreBG Mod | den wirren Scheiss hier brauch mer nimmer, wir haben colorized png's - no need for wirrness also + // set player colors - macht nichts weiter als die farben des statics zu wechseln, was zu unschönen effekten bei colorized png führt +{ if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P4Dark'); + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P3Dark'); + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); + end; + if ScreenAct = 2 then begin + + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P6Dark'); + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); + end; + end; + } + + // set player names (for 2 screens and only Singstar skin) + if ScreenAct = 1 then begin + Text[TextP1].Text := 'P1'; + Text[TextP1TwoP].Text := 'P1'; + Text[TextP1ThreeP].Text := 'P1'; + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; + end; + + if ScreenAct = 2 then begin + case PlayersPlay of +{ 1: begin + Text[TextP1].Text := 'P2'; + end; + 2: begin + Text[TextP1].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 3: begin + Text[TextP1].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end;} + + 4: begin + Text[TextP1TwoP].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 6: begin + Text[TextP1ThreeP].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end; + end; // case + end; // if + + // stereo + +// weird stuff, maybe this is for "dual screen?", but where is player three then? | okay, i commented the stuff out the other day - nothing was missing on screen w/ 6 players - so do we even need this stuff? +// okay this stuff appears again some lines beneath this one, I commented it out for testing what it does - seems like it's doing nothing +// but I might be wrong, so what is this stuff here doing? O.o + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + + Text[TextP1].X := Text[TextP1].X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; + + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; + Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + + Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; +// end of weird stuff + + for S := 1 to 1 do //wtf? + Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X + 10*ScreenX; + + // update static menu with time ... + Min := Round(Czas.Teraz) div 60; + Sec := Round(Czas.Teraz) mod 60; + Text[TextTimeText].Text := ''; + if Min < 10 then Text[TextTimeText].Text := '0'; + Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':'; + if Sec < 10 then Text[TextTimeText].Text := Text[TextTimeText].Text + '0'; + Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec); + + // .. and scores + if PlayersPlay = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + end; + + if PlayersPlay = 2 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + + if PlayersPlay = 3 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[4].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[5].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + end; + + // draw static menu (BG) + DrawBG; + //Draw Background + SingDrawBackground; + // update and draw movie + if ShowFinish and AktSong.VideoLoaded then begin + try +// UpdateSmpeg; // this only draws + // todo: find a way to determine, when a new frame is needed + // toto: same for the need to skip frames + FFmpegGetFrame(Czas.Teraz); + FFmpegDrawGL(ScreenAct); + except + //If an Error occurs drawing: prevent Video from being Drawn again and Close Video + AktSong.VideoLoaded := False; + log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); + Log.LogError('Corrupted File: ' + AktSong.Video); + try +// CloseSmpeg; + FFmpegClose; + except + + end; + end; + end; + + // draw static menu (FG) + DrawFG; + + // check for music finish +// Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(AktSong.Finish)); + if ShowFinish then begin + if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + //Pause Mod: + if not Paused then + Sing(Self); // analyze song + end else begin +// Log.LogError('End'); + if not FadeOut then begin +// Log.LogError('End2'); + Finish; + FadeOut := true; + FadeTo(@ScreenScore); + end; + end; + end; + + // draw custom items + SingDraw; // always draw + +//GoldenNoteStarsTwinkle Mod + GoldenRec.SpawnRec; +//GoldenNoteStarsTwinkle Mod + + // back stereo + +// weird stuff, maybe this is for "dual screen?", but where is player three then? +// okay this stuff appears again some lines above this one, I commented it out for testing what it does - seems like it's doing nothing +// but I might be wrong, so what is this stuff here doing? O.o + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; + Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; + + Text[TextP1].X := Text[TextP1].X - 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; + + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; + Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; + + Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; +//weird end + + for S := 1 to 1 do // wtf? + Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X - 10*ScreenX; + +end; + +procedure TScreenSing.Finish; +begin + Music.CaptureStop; + Music.Stop; + + if Ini.SavePlayback = 1 then begin + Log.BenchmarkStart(0); + Log.LogVoice(0); + Log.LogVoice(1); + Log.LogVoice(2); + Log.BenchmarkEnd(0); + Log.LogBenchmark('Creating files', 0); + end; + + if AktSong.VideoLoaded then begin +// CloseSmpeg; + FFmpegClose; + AktSong.VideoLoaded := false; // to prevent drawing closed video + end; + + SetFontItalic (False); +end; + +procedure TScreenSing.UpdateLCD; +var + T: string; +begin + //Todo: Lyrics +{ LCD.HideCursor; + LCD.Clear; + + T := LyricMain.Text; + if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; + LCD.AddTextBR(T); + + T := LyricSub.Text; + if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; + LCD.AddTextBR(T);} +end; + +procedure TScreenSing.onSentenceEnd(S: Cardinal); +var +I: Integer; +A: Real; +B: integer; //Max Points for Notes +begin + + //Check for Empty Sentence + if (Czesci[0].Czesc[S].TotalNotes<=0) then + exit; + + //Set Max Note Points + if (Ini.LineBonus > 0) then + B := 9000 + else + B := 10000; + + for I := 0 to High(Player) do begin + A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2; + + //SingBar Mod + If ({(Ini.Oscilloscope = 2) and }(Czesci[0].Czesc[S].TotalNotes>0)) then + begin + Player[I].ScorePercentTarget := Player[I].ScorePercentTarget + floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 40 - 26); + if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0; + if Player[I].ScorePercentTarget > 99 then Player[I].ScorePercentTarget := 99; + + //end Singbar Mod + end; + + //PhrasenBonus - Line Bonus Mod + + //Generate Steps 0 to 8 + A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); + + If (Ini.LineBonus > 0) then + begin + + //Generate Text + if A >= 8 then + Player[I].LineBonus_Text := Theme.Sing.LineBonusText[8] + else + Player[I].LineBonus_Text := Theme.Sing.LineBonusText[Floor(A)]; + + //PhrasenBonus give Points + Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8); + Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10; + //Update Total Score + Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; + + //Color + Case Floor(A) of + 0: begin + Player[I].LineBonus_Color.R := 1; + Player[I].LineBonus_Color.G := 0; + Player[I].LineBonus_Color.B := 0; + end; + 1..3: begin + Player[I].LineBonus_Color.R := 1; + Player[I].LineBonus_Color.G := (A * 0.25); + Player[I].LineBonus_Color.B := 0; + end; + 4: begin + Player[I].LineBonus_Color.R := 1; + Player[I].LineBonus_Color.G := 1; + Player[I].LineBonus_Color.B := 0; + end; + 5..7: begin + Player[I].LineBonus_Color.R := 1-((a-4)*0.25); + Player[I].LineBonus_Color.G := 1; + Player[I].LineBonus_Color.B := 0; + end; + 8: begin + Player[I].LineBonus_Color.R := 0; + Player[I].LineBonus_Color.G := 1; + Player[I].LineBonus_Color.B := 0; + end; + End; //Case + //Player[I].LineBonus_Color.B := 0; + //Player[I].LineBonus_Color.R := (8-A)/8; + //Player[I].LineBonus_Color.G := A/10; + + Player[I].LineBonus_PosX := Player[I].LineBonus_StartX; + Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; + Player[I].LineBonus_Alpha := 0.92; + Player[I].LineBonus_Visible := True; + Player[I].LineBonus_Age := 1; + end; + //PhrasenBonus - Line Bonus Mod End// } + + //PerfectLineTwinkle Mod (effect) Pt.1 + If (Ini.EffectSing=1) then + begin + if A >= 8 then Player[I].LastSentencePerfect := True + else Player[I].LastSentencePerfect := False; + end; + //PerfectLineTwinkle Mod end + + //Refresh LastScore + Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; + + end; + + //PerfectLineTwinkle Mod (effect) Pt.2 + if Ini.EffectSing=1 then + GoldenRec.SpawnPerfectLineTwinkle; + //PerfectLineTwinkle Mod end +end; + +//Called on Sentence Change S= New Current Sentence +procedure TScreenSing.onSentenceChange(S: Cardinal); +begin + //GoldenStarsTwinkle Mod + GoldenRec.SentenceChange; + if (Lyrics.LineCounter <= High(Czesci[0].Czesc)) then + Lyrics.AddLine(@Czesci[0].Czesc[Lyrics.LineCounter]); + //GoldenStarsTwinkle Mod End +end; + +end. -- cgit v1.2.3 From 3c41f973b397b718135a7713c7501607812b0192 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Sep 2007 09:42:35 +0000 Subject: renamed Ulyrics.bak.pas hack to Ulyrics_bak.pas for lazarus compatiblity. minor changes to get code base compiling in Lazarus(win) and Delphi git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@415 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditSub.pas | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 93a4892a..e896d603 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -2,6 +2,10 @@ unit UScreenEditSub; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + {$I switches.inc} uses @@ -16,7 +20,7 @@ uses ULog, UTexture, UMenuText, - ULyrics.bak, + ULyrics_bak, Math, OpenGL12, {$IFDEF UseMIDIPort} -- cgit v1.2.3 From a1c2876fb12cfc860044f00210f69a9bdc2cf687 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Sep 2007 10:35:02 +0000 Subject: minor fixes for lazarus build.. forgot file... oops.. :) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@416 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenLoading.pas | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenLoading.pas b/Game/Code/Screens/UScreenLoading.pas index 438b606e..2ccc5c79 100644 --- a/Game/Code/Screens/UScreenLoading.pas +++ b/Game/Code/Screens/UScreenLoading.pas @@ -2,22 +2,33 @@ unit UScreenLoading; interface +{$I switches.inc} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + uses - UMenu, SDL, SysUtils, UThemes, OpenGL12; + UMenu, + SDL, + SysUtils, + UThemes, + OpenGL12; type TScreenLoading = class(TMenu) public Fadeout: boolean; constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function GetBGTexNum: GLUInt; - procedure onShow; override; + procedure onShow; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function GetBGTexNum: GLUInt; end; implementation -uses UGraphic, UTime; +uses UGraphic, + UTime; function TScreenLoading.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin -- cgit v1.2.3 From 50523ba17fcb19d37c54420ec3ea651538121e35 Mon Sep 17 00:00:00 2001 From: b1indy Date: Thu, 20 Sep 2007 10:39:30 +0000 Subject: moved a hack to a more appropriate place git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@417 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditSub.pas | 1 + 1 file changed, 1 insertion(+) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index e896d603..22420b26 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -1072,6 +1072,7 @@ 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); -- cgit v1.2.3 From cac6be301884b2c0f0b968ff156631cdda9d0410 Mon Sep 17 00:00:00 2001 From: b1indy Date: Thu, 20 Sep 2007 22:49:41 +0000 Subject: testing SDL_Image in credits screen (code is in TScreenCredits.OnShow) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@424 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 138 ++++++++++++++++++++++++++++++++++- 1 file changed, 136 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index b931f461..30237f95 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -5,6 +5,7 @@ interface uses UMenu, SDL, + SDL_Image, UDisplay, UTexture, OpenGL12, @@ -67,6 +68,7 @@ type CRDTS_Stage: TCreditsStages; myTex: glUint; + mysdlimage,myconvertedsdlimage: PSDL_Surface; Fadeout: boolean; constructor Create; override; @@ -113,6 +115,26 @@ const 3366, // 20 Ende Credits Tune 60); // 21 start flare im intro + + sdl32bpprgba: TSDL_Pixelformat=(palette: nil; + BitsPerPixel: 32; + BytesPerPixel: 4; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 24; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $ff000000; + colorkey: 0; + alpha: 255 ); + + implementation uses {$IFDEF win32} @@ -127,8 +149,9 @@ uses {$IFDEF win32} Textgl, ULanguage, UCommon, - Math; - + Math, + dialogs; + function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -156,6 +179,7 @@ end; constructor TScreenCredits.Create; begin inherited Create; + credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0); credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0); @@ -192,6 +216,63 @@ begin Draw:=true; end; +function pixfmt_eq(fmt1,fmt2: TSDL_Pixelformat): boolean; +begin + if (fmt1.BitsPerPixel = fmt2.BitsPerPixel) and + (fmt1.BytesPerPixel = fmt2.BytesPerPixel) and + (fmt1.Rloss = fmt2.Rloss) and + (fmt1.Gloss = fmt2.Gloss) and + (fmt1.Bloss = fmt2.Bloss) and + (fmt1.Rmask = fmt2.Rmask) and + (fmt1.Gmask = fmt2.Gmask) and + (fmt1.Bmask = fmt2.Bmask) and + (fmt1.Rshift = fmt2.Rshift) and + (fmt1.Gshift = fmt2.Gshift) and + (fmt1.Bshift = fmt2.Bshift) + then + pixfmt_eq:=True + else + pixfmt_eq:=False; +end; + +function inttohexstr(i: cardinal):pchar; +var helper, i2, c:cardinal; + tmpstr: string; +begin + helper:=0; + i2:=i; + tmpstr:=''; + for c:=1 to 8 do + begin + helper:=(helper shl 4) or (i2 and $f); + i2:=i2 shr 4; + end; + for c:=1 to 8 do + begin + i2:=helper and $f; + helper := helper shr 4; + case i2 of + 0: tmpstr:=tmpstr+'0'; + 1: tmpstr:=tmpstr+'1'; + 2: tmpstr:=tmpstr+'2'; + 3: tmpstr:=tmpstr+'3'; + 4: tmpstr:=tmpstr+'4'; + 5: tmpstr:=tmpstr+'5'; + 6: tmpstr:=tmpstr+'6'; + 7: tmpstr:=tmpstr+'7'; + 8: tmpstr:=tmpstr+'8'; + 9: tmpstr:=tmpstr+'9'; + 10: tmpstr:=tmpstr+'a'; + 11: tmpstr:=tmpstr+'b'; + 12: tmpstr:=tmpstr+'c'; + 13: tmpstr:=tmpstr+'d'; + 14: tmpstr:=tmpstr+'e'; + 15: tmpstr:=tmpstr+'f'; + end; + end; + inttohexstr:=pchar(tmpstr); +end; + procedure TScreenCredits.onShow; begin CRDTS_Stage:=InitialDelay; @@ -203,6 +284,43 @@ begin // Music.Play; CTime:=0; // setlength(CTime_hold,0); + mysdlimage:=IMG_Load('test.png'); + if assigned(mysdlimage) then + begin + showmessage('opened image via SDL_Image'+#13#10+ + 'Width: '+inttostr(mysdlimage^.w)+#13#10+ + 'Height: '+inttostr(mysdlimage^.h)+#13#10+ + 'BitsPP: '+inttostr(mysdlimage^.format.BitsPerPixel)+#13#10+ + 'BytesPP: '+inttostr(mysdlimage^.format.BytesPerPixel)+#13#10+ + 'Rloss: '+inttostr(mysdlimage^.format.Rloss)+#13#10+ + 'Gloss: '+inttostr(mysdlimage^.format.Gloss)+#13#10+ + 'Bloss: '+inttostr(mysdlimage^.format.Bloss)+#13#10+ + 'Aloss: '+inttostr(mysdlimage^.format.Aloss)+#13#10+ + 'Rshift: '+inttostr(mysdlimage^.format.Rshift)+#13#10+ + 'Gshift: '+inttostr(mysdlimage^.format.Gshift)+#13#10+ + 'Bshift: '+inttostr(mysdlimage^.format.Bshift)+#13#10+ + 'Ashift: '+inttostr(mysdlimage^.format.Ashift)+#13#10+ + 'Rmask: '+inttohexstr(mysdlimage^.format.Rmask)+#13#10+ + 'Gmask: '+inttohexstr(mysdlimage^.format.Gmask)+#13#10+ + 'Bmask: '+inttohexstr(mysdlimage^.format.Bmask)+#13#10+ + 'Amask: '+inttohexstr(mysdlimage^.format.Amask)+#13#10+ + 'ColKey: '+inttostr(mysdlimage^.format.Colorkey)+#13#10+ + 'Alpha: '+inttostr(mysdlimage^.format.Alpha)); + if pixfmt_eq(mysdlimage^.format^,sdl32bpprgba) + then showmessage('equal pixelformats') + else showmessage('different pixelformats'); + myconvertedsdlimage:=SDL_ConvertSurface(mysdlimage,@sdl32bpprgba,SDL_SWSURFACE); + glGenTextures(1,@myTex); + glBindTexture(GL_TEXTURE_2D, myTex); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + glTexImage2D( GL_TEXTURE_2D, 0, 4, myconvertedsdlimage^.w, myconvertedsdlimage^.h, 0, + GL_RGBA, GL_UNSIGNED_BYTE, myconvertedsdlimage^.pixels ); + SDL_FreeSurface(mysdlimage); + SDL_FreeSurface(myconvertedsdlimage); + end else + showmessage('could not open file'); + end; procedure TScreenCredits.onHide; @@ -1098,6 +1216,22 @@ begin RuntimeStr:='CTime: '+inttostr(CTime); glPrint (Addr(RuntimeStr[1])); } + + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, myTex); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(100, 100); + glTexCoord2f(0,1);glVertex2f(100, 200); + glTexCoord2f(1,1); glVertex2f(200, 200); + glTexCoord2f(1,0);glVertex2f(200, 100); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // make the stars shine GoldenRec.Draw; end; -- cgit v1.2.3 From f0a22b8ae97aebaf6dc4a9924a22204bc9e3a306 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Fri, 21 Sep 2007 00:55:56 +0000 Subject: added sdl_image to project uses clause and fixed credits screen to compile in lazarus / linux after the minor changes, to use sdl_image git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@425 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 30237f95..7b5e4c00 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -2,6 +2,13 @@ unit UScreenCredits; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +{$I switches.inc} + + uses UMenu, SDL, @@ -313,7 +320,7 @@ begin glGenTextures(1,@myTex); glBindTexture(GL_TEXTURE_2D, myTex); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexImage2D( GL_TEXTURE_2D, 0, 4, myconvertedsdlimage^.w, myconvertedsdlimage^.h, 0, GL_RGBA, GL_UNSIGNED_BYTE, myconvertedsdlimage^.pixels ); SDL_FreeSurface(mysdlimage); -- cgit v1.2.3 From f26a2364e41b95665d9e55593eb0c0e8f4cf646b Mon Sep 17 00:00:00 2001 From: mogguh Date: Fri, 21 Sep 2007 11:20:41 +0000 Subject: ScoreScreen, still working on some minor things like simplifying the src (messy joes), color stuff, overlay for the bars, 2 screen fix and when the bars should be drawn (regarding to the playercount) - other skin stuff will follow soon git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@426 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenScore.pas | 436 ++++++++++++++++++++++++++----------- 1 file changed, 303 insertions(+), 133 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 42edf4c9..222879ba 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -14,7 +14,11 @@ uses UMusic, USongs, UThemes, + OpenGL12, + Windows, + math, ULCD; + // OpenGL; type @@ -52,11 +56,30 @@ type Animation: real; Fadeout: boolean; + + BarScore_ActualHeight : array[1..6] of real; + BarPhrase_ActualHeight : array[1..6] of real; + BarGolden_ActualHeight : array[1..6] of real; + + BarScore_EaseOut_Step : real; + BarPhrase_EaseOut_Step : real; + BarGolden_EaseOut_Step : real; + + TextScore_ActualValue : array[1..6] of integer; + TextPhrase_ActualValue : array[1..6] of integer; + TextGolden_ActualValue : array[1..6] of integer; + + EaseOut_MaxSteps : real; + constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; + procedure onShowFinish; override; function Draw: boolean; override; procedure FillPlayer(Item, P: integer); + + function RaiseBar(PlayerNumber: integer; BarStartPosY: Single; ActualHeight: real; Score: integer; ColorBrightness : String; EaseOut_Step: Real) : real; + function IncrementScore(PlayerNumber: integer; ActualScoreValue: Integer; ScoreReached: integer; EaseOut_Step: Real) : integer; end; implementation @@ -239,34 +262,45 @@ begin end; for P := 1 to 6 do begin - Text[TextName[P]].Visible := V[P]; - Text[TextScore[P]].Visible := V[P]; - - Text[TextNotes[P]].Visible := V[P]; - Text[TextNotesScore[P]].Visible := V[P]; - Text[TextLineBonus[P]].Visible := V[P]; - Text[TextLineBonusScore[P]].Visible := V[P]; - Text[TextGoldenNotes[P]].Visible := V[P]; - Text[TextGoldenNotesScore[P]].Visible := V[P]; - Text[TextTotal[P]].Visible := V[P]; - Text[TextTotalScore[P]].Visible := V[P]; + Text[TextName[P]].Visible := V[P]; + Text[TextScore[P]].Visible := V[P]; + + // We set alpha to 0 , so we can nicely blend them in when we need them + Text[TextScore[P]].Alpha := 0; + Text[TextNotesScore[P]].Alpha := 0; + Text[TextNotes[P]].Alpha := 0; + Text[TextLineBonus[P]].Alpha := 0; + Text[TextLineBonusScore[P]].Alpha := 0; + Text[TextGoldenNotes[P]].Alpha := 0; + Text[TextGoldenNotesScore[P]].Alpha := 0; + Text[TextTotal[P]].Alpha := 0; + Text[TextTotalScore[P]].Alpha := 0; + + Text[TextNotes[P]].Visible := V[P]; + Text[TextNotesScore[P]].Visible := V[P]; + Text[TextLineBonus[P]].Visible := V[P]; + Text[TextLineBonusScore[P]].Visible := V[P]; + Text[TextGoldenNotes[P]].Visible := V[P]; + Text[TextGoldenNotesScore[P]].Visible := V[P]; + Text[TextTotal[P]].Visible := V[P]; + Text[TextTotalScore[P]].Visible := V[P]; for I := 0 to high(PlayerStatic[P]) do - Static[PlayerStatic[P, I]].Visible := V[P]; + Static[PlayerStatic[P, I]].Visible := V[P]; for I := 0 to high(PlayerTexts[P]) do - Text[PlayerTexts[P, I]].Visible := V[P]; + Text[PlayerTexts[P, I]].Visible := V[P]; - Static[StaticBoxLightest[P]].Visible := V[P]; - Static[StaticBoxLight[P]].Visible := V[P]; - Static[StaticBoxDark[P]].Visible := V[P]; + Static[StaticBoxLightest[P]].Visible := V[P]; + Static[StaticBoxLight[P]].Visible := V[P]; + Static[StaticBoxDark[P]].Visible := V[P]; - Static[StaticBackLevel[P]].Visible := V[P]; - Static[StaticBackLevelRound[P]].Visible := V[P]; - Static[StaticLevel[P]].Visible := V[P]; - Static[StaticLevelRound[P]].Visible := V[P]; + Static[StaticBackLevel[P]].Visible := false; //V[P]; + Static[StaticBackLevelRound[P]].Visible := false; //V[P]; + Static[StaticLevel[P]].Visible := false; //V[P]; + Static[StaticLevelRound[P]].Visible := false; //V[P]; end; - +{ if PlayersPlay <= 3 then begin // only for 1 screen mode for P := 0 to PlayersPlay-1 do begin case PlayersPlay of @@ -279,7 +313,7 @@ begin Text[TextName[PP]].Text := Ini.Name[P]; //{$IFDEF TRANSLATE} - case (Player[P].ScoreTotalI) of +{ case (Player[P].ScoreTotalI) of 0..2000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_TONE_DEAF'); 2010..4000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_AMATEUR'); 4010..6000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_RISING_STAR'); @@ -298,9 +332,10 @@ begin 9010..9800: Text[TextScore[PP]].Text := 'Superstar'; 9810..10000: Text[TextScore[PP]].Text := 'Ultrastar'; end; - {$ENDIF} *) +{ {$ENDIF} +//*) - S := IntToStr(Player[P].ScoreI); +{ S := IntToStr(Player[P].ScoreI); while (Length(S)<4) do S := '0' + S; Text[TextNotesScore[PP]].Text := S; @@ -322,12 +357,12 @@ begin Static[StaticLevel[PP]].Texture.H := Round(Static[StaticBackLevel[PP]].Texture.H * Lev); Static[StaticLevel[PP]].Texture.Y := Static[StaticBackLevel[PP]].Texture.Y + Static[StaticBackLevel[PP]].Texture.H - Static[StaticLevel[PP]].Texture.H; Static[StaticLevelRound[PP]].Texture.Y := Static[StaticLevel[PP]].Texture.Y - Static[StaticLevelRound[PP]].Texture.H;} -*) +//*) // doesn't align too much... (to fix) // hint: play with wrapping textures // resolution: setting TexY1 and TexY2 to 0.1 and 0.9 - Lev := Player[P].ScoreTotalI / 10000; +{ Lev := Player[P].ScoreTotalI / 10000; MaxH := Static[StaticBackLevel[PP]].Texture.H + Static[StaticBackLevelRound[PP]].Texture.H / 2; // developer note (Polish): @@ -370,7 +405,30 @@ begin LCD.Clear; LCD.WriteText(1, Ini.Name[0]); LCD.WriteText(2, 'Score: ' + Text[TextTotalScore[1]].Text); +} +end; + +procedure TScreenScore.onShowFinish; +var + index : integer; +begin +for index := 1 to 2 do + begin + BarScore_ActualHeight[index] := 0; + BarPhrase_ActualHeight[index] := 0; + BarGolden_ActualHeight[index] := 0; + + TextScore_ActualValue[index] := 0; + TextPhrase_ActualValue[index] := 0; + TextGolden_ActualValue[index] := 0; + end; + + + BarScore_EaseOut_Step := 1; + BarPhrase_EaseOut_Step := 1; + BarGolden_EaseOut_Step := 1; + EaseOut_MaxSteps := 100; end; function TScreenScore.Draw: boolean; @@ -381,117 +439,14 @@ var Wsp2: real; Pet: integer;} + ActualTime, OldTime : Integer; + Item: integer; P: integer; C: integer; -begin - // star animation -{ Animation := Animation + TimeSkip*1000; - - // move right - Min := 0; Max := 500; - if (Animation >= Min) and (Animation < Max) then begin - Wsp := (Animation - Min) / (Max - Min); - Wsp2 := 1 - Wsp; - - Static[0].Texture.X := 400 + Wsp2 * 50; // prawa mala - Static[0].Texture.Y := 150 - Wsp2 * 500; - Static[1].Texture.X := -50 - Wsp2 * 500; // lewa mala - Static[1].Texture.Y := 200 + Wsp2 * 50; - Static[2].Texture.X := 100 - Wsp2 * 200; // gorna w prawo - Static[2].Texture.Y := 80 - Wsp2 * 200; - Static[3].Texture.X := -280 - Wsp2 * 1000; // lewa wieksza gorna - Static[3].Texture.Y := 90; - - - Static[4].Texture.X := -1200 + Wsp * 1000; - Text[0].X := Static[4].Texture.X + 430; - end; - - // slowly move right - Min := 500; Max := 4100; - if (Animation >= Min) and (Animation < Max) then begin - Wsp := (Animation - Min) / (Max - Min); - - Static[0].Texture.X := 400 - Wsp * 10; // prawa mala - Static[0].Texture.Y := 150 + Wsp * 50; - Static[1].Texture.X := -50 + Wsp * 50; // lewa mala - Static[1].Texture.Y := 200; - Static[2].Texture.X := 100 + Wsp * 50; // gorna w prawo - Static[2].Texture.Y := 80 + Wsp * 30; - Static[3].Texture.X := -280 + Wsp * 200; // lewa wieksza gorna - Static[3].Texture.Y := 90; - - Static[4].Texture.X := -200 + Wsp * 150; // duza glowna - Text[0].X := Static[4].Texture.X + 430; - end; - - // fast move right - Min := 4100; Max := 4400; - if (Animation >= Min) and (Animation < Max) then begin - Wsp := (Animation - Min) / (Max - Min); - Wsp2 := 1 - Wsp; - - Static[0].Texture.X := 390 - Wsp * 200; // prawa mala - Static[0].Texture.Y := 200 + Wsp * 1000; - Static[1].Texture.X := 0 + Wsp * 1000; // lewa mala - Static[1].Texture.Y := 200; - Static[2].Texture.X := 150 + Wsp * 1000; // gorna w prawo - Static[2].Texture.Y := 110 + Wsp * 600; - Static[3].Texture.X := -80 + Wsp * 2000; // lewa wieksza gorna - Static[3].Texture.Y := 90; - - Static[4].Texture.X := -50 + Wsp * 2000; - Text[0].X := Static[4].Texture.X + 430; - - Static[7].Texture.X := 100 + Wsp2 * 3000; - Text[1].X := Static[7].Texture.X + 230; // 300 - Text[1].Y := Static[7].Texture.Y + 140; // 120 Sh - - Text[2].X := Static[7].Texture.X + 250; - Text[2].Y := Static[7].Texture.Y - 250; - Text[3].X := Static[7].Texture.X + 250; - Text[3].Y := Static[7].Texture.Y - 200; - end; - - // last arrow - Min := 4400; Max := 8000; - if (Animation >= Min) and (Animation < Max) then begin - Wsp := (Animation - Min) / (Max - Min); - - Static[7].Texture.X := 100 - Wsp * 100; - Text[1].X := Static[7].Texture.X + 230; // 300 - Text[1].Y := Static[7].Texture.Y + 140; // 120 - - Text[2].X := Static[7].Texture.X + 250; - Text[2].Y := Static[7].Texture.Y - 250; - Text[3].X := Static[7].Texture.X + 250; - Text[3].Y := Static[7].Texture.Y - 200; - end; - - // fade last arrow to left - Min := 8000; Max := 8300; - if (Animation >= Min) and (Animation < Max) then begin - Wsp := (Animation - Min) / (Max - Min); - - Static[7].Texture.X := 0 - Wsp * 3000; - Static[7].Texture.Y := 340 - Wsp * 50; - Text[1].X := Static[7].Texture.X + 230; // 300 Sh - Text[1].Y := Static[7].Texture.Y + 140; // 120 Sh - - Text[2].X := Static[7].Texture.X + 250; - Text[2].Y := Static[7].Texture.Y - 250; - Text[3].X := Static[7].Texture.X + 250; - Text[3].Y := Static[7].Texture.Y - 200; - end; - - Min := 8300; - if (Animation >= Min) and (not Fadeout) then begin - Music.StopShuffle; - FadeTo(@ScreenSong); - Fadeout := true; - end;} + katze : integer; +begin // 0.5.0: try also use 4 players screen with nicks if PlayersPlay = 4 then begin @@ -532,6 +487,221 @@ begin end; inherited Draw; +{ + player[1].ScoreI := 7000; + player[1].ScoreLineI := 2000; + player[1].ScoreGoldenI := 1000; + + player[2].ScoreI := 2500; + player[2].ScoreLineI := 1100; + player[2].ScoreGoldenI := 900; + } +// Let's arise the bars + ActualTime := GetTickCount div 33; + if ((ActualTime <> OldTime) and ShowFinish )then + begin + OldTime := ActualTime; + + For katze:= 0 to 5 do + begin + + // We actually araise them in the right order, but we have to draw them in reverse order (golden -> phrase -> mainscore) + Case BarScore_EaseOut_Step < EaseOut_MaxSteps * 10 of + true : BarScore_EaseOut_Step := BarScore_EaseOut_Step + 1; + end; + + // PhrasenBonus + if (BarScore_EaseOut_Step >= (EaseOut_MaxSteps * 10)) then + begin + Case BarPhrase_EaseOut_Step < EaseOut_MaxSteps * 10 of + true : BarPhrase_EaseOut_Step := BarPhrase_EaseOut_Step + 1; + end; + + // GoldenNotebonus + if (BarPhrase_EaseOut_Step >= (EaseOut_MaxSteps * 10)) then + begin + Case BarGolden_EaseOut_Step < EaseOut_MaxSteps * 10 of + true : BarGolden_EaseOut_Step := BarGolden_EaseOut_Step + 1; + end; + + //######################## + // Draw golden score bar # + //######################## + + BarGolden_ActualHeight[katze] := RaiseBar(katze, + Static[StaticBackLevel[katze+1]].Texture.y - BarScore_ActualHeight[katze] - BarPhrase_ActualHeight[katze], + BarGolden_ActualHeight[katze], + player[katze+1].ScoreGoldenI, + 'Lightest', + BarGolden_EaseOut_Step); + + // Increment and show total score and plain score + TextGolden_ActualValue[katze] := IncrementScore(katze, + TextGolden_ActualValue[katze], + Player[katze+1].ScoreGoldenI, + BarGolden_EaseOut_Step); + Text[TextGoldenNotesScore[katze+1]].Text := IntToStr(TextGolden_ActualValue[katze]); + + // Blend in + Text[TextGoldenNotesScore[katze+1]].Alpha := (BarGolden_EaseOut_Step / 100); + Text[TextGoldenNotes[katze+1]].Alpha := (BarGolden_EaseOut_Step / 100); + + end; + //######################## + // Draw phrase score bar # + //######################## + BarPhrase_ActualHeight[katze] := RaiseBar(katze, + Static[StaticBackLevel[katze+1]].Texture.y - BarScore_ActualHeight[katze], + BarPhrase_ActualHeight[katze], + Player[katze+1].ScoreLineI, + 'Light', + BarPhrase_EaseOut_Step); + + // Increment and show total score and plain score + TextPhrase_ActualValue[katze] := IncrementScore(katze, + TextPhrase_ActualValue[katze], + Player[katze+1].ScoreLineI, + BarPhrase_EaseOut_Step); + Text[TextLineBonusScore[katze+1]].Text := IntToStr(TextPhrase_ActualValue[katze]); + + //Blend in + Text[TextLineBonusScore[katze+1]].Alpha := (BarPhrase_EaseOut_Step / 100); + Text[TextLineBonus[katze+1]].Alpha := (BarPhrase_EaseOut_Step / 100); + + + end; + //####################### + // Draw plain score bar # + //####################### + BarScore_ActualHeight[katze] := RaiseBar(katze, + Static[StaticBackLevel[katze+1]].Texture.y, + BarScore_ActualHeight[katze], + Player[katze+1].ScoreI, + 'Dark', + BarScore_EaseOut_Step); + // Increment and show total score and plain score + TextScore_ActualValue[katze] := IncrementScore(katze, + TextScore_ActualValue[katze], + Player[katze+1].ScoreI, + BarScore_EaseOut_Step); + Text[TextNotesScore[katze+1]].Text := IntToStr(TextScore_ActualValue[katze]); + + Text[TextTotalScore[katze+1]].Text := IntToStr(TextScore_ActualValue[katze] + TextPhrase_ActualValue[katze] + TextGolden_ActualValue[katze]); + + //Blend em in + Text[TextTotalScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextTotal[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextNotesScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextNotes[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + + end; // me loop + end; +end; + + +function TscreenScore.RaiseBar(PlayerNumber: integer; BarStartPosY: Single; ActualHeight: real; Score: integer; ColorBrightness : String; EaseOut_Step: Real) : real; +const + RaiseSmoothness : integer = 100; +var + MaxHeight : real; + NewHeight : real; + Width : real; + + Height2Reach : real; + + RaiseStep : real; + + BarStartPosX : Single; + + R,G,B : real; +begin + + MaxHeight := Static[StaticBackLevel[PlayerNumber + 1]].Texture.H; + Width := Static[StaticBackLevel[PlayerNumber + 1]].Texture.W; + + BarStartPosX := Static[StaticBackLevel[PlayerNumber + 1]].Texture.X; + + BarStartPosY := BarStartPosY + MaxHeight; // The texture starts in the upper left corner, so let's subtract the height - so we can arise it + + // the height dependend of the score + Height2Reach := (Score / 10000) * MaxHeight; + + // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps + RaiseStep := EaseOut_Step; + + if (ActualHeight < Height2Reach) then + begin + // Check http://proto.layer51.com/d.aspx?f=400 for more info on easing functions + // Calculate the actual step according to the maxsteps + RaiseStep := RaiseStep / EaseOut_MaxSteps; + + // quadratic easing out - decelerating to zero velocity + // -end_position * current_time * ( current_time - 2 ) + start_postion + NewHeight := (-Height2Reach * RaiseStep * (RaiseStep - 20) + BarStartPosY) / RaiseSmoothness; + end + else + begin + NewHeight := Height2Reach; + end; + //+1 + LoadColor(R, G, B, 'P' + inttostr(PlayerNumber+1) + ColorBrightness); //dark, light, lightest + glColor4f(R, G, B, 1); + + //the actual bar + glBindTexture(GL_TEXTURE_2D, Static[StaticLevel[PlayerNumber + 1]].Texture.TexNum); + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(BarStartPosX, BarStartPosY - NewHeight); + glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, BarStartPosY - NewHeight); + glTexCoord2f(1, 1); glVertex2f(BarStartPosX + Width, BarStartPosY); + glTexCoord2f(0, 1); glVertex2f(BarStartPosX, BarStartPosY); + glEnd; + + //the round thing on top + glBindTexture(GL_TEXTURE_2D, Static[StaticLevelRound[PlayerNumber + 1]].Texture.TexNum); + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(BarStartPosX, (BarStartPosY - Static[StaticLevelRound[PlayerNumber + 1]].Texture.h) - NewHeight); + glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, (BarStartPosY - Static[StaticLevelRound[PlayerNumber + 1]].Texture.h) - NewHeight); + glTexCoord2f(1, 1); glVertex2f(BarStartPosX + Width, BarStartPosY - NewHeight); + glTexCoord2f(0, 1); glVertex2f(BarStartPosX, BarStartPosY - NewHeight); + glEnd; + + Result := NewHeight; +end; + +function TScreenScore.IncrementScore(PlayerNumber: integer; ActualScoreValue: Integer; ScoreReached: integer; EaseOut_Step: Real) : integer; +const + RaiseSmoothness : integer = 100; +var + RaiseStep : Real; +begin + // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps + RaiseStep := EaseOut_Step; + + if (ActualScoreValue < ScoreReached) then + begin + // Calculate the actual step according to the maxsteps + RaiseStep := RaiseStep / EaseOut_MaxSteps; + + // quadratic easing out - decelerating to zero velocity + // -end_position * current_time * ( current_time - 2 ) + start_postion + Result := floor((-ScoreReached * RaiseStep * (RaiseStep - 20)) / RaiseSmoothness); + end + else + begin + Result := ScoreReached; + end; + end; procedure TScreenScore.FillPlayer(Item, P: integer); -- cgit v1.2.3 From 1f9fd791bbe68741b8273a64eb5c0abe928e431c Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 23 Sep 2007 14:00:46 +0000 Subject: New class for score management -Scores are raised when PopUp slides under the scorebg -1 to 6 Player support (even 5 Players(not supported by Core atm)) -Display 3 Players instead of 2 when 4 Players are set in the Options and Screens=2 Ratingbar is not drawn by class atm. Have to be done git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@430 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 163 +++--- Game/Code/Screens/UScreenSingModi.pas | 903 +++++++++++++++++----------------- 2 files changed, 560 insertions(+), 506 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index ff6bfe20..b953cc07 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -28,7 +28,8 @@ uses UMenu, UThemes, ULCD, UGraphicClasses, - UVideo; + UVideo, + USingScores; type TScreenSing = class(TMenu) @@ -45,46 +46,51 @@ type //eoa TimeBar mod StaticP1: integer; - StaticP1ScoreBG: integer; TextP1: integer; - TextP1Score: integer; + {StaticP1ScoreBG: integer; + TextP1Score: integer;} - //moveable singbar mod + {//moveable singbar mod StaticP1SingBar: integer; StaticP1ThreePSingBar: integer; StaticP1TwoPSingBar: integer; StaticP2RSingBar: integer; StaticP2MSingBar: integer; StaticP3SingBar: integer; - //eoa moveable singbar + //eoa moveable singbar } //Added for ps3 skin //shown when game is in 2/4 player modus StaticP1TwoP: integer; - StaticP1TwoPScoreBG: integer; TextP1TwoP: integer; - TextP1TwoPScore: integer; + + {StaticP1TwoPScoreBG: integer; + TextP1TwoPScore: integer;} //shown when game is in 3/6 player modus StaticP1ThreeP: integer; - StaticP1ThreePScoreBG: integer; TextP1ThreeP: integer; - TextP1ThreePScore: integer; + + {TextP1ThreePScore: integer; + StaticP1ThreePScoreBG: integer; } //eoa StaticP2R: integer; - StaticP2RScoreBG: integer; TextP2R: integer; - TextP2RScore: integer; + + {StaticP2RScoreBG: integer; + TextP2RScore: integer;} StaticP2M: integer; - StaticP2MScoreBG: integer; TextP2M: integer; - TextP2MScore: integer; + + {StaticP2MScoreBG: integer; + TextP2MScore: integer; } StaticP3R: integer; - StaticP3RScoreBG: integer; TextP3R: integer; - TextP3RScore: integer; + + {StaticP3RScoreBG: integer; + TextP3RScore: integer;} Tex_Background: TTexture; FadeOut: boolean; @@ -92,6 +98,9 @@ type // LyricSub: TLyric; Lyrics: TLyricEngine; + //Score Manager: + Scores: TSingScores; + constructor Create; override; procedure onShow; override; procedure onShowFinish; override; @@ -205,6 +214,10 @@ var begin inherited Create; + //Create Score Class + Scores := TSingScores.Create; + Scores.LoadfromTheme; + LoadFromTheme(Theme.Sing); //TimeBar @@ -213,45 +226,51 @@ begin // 1 player | P1 StaticP1 := AddStatic(Theme.Sing.StaticP1); - StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); TextP1 := AddText(Theme.Sing.TextP1); + + {StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); TextP1Score := AddText(Theme.Sing.TextP1Score); - StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar); + StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar);} // 2 or 4 players | P1 StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); - StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG); TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); + + {StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG); TextP1TwoPScore := AddText(Theme.Sing.TextP1TwoPScore); - StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); + StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar);} // | P2 StaticP2R := AddStatic(Theme.Sing.StaticP2R); - StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); TextP2R := AddText(Theme.Sing.TextP2R); + + {StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); TextP2RScore := AddText(Theme.Sing.TextP2RScore); - StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); + StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); } // 3 or 6 players | P1 StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); - StaticP1ThreePScoreBG := AddStatic(Theme.Sing.StaticP1ThreePScoreBG); TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); + + {StaticP1ThreePScoreBG := AddStatic(Theme.Sing.StaticP1ThreePScoreBG); TextP1ThreePScore := AddText(Theme.Sing.TextP1ThreePScore); - StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar); + StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar);} // | P2 StaticP2M := AddStatic(Theme.Sing.StaticP2M); - StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG); TextP2M := AddText(Theme.Sing.TextP2M); + + {StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG); TextP2MScore := AddText(Theme.Sing.TextP2MScore); - StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar); + StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar);} // | P3 StaticP3R := AddStatic(Theme.Sing.StaticP3R); - StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG); TextP3R := AddText(Theme.Sing.TextP3R); + + {StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG); TextP3RScore := AddText(Theme.Sing.TextP3RScore); - StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar); + StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar);} if ScreenAct = 2 then begin // katze und affe @@ -273,10 +292,24 @@ var V2M: boolean; V3R: boolean; NR: TRecR; //Line Bonus Mod + + Color: TRGB; begin Log.LogStatus('Begin', 'onShow'); FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented + //SetUp Score Manager + Scores.ClearPlayers; //Clear Old Player Values + Color.R := 0; Color.G := 0; Color.B := 0; //Dummy atm + For P := 0 to PlayersPlay -1 do //Add new Ones + begin + Scores.AddPlayer(Tex_ScoreBG[P], Color); + end; + + Scores.Init; //Get Positions for Players + + + // prepare players SetLength(Player, PlayersPlay); // Player[0].ScoreTotalI := 0; @@ -327,38 +360,44 @@ begin //This one is shown in 1P mode Static[StaticP1].Visible := V1; - Static[StaticP1ScoreBG].Visible := V1; Text[TextP1].Visible := V1; - Text[TextP1Score].Visible := V1; + + {Static[StaticP1ScoreBG].Visible := V1; + Text[TextP1Score].Visible := V1;} //This one is shown in 2/4P mode Static[StaticP1TwoP].Visible := V1TwoP; - Static[StaticP1TwoPScoreBG].Visible := V1TwoP; Text[TextP1TwoP].Visible := V1TwoP; - Text[TextP1TwoPScore].Visible := V1TwoP; + + {Static[StaticP1TwoPScoreBG].Visible := V1TwoP; + Text[TextP1TwoPScore].Visible := V1TwoP;} Static[StaticP2R].Visible := V2R; - Static[StaticP2RScoreBG].Visible := V2R; Text[TextP2R].Visible := V2R; - Text[TextP2RScore].Visible := V2R; + + {Static[StaticP2RScoreBG].Visible := V2R; + Text[TextP2RScore].Visible := V2R; } //This one is shown in 3/6P mode Static[StaticP1ThreeP].Visible := V1ThreeP; - Static[StaticP1ThreePScoreBG].Visible := V1ThreeP; Text[TextP1ThreeP].Visible := V1ThreeP; - Text[TextP1ThreePScore].Visible := V1ThreeP; + + {Static[StaticP1ThreePScoreBG].Visible := V1ThreeP; + Text[TextP1ThreePScore].Visible := V1ThreeP; } Static[StaticP2M].Visible := V2M; - Static[StaticP2MScoreBG].Visible := V2M; Text[TextP2M].Visible := V2M; - Text[TextP2MScore].Visible := V2M; + + {Static[StaticP2MScoreBG].Visible := V2M; + Text[TextP2MScore].Visible := V2M; } Static[StaticP3R].Visible := V3R; - Static[StaticP3RScoreBG].Visible := V3R; Text[TextP3R].Visible := V3R; - Text[TextP3RScore].Visible := V3R; + + {Static[StaticP3RScoreBG].Visible := V3R; + Text[TextP3RScore].Visible := V3R; } // load notes ResetSingTemp; @@ -559,7 +598,7 @@ begin GoldenRec.SentenceChange; //GoldenStarsTwinkle Mod End - //Set Position of Line Bonus - PhrasenBonus + {//Set Position of Line Bonus - PhrasenBonus if (Ini.LineBonus = 1) then //Show Line Bonus at Scores begin Case PlayersPlay of @@ -790,7 +829,8 @@ begin Player[5].LineBonus_StartY := 370 + 28; end; end; - end; + end; } + //Set Position of Line Bonus - PhrasenBonus End //Set Num of Empty Sentences for Phrasen Bonus NumEmptySentences := 0; @@ -949,17 +989,19 @@ begin // okay this stuff appears again some lines beneath this one, I commented it out for testing what it does - seems like it's doing nothing // but I might be wrong, so what is this stuff here doing? O.o Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; Text[TextP1].X := Text[TextP1].X + 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; + + {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; - Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; + + {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} // end of weird stuff for S := 1 to 1 do //wtf? @@ -977,7 +1019,7 @@ begin if Sec < 10 then Text[TextTimeText].Text := Text[TextTimeText].Text + '0'; Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec); - // .. and scores + {// .. and scores if PlayersPlay = 1 then begin Tekst := IntToStr(Player[0].ScoreTotalI); while Length(Tekst) < 5 do Tekst := '0' + Tekst; @@ -1056,7 +1098,7 @@ begin while Length(Tekst) < 5 do Tekst := '0' + Tekst; Text[TextP3RScore].Text := Tekst; end; - end; + end; } // draw static menu (BG) DrawBG; @@ -1112,23 +1154,26 @@ begin GoldenRec.SpawnRec; //GoldenNoteStarsTwinkle Mod + //Draw Scores + Scores.Draw; + // back stereo // weird stuff, maybe this is for "dual screen?", but where is player three then? // okay this stuff appears again some lines above this one, I commented it out for testing what it does - seems like it's doing nothing // but I might be wrong, so what is this stuff here doing? O.o Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; - Text[TextP1].X := Text[TextP1].X - 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; + {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX;} - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; - Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; + + {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX;} //weird end for S := 1 to 1 do // wtf? @@ -1229,7 +1274,7 @@ begin //Update Total Score Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; - //Color + {//Color Case Floor(A) of 0: begin Player[I].LineBonus_Color.R := 1; @@ -1265,7 +1310,15 @@ begin Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; Player[I].LineBonus_Alpha := 0.92; Player[I].LineBonus_Visible := True; - Player[I].LineBonus_Age := 1; + Player[I].LineBonus_Age := 1;} + + //Spawn PopUp + If (A >= 8) then + A := 8 + else IF A < 0 then + A := 0; + //Round(Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8)); + Scores.SpawnPopUp(I, Floor(A), Player[I].ScoreTotalI); end; //PhrasenBonus - Line Bonus Mod End// } diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 455d7b40..44615662 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -1,4 +1,4 @@ -unit UScreenSingModi; +unit UScreenSingModi; interface @@ -158,456 +158,456 @@ begin end; procedure TScreenSingModi.onShow; -var - I: Integer; -begin - - PlayersPlay := TeamInfo.NumTeams; - - if DLLMan.Selected.LoadSong then //Start with Song - begin - inherited; - end - else //Start Without Song - begin - Music.CaptureStart; - end; - -//Set Playerinfo - PlayerInfo.NumPlayers := PlayersPlay; - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); - PlayerInfo.Playerinfo[I].Score := 0; - PlayerInfo.Playerinfo[I].Bar := 50; - PlayerInfo.Playerinfo[I].Enabled := True; - end; - - for I := PlayerInfo.NumPlayers to high(PlayerInfo.Playerinfo) do - begin - PlayerInfo.Playerinfo[I].Score:= 0; - PlayerInfo.Playerinfo[I].Bar := 0; - PlayerInfo.Playerinfo[I].Enabled := False; - end; - - Case PlayersPlay of - 1: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; - end; - 2,4: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1TwoPScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; - PlayerInfo.Playerinfo[2].PosX := Static[StaticP1TwoPScoreBG].Texture.X; - PlayerInfo.Playerinfo[2].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; - PlayerInfo.Playerinfo[1].PosX := Static[StaticP2RScoreBG].Texture.X; - PlayerInfo.Playerinfo[1].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; - PlayerInfo.Playerinfo[3].PosX := Static[StaticP2RScoreBG].Texture.X; - PlayerInfo.Playerinfo[3].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; - end; - 3,6: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ThreePScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; - PlayerInfo.Playerinfo[3].PosX := Static[StaticP1ThreePScoreBG].Texture.X; - PlayerInfo.Playerinfo[3].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; - PlayerInfo.Playerinfo[1].PosX := Static[StaticP2MScoreBG].Texture.X; - PlayerInfo.Playerinfo[1].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; - PlayerInfo.Playerinfo[4].PosX := Static[StaticP2MScoreBG].Texture.X; - PlayerInfo.Playerinfo[4].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; - PlayerInfo.Playerinfo[2].PosX := Static[StaticP3RScoreBG].Texture.X; - PlayerInfo.Playerinfo[2].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; - PlayerInfo.Playerinfo[5].PosX := Static[StaticP3RScoreBG].Texture.X; - PlayerInfo.Playerinfo[5].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; - end; - end; - - // play music (I) - //Music.CaptureStart; - //Music.MoveTo(AktSong.Start); - - //Init Plugin - if not DLLMan.PluginInit(TeamInfo, PlayerInfo, ToSentences(Czesci[0]), LoadTex, Print, LoadSound, PlaySound) then - begin - //Fehler - Log.LogError('Could not Init Plugin'); - Halt; - end; - - // Set Background (Little Workaround, maybe change sometime) - if (DLLMan.Selected.LoadBack) AND (DLLMan.Selected.LoadSong) then - ScreenSing.Tex_Background := Tex_Background; - - Winner := 0; - - //Set Score Visibility - if PlayersPlay = 1 then begin - Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; - Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; - end; - - if (PlayersPlay = 2) OR (PlayersPlay = 4) then begin - Text[TextP1TwoPScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP1TwoPScoreBG].Visible := DLLMan.Selected.ShowScore; - - Text[TextP2RScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP2RScoreBG].Visible := DLLMan.Selected.ShowScore; - end; - - if (PlayersPlay = 3) OR (PlayersPlay = 6) then begin - Text[TextP1ThreePScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP1ThreePScoreBG].Visible := DLLMan.Selected.ShowScore; - - Text[TextP2MScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP2MScoreBG].Visible := DLLMan.Selected.ShowScore; - - Text[TextP3RScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP3RScoreBG].Visible := DLLMan.Selected.ShowScore; - end; -end; - -function TScreenSingModi.Draw: boolean; -var - Min: integer; - Sec: integer; - Tekst: string; - S, I: integer; - T: integer; -begin -//Set Playerinfo - PlayerInfo.NumPlayers := PlayersPlay; - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - PlayerInfo.Playerinfo[I].Name := PChar(Player[I].Name); - if PlayerInfo.Playerinfo[I].Enabled then - begin - if (Player[I].ScoreTotalI<=10000) then - PlayerInfo.Playerinfo[I].Score:= Player[I].ScoreTotalI; - PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; - end; - end; - -//Show Score -if DLLMan.Selected.ShowScore then -begin - //ScoreBG Mod - // set player colors - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - - - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - - - - end; - if ScreenAct = 2 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P4Dark'); - - - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); - - - - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P3Dark'); - - - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); - - - - end; - if ScreenAct = 2 then begin - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P6Dark'); - - - - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); - - - - - end; - end; - //end ScoreBG Mod - -// set player names (for 2 screens and only Singstar skin) - if ScreenAct = 1 then begin - Text[TextP1].Text := 'P1'; - Text[TextP1TwoP].Text := 'P1'; // added for ps3 skin - Text[TextP1ThreeP].Text := 'P1'; // added for ps3 skin - Text[TextP2R].Text := 'P2'; - Text[TextP2M].Text := 'P2'; - Text[TextP3R].Text := 'P3'; - end; - - if ScreenAct = 2 then begin - case PlayersPlay of - 4: begin - Text[TextP1TwoP].Text := 'P3'; - Text[TextP2R].Text := 'P4'; - end; - 6: begin - Text[TextP1ThreeP].Text := 'P4'; - Text[TextP2M].Text := 'P5'; - Text[TextP3R].Text := 'P6'; - end; - end; // case - end; // if - - - // stereo <- and where iss P2M? or P3? - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; - - Text[TextP1].X := Text[TextP1].X + 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX; - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; - Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; - - Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX; - - // .. and scores - if PlayersPlay = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; - end; - - if PlayersPlay = 2 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - - if PlayersPlay = 3 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[4].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[5].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - end; - -end; //ShowScore - - for S := 1 to 1 do - Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X + 10*ScreenX; - -if DLLMan.Selected.LoadSong then -begin - // update static menu with time ... - Min := Round(Czas.Teraz) div 60; - Sec := Round(Czas.Teraz) mod 60; - Text[TextTimeText].Text := ''; - if Min < 10 then Text[TextTimeText].Text := '0'; - Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':'; - if Sec < 10 then Text[TextTimeText].Text := Text[TextTimeText].Text + '0'; - Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec); -end; - - // draw static menu (BG) - DrawBG; - - //Draw Background - if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) then - SingDrawBackground; - - // comment by blindy: wo zum henker wird denn in diesem screen ein video abgespielt? - // update and draw movie - // wie wo wadd? also in der selben funktion in der uscreensing kommt des video in der zeile 995, oder was wollteste wissen? :X -{ if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin - UpdateSmpeg; // this only draws - end;} - - // draw static menu (FG) - DrawFG; - - if ShowFinish then begin - if DllMan.Selected.LoadSong then - begin - if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin - //Pause Mod: - if not Paused then - Sing(Self); // analyze song - end else begin - if not FadeOut then begin - Finish; - FadeOut := true; - FadeTo(@ScreenPartyScore); - end; - end; - end; - end; - - // draw custom items - SingModiDraw(PlayerInfo); // always draw - - //GoldenNoteStarsTwinkle Mod - GoldenRec.SpawnRec; - //GoldenNoteStarsTwinkle Mod - - //Update PlayerInfo - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - if PlayerInfo.Playerinfo[I].Enabled then - begin - PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; - PlayerInfo.Playerinfo[I].Score := Player[I].ScoreTotalI; - end; - end; - - if ((ShowFinish) AND (NOT Paused)) then - begin - if not DLLMan.PluginDraw(Playerinfo, Czesci[0].Akt) then - begin - if not FadeOut then begin - Finish; - FadeOut := true; - FadeTo(@ScreenPartyScore); - end; - end; - end; - - //Change PlayerInfo/Changeables - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - if (Player[I].ScoreTotalI <> PlayerInfo.Playerinfo[I].Score) then - begin - //Player[I].ScoreTotal := Player[I].ScoreTotal + (PlayerInfo.Playerinfo[I].Score - Player[I].ScoreTotalI); - Player[I].ScoreTotalI := PlayerInfo.Playerinfo[I].Score; - end; - if (PlayerInfo.Playerinfo[I].Bar <> Player[I].ScorePercent) then - Player[I].ScorePercentTarget := PlayerInfo.Playerinfo[I].Bar; - end; - - // back stereo - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; - Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; - - Text[TextP1].X := Text[TextP1].X - 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX; - - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; - Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; - - Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX; - - - for S := 1 to 1 do - Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X - 10*ScreenX; - - +var + I: Integer; +begin + + PlayersPlay := TeamInfo.NumTeams; + + if DLLMan.Selected.LoadSong then //Start with Song + begin + inherited; + end + else //Start Without Song + begin + Music.CaptureStart; + end; + +//Set Playerinfo + PlayerInfo.NumPlayers := PlayersPlay; + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); + PlayerInfo.Playerinfo[I].Score := 0; + PlayerInfo.Playerinfo[I].Bar := 50; + PlayerInfo.Playerinfo[I].Enabled := True; + end; + + for I := PlayerInfo.NumPlayers to high(PlayerInfo.Playerinfo) do + begin + PlayerInfo.Playerinfo[I].Score:= 0; + PlayerInfo.Playerinfo[I].Bar := 0; + PlayerInfo.Playerinfo[I].Enabled := False; + end; + + {Case PlayersPlay of + 1: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; + end; + 2,4: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1TwoPScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; + PlayerInfo.Playerinfo[2].PosX := Static[StaticP1TwoPScoreBG].Texture.X; + PlayerInfo.Playerinfo[2].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; + PlayerInfo.Playerinfo[1].PosX := Static[StaticP2RScoreBG].Texture.X; + PlayerInfo.Playerinfo[1].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; + PlayerInfo.Playerinfo[3].PosX := Static[StaticP2RScoreBG].Texture.X; + PlayerInfo.Playerinfo[3].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; + end; + 3,6: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ThreePScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; + PlayerInfo.Playerinfo[3].PosX := Static[StaticP1ThreePScoreBG].Texture.X; + PlayerInfo.Playerinfo[3].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; + PlayerInfo.Playerinfo[1].PosX := Static[StaticP2MScoreBG].Texture.X; + PlayerInfo.Playerinfo[1].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; + PlayerInfo.Playerinfo[4].PosX := Static[StaticP2MScoreBG].Texture.X; + PlayerInfo.Playerinfo[4].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; + PlayerInfo.Playerinfo[2].PosX := Static[StaticP3RScoreBG].Texture.X; + PlayerInfo.Playerinfo[2].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; + PlayerInfo.Playerinfo[5].PosX := Static[StaticP3RScoreBG].Texture.X; + PlayerInfo.Playerinfo[5].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; + end; + end; } + + // play music (I) + //Music.CaptureStart; + //Music.MoveTo(AktSong.Start); + + //Init Plugin + if not DLLMan.PluginInit(TeamInfo, PlayerInfo, ToSentences(Czesci[0]), LoadTex, Print, LoadSound, PlaySound) then + begin + //Fehler + Log.LogError('Could not Init Plugin'); + Halt; + end; + + // Set Background (Little Workaround, maybe change sometime) + if (DLLMan.Selected.LoadBack) AND (DLLMan.Selected.LoadSong) then + ScreenSing.Tex_Background := Tex_Background; + + Winner := 0; + + //Set Score Visibility + {if PlayersPlay = 1 then begin + Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; + end; + + if (PlayersPlay = 2) OR (PlayersPlay = 4) then begin + Text[TextP1TwoPScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1TwoPScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP2RScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP2RScoreBG].Visible := DLLMan.Selected.ShowScore; + end; + + if (PlayersPlay = 3) OR (PlayersPlay = 6) then begin + Text[TextP1ThreePScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1ThreePScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP2MScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP2MScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP3RScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP3RScoreBG].Visible := DLLMan.Selected.ShowScore; + end; } +end; + +function TScreenSingModi.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + S, I: integer; + T: integer; +begin +//Set Playerinfo + PlayerInfo.NumPlayers := PlayersPlay; + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + PlayerInfo.Playerinfo[I].Name := PChar(Player[I].Name); + if PlayerInfo.Playerinfo[I].Enabled then + begin + if (Player[I].ScoreTotalI<=10000) then + PlayerInfo.Playerinfo[I].Score:= Player[I].ScoreTotalI; + PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; + end; + end; + +//Show Score +if DLLMan.Selected.ShowScore then +begin + {//ScoreBG Mod + // set player colors + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + + + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P4Dark'); + + + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); + + + + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P3Dark'); + + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P6Dark'); + + + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); + + + + + end; + end; + //end ScoreBG Mod } + +// set player names (for 2 screens and only Singstar skin) + if ScreenAct = 1 then begin + Text[TextP1].Text := 'P1'; + Text[TextP1TwoP].Text := 'P1'; // added for ps3 skin + Text[TextP1ThreeP].Text := 'P1'; // added for ps3 skin + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; + end; + + if ScreenAct = 2 then begin + case PlayersPlay of + 4: begin + Text[TextP1TwoP].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 6: begin + Text[TextP1ThreeP].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end; + end; // case + end; // if + + + // stereo <- and where iss P2M? or P3? + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; + Text[TextP1].X := Text[TextP1].X + 10*ScreenX; + + {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; + Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; + + {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} + + // .. and scores + {if PlayersPlay = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + end; + + if PlayersPlay = 2 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + + if PlayersPlay = 3 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[4].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[5].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + end; } + +end; //ShowScore + + for S := 1 to 1 do + Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X + 10*ScreenX; + +if DLLMan.Selected.LoadSong then +begin + // update static menu with time ... + Min := Round(Czas.Teraz) div 60; + Sec := Round(Czas.Teraz) mod 60; + Text[TextTimeText].Text := ''; + if Min < 10 then Text[TextTimeText].Text := '0'; + Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':'; + if Sec < 10 then Text[TextTimeText].Text := Text[TextTimeText].Text + '0'; + Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec); +end; + + // draw static menu (BG) + DrawBG; + + //Draw Background + if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) then + SingDrawBackground; + + // comment by blindy: wo zum henker wird denn in diesem screen ein video abgespielt? + // update and draw movie + // wie wo wadd? also in der selben funktion in der uscreensing kommt des video in der zeile 995, oder was wollteste wissen? :X +{ if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin + UpdateSmpeg; // this only draws + end;} + + // draw static menu (FG) + DrawFG; + + if ShowFinish then begin + if DllMan.Selected.LoadSong then + begin + if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + //Pause Mod: + if not Paused then + Sing(Self); // analyze song + end else begin + if not FadeOut then begin + Finish; + FadeOut := true; + FadeTo(@ScreenPartyScore); + end; + end; + end; + end; + + // draw custom items + SingModiDraw(PlayerInfo); // always draw + + //GoldenNoteStarsTwinkle Mod + GoldenRec.SpawnRec; + //GoldenNoteStarsTwinkle Mod + + //Update PlayerInfo + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + if PlayerInfo.Playerinfo[I].Enabled then + begin + PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; + PlayerInfo.Playerinfo[I].Score := Player[I].ScoreTotalI; + end; + end; + + if ((ShowFinish) AND (NOT Paused)) then + begin + if not DLLMan.PluginDraw(Playerinfo, Czesci[0].Akt) then + begin + if not FadeOut then begin + Finish; + FadeOut := true; + FadeTo(@ScreenPartyScore); + end; + end; + end; + + //Change PlayerInfo/Changeables + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + if (Player[I].ScoreTotalI <> PlayerInfo.Playerinfo[I].Score) then + begin + //Player[I].ScoreTotal := Player[I].ScoreTotal + (PlayerInfo.Playerinfo[I].Score - Player[I].ScoreTotalI); + Player[I].ScoreTotalI := PlayerInfo.Playerinfo[I].Score; + end; + if (PlayerInfo.Playerinfo[I].Bar <> Player[I].ScorePercent) then + Player[I].ScorePercentTarget := PlayerInfo.Playerinfo[I].Bar; + end; + + // back stereo + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; + Text[TextP1].X := Text[TextP1].X - 10*ScreenX; + + {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX;} + + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; + Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; + + {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX;} + + + for S := 1 to 1 do + Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X - 10*ScreenX; + + end; procedure TScreenSingModi.Finish; @@ -667,3 +667,4 @@ begin end; end. +>>>>>>> .r429 -- cgit v1.2.3 From 1acdd4a165647aa45d44f537326506d97c90c121 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 25 Sep 2007 18:59:00 +0000 Subject: Some Cleanup in UDraw, UMain and UScreenSing Removed some old, yet not used functions One class todo(Notes) then the dirty UDraw will be a thing of the past. Also Player and Notes Array needs some rewriting. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@434 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 49 +-------------------------------------- 1 file changed, 1 insertion(+), 48 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index b953cc07..4e60a78b 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1244,15 +1244,6 @@ begin for I := 0 to High(Player) do begin A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2; - //SingBar Mod - If ({(Ini.Oscilloscope = 2) and }(Czesci[0].Czesc[S].TotalNotes>0)) then - begin - Player[I].ScorePercentTarget := Player[I].ScorePercentTarget + floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 40 - 26); - if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0; - if Player[I].ScorePercentTarget > 99 then Player[I].ScorePercentTarget := 99; - - //end Singbar Mod - end; //PhrasenBonus - Line Bonus Mod @@ -1274,50 +1265,12 @@ begin //Update Total Score Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; - {//Color - Case Floor(A) of - 0: begin - Player[I].LineBonus_Color.R := 1; - Player[I].LineBonus_Color.G := 0; - Player[I].LineBonus_Color.B := 0; - end; - 1..3: begin - Player[I].LineBonus_Color.R := 1; - Player[I].LineBonus_Color.G := (A * 0.25); - Player[I].LineBonus_Color.B := 0; - end; - 4: begin - Player[I].LineBonus_Color.R := 1; - Player[I].LineBonus_Color.G := 1; - Player[I].LineBonus_Color.B := 0; - end; - 5..7: begin - Player[I].LineBonus_Color.R := 1-((a-4)*0.25); - Player[I].LineBonus_Color.G := 1; - Player[I].LineBonus_Color.B := 0; - end; - 8: begin - Player[I].LineBonus_Color.R := 0; - Player[I].LineBonus_Color.G := 1; - Player[I].LineBonus_Color.B := 0; - end; - End; //Case - //Player[I].LineBonus_Color.B := 0; - //Player[I].LineBonus_Color.R := (8-A)/8; - //Player[I].LineBonus_Color.G := A/10; - - Player[I].LineBonus_PosX := Player[I].LineBonus_StartX; - Player[I].LineBonus_PosY := Player[I].LineBonus_StartY; - Player[I].LineBonus_Alpha := 0.92; - Player[I].LineBonus_Visible := True; - Player[I].LineBonus_Age := 1;} - //Spawn PopUp If (A >= 8) then A := 8 else IF A < 0 then A := 0; - //Round(Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8)); + Scores.SpawnPopUp(I, Floor(A), Player[I].ScoreTotalI); end; //PhrasenBonus - Line Bonus Mod End// } -- cgit v1.2.3 From 2221d3db9408f3d7c6ee0ab0cc024e253cac80e0 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 27 Sep 2007 11:58:51 +0000 Subject: fixed compile error from whiteshark.. now it compiles :) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@435 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenMain.pas | 560 +++++++++++++++++++------------------- 1 file changed, 282 insertions(+), 278 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 7bcc9e65..aecc40bb 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -1,278 +1,282 @@ -unit UScreenMain; - -interface - -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; - Music.PlayStart; - FadeTo(@ScreenCredits); - end; - end; - SDLK_M: - begin - if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then - begin - Music.PlayStart; - FadeTo(@ScreenPartyOptions); - end; - end; - - SDLK_S: - begin - Music.PlayStart; - FadeTo(@ScreenStatMain); - end; - - SDLK_E: - begin - Music.PlayStart; - FadeTo(@ScreenEdit); - end; - - SDLK_RETURN: - begin - //Solo - if (Interaction = 0) then - begin - if (Length(Songs.Song) >= 1) then - begin - Music.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 - Music.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 - Music.PlayStart; - FadeTo(@ScreenStatMain); - end; - - //Editor - if Interaction = 3 then begin - Music.PlayStart; - FadeTo(@ScreenEdit); - end; - - //Options - if Interaction = 4 then begin - Music.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} + +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; + Music.PlayStart; + FadeTo(@ScreenCredits); + end; + end; + SDLK_M: + begin + if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then + begin + Music.PlayStart; + FadeTo(@ScreenPartyOptions); + end; + end; + + SDLK_S: + begin + Music.PlayStart; + FadeTo(@ScreenStatMain); + end; + + SDLK_E: + begin + Music.PlayStart; + FadeTo(@ScreenEdit); + end; + + SDLK_RETURN: + begin + //Solo + if (Interaction = 0) then + begin + if (Length(Songs.Song) >= 1) then + begin + Music.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 + Music.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 + Music.PlayStart; + FadeTo(@ScreenStatMain); + end; + + //Editor + if Interaction = 3 then begin + Music.PlayStart; + FadeTo(@ScreenEdit); + end; + + //Options + if Interaction = 4 then begin + Music.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. -- cgit v1.2.3 From e5b70a52b5fc4a572136a3a07ee2f5e443c5e52b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 28 Sep 2007 13:57:52 +0000 Subject: Reremoved old TPlayer attributes and removed some code fragments that still links to these attributes git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@444 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 7 ------- Game/Code/Screens/UScreenSingModi.pas | 8 ++++---- 2 files changed, 4 insertions(+), 11 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 4e60a78b..391fdccf 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1252,13 +1252,6 @@ begin If (Ini.LineBonus > 0) then begin - - //Generate Text - if A >= 8 then - Player[I].LineBonus_Text := Theme.Sing.LineBonusText[8] - else - Player[I].LineBonus_Text := Theme.Sing.LineBonusText[Floor(A)]; - //PhrasenBonus give Points Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8); Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10; diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 44615662..d18dd5bc 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -282,7 +282,7 @@ begin begin if (Player[I].ScoreTotalI<=10000) then PlayerInfo.Playerinfo[I].Score:= Player[I].ScoreTotalI; - PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; + PlayerInfo.Playerinfo[I].Bar := Round(Scores.Players[I].RBPos * 100); end; end; @@ -557,7 +557,7 @@ end; begin if PlayerInfo.Playerinfo[I].Enabled then begin - PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; + //PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; PlayerInfo.Playerinfo[I].Score := Player[I].ScoreTotalI; end; end; @@ -582,8 +582,8 @@ end; //Player[I].ScoreTotal := Player[I].ScoreTotal + (PlayerInfo.Playerinfo[I].Score - Player[I].ScoreTotalI); Player[I].ScoreTotalI := PlayerInfo.Playerinfo[I].Score; end; - if (PlayerInfo.Playerinfo[I].Bar <> Player[I].ScorePercent) then - Player[I].ScorePercentTarget := PlayerInfo.Playerinfo[I].Bar; + {if (PlayerInfo.Playerinfo[I].Bar <> Player[I].ScorePercent) then + Player[I].ScorePercentTarget := PlayerInfo.Playerinfo[I].Bar; } end; // back stereo -- cgit v1.2.3 From 95662b4cb8252ae665de8222762f9fc320f11ea0 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sat, 29 Sep 2007 01:47:49 +0000 Subject: small fixes for lazarus build. cleanup on some code. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@445 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 4081 +++++++++++++++++++------------------ 1 file changed, 2041 insertions(+), 2040 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 569645d4..0a3c1d02 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1,2040 +1,2041 @@ -unit UScreenSong; - -interface -{$I switches.inc} - -uses - UMenu, - SDL, - UMusic, - UFiles, - UTime, - UDisplay, - USongs, - SysUtils, - ULog, - UThemes, - UTexture, - ULanguage, - ULCD, - ULight, - UIni; - -type - TScreenSong = class(TMenu) - public - TextArtist: integer; - TextTitle: integer; - TextNumber: integer; - - //Video Icon Mod - VideoIcon: Cardinal; - - TextCat: integer; - StaticCat: integer; - - SongCurrent: real; - SongTarget: real; - - HighSpeed: boolean; - CoverFull: boolean; - CoverTime: real; - CoverX: integer; - CoverY: integer; - CoverW: integer; - is_jump: boolean; // Jump to Song Mod - is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title - - EqualizerBands: array of Byte; - EqualizerTime: Cardinal; - EqualizerTime2: Byte; - - //Party Mod - Mode: Byte; //0 = Standard, 1= Go to PartyMode after Selection + Change to Random Song at Show - //party Statics (Joker) - StaticTeam1Joker1: Cardinal; - StaticTeam1Joker2: Cardinal; - StaticTeam1Joker3: Cardinal; - StaticTeam1Joker4: Cardinal; - StaticTeam1Joker5: Cardinal; - - StaticTeam2Joker1: Cardinal; - StaticTeam2Joker2: Cardinal; - StaticTeam2Joker3: Cardinal; - StaticTeam2Joker4: Cardinal; - StaticTeam2Joker5: Cardinal; - - StaticTeam3Joker1: Cardinal; - StaticTeam3Joker2: Cardinal; - StaticTeam3Joker3: Cardinal; - StaticTeam3Joker4: Cardinal; - StaticTeam3Joker5: Cardinal; - - StaticParty: Array of Cardinal; - TextParty: Array of Cardinal; - StaticNonParty: Array of Cardinal; - TextNonParty: Array of Cardinal; - - - constructor Create; override; - procedure SetScroll; - procedure SetScroll1; - procedure SetScroll2; - procedure SetScroll3; - procedure SetScroll4; - procedure SetScroll5; - procedure SetScroll6; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure onShow; override; - procedure onHide; override; - procedure SelectNext; - procedure SelectPrev; - procedure UpdateLCD; - procedure SkipTo(Target: Cardinal); - procedure FixSelected; //Show Wrong Song when Tabs on Fix - procedure FixSelected2; //Show Wrong Song when Tabs on Fix - procedure ShowCatTL(Cat: Integer);// Show Cat in Top left - procedure ShowCatTLCustom(Caption: String);// Show Custom Text in Top left - procedure HideCatTL;// Show Cat in Tob left - procedure Refresh; //Refresh Song Sorting - procedure DrawEqualizer; - procedure ChangeMusic; - //Party Mode - procedure SelectRandomSong; - procedure SetJoker; - procedure SetStatics; - //procedures for Menu - procedure StartSong; - procedure OpenEditor; - procedure DoJoker(Team: Byte); - procedure SelectPlayers; - - procedure UnLoadDetailedCover; - - //Extensions - procedure DrawExtensions; - end; - -implementation -uses UGraphic, - UMain, - UCovers, - math, - OpenGL12, - {$IFDEF win32} - windows, - {$ELSE} - lclintf, - {$ENDIF} - USkins, - UDLLManager, - UParty, - UPlaylist, - UScreenSongMenu; - -// ***** Public methods ****** // - -//Show Wrong Song when Tabs on Fix -procedure TScreenSong.FixSelected; -var I, I2: Integer; - begin - if CatSongs.VisibleSongs > 0 then - begin - I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do - begin - if CatSongs.Song[I].Visible then - inc(I2); - - if I = Interaction - 1 then - break; - end; - - SongCurrent := I2; - SongTarget := I2; - end; - end; - -procedure TScreenSong.FixSelected2; -var I, I2: Integer; - begin - if CatSongs.VisibleSongs > 0 then - begin - I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do - begin - if CatSongs.Song[I].Visible then - inc(I2); - - if I = Interaction - 1 then - break; - end; - - SongTarget := I2; - end; - end; -//Show Wrong Song when Tabs on Fix End - - procedure TScreenSong.ShowCatTLCustom(Caption: String);// Show Custom Text in Top left - begin - Text[TextCat].Text := Caption; - Text[TextCat].Visible := true; - Static[StaticCat].Visible := False; - end; - - //Show Cat in Top Left Mod - procedure TScreenSong.ShowCatTL(Cat: Integer); - begin - //Change - Text[TextCat].Text := CatSongs.Song[Cat].Artist; - //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover); - //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); - - Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); - //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false); - //Button[Cat]. - //Cover - - - //Show - Text[TextCat].Visible := true; - Static[StaticCat].Visible := True; - end; - - procedure TScreenSong.HideCatTL; - begin - //Hide - //Text[TextCat].Visible := false; - Static[StaticCat].Visible := false; - //New -> Show Text specified in Theme - Text[TextCat].Visible := True; - Text[TextCat].Text := Theme.Song.TextCat.Text; - end; - //Show Cat in Top Left Mod End - - -// Method for input parsing. If False is returned, GetNextWindow -// should be checked to know the next window to load; -function TScreenSong.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -var - I: integer; - I2: integer; - HS: integer; - SDL_ModState: Word; - Letter: Char; -begin - Result := true; - - //Song Screen Extensions (Jumpto + Menu) - if (ScreenSongMenu.Visible) then - begin - Result := ScreenSongMenu.ParseInput(PressedKey, ScanCode, PressedDown); - Exit; - end - else if (ScreenSongJumpto.Visible) then - begin - Result := ScreenSongJumpto.ParseInput(PressedKey, ScanCode, PressedDown); - Exit; - end; - - If (PressedDown) Then - begin // Key Down - - SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT - + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); - - //Jump to Artist/Titel - if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then - begin - Letter := UpCase(Chr(ScanCode)); - I2 := Length(CatSongs.Song); - - //Jump To Titel - if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then - begin - For I := 1 to high(CatSongs.Song) do - begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then - begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - - Music.PlayChange; - - ChangeMusic; - SetScroll4; - UpdateLCD; - //Break and Exit - Exit; - end; - end; - end - //Jump to Artist - else if (SDL_ModState = KMOD_LALT) then - begin - For I := 1 to high(CatSongs.Song) do - begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Artist[1]) = Letter) then - begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - - Music.PlayChange; - - ChangeMusic; - SetScroll4; - UpdateLCD; - - //Break and Exit - Exit; - end; - end; - end; - Exit; - end; - - case PressedKey of - SDLK_Q: - begin - Result := false; - end; - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - if (Mode = 0) then - begin - //On Escape goto Cat-List Hack - if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then - begin - //Find Category - I := Interaction; - while not catsongs.Song[I].Main do - begin - Dec (I); - if (I < low(catsongs.Song)) then - break; - end; - if (I<= 1) then - Interaction := high(catsongs.Song) - else - Interaction := I - 1; - - //Stop Music - Music.Stop; - - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - HideCatTL; - - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - //SelectPrev; - //CatSongs.Song[0].Visible := False; - end - else - begin - //On Escape goto Cat-List Hack End - //Tabs off and in Search or Playlist -> Go back to Song view - if (CatSongs.CatNumShow < -1) then - begin - //Atm: Set Empty Filter - CatSongs.SetFilter('', 0); - - //Show Cat in Top Left Mod - HideCatTL; - Interaction := 0; - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - - ChangeMusic; - end - else - begin - Music.Stop; - Music.PlayBack; - - FadeTo(@ScreenMain); - end; - - end; - end - //When in party Mode then Ask before Close - else if (Mode = 1) then - begin - Music.PlayBack; - CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); - end; - end; - SDLK_RETURN: - begin - if Length(Songs.Song) > 0 then - begin - {$IFDEF UseSerialPort} - // PortWriteB($378, 0); - {$ENDIF} - if CatSongs.Song[Interaction].Main then - begin // clicked on Category Button - - //Show Cat in Top Left Mod - ShowCatTL (Interaction); - - //I := CatSongs.VisibleIndex(Interaction); - CatSongs.ClickCategoryButton(Interaction); - {I2 := CatSongs.VisibleIndex(Interaction); - SongCurrent := SongCurrent - I + I2; - SongTarget := SongTarget - I + I2; } - -// if I<>I2 then beep; - // SetScroll4; - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - - //Play Music: - ChangeMusic; - - end else begin // clicked on song - if (Mode = 0) then //Normal Mode -> Start Song - begin - //Do the Action that is specified in Ini - case Ini.OnSongClick of - 0: StartSong; - 1: SelectPlayers; - 2:begin - If (CatSongs.CatNumShow = -3) then - ScreenSongMenu.MenuShow(SM_Playlist) - else - ScreenSongMenu.MenuShow(SM_Main); - end; - end; - end - else if (Mode = 1) then //PartyMode -> Show Menu - begin - if (Ini.PartyPopup = 1) then - ScreenSongMenu.MenuShow(SM_Party_Main) - else - ScreenSong.StartSong; - end; - end; - end; - end; - - SDLK_M: //Show SongMenu - begin - if (Length(Songs.Song) > 0) then begin - if (Mode = 0) then begin - if not CatSongs.Song[Interaction].Main then begin // clicked on Song - if CatSongs.CatNumShow = -3 then - ScreenSongMenu.MenuShow(SM_Playlist) - else - ScreenSongMenu.MenuShow(SM_Main); - end - else - begin - ScreenSongMenu.MenuShow(SM_Playlist_Load); - end; - end //Party Mode -> Show Party Menu - else ScreenSongMenu.MenuShow(SM_Party_Main); - end; - end; - - SDLK_P: //Show Playlist Menu - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin - ScreenSongMenu.MenuShow(SM_Playlist_Load); - end; - end; - - SDLK_J: //Show Jumpto Menu - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then - begin - ScreenSongJumpto.Visible := True; - end; - end; - - SDLK_DOWN: - begin - if (Mode = 0) then - begin - //Only Change Cat when not in Playlist or Search Mode - if (CatSongs.CatNumShow > -2) then - begin - //Cat Change Hack - if Ini.Tabs_at_startup = 1 then - begin - I := Interaction; - if I <= 0 then I := 1; - - while not catsongs.Song[I].Main do - begin - Inc (I); - if (I > high(catsongs.Song)) then - I := low(catsongs.Song); - end; - - Interaction := I; - - //Show Cat in Top Left Mod - ShowCatTL (Interaction); - - CatSongs.ClickCategoryButton(Interaction); - SelectNext; - FixSelected; - - //Play Music: - Music.PlayChange; - ChangeMusic; - - end; - - // - //Cat Change Hack End} - end; - end; - end; - SDLK_UP: - begin - if (Mode = 0) then - begin - //Only Change Cat when not in Playlist or Search Mode - if (CatSongs.CatNumShow > -2) then - begin - //Cat Change Hack - if Ini.Tabs_at_startup = 1 then - begin - I := Interaction; - I2 := 0; - if I <= 0 then I := 1; - - while not catsongs.Song[I].Main or (I2 = 0) do - begin - if catsongs.Song[I].Main then - Inc(I2); - Dec (I); - if (I < low(catsongs.Song)) then - I := high(catsongs.Song); - end; - - Interaction := I; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - FixSelected; - - //Play Music: - Music.PlayChange; - ChangeMusic; - end; - end; - //Cat Change Hack End} - end; - end; - - SDLK_RIGHT: - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin - Music.PlayChange; - SelectNext; -// InteractNext; -// SongTarget := Interaction; - ChangeMusic; - SetScroll4; - UpdateLCD; - Light.LightOne(1, 200); - end; - end; - - SDLK_LEFT: - begin - if (Length(Songs.Song) > 0)AND (Mode = 0) then begin - Music.PlayChange; - SelectPrev; - ChangeMusic; - SetScroll4; - UpdateLCD; - Light.LightOne(0, 200); - end; - end; - - SDLK_E: - begin - OpenEditor; - end; - - SDLK_R: - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin - - if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category - begin - I2 := 0; //Count Cats - for I:= low(CatSongs.Song) to high (CatSongs.Song) do - if CatSongs.Song[I].Main then Inc(I2); - - I2 := Random (I2)+1; //Zufall - - //Find Cat: - for I:= low(CatSongs.Song) to high (CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - Dec(I2); - if (I2<=0) then - begin - //Show Cat in Top Left Mod - ShowCatTL (I); - - Interaction := I; - - CatSongs.ShowCategoryList; - CatSongs.ClickCategoryButton(I); - SelectNext; - FixSelected; - break; - end; - end; - - - end - else if (SDL_ModState = KMOD_LCTRL) AND (Ini.Tabs_at_startup = 1) then //random in All Categorys - begin - repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; - - //Search Cat - for I := I2 downto low(CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - break; - end; - //In I ist jetzt die Kategorie in I2 der Song - - //Choose Cat - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - - //Fix: Not Existing Song selected: - //if (I+1=I2) then Inc(I2); - - //Choose Song - SkipTo(I2-I); - - end - else //Random in one Category - begin - SkipTo(Random(CatSongs.VisibleSongs)); - end; - Music.PlayChange; - - ChangeMusic; - SetScroll4; - UpdateLCD; - end; - end; - - SDLK_1: - begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[0].Joker); - SelectRandomSong; - SetJoker; - end; - end; - - SDLK_2: - begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[1].Joker); - SelectRandomSong; - SetJoker; - end; - end; - - SDLK_3: - begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[2].Joker); - SelectRandomSong; - SetJoker; - end; - end; - end; - end; -end; - -constructor TScreenSong.Create; -var - Pet: integer; - I: integer; -Label CreateSongButtons; -begin - inherited Create; - - LoadFromTheme(Theme.Song); - - TextArtist := AddText(Theme.Song.TextArtist); - TextTitle := AddText(Theme.Song.TextTitle); - TextNumber := AddText(Theme.Song.TextNumber); - - //Show Cat in Top Left mod - TextCat := AddText(Theme.Song.TextCat); - StaticCat := AddStatic(Theme.Song.StaticCat); - - //Show Video Icon Mod - VideoIcon := AddStatic(Theme.Song.VideoIcon); - - //Party Mode - StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1); - StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2); - StaticTeam1Joker3 := AddStatic(Theme.Song.StaticTeam1Joker3); - StaticTeam1Joker4 := AddStatic(Theme.Song.StaticTeam1Joker4); - StaticTeam1Joker5 := AddStatic(Theme.Song.StaticTeam1Joker5); - - StaticTeam2Joker1 := AddStatic(Theme.Song.StaticTeam2Joker1); - StaticTeam2Joker2 := AddStatic(Theme.Song.StaticTeam2Joker2); - StaticTeam2Joker3 := AddStatic(Theme.Song.StaticTeam2Joker3); - StaticTeam2Joker4 := AddStatic(Theme.Song.StaticTeam2Joker4); - StaticTeam2Joker5 := AddStatic(Theme.Song.StaticTeam2Joker5); - - StaticTeam3Joker1 := AddStatic(Theme.Song.StaticTeam3Joker1); - StaticTeam3Joker2 := AddStatic(Theme.Song.StaticTeam3Joker2); - StaticTeam3Joker3 := AddStatic(Theme.Song.StaticTeam3Joker3); - StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); - StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); - - //Load Party or NonParty specific Statics and Texts - SetLength(StaticParty, Length(Theme.Song.StaticParty)); - for I := 0 to High(Theme.Song.StaticParty) do - StaticParty[I] := AddStatic(Theme.Song.StaticParty[I]); - - SetLength(TextParty, Length(Theme.Song.TextParty)); - for I := 0 to High(Theme.Song.TextParty) do - TextParty[I] := AddText(Theme.Song.TextParty[I]); - - SetLength(StaticNonParty, Length(Theme.Song.StaticNonParty)); - for I := 0 to High(Theme.Song.StaticNonParty) do - StaticNonParty[I] := AddStatic(Theme.Song.StaticNonParty[I]); - - SetLength(TextNonParty, Length(Theme.Song.TextNonParty)); - for I := 0 to High(Theme.Song.TextNonParty) do - TextNonParty[I] := AddText(Theme.Song.TextNonParty[I]); - - // Song List -// Songs.LoadSongList; // moved to the UltraStar unit - CatSongs.Refresh; - - if (length(CatSongs.Song) > 0) then - begin - //Set Length of Button Array one Time Instead of one time for every Song - SetButtonLength(Length(CatSongs.Song)); - - I := 0; - CreateSongButtons: - - try - for Pet := I to High(CatSongs.Song) do begin // creating all buttons - // new - Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 - - if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then - CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' - - if CatSongs.Song[Pet].Cover = '' then - AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) - else begin - // cache texture if there is a need to this - if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then begin - Texture.CreateCacheMipmap := true; - Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap - Texture.CreateCacheMipmap := false; - - // puts this texture to the cache file - Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); - - // unload full size texture - Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); - - // we should also add mipmap texture by calling createtexture and use mipmap cache as data source - end; - - // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) - AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); - end; - Texture.Limit := 1024*1024; - I := -1; - end; - except - //When Error is reported the First time for this Song - if (I <> Pet) then - begin - //Some Error reporting: - Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); - - //Change Cover to NoCover and Continue Loading - CatSongs.Song[Pet].Cover := ''; - I := Pet; - end - else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song - begin - Log.LogError('NoCover Cover is damaged!'); - try - AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); - except - {$IFDEF win32} - Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); - {$ELSE} - // TODO : JB_linux - better handle this message and display to user.. - writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'); - Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' ); - {$ENDIF} - Halt; - end; - I := Pet + 1; - end; - end; - - if (I <> -1) then - GoTo CreateSongButtons; - - end; - - // Randomize Patch - Randomize; - //Equalizer - SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); - //ClearArray - For I := low(EqualizerBands) to high(EqualizerBands) do - EqualizerBands[I] := 3; - - if (Length(CatSongs.Song) > 0) then - Interaction := 0; -end; - -procedure TScreenSong.SetScroll; -var - VS, B: Integer; -begin - VS := CatSongs.VisibleSongs; - if VS > 0 then - begin - //Set Positions - Case Theme.Song.Cover.Style of - 3: SetScroll3; - 5:begin - if VS > 5 then - SetScroll5 - else - SetScroll4; - end; - 6: SetScroll6; - else SetScroll4; - end; - //Set Visibility of Video Icon - Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> ''); - - //Set Texts: - Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; - Text[TextTitle].Text := CatSongs.Song[Interaction].Title; - if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then - begin - Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); - Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; - end - else if (CatSongs.CatNumShow = -2) then - Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) - else if (CatSongs.CatNumShow = -3) then - Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) - else if (Ini.Tabs_at_startup = 1) then - Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) - else - Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); - end - else - begin - Text[TextNumber].Text := '0/0'; - Text[TextArtist].Text := ''; - Text[TextTitle].Text := ''; - for B := 0 to High(Button) do - Button[B].Visible := False; - - end; -end; - -procedure TScreenSong.SetScroll1; -var - B: integer; // button - BMin: integer; // button min - BMax: integer; // button max - Src: integer; -// Dst: integer; - Count: integer; // Dst is not used. Count is used. - Ready: boolean; - - VisCount: integer; // count of visible (or selectable) buttons - VisInt: integer; // visible position of interacted button - Typ: integer; // 0 when all songs fits the screen - Placed: integer; // number of placed visible buttons -begin -// Src := 0; -// Dst := -1; - Count := 1; - Typ := 0; - Ready := false; - Placed := 0; - - VisCount := 0; - for B := 0 to High(Button) do - if CatSongs.Song[B].Visible then Inc(VisCount); - - VisInt := 0; - for B := 0 to Interaction-1 do - if CatSongs.Song[B].Visible then Inc(VisInt); - - - if VisCount <= 6 then begin - Typ := 0; - end else begin - if VisInt <= 3 then begin - Typ := 1; - Count := 7; - Ready := true; - end; - - if (VisCount - VisInt) <= 3 then begin - Typ := 2; - Count := 7; - Ready := true; - end; - - if not Ready then begin - Typ := 3; - Src := Interaction; - end; - end; - - - - // hide all buttons - for B := 0 to High(Button) do begin - Button[B].Visible := false; - Button[B].Selectable := CatSongs.Song[B].Visible; - end; - -{ for B := Src to Dst do begin -// Button[B].Visible := true; - Button[B].Visible := CatSongs.Song[B].Visible; - Button[B].Selectable := Button[B].Visible; - Button[B].Y := 140 + (B-Src) * 60; - end;} - - - if Typ = 0 then begin - for B := 0 to High(Button) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (Placed) * 60; - Inc(Placed); - end; - end; - end; - - if Typ = 1 then begin - B := 0; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Inc(B); - end; - end; - - if Typ = 2 then begin - B := High(Button); - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (6-Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Dec(B); - end; - end; - - if Typ = 3 then begin - B := Src; - Count := 4; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (3+Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Inc(B); - end; - - B := Src-1; - Placed := 0; - Count := 3; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (2-Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Dec(B); - end; - - end; - - if Length(Button) > 0 then - Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture -end; - -procedure TScreenSong.SetScroll2; -var - B: integer; - Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu - Wsp2: real; -begin - // liniowe - for B := 0 to High(Button) do - Button[B].X := 300 + (B - Interaction) * 260; - - if Length(Button) >= 3 then begin - if Interaction = 0 then - Button[High(Button)].X := 300 - 260; - - if Interaction = High(Button) then - Button[0].X := 300 + 260; - end; - - // kolowe -{ for B := 0 to High(Button) do begin - Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. - Wsp2 := Wsp / Length(Button); - Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); -// Button[B].Y := 140 + 50 * ; - end;} -end; - -procedure TScreenSong.SetScroll3; // with slide -var - B: integer; - Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu - Wsp2: real; -begin - SongTarget := Interaction; - - // liniowe - for B := 0 to High(Button) do - begin - Button[B].X := 300 + (B - SongCurrent) * 260; - if (Button[B].X < -Button[B].W) OR (Button[B].X > 800) then - Button[B].Visible := False - else - Button[B].Visible := True; - end; - -{ if Length(Button) >= 3 then begin - if Interaction = 0 then - Button[High(Button)].X := 300 - 260; - - if Interaction = High(Button) then - Button[0].X := 300 + 260; - end;} - - // kolowe -{ for B := 0 to High(Button) do begin - Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. - Wsp2 := Wsp / Length(Button); - Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); -// Button[B].Y := 140 + 50 * ; - end;} -end; - -procedure TScreenSong.SetScroll4; // rotate -var - B: integer; - Wsp: real; - Z, Z2: real; - VS: integer; -begin - VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important - - // kolowe - for B := 0 to High(Button) do begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2; - Z2 := (1 + 2*Z) / 3; - - - Button[B].X := Theme.Song.Cover.X + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - Button[B].Z := Z / 2 + 0.3; - - Button[B].W := Theme.Song.Cover.H * Z2; - -// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; - Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; - Button[B].H := Button[B].W; - end; - end; -end; - -(* -procedure TScreenSong.SetScroll4; // rotate -var - B: integer; - Wsp: real; - Z: real; - Z2, Z3: real; - VS: integer; - function modreal (const X, Y: real):real; - begin - Result := Frac(x / y) * y; - if Result < -3 then - Result := Result + Y - else if Result > 3 then - Result := Result - Y; - end; -begin - VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important - Z3 := 1; - if VS < 12 then - Z2 := VS - else - Z2 := 12; - - // kolowe - for B := 0 to High(Button) do begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - if ((ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)>-3) AND (ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)<3)) then - begin - if CatSongs.VisibleIndex(B)> SongCurrent then - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2 - else - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2; - - Z3 := 2; - Z := (1 + cos(Wsp)) / 2; - //Z2 := (1 + 2*Z) / 3; - //Z2 := (0.5 + Z/2); - //Z2 := sin(Wsp); - - //Z2 := Power (Z2,Z3); - - Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); - - //Button[B].X := Theme.Song.CoverX + ({Theme.Song.CoverX + Theme.Song.CoverW/2 + Theme.Song.CoverW*0.18 * VS {CatSongs.VisibleSongs {Length(Button) * sin(Wsp) {- Theme.Song.CoverX - Theme.Song.CoverW) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - if (sin(Wsp)<0) then - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W - else //*Theme.Song.CoverW*0.004*Z3 - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; - Button[B].Z := Z-0.00001; - -// Button[B].Y := {50 + 140 + 50 - 50 * Z2; - // Button[B].Y := (Theme.Song.CoverY + 40 + 50 - 50 * Z2); - Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); - Button[B].H := Button[B].W; - Button[B].Visible := True; - end - {else if (((CatSongs.VisibleIndex(B) - SongCurrent)>-3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) OR ((round (CatSongs.VisibleIndex(B) - SongCurrent) mod VS > -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) then - begin - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / 12 ;// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2 -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); - - if (sin(Wsp)<0) then - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W - else - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; - - Button[B].Z := Z; - - Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); - - Button[B].H := Button[B].W; - Button[B].Visible := True; - end - else Button[B].Visible := False; - end; - end; -end; *) - -procedure TScreenSong.SetScroll5; // rotate -var - B: integer; - Angle: real; - Pos: Real; - VS: integer; - diff: real; - X: Real; - helper: real; -begin - VS := CatSongs.VisibleSongs; // cache Visible Songs - {Vars - Theme.Song.CoverW: Radius des Kreises - Theme.Song.CoverX: X Pos Linke Kante des gewählten Covers - Theme.Song.CoverX: Y Pos Obere Kante des gewählten Covers - Theme.Song.CoverH: Höhe der Cover - - (CatSongs.VisibleIndex(B) - SongCurrent)/VS = Abstand zum MIttleren Cover in % - } - - //Change Pos of all Buttons - for B := low(Button) to high(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility - if Button[B].Visible then //Only Change Pos for Visible Buttons - begin - Pos := (CatSongs.VisibleIndex(B) - SongCurrent); - if (Pos < -VS/2) then - Pos := Pos + VS - else if (Pos > VS/2) then - Pos := Pos - VS; - - if (Abs(Pos) < 2.5) then {fixed Positions} - begin - Angle := Pi * (Pos / 5); -// Button[B].Visible := False; - - Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); - -// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Z := 0.95 - Abs(Pos) * 0.01; - - Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); - - Button[B].W := Button[B].H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - - X := Sin(Angle*1.3)*0.9; - - Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Diff; - - end - else - begin {Behind the Front Covers} - - // limit-bg-covers hack - if (abs(abs(Pos)-VS/2)>10) then Button[B].Visible:=False; - // end of limit-bg-covers hack - - if Pos < 0 then - Pos := (Pos - VS/2)/VS - else - Pos := (Pos + VS/2)/VS; - - Angle := pi * Pos*2; - if VS > 24 then - begin - if Angle < 0 then helper:=-1 else helper:=1; - Angle:=2*pi-abs(Angle); - Angle:=Angle*(VS/24); - Angle:=(2*pi-Angle)*helper; - end; - - Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); - - Button[B].W := Button[B].H; - - Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; - -// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*((Theme.Song.Cover.H)*sin(Angle/2)*1.52); - - end; - - //Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field -// Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); - - end; - end; -end; - -procedure TScreenSong.SetScroll6; // rotate (slotmachine style) -var - B: integer; - Angle: real; - Pos: Real; - VS: integer; - diff: real; - X: Real; - Wsp: real; - Z, Z2: real; -begin - VS := CatSongs.VisibleSongs; // cache Visible Songs - if VS <=5 then begin - // kolowe - for B := 0 to High(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2; - Z2 := (1 + 2*Z) / 3; - - - Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - Button[B].Z := Z / 2 + 0.3; - - Button[B].W := Theme.Song.Cover.H * Z2; - -// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; - Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; - Button[B].H := Button[B].W; - end; - end; - end - else begin - - //Change Pos of all Buttons - for B := low(Button) to high(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility - if Button[B].Visible then //Only Change Pos for Visible Buttons - begin - Pos := (CatSongs.VisibleIndex(B) - SongCurrent); - if (Pos < -VS/2) then - Pos := Pos + VS - else if (Pos > VS/2) then - Pos := Pos - VS; - - if (Abs(Pos) < 2.5) then {fixed Positions} - begin - Angle := Pi * (Pos / 5); -// Button[B].Visible := False; - - Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); - - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Z := 0.95 - Abs(Pos) * 0.01; - - Button[B].X := (Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); - - Button[B].W := Button[B].H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - - X := Sin(Angle*1.3)*0.9; - - Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff; - end - else - begin {Behind the Front Covers} - - // limit-bg-covers hack - if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; - if VS > 25 then VS:=25; - // end of limit-bg-covers hack - - if Pos < 0 then - Pos := (Pos - VS/2)/VS - else - Pos := (Pos + VS/2)/VS; - - Angle := pi * Pos*2; - - Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); - - Button[B].W := Button[B].H; - - Button[B].X := Theme.Song.Cover.X - (Button[B].H - Theme.Song.Cover.H)*0.5; - - - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Y := Theme.Song.Cover.Y+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*(Theme.Song.Cover.H*sin(Angle/2)*1.52); - end; - end; - end; - end; -end; - - -procedure TScreenSong.onShow; -begin - Music.Stop; - - if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; - if Ini.Players = 4 then PlayersPlay := 6; - - //Cat Mod etc - if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then - begin - CatSongs.ShowCategoryList; - FixSelected; - //Show Cat in Top Left Mod - HideCatTL; - end; - - - if Length(CatSongs.Song) > 0 then begin - //Load Music only when Song Preview is activated - if (Ini.PreviewVolume <> 0) then - begin - Music.SetLoop(false); - Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); - Music.MoveTo(Music.Length / 4); - Music.Play; - - //Set Preview Volume - Music.SetMusicVolume (Ini.PreviewVolume * 10); - {//if Music Fade is activated, Set Volume to 0 % - if (Ini.PreviewFading <> 0) then - Music.SetMusicVolume(0);} - end; - - SetScroll; - UpdateLCD; - end; - - //Playlist Mode - if (Mode = 0) then - begin - //If Playlist Shown -> Select Next automatically - if (CatSongs.CatNumShow = -3) then - begin - SelectNext; - ChangeMusic; - end; - end - //Party Mode - else if (Mode = 1) then - begin - - SelectRandomSong; - //Show Menu directly in PartyMode - //But only if selected in Options - if (Ini.PartyPopup = 1) then - begin - ScreenSongMenu.MenuShow(SM_Party_Main); - end; - - - end; - - SetJoker; - SetStatics; -end; - -procedure TScreenSong.onHide; -begin - //When Music Fading is activated, Turn Music to 100 % - If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then - Music.SetMusicVolume(100); - - //If Preview is deactivated: Load MUsicfile now - If (Ini.PreviewVolume = 0) then - Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); - - //When hide then Stop Music (For Party Mode Popup on Exit) - if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then - Music.Stop; -end; - -procedure TScreenSong.DrawExtensions; -begin - //Draw Song Menu - if (ScreenSongMenu.Visible) then - begin - ScreenSongMenu.Draw; - end - else if (ScreenSongJumpto.Visible) then - begin - ScreenSongJumpto.Draw; - end -end; - -function TScreenSong.Draw: boolean; -var - dx: real; - dt: real; - I: Integer; -begin - dx := SongTarget-SongCurrent; - dt := TimeSkip*7; - if dt > 1 then dt := 1; - SongCurrent := SongCurrent + dx*dt; - -{ if SongCurrent > Catsongs.VisibleSongs then begin - SongCurrent := SongCurrent - Catsongs.VisibleSongs; - SongTarget := SongTarget - Catsongs.VisibleSongs; - end;} - -// Log.BenchmarkStart(5); - SetScroll; -// Log.BenchmarkEnd(5); -// Log.LogBenchmark('SetScroll4', 5); - - //Fading Functions, Only if Covertime is under 5 Seconds - If (CoverTime < 5) then - begin - // 0.5.0: cover fade - if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin - // load new texture - Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); - Button[Interaction].Texture.Alpha := 1; - Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); - Button[Interaction].Texture2.Alpha := 1; - end; - - //Song Fade - if (CatSongs.VisibleSongs > 0) AND (Ini.PreviewVolume <> 0) AND (Not CatSongs.Song[Interaction].Main) AND (Ini.PreviewFading <> 0) then - begin - //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling - if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then - Music.Play; - - //Update Song Volume - if (CoverTime < Ini.PreviewFading) then - Music.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) - else - Music.SetMusicVolume(Ini.PreviewVolume * 10); - - end; - - - //Update Fading Time - CoverTime := CoverTime + TimeSkip; - - //Update Fading Texture - Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; - if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; - - end; - - //inherited Draw; - //heres a little Hack, that causes the Statics - //are Drawn after the Buttons because of some Blending Problems. - //This should cause no Problems because all Buttons on this screen - //Has Z Position. - //Draw BG - DrawBG; - - //Instead of Draw FG Procedure: - //We draw Buttons for our own - for I := 0 to Length(Button) - 1 do - Button[I].Draw; - - // Statics - for I := 0 to Length(Static) - 1 do - Static[I].Draw; - - // and texts - for I := 0 to Length(Text) - 1 do - Text[I].Draw; - - - //Draw Equalizer - if Theme.Song.Equalizer.Visible then - DrawEqualizer; - - DrawExtensions; - -end; - -procedure TScreenSong.SelectNext; -var - Skip: integer; - I: integer; - VS: Integer; -begin - VS := CatSongs.VisibleSongs; - - if VS > 0 then - begin - UnLoadDetailedCover; - - Skip := 1; - - // this 1 could be changed by CatSongs.FindNextVisible - while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); - - SongTarget := SongTarget + 1;//Skip; - - Interaction := (Interaction + Skip) mod Length(Interactions); - - // try to keep all at the beginning - if SongTarget > VS-1 then begin - SongTarget := SongTarget - VS; - SongCurrent := SongCurrent - VS; - end; - - end; - // Interaction -> Button, ktorego okladke przeczytamy - // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture -end; - -procedure TScreenSong.SelectPrev; -var - Skip: integer; - I: integer; - VS: Integer; -begin - VS := CatSongs.VisibleSongs; - - if VS > 0 then - begin - UnLoadDetailedCover; - - Skip := 1; - - while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); - SongTarget := SongTarget - 1;//Skip; - - Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); - - // try to keep all at the beginning - if SongTarget < 0 then begin - SongTarget := SongTarget + CatSongs.VisibleSongs; - SongCurrent := SongCurrent + CatSongs.VisibleSongs; - end; - - // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture - end; -end; - -procedure TScreenSong.UpdateLCD; -begin - LCD.HideCursor; - LCD.Clear; - LCD.WriteText(1, Text[TextArtist].Text); - LCD.WriteText(2, Text[TextTitle].Text); -end; - -//Procedure Change current played Preview -procedure TScreenSong.ChangeMusic; -begin - //When Music Preview is avtivated -> then Change Music - if (Ini.PreviewVolume <> 0) then - begin - if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then - begin - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); - //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal - if (Ini.PreviewFading = 0) then - Music.Play - else - Music.SetMusicVolume(0); - end; - end - else - Music.Stop; - end; -end; - -procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0 -var - Skip: integer; - I: integer; -begin - UnLoadDetailedCover; - - Interaction := High(CatSongs.Song); - SongTarget := 0; - - for I := 1 to Target+1 do - SelectNext; - - FixSelected2; -end; - -procedure TScreenSong.DrawEqualizer; -var - Data: TFFTData; //Audio Data - I, J: Integer; - Res: byte; - A, B: Integer; - PosX, PosY: Integer; - Pos: Real; -begin -if (not Music.Finished) AND (Theme.Song.Equalizer.Length > 0) then -begin - - - A := GetTickCount div 44; - - if (A <> EqualizerTime) then - begin - EqualizerTime := A; - Data := Music.GetFFTData; - - B:=0; - Pos := 0; - Res := ceil(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band - - //Change Lengths - for I := 0 to (Res * Theme.Song.Equalizer.Bands - 1) do - begin - A := floor(I/Res); - - if (A<>B) then //Band changed - begin - if (Pos <= Theme.Song.Equalizer.Length) then - begin - if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then - EqualizerBands[B] := EqualizerBands[B] - 1 - else - EqualizerBands[B] := floor(Pos); - end - else - EqualizerBands[B] := 1; - - B := A; - Pos := 0; - end; - - if I > 35 then - Data[i] := Data[i] * 8 - else if I > 11 then - Data[i] := Data[i] * 4.5 - else - Data[i] := Data[i] * 1.1; - - if (Data[i] >= 1) then - Data[i] := 0.9999999999999; - - if Data[i]*Theme.Song.Equalizer.Length > Pos then - Pos := Data[i]*Theme.Song.Equalizer.Length; - end; - - //Change Last Band - if (EqualizerBands[B] <= Theme.Song.Equalizer.Length) then - begin - if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then - EqualizerBands[B] := EqualizerBands[B] - 1 - else - EqualizerBands[B] := floor(Pos) - end - else - EqualizerBands[B] := 1; - end; - - //Draw every Channel - glColor4f(Theme.Song.Equalizer.ColR, Theme.Song.Equalizer.ColG, Theme.Song.Equalizer.ColB, Theme.Song.Equalizer.Alpha); //Set Color - glDisable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - - PosY := Theme.Song.Equalizer.Y; - PosX := Theme.Song.Equalizer.X; - - For I := 0 to Theme.Song.Equalizer.Bands-1 do - begin - if Theme.Song.Equalizer.Direction then - PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length - else - PosX := Theme.Song.Equalizer.X; - //Draw for every visible quad - for J := 1 to EqualizerBands[I] do - begin - glBegin(GL_QUADS); - glVertex3f(PosX, PosY, Theme.Song.Equalizer.Z); - glVertex3f(PosX, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); - glVertex3f(PosX+Theme.Song.Equalizer.W, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); - glVertex3f(PosX+Theme.Song.Equalizer.W, PosY, Theme.Song.Equalizer.Z); - glEnd; - - if Theme.Song.Equalizer.Direction then //Vertically - PosY := PosY - Theme.Song.Equalizer.H - Theme.Song.Equalizer.Space - else //Horizontally - PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space; - end; - if Theme.Song.Equalizer.Direction then //Horizontally - PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space - else //Vertically - PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space; - end; -end; -end; - -Procedure TScreenSong.SelectRandomSong; -var - I, I2: Integer; -begin - Case PlaylistMan.Mode of - 0: //All Songs Just Select Random Song - begin - //When Tabs are activated then use Tab Method - if (Ini.Tabs_at_startup = 1) then - begin - repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; - - //Search Cat - for I := I2 downto low(CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - break; - end; - //In I ist jetzt die Kategorie in I2 der Song - //I is the CatNum, I2 is the No of the Song within this Cat - - //Choose Cat - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - - //Choose Song - SkipTo(I2-I); - end - //When Tabs are deactivated use easy Method - else - SkipTo(Random(CatSongs.VisibleSongs)); - end; - 1: //One Category Select Category and Select Random Song - begin - CatSongs.ShowCategoryList; - CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); - ShowCatTL(PlaylistMan.CurPlayList); - - SelectNext; - FixSelected2; - - SkipTo(Random(CatSongs.VisibleSongs)); - end; - 2: //Playlist: Select Playlist and Select Random Song - begin - PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); - - SkipTo(Random(CatSongs.VisibleSongs)); - FixSelected2; - end; - end; - - Music.PlayChange; - ChangeMusic; - SetScroll; - UpdateLCD; -end; - -procedure TScreenSong.SetJoker; -begin - //If Party Mode - if Mode = 1 then //Show Joker that are available - begin - if (PartySession.Teams.NumTeams >= 1) then - begin - Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1); - Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2); - Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3); - Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4); - Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5); - end - else - begin - Static[StaticTeam1Joker1].Visible := False; - Static[StaticTeam1Joker2].Visible := False; - Static[StaticTeam1Joker3].Visible := False; - Static[StaticTeam1Joker4].Visible := False; - Static[StaticTeam1Joker5].Visible := False; - end; - - if (PartySession.Teams.NumTeams >= 2) then - begin - Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1); - Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2); - Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3); - Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4); - Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5); - end - else - begin - Static[StaticTeam2Joker1].Visible := False; - Static[StaticTeam2Joker2].Visible := False; - Static[StaticTeam2Joker3].Visible := False; - Static[StaticTeam2Joker4].Visible := False; - Static[StaticTeam2Joker5].Visible := False; - end; - - if (PartySession.Teams.NumTeams >= 3) then - begin - Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1); - Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2); - Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3); - Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4); - Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5); - end - else - begin - Static[StaticTeam3Joker1].Visible := False; - Static[StaticTeam3Joker2].Visible := False; - Static[StaticTeam3Joker3].Visible := False; - Static[StaticTeam3Joker4].Visible := False; - Static[StaticTeam3Joker5].Visible := False; - end; - end - else - begin //Hide all - Static[StaticTeam1Joker1].Visible := False; - Static[StaticTeam1Joker2].Visible := False; - Static[StaticTeam1Joker3].Visible := False; - Static[StaticTeam1Joker4].Visible := False; - Static[StaticTeam1Joker5].Visible := False; - - Static[StaticTeam2Joker1].Visible := False; - Static[StaticTeam2Joker2].Visible := False; - Static[StaticTeam2Joker3].Visible := False; - Static[StaticTeam2Joker4].Visible := False; - Static[StaticTeam2Joker5].Visible := False; - - Static[StaticTeam3Joker1].Visible := False; - Static[StaticTeam3Joker2].Visible := False; - Static[StaticTeam3Joker3].Visible := False; - Static[StaticTeam3Joker4].Visible := False; - Static[StaticTeam3Joker5].Visible := False; - end; -end; - -procedure TScreenSong.SetStatics; -var - I: Integer; - Visible: Boolean; -begin - //Set Visibility of Party Statics and Text - Visible := (Mode = 1); - - For I := 0 to high(StaticParty) do - Static[StaticParty[I]].Visible := Visible; - - For I := 0 to high(TextParty) do - Text[TextParty[I]].Visible := Visible; - - //Set Visibility of Non Party Statics and Text - Visible := not Visible; - - For I := 0 to high(StaticNonParty) do - Static[StaticNonParty[I]].Visible := Visible; - - For I := 0 to high(TextNonParty) do - Text[TextNonParty[I]].Visible := Visible; -end; - -//Procedures for Menu - -procedure TScreenSong.StartSong; -begin - CatSongs.Selected := Interaction; - Music.Stop; - //Party Mode - if (Mode = 1) then - begin - FadeTo(@ScreenSingModi); - end - else - begin - FadeTo(@ScreenSing); - end; -end; - -procedure TScreenSong.SelectPlayers; -begin - CatSongs.Selected := Interaction; - Music.Stop; - - ScreenName.Goto_SingScreen := True; - FadeTo(@ScreenName); -end; - -procedure TScreenSong.OpenEditor; -begin - if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin - Music.Stop; - Music.PlayStart; - ScreenEditSub.Path := CatSongs.Song[Interaction].Path; - ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName; - FadeTo(@ScreenEditSub); - end; -end; - -//Team No of Team (0-5) -procedure TScreenSong.DoJoker (Team: Byte); -begin - if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[Team].Joker); - SelectRandomSong; - SetJoker; - end; -end; - -//Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song -procedure TScreenSong.UnLoadDetailedCover; -begin - CoverTime := 0; - - Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture - Button[Interaction].Texture2.Alpha := 0; - - if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then - Texture.UnloadTexture(Button[Interaction].Texture.Name, false); -end; - -procedure TScreenSong.Refresh; -begin { -CatSongs.Refresh; -CatSongs.ShowCategoryList; -Interaction := 0; -SelectNext; -FixSelected; } - -end; - -end. +unit UScreenSong; + +interface +{$I switches.inc} + +uses + UMenu, + SDL, + UMusic, + UFiles, + UTime, + UDisplay, + USongs, + SysUtils, + ULog, + UThemes, + UTexture, + ULanguage, + ULCD, + ULight, + UIni; + +type + TScreenSong = class(TMenu) + public + TextArtist: integer; + TextTitle: integer; + TextNumber: integer; + + //Video Icon Mod + VideoIcon: Cardinal; + + TextCat: integer; + StaticCat: integer; + + SongCurrent: real; + SongTarget: real; + + HighSpeed: boolean; + CoverFull: boolean; + CoverTime: real; + CoverX: integer; + CoverY: integer; + CoverW: integer; + is_jump: boolean; // Jump to Song Mod + is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title + + EqualizerBands: array of Byte; + EqualizerTime: Cardinal; + EqualizerTime2: Byte; + + //Party Mod + Mode: Byte; //0 = Standard, 1= Go to PartyMode after Selection + Change to Random Song at Show + //party Statics (Joker) + StaticTeam1Joker1: Cardinal; + StaticTeam1Joker2: Cardinal; + StaticTeam1Joker3: Cardinal; + StaticTeam1Joker4: Cardinal; + StaticTeam1Joker5: Cardinal; + + StaticTeam2Joker1: Cardinal; + StaticTeam2Joker2: Cardinal; + StaticTeam2Joker3: Cardinal; + StaticTeam2Joker4: Cardinal; + StaticTeam2Joker5: Cardinal; + + StaticTeam3Joker1: Cardinal; + StaticTeam3Joker2: Cardinal; + StaticTeam3Joker3: Cardinal; + StaticTeam3Joker4: Cardinal; + StaticTeam3Joker5: Cardinal; + + StaticParty: Array of Cardinal; + TextParty: Array of Cardinal; + StaticNonParty: Array of Cardinal; + TextNonParty: Array of Cardinal; + + + constructor Create; override; + procedure SetScroll; + procedure SetScroll1; + procedure SetScroll2; + procedure SetScroll3; + procedure SetScroll4; + procedure SetScroll5; + procedure SetScroll6; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure SelectNext; + procedure SelectPrev; + procedure UpdateLCD; + procedure SkipTo(Target: Cardinal); + procedure FixSelected; //Show Wrong Song when Tabs on Fix + procedure FixSelected2; //Show Wrong Song when Tabs on Fix + procedure ShowCatTL(Cat: Integer);// Show Cat in Top left + procedure ShowCatTLCustom(Caption: String);// Show Custom Text in Top left + procedure HideCatTL;// Show Cat in Tob left + procedure Refresh; //Refresh Song Sorting + procedure DrawEqualizer; + procedure ChangeMusic; + //Party Mode + procedure SelectRandomSong; + procedure SetJoker; + procedure SetStatics; + //procedures for Menu + procedure StartSong; + procedure OpenEditor; + procedure DoJoker(Team: Byte); + procedure SelectPlayers; + + procedure UnLoadDetailedCover; + + //Extensions + procedure DrawExtensions; + end; + +implementation +uses UGraphic, + UMain, + UCovers, + math, + OpenGL12, + {$IFDEF win32} + windows, + {$ELSE} + lclintf, + {$ENDIF} + USkins, + UDLLManager, + UParty, + UPlaylist, + UScreenSongMenu; + +// ***** Public methods ****** // + +//Show Wrong Song when Tabs on Fix +procedure TScreenSong.FixSelected; +var I, I2: Integer; + begin + if CatSongs.VisibleSongs > 0 then + begin + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); + + if I = Interaction - 1 then + break; + end; + + SongCurrent := I2; + SongTarget := I2; + end; + end; + +procedure TScreenSong.FixSelected2; +var I, I2: Integer; + begin + if CatSongs.VisibleSongs > 0 then + begin + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); + + if I = Interaction - 1 then + break; + end; + + SongTarget := I2; + end; + end; +//Show Wrong Song when Tabs on Fix End + + procedure TScreenSong.ShowCatTLCustom(Caption: String);// Show Custom Text in Top left + begin + Text[TextCat].Text := Caption; + Text[TextCat].Visible := true; + Static[StaticCat].Visible := False; + end; + + //Show Cat in Top Left Mod + procedure TScreenSong.ShowCatTL(Cat: Integer); + begin + //Change + Text[TextCat].Text := CatSongs.Song[Cat].Artist; + //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover); + //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); + + Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); + //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false); + //Button[Cat]. + //Cover + + + //Show + Text[TextCat].Visible := true; + Static[StaticCat].Visible := True; + end; + + procedure TScreenSong.HideCatTL; + begin + //Hide + //Text[TextCat].Visible := false; + Static[StaticCat].Visible := false; + //New -> Show Text specified in Theme + Text[TextCat].Visible := True; + Text[TextCat].Text := Theme.Song.TextCat.Text; + end; + //Show Cat in Top Left Mod End + + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenSong.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var + I: integer; + I2: integer; + HS: integer; + SDL_ModState: Word; + Letter: Char; +begin + Result := true; + + //Song Screen Extensions (Jumpto + Menu) + if (ScreenSongMenu.Visible) then + begin + Result := ScreenSongMenu.ParseInput(PressedKey, ScanCode, PressedDown); + Exit; + end + else if (ScreenSongJumpto.Visible) then + begin + Result := ScreenSongJumpto.ParseInput(PressedKey, ScanCode, PressedDown); + Exit; + end; + + If (PressedDown) Then + begin // Key Down + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + + //Jump to Artist/Titel + if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then + begin + Letter := UpCase(Chr(ScanCode)); + I2 := Length(CatSongs.Song); + + //Jump To Titel + if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then + begin + For I := 1 to high(CatSongs.Song) do + begin + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + + Music.PlayChange; + + ChangeMusic; + SetScroll4; + UpdateLCD; + //Break and Exit + Exit; + end; + end; + end + //Jump to Artist + else if (SDL_ModState = KMOD_LALT) then + begin + For I := 1 to high(CatSongs.Song) do + begin + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Artist[1]) = Letter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + + Music.PlayChange; + + ChangeMusic; + SetScroll4; + UpdateLCD; + + //Break and Exit + Exit; + end; + end; + end; + Exit; + end; + + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + if (Mode = 0) then + begin + //On Escape goto Cat-List Hack + if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then + begin + //Find Category + I := Interaction; + while not catsongs.Song[I].Main do + begin + Dec (I); + if (I < low(catsongs.Song)) then + break; + end; + if (I<= 1) then + Interaction := high(catsongs.Song) + else + Interaction := I - 1; + + //Stop Music + Music.Stop; + + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + HideCatTL; + + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + //SelectPrev; + //CatSongs.Song[0].Visible := False; + end + else + begin + //On Escape goto Cat-List Hack End + //Tabs off and in Search or Playlist -> Go back to Song view + if (CatSongs.CatNumShow < -1) then + begin + //Atm: Set Empty Filter + CatSongs.SetFilter('', 0); + + //Show Cat in Top Left Mod + HideCatTL; + Interaction := 0; + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + + ChangeMusic; + end + else + begin + Music.Stop; + Music.PlayBack; + + FadeTo(@ScreenMain); + end; + + end; + end + //When in party Mode then Ask before Close + else if (Mode = 1) then + begin + Music.PlayBack; + CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); + end; + end; + SDLK_RETURN: + begin + if Length(Songs.Song) > 0 then + begin + {$IFDEF UseSerialPort} + // PortWriteB($378, 0); + {$ENDIF} + if CatSongs.Song[Interaction].Main then + begin // clicked on Category Button + + //Show Cat in Top Left Mod + ShowCatTL (Interaction); + + //I := CatSongs.VisibleIndex(Interaction); + CatSongs.ClickCategoryButton(Interaction); + {I2 := CatSongs.VisibleIndex(Interaction); + SongCurrent := SongCurrent - I + I2; + SongTarget := SongTarget - I + I2; } + +// if I<>I2 then beep; + // SetScroll4; + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + + //Play Music: + ChangeMusic; + + end else begin // clicked on song + if (Mode = 0) then //Normal Mode -> Start Song + begin + //Do the Action that is specified in Ini + case Ini.OnSongClick of + 0: StartSong; + 1: SelectPlayers; + 2:begin + If (CatSongs.CatNumShow = -3) then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end; + end; + end + else if (Mode = 1) then //PartyMode -> Show Menu + begin + if (Ini.PartyPopup = 1) then + ScreenSongMenu.MenuShow(SM_Party_Main) + else + ScreenSong.StartSong; + end; + end; + end; + end; + + SDLK_M: //Show SongMenu + begin + if (Length(Songs.Song) > 0) then begin + if (Mode = 0) then begin + if not CatSongs.Song[Interaction].Main then begin // clicked on Song + if CatSongs.CatNumShow = -3 then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end + else + begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); + end; + end //Party Mode -> Show Party Menu + else ScreenSongMenu.MenuShow(SM_Party_Main); + end; + end; + + SDLK_P: //Show Playlist Menu + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); + end; + end; + + SDLK_J: //Show Jumpto Menu + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then + begin + ScreenSongJumpto.Visible := True; + end; + end; + + SDLK_DOWN: + begin + if (Mode = 0) then + begin + //Only Change Cat when not in Playlist or Search Mode + if (CatSongs.CatNumShow > -2) then + begin + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then + begin + I := Interaction; + if I <= 0 then I := 1; + + while not catsongs.Song[I].Main do + begin + Inc (I); + if (I > high(catsongs.Song)) then + I := low(catsongs.Song); + end; + + Interaction := I; + + //Show Cat in Top Left Mod + ShowCatTL (Interaction); + + CatSongs.ClickCategoryButton(Interaction); + SelectNext; + FixSelected; + + //Play Music: + Music.PlayChange; + ChangeMusic; + + end; + + // + //Cat Change Hack End} + end; + end; + end; + SDLK_UP: + begin + if (Mode = 0) then + begin + //Only Change Cat when not in Playlist or Search Mode + if (CatSongs.CatNumShow > -2) then + begin + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then + begin + I := Interaction; + I2 := 0; + if I <= 0 then I := 1; + + while not catsongs.Song[I].Main or (I2 = 0) do + begin + if catsongs.Song[I].Main then + Inc(I2); + Dec (I); + if (I < low(catsongs.Song)) then + I := high(catsongs.Song); + end; + + Interaction := I; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + + //Play Music: + Music.PlayChange; + ChangeMusic; + end; + end; + //Cat Change Hack End} + end; + end; + + SDLK_RIGHT: + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + Music.PlayChange; + SelectNext; +// InteractNext; +// SongTarget := Interaction; + ChangeMusic; + SetScroll4; + UpdateLCD; + Light.LightOne(1, 200); + end; + end; + + SDLK_LEFT: + begin + if (Length(Songs.Song) > 0)AND (Mode = 0) then begin + Music.PlayChange; + SelectPrev; + ChangeMusic; + SetScroll4; + UpdateLCD; + Light.LightOne(0, 200); + end; + end; + + SDLK_E: + begin + OpenEditor; + end; + + SDLK_R: + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + + if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category + begin + I2 := 0; //Count Cats + for I:= low(CatSongs.Song) to high (CatSongs.Song) do + if CatSongs.Song[I].Main then Inc(I2); + + I2 := Random (I2)+1; //Zufall + + //Find Cat: + for I:= low(CatSongs.Song) to high (CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + Dec(I2); + if (I2<=0) then + begin + //Show Cat in Top Left Mod + ShowCatTL (I); + + Interaction := I; + + CatSongs.ShowCategoryList; + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + break; + end; + end; + + + end + else if (SDL_ModState = KMOD_LCTRL) AND (Ini.Tabs_at_startup = 1) then //random in All Categorys + begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; + + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + + //Choose Cat + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Fix: Not Existing Song selected: + //if (I+1=I2) then Inc(I2); + + //Choose Song + SkipTo(I2-I); + + end + else //Random in one Category + begin + SkipTo(Random(CatSongs.VisibleSongs)); + end; + Music.PlayChange; + + ChangeMusic; + SetScroll4; + UpdateLCD; + end; + end; + + SDLK_1: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[0].Joker); + SelectRandomSong; + SetJoker; + end; + end; + + SDLK_2: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[1].Joker); + SelectRandomSong; + SetJoker; + end; + end; + + SDLK_3: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[2].Joker); + SelectRandomSong; + SetJoker; + end; + end; + end; + end; +end; + +constructor TScreenSong.Create; +var + Pet: integer; + I: integer; +Label CreateSongButtons; +begin + inherited Create; + + LoadFromTheme(Theme.Song); + + TextArtist := AddText(Theme.Song.TextArtist); + TextTitle := AddText(Theme.Song.TextTitle); + TextNumber := AddText(Theme.Song.TextNumber); + + //Show Cat in Top Left mod + TextCat := AddText(Theme.Song.TextCat); + StaticCat := AddStatic(Theme.Song.StaticCat); + + //Show Video Icon Mod + VideoIcon := AddStatic(Theme.Song.VideoIcon); + + //Party Mode + StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1); + StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2); + StaticTeam1Joker3 := AddStatic(Theme.Song.StaticTeam1Joker3); + StaticTeam1Joker4 := AddStatic(Theme.Song.StaticTeam1Joker4); + StaticTeam1Joker5 := AddStatic(Theme.Song.StaticTeam1Joker5); + + StaticTeam2Joker1 := AddStatic(Theme.Song.StaticTeam2Joker1); + StaticTeam2Joker2 := AddStatic(Theme.Song.StaticTeam2Joker2); + StaticTeam2Joker3 := AddStatic(Theme.Song.StaticTeam2Joker3); + StaticTeam2Joker4 := AddStatic(Theme.Song.StaticTeam2Joker4); + StaticTeam2Joker5 := AddStatic(Theme.Song.StaticTeam2Joker5); + + StaticTeam3Joker1 := AddStatic(Theme.Song.StaticTeam3Joker1); + StaticTeam3Joker2 := AddStatic(Theme.Song.StaticTeam3Joker2); + StaticTeam3Joker3 := AddStatic(Theme.Song.StaticTeam3Joker3); + StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); + StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); + + //Load Party or NonParty specific Statics and Texts + SetLength(StaticParty, Length(Theme.Song.StaticParty)); + for I := 0 to High(Theme.Song.StaticParty) do + StaticParty[I] := AddStatic(Theme.Song.StaticParty[I]); + + SetLength(TextParty, Length(Theme.Song.TextParty)); + for I := 0 to High(Theme.Song.TextParty) do + TextParty[I] := AddText(Theme.Song.TextParty[I]); + + SetLength(StaticNonParty, Length(Theme.Song.StaticNonParty)); + for I := 0 to High(Theme.Song.StaticNonParty) do + StaticNonParty[I] := AddStatic(Theme.Song.StaticNonParty[I]); + + SetLength(TextNonParty, Length(Theme.Song.TextNonParty)); + for I := 0 to High(Theme.Song.TextNonParty) do + TextNonParty[I] := AddText(Theme.Song.TextNonParty[I]); + + // Song List +// Songs.LoadSongList; // moved to the UltraStar unit + CatSongs.Refresh; + + if (length(CatSongs.Song) > 0) then + begin + //Set Length of Button Array one Time Instead of one time for every Song + SetButtonLength(Length(CatSongs.Song)); + + I := 0; + CreateSongButtons: + + try + for Pet := I to High(CatSongs.Song) do begin // creating all buttons + // new + Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 + + if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' + + if CatSongs.Song[Pet].Cover = '' then + AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) + else begin + // cache texture if there is a need to this + if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + begin + Texture.CreateCacheMipmap := true; + Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap + Texture.CreateCacheMipmap := false; + + // puts this texture to the cache file + Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + + // unload full size texture + Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); + + // we should also add mipmap texture by calling createtexture and use mipmap cache as data source + end; + + // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) + AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + end; + Texture.Limit := 1024*1024; + I := -1; + end; + except + //When Error is reported the First time for this Song + if (I <> Pet) then + begin + //Some Error reporting: + Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); + + //Change Cover to NoCover and Continue Loading + CatSongs.Song[Pet].Cover := ''; + I := Pet; + end + else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song + begin + Log.LogError('NoCover Cover is damaged!'); + try + AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); + except + {$IFDEF win32} + Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); + {$ELSE} + // TODO : JB_linux - better handle this message and display to user.. + writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'); + Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' ); + {$ENDIF} + Halt; + end; + I := Pet + 1; + end; + end; + + if (I <> -1) then + GoTo CreateSongButtons; + + end; + + // Randomize Patch + Randomize; + //Equalizer + SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); + //ClearArray + For I := low(EqualizerBands) to high(EqualizerBands) do + EqualizerBands[I] := 3; + + if (Length(CatSongs.Song) > 0) then + Interaction := 0; +end; + +procedure TScreenSong.SetScroll; +var + VS, B: Integer; +begin + VS := CatSongs.VisibleSongs; + if VS > 0 then + begin + //Set Positions + Case Theme.Song.Cover.Style of + 3: SetScroll3; + 5:begin + if VS > 5 then + SetScroll5 + else + SetScroll4; + end; + 6: SetScroll6; + else SetScroll4; + end; + //Set Visibility of Video Icon + Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> ''); + + //Set Texts: + Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; + Text[TextTitle].Text := CatSongs.Song[Interaction].Title; + if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then + begin + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); + Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; + end + else if (CatSongs.CatNumShow = -2) then + Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) + else if (CatSongs.CatNumShow = -3) then + Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) + else if (Ini.Tabs_at_startup = 1) then + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) + else + Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); + end + else + begin + Text[TextNumber].Text := '0/0'; + Text[TextArtist].Text := ''; + Text[TextTitle].Text := ''; + for B := 0 to High(Button) do + Button[B].Visible := False; + + end; +end; + +procedure TScreenSong.SetScroll1; +var + B: integer; // button + BMin: integer; // button min + BMax: integer; // button max + Src: integer; +// Dst: integer; + Count: integer; // Dst is not used. Count is used. + Ready: boolean; + + VisCount: integer; // count of visible (or selectable) buttons + VisInt: integer; // visible position of interacted button + Typ: integer; // 0 when all songs fits the screen + Placed: integer; // number of placed visible buttons +begin +// Src := 0; +// Dst := -1; + Count := 1; + Typ := 0; + Ready := false; + Placed := 0; + + VisCount := 0; + for B := 0 to High(Button) do + if CatSongs.Song[B].Visible then Inc(VisCount); + + VisInt := 0; + for B := 0 to Interaction-1 do + if CatSongs.Song[B].Visible then Inc(VisInt); + + + if VisCount <= 6 then begin + Typ := 0; + end else begin + if VisInt <= 3 then begin + Typ := 1; + Count := 7; + Ready := true; + end; + + if (VisCount - VisInt) <= 3 then begin + Typ := 2; + Count := 7; + Ready := true; + end; + + if not Ready then begin + Typ := 3; + Src := Interaction; + end; + end; + + + + // hide all buttons + for B := 0 to High(Button) do begin + Button[B].Visible := false; + Button[B].Selectable := CatSongs.Song[B].Visible; + end; + +{ for B := Src to Dst do begin +// Button[B].Visible := true; + Button[B].Visible := CatSongs.Song[B].Visible; + Button[B].Selectable := Button[B].Visible; + Button[B].Y := 140 + (B-Src) * 60; + end;} + + + if Typ = 0 then begin + for B := 0 to High(Button) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (Placed) * 60; + Inc(Placed); + end; + end; + end; + + if Typ = 1 then begin + B := 0; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Inc(B); + end; + end; + + if Typ = 2 then begin + B := High(Button); + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (6-Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Dec(B); + end; + end; + + if Typ = 3 then begin + B := Src; + Count := 4; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (3+Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Inc(B); + end; + + B := Src-1; + Placed := 0; + Count := 3; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (2-Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Dec(B); + end; + + end; + + if Length(Button) > 0 then + Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture +end; + +procedure TScreenSong.SetScroll2; +var + B: integer; + Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu + Wsp2: real; +begin + // liniowe + for B := 0 to High(Button) do + Button[B].X := 300 + (B - Interaction) * 260; + + if Length(Button) >= 3 then begin + if Interaction = 0 then + Button[High(Button)].X := 300 - 260; + + if Interaction = High(Button) then + Button[0].X := 300 + 260; + end; + + // kolowe +{ for B := 0 to High(Button) do begin + Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. + Wsp2 := Wsp / Length(Button); + Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); +// Button[B].Y := 140 + 50 * ; + end;} +end; + +procedure TScreenSong.SetScroll3; // with slide +var + B: integer; + Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu + Wsp2: real; +begin + SongTarget := Interaction; + + // liniowe + for B := 0 to High(Button) do + begin + Button[B].X := 300 + (B - SongCurrent) * 260; + if (Button[B].X < -Button[B].W) OR (Button[B].X > 800) then + Button[B].Visible := False + else + Button[B].Visible := True; + end; + +{ if Length(Button) >= 3 then begin + if Interaction = 0 then + Button[High(Button)].X := 300 - 260; + + if Interaction = High(Button) then + Button[0].X := 300 + 260; + end;} + + // kolowe +{ for B := 0 to High(Button) do begin + Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. + Wsp2 := Wsp / Length(Button); + Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); +// Button[B].Y := 140 + 50 * ; + end;} +end; + +procedure TScreenSong.SetScroll4; // rotate +var + B: integer; + Wsp: real; + Z, Z2: real; + VS: integer; +begin + VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important + + // kolowe + for B := 0 to High(Button) do begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2; + Z2 := (1 + 2*Z) / 3; + + + Button[B].X := Theme.Song.Cover.X + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z / 2 + 0.3; + + Button[B].W := Theme.Song.Cover.H * Z2; + +// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; + Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; + Button[B].H := Button[B].W; + end; + end; +end; + +(* +procedure TScreenSong.SetScroll4; // rotate +var + B: integer; + Wsp: real; + Z: real; + Z2, Z3: real; + VS: integer; + function modreal (const X, Y: real):real; + begin + Result := Frac(x / y) * y; + if Result < -3 then + Result := Result + Y + else if Result > 3 then + Result := Result - Y; + end; +begin + VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important + Z3 := 1; + if VS < 12 then + Z2 := VS + else + Z2 := 12; + + // kolowe + for B := 0 to High(Button) do begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + if ((ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)>-3) AND (ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)<3)) then + begin + if CatSongs.VisibleIndex(B)> SongCurrent then + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2 + else + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2; + + Z3 := 2; + Z := (1 + cos(Wsp)) / 2; + //Z2 := (1 + 2*Z) / 3; + //Z2 := (0.5 + Z/2); + //Z2 := sin(Wsp); + + //Z2 := Power (Z2,Z3); + + Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); + + //Button[B].X := Theme.Song.CoverX + ({Theme.Song.CoverX + Theme.Song.CoverW/2 + Theme.Song.CoverW*0.18 * VS {CatSongs.VisibleSongs {Length(Button) * sin(Wsp) {- Theme.Song.CoverX - Theme.Song.CoverW) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + if (sin(Wsp)<0) then + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W + else //*Theme.Song.CoverW*0.004*Z3 + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; + Button[B].Z := Z-0.00001; + +// Button[B].Y := {50 + 140 + 50 - 50 * Z2; + // Button[B].Y := (Theme.Song.CoverY + 40 + 50 - 50 * Z2); + Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); + Button[B].H := Button[B].W; + Button[B].Visible := True; + end + {else if (((CatSongs.VisibleIndex(B) - SongCurrent)>-3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) OR ((round (CatSongs.VisibleIndex(B) - SongCurrent) mod VS > -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) then + begin + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / 12 ;// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2 -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); + + if (sin(Wsp)<0) then + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W + else + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; + + Button[B].Z := Z; + + Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); + + Button[B].H := Button[B].W; + Button[B].Visible := True; + end + else Button[B].Visible := False; + end; + end; +end; *) + +procedure TScreenSong.SetScroll5; // rotate +var + B: integer; + Angle: real; + Pos: Real; + VS: integer; + diff: real; + X: Real; + helper: real; +begin + VS := CatSongs.VisibleSongs; // cache Visible Songs + {Vars + Theme.Song.CoverW: Radius des Kreises + Theme.Song.CoverX: X Pos Linke Kante des gewählten Covers + Theme.Song.CoverX: Y Pos Obere Kante des gewählten Covers + Theme.Song.CoverH: Höhe der Cover + + (CatSongs.VisibleIndex(B) - SongCurrent)/VS = Abstand zum MIttleren Cover in % + } + + //Change Pos of all Buttons + for B := low(Button) to high(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility + if Button[B].Visible then //Only Change Pos for Visible Buttons + begin + Pos := (CatSongs.VisibleIndex(B) - SongCurrent); + if (Pos < -VS/2) then + Pos := Pos + VS + else if (Pos > VS/2) then + Pos := Pos - VS; + + if (Abs(Pos) < 2.5) then {fixed Positions} + begin + Angle := Pi * (Pos / 5); +// Button[B].Visible := False; + + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); + +// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Z := 0.95 - Abs(Pos) * 0.01; + + Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); + + Button[B].W := Button[B].H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + + X := Sin(Angle*1.3)*0.9; + + Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Diff; + + end + else + begin {Behind the Front Covers} + + // limit-bg-covers hack + if (abs(abs(Pos)-VS/2)>10) then Button[B].Visible:=False; + // end of limit-bg-covers hack + + if Pos < 0 then + Pos := (Pos - VS/2)/VS + else + Pos := (Pos + VS/2)/VS; + + Angle := pi * Pos*2; + if VS > 24 then + begin + if Angle < 0 then helper:=-1 else helper:=1; + Angle:=2*pi-abs(Angle); + Angle:=Angle*(VS/24); + Angle:=(2*pi-Angle)*helper; + end; + + Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); + + Button[B].W := Button[B].H; + + Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; + +// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*((Theme.Song.Cover.H)*sin(Angle/2)*1.52); + + end; + + //Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field +// Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); + + end; + end; +end; + +procedure TScreenSong.SetScroll6; // rotate (slotmachine style) +var + B: integer; + Angle: real; + Pos: Real; + VS: integer; + diff: real; + X: Real; + Wsp: real; + Z, Z2: real; +begin + VS := CatSongs.VisibleSongs; // cache Visible Songs + if VS <=5 then begin + // kolowe + for B := 0 to High(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2; + Z2 := (1 + 2*Z) / 3; + + + Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z / 2 + 0.3; + + Button[B].W := Theme.Song.Cover.H * Z2; + +// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; + Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; + Button[B].H := Button[B].W; + end; + end; + end + else begin + + //Change Pos of all Buttons + for B := low(Button) to high(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility + if Button[B].Visible then //Only Change Pos for Visible Buttons + begin + Pos := (CatSongs.VisibleIndex(B) - SongCurrent); + if (Pos < -VS/2) then + Pos := Pos + VS + else if (Pos > VS/2) then + Pos := Pos - VS; + + if (Abs(Pos) < 2.5) then {fixed Positions} + begin + Angle := Pi * (Pos / 5); +// Button[B].Visible := False; + + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); + + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Z := 0.95 - Abs(Pos) * 0.01; + + Button[B].X := (Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); + + Button[B].W := Button[B].H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + + X := Sin(Angle*1.3)*0.9; + + Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff; + end + else + begin {Behind the Front Covers} + + // limit-bg-covers hack + if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; + if VS > 25 then VS:=25; + // end of limit-bg-covers hack + + if Pos < 0 then + Pos := (Pos - VS/2)/VS + else + Pos := (Pos + VS/2)/VS; + + Angle := pi * Pos*2; + + Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); + + Button[B].W := Button[B].H; + + Button[B].X := Theme.Song.Cover.X - (Button[B].H - Theme.Song.Cover.H)*0.5; + + + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Y := Theme.Song.Cover.Y+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*(Theme.Song.Cover.H*sin(Angle/2)*1.52); + end; + end; + end; + end; +end; + + +procedure TScreenSong.onShow; +begin + Music.Stop; + + if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; + if Ini.Players = 4 then PlayersPlay := 6; + + //Cat Mod etc + if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then + begin + CatSongs.ShowCategoryList; + FixSelected; + //Show Cat in Top Left Mod + HideCatTL; + end; + + + if Length(CatSongs.Song) > 0 then begin + //Load Music only when Song Preview is activated + if (Ini.PreviewVolume <> 0) then + begin + Music.SetLoop(false); + Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + Music.MoveTo(Music.Length / 4); + Music.Play; + + //Set Preview Volume + Music.SetMusicVolume (Ini.PreviewVolume * 10); + {//if Music Fade is activated, Set Volume to 0 % + if (Ini.PreviewFading <> 0) then + Music.SetMusicVolume(0);} + end; + + SetScroll; + UpdateLCD; + end; + + //Playlist Mode + if (Mode = 0) then + begin + //If Playlist Shown -> Select Next automatically + if (CatSongs.CatNumShow = -3) then + begin + SelectNext; + ChangeMusic; + end; + end + //Party Mode + else if (Mode = 1) then + begin + + SelectRandomSong; + //Show Menu directly in PartyMode + //But only if selected in Options + if (Ini.PartyPopup = 1) then + begin + ScreenSongMenu.MenuShow(SM_Party_Main); + end; + + + end; + + SetJoker; + SetStatics; +end; + +procedure TScreenSong.onHide; +begin + //When Music Fading is activated, Turn Music to 100 % + If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then + Music.SetMusicVolume(100); + + //If Preview is deactivated: Load MUsicfile now + If (Ini.PreviewVolume = 0) then + Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + + //When hide then Stop Music (For Party Mode Popup on Exit) + if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then + Music.Stop; +end; + +procedure TScreenSong.DrawExtensions; +begin + //Draw Song Menu + if (ScreenSongMenu.Visible) then + begin + ScreenSongMenu.Draw; + end + else if (ScreenSongJumpto.Visible) then + begin + ScreenSongJumpto.Draw; + end +end; + +function TScreenSong.Draw: boolean; +var + dx: real; + dt: real; + I: Integer; +begin + dx := SongTarget-SongCurrent; + dt := TimeSkip*7; + if dt > 1 then dt := 1; + SongCurrent := SongCurrent + dx*dt; + +{ if SongCurrent > Catsongs.VisibleSongs then begin + SongCurrent := SongCurrent - Catsongs.VisibleSongs; + SongTarget := SongTarget - Catsongs.VisibleSongs; + end;} + +// Log.BenchmarkStart(5); + SetScroll; +// Log.BenchmarkEnd(5); +// Log.LogBenchmark('SetScroll4', 5); + + //Fading Functions, Only if Covertime is under 5 Seconds + If (CoverTime < 5) then + begin + // 0.5.0: cover fade + if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin + // load new texture + Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture.Alpha := 1; + Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture2.Alpha := 1; + end; + + //Song Fade + if (CatSongs.VisibleSongs > 0) AND (Ini.PreviewVolume <> 0) AND (Not CatSongs.Song[Interaction].Main) AND (Ini.PreviewFading <> 0) then + begin + //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling + if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then + Music.Play; + + //Update Song Volume + if (CoverTime < Ini.PreviewFading) then + Music.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) + else + Music.SetMusicVolume(Ini.PreviewVolume * 10); + + end; + + + //Update Fading Time + CoverTime := CoverTime + TimeSkip; + + //Update Fading Texture + Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; + if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; + + end; + + //inherited Draw; + //heres a little Hack, that causes the Statics + //are Drawn after the Buttons because of some Blending Problems. + //This should cause no Problems because all Buttons on this screen + //Has Z Position. + //Draw BG + DrawBG; + + //Instead of Draw FG Procedure: + //We draw Buttons for our own + for I := 0 to Length(Button) - 1 do + Button[I].Draw; + + // Statics + for I := 0 to Length(Static) - 1 do + Static[I].Draw; + + // and texts + for I := 0 to Length(Text) - 1 do + Text[I].Draw; + + + //Draw Equalizer + if Theme.Song.Equalizer.Visible then + DrawEqualizer; + + DrawExtensions; + +end; + +procedure TScreenSong.SelectNext; +var + Skip: integer; + I: integer; + VS: Integer; +begin + VS := CatSongs.VisibleSongs; + + if VS > 0 then + begin + UnLoadDetailedCover; + + Skip := 1; + + // this 1 could be changed by CatSongs.FindNextVisible + while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); + + SongTarget := SongTarget + 1;//Skip; + + Interaction := (Interaction + Skip) mod Length(Interactions); + + // try to keep all at the beginning + if SongTarget > VS-1 then begin + SongTarget := SongTarget - VS; + SongCurrent := SongCurrent - VS; + end; + + end; + // Interaction -> Button, ktorego okladke przeczytamy + // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture +end; + +procedure TScreenSong.SelectPrev; +var + Skip: integer; + I: integer; + VS: Integer; +begin + VS := CatSongs.VisibleSongs; + + if VS > 0 then + begin + UnLoadDetailedCover; + + Skip := 1; + + while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); + SongTarget := SongTarget - 1;//Skip; + + Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); + + // try to keep all at the beginning + if SongTarget < 0 then begin + SongTarget := SongTarget + CatSongs.VisibleSongs; + SongCurrent := SongCurrent + CatSongs.VisibleSongs; + end; + + // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture + end; +end; + +procedure TScreenSong.UpdateLCD; +begin + LCD.HideCursor; + LCD.Clear; + LCD.WriteText(1, Text[TextArtist].Text); + LCD.WriteText(2, Text[TextTitle].Text); +end; + +//Procedure Change current played Preview +procedure TScreenSong.ChangeMusic; +begin + //When Music Preview is avtivated -> then Change Music + if (Ini.PreviewVolume <> 0) then + begin + if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then + begin + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal + if (Ini.PreviewFading = 0) then + Music.Play + else + Music.SetMusicVolume(0); + end; + end + else + Music.Stop; + end; +end; + +procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0 +var + Skip: integer; + I: integer; +begin + UnLoadDetailedCover; + + Interaction := High(CatSongs.Song); + SongTarget := 0; + + for I := 1 to Target+1 do + SelectNext; + + FixSelected2; +end; + +procedure TScreenSong.DrawEqualizer; +var + Data: TFFTData; //Audio Data + I, J: Integer; + Res: byte; + A, B: Integer; + PosX, PosY: Integer; + Pos: Real; +begin +if (not Music.Finished) AND (Theme.Song.Equalizer.Length > 0) then +begin + + + A := GetTickCount div 44; + + if (A <> EqualizerTime) then + begin + EqualizerTime := A; + Data := Music.GetFFTData; + + B:=0; + Pos := 0; + Res := ceil(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band + + //Change Lengths + for I := 0 to (Res * Theme.Song.Equalizer.Bands - 1) do + begin + A := floor(I/Res); + + if (A<>B) then //Band changed + begin + if (Pos <= Theme.Song.Equalizer.Length) then + begin + if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then + EqualizerBands[B] := EqualizerBands[B] - 1 + else + EqualizerBands[B] := floor(Pos); + end + else + EqualizerBands[B] := 1; + + B := A; + Pos := 0; + end; + + if I > 35 then + Data[i] := Data[i] * 8 + else if I > 11 then + Data[i] := Data[i] * 4.5 + else + Data[i] := Data[i] * 1.1; + + if (Data[i] >= 1) then + Data[i] := 0.9999999999999; + + if Data[i]*Theme.Song.Equalizer.Length > Pos then + Pos := Data[i]*Theme.Song.Equalizer.Length; + end; + + //Change Last Band + if (EqualizerBands[B] <= Theme.Song.Equalizer.Length) then + begin + if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then + EqualizerBands[B] := EqualizerBands[B] - 1 + else + EqualizerBands[B] := floor(Pos) + end + else + EqualizerBands[B] := 1; + end; + + //Draw every Channel + glColor4f(Theme.Song.Equalizer.ColR, Theme.Song.Equalizer.ColG, Theme.Song.Equalizer.ColB, Theme.Song.Equalizer.Alpha); //Set Color + glDisable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + + PosY := Theme.Song.Equalizer.Y; + PosX := Theme.Song.Equalizer.X; + + For I := 0 to Theme.Song.Equalizer.Bands-1 do + begin + if Theme.Song.Equalizer.Direction then + PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length + else + PosX := Theme.Song.Equalizer.X; + //Draw for every visible quad + for J := 1 to EqualizerBands[I] do + begin + glBegin(GL_QUADS); + glVertex3f(PosX, PosY, Theme.Song.Equalizer.Z); + glVertex3f(PosX, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); + glVertex3f(PosX+Theme.Song.Equalizer.W, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); + glVertex3f(PosX+Theme.Song.Equalizer.W, PosY, Theme.Song.Equalizer.Z); + glEnd; + + if Theme.Song.Equalizer.Direction then //Vertically + PosY := PosY - Theme.Song.Equalizer.H - Theme.Song.Equalizer.Space + else //Horizontally + PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space; + end; + if Theme.Song.Equalizer.Direction then //Horizontally + PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space + else //Vertically + PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space; + end; +end; +end; + +Procedure TScreenSong.SelectRandomSong; +var + I, I2: Integer; +begin + Case PlaylistMan.Mode of + 0: //All Songs Just Select Random Song + begin + //When Tabs are activated then use Tab Method + if (Ini.Tabs_at_startup = 1) then + begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; + + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + //I is the CatNum, I2 is the No of the Song within this Cat + + //Choose Cat + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Choose Song + SkipTo(I2-I); + end + //When Tabs are deactivated use easy Method + else + SkipTo(Random(CatSongs.VisibleSongs)); + end; + 1: //One Category Select Category and Select Random Song + begin + CatSongs.ShowCategoryList; + CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); + ShowCatTL(PlaylistMan.CurPlayList); + + SelectNext; + FixSelected2; + + SkipTo(Random(CatSongs.VisibleSongs)); + end; + 2: //Playlist: Select Playlist and Select Random Song + begin + PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); + + SkipTo(Random(CatSongs.VisibleSongs)); + FixSelected2; + end; + end; + + Music.PlayChange; + ChangeMusic; + SetScroll; + UpdateLCD; +end; + +procedure TScreenSong.SetJoker; +begin + //If Party Mode + if Mode = 1 then //Show Joker that are available + begin + if (PartySession.Teams.NumTeams >= 1) then + begin + Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1); + Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2); + Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3); + Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4); + Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5); + end + else + begin + Static[StaticTeam1Joker1].Visible := False; + Static[StaticTeam1Joker2].Visible := False; + Static[StaticTeam1Joker3].Visible := False; + Static[StaticTeam1Joker4].Visible := False; + Static[StaticTeam1Joker5].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 2) then + begin + Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1); + Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2); + Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3); + Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4); + Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5); + end + else + begin + Static[StaticTeam2Joker1].Visible := False; + Static[StaticTeam2Joker2].Visible := False; + Static[StaticTeam2Joker3].Visible := False; + Static[StaticTeam2Joker4].Visible := False; + Static[StaticTeam2Joker5].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 3) then + begin + Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1); + Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2); + Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3); + Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4); + Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5); + end + else + begin + Static[StaticTeam3Joker1].Visible := False; + Static[StaticTeam3Joker2].Visible := False; + Static[StaticTeam3Joker3].Visible := False; + Static[StaticTeam3Joker4].Visible := False; + Static[StaticTeam3Joker5].Visible := False; + end; + end + else + begin //Hide all + Static[StaticTeam1Joker1].Visible := False; + Static[StaticTeam1Joker2].Visible := False; + Static[StaticTeam1Joker3].Visible := False; + Static[StaticTeam1Joker4].Visible := False; + Static[StaticTeam1Joker5].Visible := False; + + Static[StaticTeam2Joker1].Visible := False; + Static[StaticTeam2Joker2].Visible := False; + Static[StaticTeam2Joker3].Visible := False; + Static[StaticTeam2Joker4].Visible := False; + Static[StaticTeam2Joker5].Visible := False; + + Static[StaticTeam3Joker1].Visible := False; + Static[StaticTeam3Joker2].Visible := False; + Static[StaticTeam3Joker3].Visible := False; + Static[StaticTeam3Joker4].Visible := False; + Static[StaticTeam3Joker5].Visible := False; + end; +end; + +procedure TScreenSong.SetStatics; +var + I: Integer; + Visible: Boolean; +begin + //Set Visibility of Party Statics and Text + Visible := (Mode = 1); + + For I := 0 to high(StaticParty) do + Static[StaticParty[I]].Visible := Visible; + + For I := 0 to high(TextParty) do + Text[TextParty[I]].Visible := Visible; + + //Set Visibility of Non Party Statics and Text + Visible := not Visible; + + For I := 0 to high(StaticNonParty) do + Static[StaticNonParty[I]].Visible := Visible; + + For I := 0 to high(TextNonParty) do + Text[TextNonParty[I]].Visible := Visible; +end; + +//Procedures for Menu + +procedure TScreenSong.StartSong; +begin + CatSongs.Selected := Interaction; + Music.Stop; + //Party Mode + if (Mode = 1) then + begin + FadeTo(@ScreenSingModi); + end + else + begin + FadeTo(@ScreenSing); + end; +end; + +procedure TScreenSong.SelectPlayers; +begin + CatSongs.Selected := Interaction; + Music.Stop; + + ScreenName.Goto_SingScreen := True; + FadeTo(@ScreenName); +end; + +procedure TScreenSong.OpenEditor; +begin + if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin + Music.Stop; + Music.PlayStart; + ScreenEditSub.Path := CatSongs.Song[Interaction].Path; + ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName; + FadeTo(@ScreenEditSub); + end; +end; + +//Team No of Team (0-5) +procedure TScreenSong.DoJoker (Team: Byte); +begin + if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[Team].Joker); + SelectRandomSong; + SetJoker; + end; +end; + +//Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song +procedure TScreenSong.UnLoadDetailedCover; +begin + CoverTime := 0; + + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture + Button[Interaction].Texture2.Alpha := 0; + + if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then + Texture.UnloadTexture(Button[Interaction].Texture.Name, false); +end; + +procedure TScreenSong.Refresh; +begin { +CatSongs.Refresh; +CatSongs.ShowCategoryList; +Interaction := 0; +SelectNext; +FixSelected; } + +end; + +end. -- cgit v1.2.3 From 82621bfeb1ccbda7425b5d11b8315a9cb91509c2 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sun, 30 Sep 2007 04:54:03 +0000 Subject: fixed credits screen in lazarus build. ( now looks and operates the same as delphi build ) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@450 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 2503 +++++++++++++++++----------------- 1 file changed, 1257 insertions(+), 1246 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 7b5e4c00..9c571b2b 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -1,1246 +1,1257 @@ -unit UScreenCredits; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -{$I switches.inc} - - -uses - UMenu, - SDL, - SDL_Image, - UDisplay, - UTexture, - OpenGL12, - UMusic, - UFiles, - SysUtils, - UThemes, - ULCD, - ULight, - UGraphicClasses; - -type - TCreditsStages=(InitialDelay,Intro,MainPart,Outro); - - TScreenCredits = class(TMenu) - public - - Credits_X: Real; - Credits_Time: Cardinal; - Credits_Alpha: Cardinal; - CTime: Cardinal; - CTime_hold: Cardinal; - ESC_Alpha: Integer; - - credits_entry_tex: TTexture; - credits_entry_dx_tex: TTexture; - credits_bg_tex: TTexture; - credits_bg_ovl: TTexture; -// credits_bg_logo: TTexture; - credits_bg_scrollbox_left: TTexture; - credits_blindguard: TTexture; - credits_blindy: TTexture; - credits_canni: TTexture; - credits_commandio: TTexture; - credits_lazyjoker: TTexture; - credits_mog: TTexture; - credits_mota: TTexture; - credits_skillmaster: TTexture; - credits_whiteshark: TTexture; - intro_layer01: TTexture; - intro_layer02: TTexture; - intro_layer03: TTexture; - intro_layer04: TTexture; - intro_layer05: TTexture; - intro_layer06: TTexture; - intro_layer07: TTexture; - intro_layer08: TTexture; - intro_layer09: TTexture; - outro_bg: TTexture; - outro_esc: TTexture; - outro_exd: TTexture; - - deluxe_slidein: cardinal; - - CurrentScrollText: String; - NextScrollUpdate: Real; - EndofLastScrollingPart: Cardinal; - CurrentScrollStart, CurrentScrollEnd: Integer; - - CRDTS_Stage: TCreditsStages; - - myTex: glUint; - mysdlimage,myconvertedsdlimage: PSDL_Surface; - - Fadeout: boolean; - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure onShow; override; - procedure onHide; override; - procedure DrawCredits; - procedure Draw_FunkyText; - end; - -const - Funky_Text: AnsiString = - 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+ - 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+ - 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+ - 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..'; - - - Timings: array[0..21] of Cardinal=( - 20, // 0 Delay vor Start - - 149, // 1 Ende erster Intro Zoom - 155, // 2 Start 2. Action im Intro - 170, // 3 Ende Separation im Intro - 271, // 4 Anfang Zoomout im Intro - 0, // 5 unused - 261, // 6 Start fade-to-white im Intro - - 271, // 7 Start Main Part - 280, // 8 Start On-Beat-Sternchen Main Part - - 396, // 9 Start BlindGuard - 666, // 10 Start blindy - 936, // 11 Start Canni - 1206, // 12 Start Commandio - 1476, // 13 Start LazyJoker - 1746, // 14 Start Mog - 2016, // 15 Start Mota - 2286, // 16 Start SkillMaster - 2556, // 17 Start WhiteShark - 2826, // 18 Ende Whiteshark - 3096, // 19 Start FadeOut Mainscreen - 3366, // 20 Ende Credits Tune - 60); // 21 start flare im intro - - - sdl32bpprgba: TSDL_Pixelformat=(palette: nil; - BitsPerPixel: 32; - BytesPerPixel: 4; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 24; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $ff000000; - colorkey: 0; - alpha: 255 ); - - -implementation - -uses {$IFDEF win32} - windows, - {$ELSE} - lclintf, - {$ENDIF} - UGraphic, - UMain, - UIni, - USongs, - Textgl, - ULanguage, - UCommon, - Math, - dialogs; - - -function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then - begin // Key Down - case PressedKey of - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - FadeTo(@ScreenMain); - Music.PlayBack; - end; -{ SDLK_SPACE: - begin - setlength(CTime_hold,length(CTime_hold)+1); - CTime_hold[high(CTime_hold)]:=CTime; - end; -} - end;//esac - end; //fi -end; - -constructor TScreenCredits.Create; -begin - inherited Create; - - credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0); - credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0); - - credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', 'PNG', 'Font Black', 0); - credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0); - credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0); - credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', 'PNG', 'Font Black', 0); - credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', 'PNG', 'Font Black', 0); - credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', 'Font Black', 0); - credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', 'PNG', 'Font Black', 0); - credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', 'PNG', 'Font Black', 0); - credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', 'PNG', 'Font Black', 0); - - intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', 'PNG', 'Transparent', 0); - intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', 'PNG', 'Transparent', 0); - intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', 'PNG', 'Transparent', 0); - intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', 'PNG', 'Transparent', 0); - intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', 'PNG', 'Transparent', 0); - intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', 'PNG', 'Transparent', 0); - intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', 'PNG', 'Transparent', 0); - intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', 'PNG', 'Transparent', 0); - intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', 'PNG', 'Transparent', 0); - - outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0); - outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0); - outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Transparent', 0); - - CRDTS_Stage:=InitialDelay; -end; - -function TScreenCredits.Draw: boolean; -begin - DrawCredits; - Draw:=true; -end; - -function pixfmt_eq(fmt1,fmt2: TSDL_Pixelformat): boolean; -begin - if (fmt1.BitsPerPixel = fmt2.BitsPerPixel) and - (fmt1.BytesPerPixel = fmt2.BytesPerPixel) and - (fmt1.Rloss = fmt2.Rloss) and - (fmt1.Gloss = fmt2.Gloss) and - (fmt1.Bloss = fmt2.Bloss) and - (fmt1.Rmask = fmt2.Rmask) and - (fmt1.Gmask = fmt2.Gmask) and - (fmt1.Bmask = fmt2.Bmask) and - (fmt1.Rshift = fmt2.Rshift) and - (fmt1.Gshift = fmt2.Gshift) and - (fmt1.Bshift = fmt2.Bshift) - then - pixfmt_eq:=True - else - pixfmt_eq:=False; -end; - -function inttohexstr(i: cardinal):pchar; -var helper, i2, c:cardinal; - tmpstr: string; -begin - helper:=0; - i2:=i; - tmpstr:=''; - for c:=1 to 8 do - begin - helper:=(helper shl 4) or (i2 and $f); - i2:=i2 shr 4; - end; - for c:=1 to 8 do - begin - i2:=helper and $f; - helper := helper shr 4; - case i2 of - 0: tmpstr:=tmpstr+'0'; - 1: tmpstr:=tmpstr+'1'; - 2: tmpstr:=tmpstr+'2'; - 3: tmpstr:=tmpstr+'3'; - 4: tmpstr:=tmpstr+'4'; - 5: tmpstr:=tmpstr+'5'; - 6: tmpstr:=tmpstr+'6'; - 7: tmpstr:=tmpstr+'7'; - 8: tmpstr:=tmpstr+'8'; - 9: tmpstr:=tmpstr+'9'; - 10: tmpstr:=tmpstr+'a'; - 11: tmpstr:=tmpstr+'b'; - 12: tmpstr:=tmpstr+'c'; - 13: tmpstr:=tmpstr+'d'; - 14: tmpstr:=tmpstr+'e'; - 15: tmpstr:=tmpstr+'f'; - end; - end; - inttohexstr:=pchar(tmpstr); -end; - -procedure TScreenCredits.onShow; -begin - CRDTS_Stage:=InitialDelay; - Credits_X := 580; - deluxe_slidein := 0; - Credits_Alpha := 0; - //Music.SetLoop(true); Loop looped ned, so ne scheisse - Music.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! -// Music.Play; - CTime:=0; -// setlength(CTime_hold,0); - mysdlimage:=IMG_Load('test.png'); - if assigned(mysdlimage) then - begin - showmessage('opened image via SDL_Image'+#13#10+ - 'Width: '+inttostr(mysdlimage^.w)+#13#10+ - 'Height: '+inttostr(mysdlimage^.h)+#13#10+ - 'BitsPP: '+inttostr(mysdlimage^.format.BitsPerPixel)+#13#10+ - 'BytesPP: '+inttostr(mysdlimage^.format.BytesPerPixel)+#13#10+ - 'Rloss: '+inttostr(mysdlimage^.format.Rloss)+#13#10+ - 'Gloss: '+inttostr(mysdlimage^.format.Gloss)+#13#10+ - 'Bloss: '+inttostr(mysdlimage^.format.Bloss)+#13#10+ - 'Aloss: '+inttostr(mysdlimage^.format.Aloss)+#13#10+ - 'Rshift: '+inttostr(mysdlimage^.format.Rshift)+#13#10+ - 'Gshift: '+inttostr(mysdlimage^.format.Gshift)+#13#10+ - 'Bshift: '+inttostr(mysdlimage^.format.Bshift)+#13#10+ - 'Ashift: '+inttostr(mysdlimage^.format.Ashift)+#13#10+ - 'Rmask: '+inttohexstr(mysdlimage^.format.Rmask)+#13#10+ - 'Gmask: '+inttohexstr(mysdlimage^.format.Gmask)+#13#10+ - 'Bmask: '+inttohexstr(mysdlimage^.format.Bmask)+#13#10+ - 'Amask: '+inttohexstr(mysdlimage^.format.Amask)+#13#10+ - 'ColKey: '+inttostr(mysdlimage^.format.Colorkey)+#13#10+ - 'Alpha: '+inttostr(mysdlimage^.format.Alpha)); - if pixfmt_eq(mysdlimage^.format^,sdl32bpprgba) - then showmessage('equal pixelformats') - else showmessage('different pixelformats'); - myconvertedsdlimage:=SDL_ConvertSurface(mysdlimage,@sdl32bpprgba,SDL_SWSURFACE); - glGenTextures(1,@myTex); - glBindTexture(GL_TEXTURE_2D, myTex); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - glTexImage2D( GL_TEXTURE_2D, 0, 4, myconvertedsdlimage^.w, myconvertedsdlimage^.h, 0, - GL_RGBA, GL_UNSIGNED_BYTE, myconvertedsdlimage^.pixels ); - SDL_FreeSurface(mysdlimage); - SDL_FreeSurface(myconvertedsdlimage); - end else - showmessage('could not open file'); - -end; - -procedure TScreenCredits.onHide; -begin - Music.Stop; -end; - -Procedure TScreenCredits.Draw_FunkyText; -var - S: Integer; - X,Y,A: Real; - visibleText: PChar; -begin - SetFontSize(10); - //Init ScrollingText - if (CTime = Timings[7]) then - begin - //Set Position of Text - Credits_X := 600; - CurrentScrollStart:=1; - CurrentScrollEnd:=1; - end; - - if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then - begin - X:=0; - visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); - for S := 0 to length(visibleText)-1 do begin - Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); - SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); - A:=0; - if (Credits_X+X < 15) then A:=0; - if (Credits_X+X >=15) then A:=Credits_X+X-15; - if Credits_X+X > 32 then A:=17; - glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17); - glPrintLetter(visibleText[S]); - X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; - end; - if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin - Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; - inc(CurrentScrollStart); - end; - visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); - if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin - inc(CurrentScrollEnd); - end; - end; -{ // timing hack - X:=5; - SetFontStyle (2); - SetFontItalic(False); - SetFontSize(9); - glColor4f(1, 1, 1, 1); - for S:=0 to high(CTime_hold) do begin - visibleText:=pchar(inttostr(CTime_hold[S])); - SetFontPos (500, X); - glPrint (Addr(visibleText[0])); - X:=X+20; - end;} -end; - -procedure Start3D; -begin - glMatrixMode(GL_PROJECTION); - glPushMatrix; - glLoadIdentity; - glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity; -end; -procedure End3D; -begin - glMatrixMode(GL_PROJECTION); - glPopMatrix; - glMatrixMode(GL_MODELVIEW); -end; - -procedure TScreenCredits.DrawCredits; -var - T,I: Cardinal; - X: Real; - Ver: PChar; - RuntimeStr: AnsiString; - Data: TFFTData; - j,k,l:cardinal; - f,g,h: Real; - STime:cardinal; - Delay:cardinal; - - myPixel: longword; - myColor: Cardinal; - myScale: Real; - myAngle: Real; - - -const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24), - (154,31),(156,58),(168,32),(203,36), - (258,34),(251,50),(274,93),(294,84), - (232,54),(278,62),(319,34),(336,92), - (347,23),(374,32),(377,58),(361,83), - (385,91),(405,91),(429,35),(423,51), - (450,32),(485,34),(444,91),(486,93)); - -begin - //dis does teh muiwk y0r - Data := Music.GetFFTData; - - T := GetTickCount div 33; - if T <> Credits_Time then - begin - Credits_Time := T; - inc(CTime); - inc(CTime_hold); - Credits_X := Credits_X-2; - if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then - begin -// CTime:=Timings[20]; -// CRDTS_Stage:=Outro; - - CRDTS_Stage:=Intro; - CTime:=0; - Music.Play; - - end; - if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then - begin - CRDTS_Stage:=MainPart; - end; - if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then - begin - CRDTS_Stage:=Outro; - end; - end; - - //draw background - if CRDTS_Stage=InitialDelay then - begin - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - end - else - if CRDTS_Stage=Intro then - begin - Start3D; - glPushMatrix; - - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - if CTime < Timings[1] then begin - myScale:= 0.5+0.5*(Timings[1]-CTime)/(Timings[1]); // slowly move layers together - myAngle:=cos((CTime)*pi/((Timings[1])*2)); // and make logo face towards camera - end else begin // this is the part when the logo stands still - myScale:=0.5; - myAngle:=0; - end; - if CTime > Timings[2] then begin - myScale:= 0.5+0.5*(CTime-Timings[2])/(Timings[3]-Timings[2]); // get some space between layers - myAngle:=0; - end; -// if CTime > Timings[3] then myScale:=1; // keep the space between layers - glTranslatef(0,0,-5+0.5*myScale); - if CTime > Timings[3] then myScale:=1; // keep the space between layers - if CTime > Timings[3] then begin // make logo rotate left and grow -// myScale:=(CTime-Timings[4])/(Timings[7]-Timings[4]); - glRotatef(20*sqr(CTime-Timings[3])/sqr((Timings[7]-Timings[3])/2),0,0,1); - glScalef(1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1); - end; - if CTime < Timings[2] then - glRotatef(30*myAngle,0.5*myScale+myScale,1+myScale,0); -// glScalef(0.5,0.5,0.5); - glScalef(4/3,-1,1); - glColor4f(1, 1, 1, 1); - - glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.4 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.4 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.4 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.4 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.3 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.3 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.3 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.3 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.2 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.2 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.2 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.2 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.1 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.1 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.1 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.1 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.1 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.1 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.1 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.1 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.2 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.2 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.2 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.2 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.3 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.3 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.3 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.3 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.22 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.22 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.22 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.22 * myScale); - glEnd; - gldisable(gl_texture_2d); - glDisable(GL_BLEND); - - glPopMatrix; - End3D; - - // do some sparkling effects - if (CTime < Timings[1]) and (CTime > Timings[21]) then - begin - for k:=1 to 3 do begin - l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5); - j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301); - GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0); - end; - end; - - // fade to white at end - if Ctime > Timings[6] then - begin - glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6])); - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glVertex2f(0,0); - glVertex2f(0,600); - glVertex2f(800,600); - glVertex2f(800,0); - glEnd; - glDisable(GL_BLEND); - end; - - end; - if (CRDTS_Stage=MainPart) then - // main credits screen background, scroller, logo and girl - begin - - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,600/1024);glVertex2f(0, 600); - glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); - glTexCoord2f(800/1024,0);glVertex2f(800, 0); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - // draw scroller - Draw_FunkyText; - -//######################################################################### -// draw credits names - -// BlindGuard (von links oben reindrehen, nach rechts unten rausdrehen) - STime:=Timings[9]-10; - Delay:=Timings[10]-Timings[9]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(0,329,0); - if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end; - gltranslatef(223,0,0); - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - gltranslatef(223,0,0); - glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1); - gltranslatef(-223,0,0); - end; - glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Blindy (zoom von 0 auf volle grösse und drehung, zoom auf doppelte grösse und nach rechts oben schieben) - STime:=Timings[10]-10; - Delay:=Timings[11]-Timings[10]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+20) and (CTime<=STime+22) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+20 then begin - j:=CTime-Stime; - glscalef(j*j/400,j*j/400,j*j/400); - glrotatef(j*18.0,0,0,1); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - f:=j*10.0; - gltranslatef(f*3,-f,0); - glscalef(1+j/10,1+j/10,1+j/10); - glrotatef(j*9.0,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Canni (von links reinschieben, nach rechts oben rausschieben) - STime:=Timings[11]-10; - Delay:=Timings[12]-Timings[11]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - gltranslatef(((CTime-STime)*21.0)-210,0,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=(CTime-(STime+Delay-10))*21; - gltranslatef(j,-j/2,0); - end; - glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Commandio (von unten reinklappen, nach rechts oben rausklappen) - STime:=Timings[12]-10; - Delay:=Timings[13]-Timings[12]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=258.0-25.8*(CTime-STime) - else - f:=0; - g:=0; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end; - glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163+g-f*1.5, -129+f*1.5-g/2); - glTexCoord2f(0,1);glVertex2f(-163+g*1.5, 129-(g*1.5*258/326)); - glTexCoord2f(1,1); glVertex2f(163+g, 129+g/4); - glTexCoord2f(1,0);glVertex2f(163+f*1.5+g/4, -129+f*1.5-g/4); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing) - STime:=Timings[13]-35; - Delay:=Timings[14]-Timings[13]+5; - if CTime > STime then - begin - k:=0; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20; - ESC_Alpha:=10; - f:=CTime-STime; - if CTime <=STime+40 then j:=CTime-STime else j:=40; - if (CTime >=STime+Delay-40) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j*j/1600); - - glPushMatrix; - gltranslatef(180+(f-70),329,0); - glBindTexture(GL_TEXTURE_2D, credits_lazyjoker.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Mog (von links reinklappen, nach rechts unten rausklappen) - STime:=Timings[14]-10; - Delay:=Timings[15]-Timings[14]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=326.0-32.6*(CTime-STime) - else - f:=0; - - g:=0; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end; - glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163+g*1.5, -129+g*1.5); - glTexCoord2f(0,1);glVertex2f(-163+g*1.2, 129+g); - glTexCoord2f(1,1); glVertex2f(163-f+g/2, 129+f*1.5+g/4); - glTexCoord2f(1,0);glVertex2f(163-f+g*1.5, -129-f*1.5); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Mota (von rechts oben reindrehen, nach links unten rausschieben und verkleinern und dabei drehen) - STime:=Timings[15]-10; - Delay:=Timings[16]-Timings[15]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - gltranslatef(223,0,0); - glrotatef((10-(CTime-STime))*9,0,0,1); - gltranslatef(-223,0,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - f:=j*10.0; - gltranslatef(-f*2,-f,0); - glscalef(1-j/10,1-j/10,1-j/10); - glrotatef(-j*9.0,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Skillmaster (von rechts unten reinschieben, nach rechts oben rausdrehen) - STime:=Timings[16]-10; - Delay:=Timings[17]-Timings[16]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - j:=STime+10-CTime; - f:=j*10.0; - gltranslatef(+f*2,+f/2,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - gltranslatef(0,-223,0); - glrotatef(integer(j)*-9,0,0,1); - gltranslatef(0,223,0); - glrotatef(j*9,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// WhiteShark (von links unten reinklappen, nach rechts oben rausklappen) - STime:=Timings[17]-10; - Delay:=Timings[18]-Timings[17]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=326.0-32.6*(CTime-STime) - else - f:=0; - - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end else - g:=0; - glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2); - glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4); - glTexCoord2f(1,1); glVertex2f(163-f*1.2+g/4, 129+f/2-g/4); - glTexCoord2f(1,0);glVertex2f(163-f*1.5+g/4, -129+f*1.5+g/4); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - - -// #################################################################### -// do some twinkle stuff (kinda on beat) - if (CTime>Timings[8]) and (CTime < Timings[19]) then begin - k:=0; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.2 then begin - l:=RandomRange(6,16); - j:=RandomRange(0,27); - GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); - end; - end; - -//################################################# -// draw the rest of the main screen (girl and logo - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(800-393, 0); - glTexCoord2f(0,600/1024);glVertex2f(800-393, 600); - glTexCoord2f(393/512,600/1024); glVertex2f(800, 600); - glTexCoord2f(393/512,0);glVertex2f(800, 0); - glEnd; -{ glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,112/128);glVertex2f(0, 112); - glTexCoord2f(497/512,112/128); glVertex2f(497, 112); - glTexCoord2f(497/512,0);glVertex2f(497, 0); - glEnd; -} - gldisable(gl_texture_2d); - glDisable(GL_BLEND); - - // fade out at end of main part - if Ctime > Timings[19] then - begin - glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19])); - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glVertex2f(0,0); - glVertex2f(0,600); - glVertex2f(800,600); - glVertex2f(800,0); - glEnd; - glDisable(GL_BLEND); - end; - end - else - if (CRDTS_Stage=Outro) then - begin - if CTime=Timings[20] then begin - CTime_hold:=0; - Music.Stop; - Music.Open(soundpath + 'credits-outro-tune.mp3'); - Music.Play; - Music.SetVolume(20); - Music.SetLoop(True); - end; - if CTime_hold > 231 then begin - Music.Play; - Ctime_hold:=0; - end; - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - - // do something useful - // outro background - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,600/1024);glVertex2f(0, 600); - glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); - glTexCoord2f(800/1024,0);glVertex2f(800, 0); - glEnd; - - //outro overlays - glColor4f(1, 1, 1, (1+sin(CTime/15))/3+1/3); - glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,223/256);glVertex2f(0, 223); - glTexCoord2f(487/512,223/256); glVertex2f(487, 223); - glTexCoord2f(487/512,0);glVertex2f(487, 0); - glEnd; - - ESC_Alpha:=20; - if (RandomRange(0,20) > 18) and (ESC_Alpha=20) then - ESC_Alpha:=0 - else inc(ESC_Alpha); - if ESC_Alpha > 20 then ESC_Alpha:=20; - glColor4f(1, 1, 1, ESC_Alpha/20); - glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(800-310, 600-247); - glTexCoord2f(0,247/256);glVertex2f(800-310, 600); - glTexCoord2f(310/512,247/256); glVertex2f(800, 600); - glTexCoord2f(310/512,0);glVertex2f(800, 600-247); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - // outro scrollers? - // ... - end; - -{ // draw credits runtime counter - SetFontStyle (2); - SetFontItalic(False); - SetFontSize(9); - SetFontPos (5, 5); - glColor4f(1, 1, 1, 1); -// RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10); - RuntimeStr:='CTime: '+inttostr(CTime); - glPrint (Addr(RuntimeStr[1])); -} - - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, myTex); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(100, 100); - glTexCoord2f(0,1);glVertex2f(100, 200); - glTexCoord2f(1,1); glVertex2f(200, 200); - glTexCoord2f(1,0);glVertex2f(200, 100); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - - // make the stars shine - GoldenRec.Draw; -end; - -end. +unit UScreenCredits; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +{$I switches.inc} + + +uses + UMenu, + SDL, + SDL_Image, + UDisplay, + UTexture, + OpenGL12, + UMusic, + UFiles, + SysUtils, + UThemes, + ULCD, + ULight, + UGraphicClasses; + +type + TCreditsStages=(InitialDelay,Intro,MainPart,Outro); + + TScreenCredits = class(TMenu) + public + + Credits_X: Real; + Credits_Time: Cardinal; + Credits_Alpha: Cardinal; + CTime: Cardinal; + CTime_hold: Cardinal; + ESC_Alpha: Integer; + + credits_entry_tex: TTexture; + credits_entry_dx_tex: TTexture; + credits_bg_tex: TTexture; + credits_bg_ovl: TTexture; +// credits_bg_logo: TTexture; + credits_bg_scrollbox_left: TTexture; + credits_blindguard: TTexture; + credits_blindy: TTexture; + credits_canni: TTexture; + credits_commandio: TTexture; + credits_lazyjoker: TTexture; + credits_mog: TTexture; + credits_mota: TTexture; + credits_skillmaster: TTexture; + credits_whiteshark: TTexture; + intro_layer01: TTexture; + intro_layer02: TTexture; + intro_layer03: TTexture; + intro_layer04: TTexture; + intro_layer05: TTexture; + intro_layer06: TTexture; + intro_layer07: TTexture; + intro_layer08: TTexture; + intro_layer09: TTexture; + outro_bg: TTexture; + outro_esc: TTexture; + outro_exd: TTexture; + + deluxe_slidein: cardinal; + + CurrentScrollText: String; + NextScrollUpdate: Real; + EndofLastScrollingPart: Cardinal; + CurrentScrollStart, CurrentScrollEnd: Integer; + + CRDTS_Stage: TCreditsStages; + + myTex: glUint; + mysdlimage,myconvertedsdlimage: PSDL_Surface; + + Fadeout: boolean; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure DrawCredits; + procedure Draw_FunkyText; + end; + +const + Funky_Text: AnsiString = + 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+ + 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+ + 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+ + 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..'; + + + Timings: array[0..21] of Cardinal=( + 20, // 0 Delay vor Start + + 149, // 1 Ende erster Intro Zoom + 155, // 2 Start 2. Action im Intro + 170, // 3 Ende Separation im Intro + 271, // 4 Anfang Zoomout im Intro + 0, // 5 unused + 261, // 6 Start fade-to-white im Intro + + 271, // 7 Start Main Part + 280, // 8 Start On-Beat-Sternchen Main Part + + 396, // 9 Start BlindGuard + 666, // 10 Start blindy + 936, // 11 Start Canni + 1206, // 12 Start Commandio + 1476, // 13 Start LazyJoker + 1746, // 14 Start Mog + 2016, // 15 Start Mota + 2286, // 16 Start SkillMaster + 2556, // 17 Start WhiteShark + 2826, // 18 Ende Whiteshark + 3096, // 19 Start FadeOut Mainscreen + 3366, // 20 Ende Credits Tune + 60); // 21 start flare im intro + + + sdl32bpprgba: TSDL_Pixelformat=(palette: nil; + BitsPerPixel: 32; + BytesPerPixel: 4; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 24; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $ff000000; + colorkey: 0; + alpha: 255 ); + + +implementation + +uses {$IFDEF win32} + windows, + {$ELSE} + lclintf, + {$ENDIF} + UGraphic, + UMain, + UIni, + USongs, + Textgl, + ULanguage, + UCommon, + Math, + dialogs; + + +function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + FadeTo(@ScreenMain); + Music.PlayBack; + end; +{ SDLK_SPACE: + begin + setlength(CTime_hold,length(CTime_hold)+1); + CTime_hold[high(CTime_hold)]:=CTime; + end; +} + end;//esac + end; //fi +end; + +constructor TScreenCredits.Create; +begin + inherited Create; + + credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0); + credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0); + + credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', 'PNG', 'Font Black', 0); + credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0); + credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0); + credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', 'PNG', 'Font Black', 0); + credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', 'PNG', 'Font Black', 0); + credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', 'Font Black', 0); + credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', 'PNG', 'Font Black', 0); + credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', 'PNG', 'Font Black', 0); + credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', 'PNG', 'Font Black', 0); + + intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', 'PNG', 'Transparent', 0); + intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', 'PNG', 'Transparent', 0); + intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', 'PNG', 'Transparent', 0); + intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', 'PNG', 'Transparent', 0); + intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', 'PNG', 'Transparent', 0); + intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', 'PNG', 'Transparent', 0); + intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', 'PNG', 'Transparent', 0); + intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', 'PNG', 'Transparent', 0); + intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', 'PNG', 'Transparent', 0); + + outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0); + outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0); + outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Transparent', 0); + + CRDTS_Stage:=InitialDelay; +end; + +function TScreenCredits.Draw: boolean; +begin + DrawCredits; + Draw:=true; +end; + +function pixfmt_eq(fmt1,fmt2: TSDL_Pixelformat): boolean; +begin + if (fmt1.BitsPerPixel = fmt2.BitsPerPixel) and + (fmt1.BytesPerPixel = fmt2.BytesPerPixel) and + (fmt1.Rloss = fmt2.Rloss) and + (fmt1.Gloss = fmt2.Gloss) and + (fmt1.Bloss = fmt2.Bloss) and + (fmt1.Rmask = fmt2.Rmask) and + (fmt1.Gmask = fmt2.Gmask) and + (fmt1.Bmask = fmt2.Bmask) and + (fmt1.Rshift = fmt2.Rshift) and + (fmt1.Gshift = fmt2.Gshift) and + (fmt1.Bshift = fmt2.Bshift) + then + pixfmt_eq:=True + else + pixfmt_eq:=False; +end; + +function inttohexstr(i: cardinal):pchar; +var helper, i2, c:cardinal; + tmpstr: string; +begin + helper:=0; + i2:=i; + tmpstr:=''; + for c:=1 to 8 do + begin + helper:=(helper shl 4) or (i2 and $f); + i2:=i2 shr 4; + end; + for c:=1 to 8 do + begin + i2:=helper and $f; + helper := helper shr 4; + case i2 of + 0: tmpstr:=tmpstr+'0'; + 1: tmpstr:=tmpstr+'1'; + 2: tmpstr:=tmpstr+'2'; + 3: tmpstr:=tmpstr+'3'; + 4: tmpstr:=tmpstr+'4'; + 5: tmpstr:=tmpstr+'5'; + 6: tmpstr:=tmpstr+'6'; + 7: tmpstr:=tmpstr+'7'; + 8: tmpstr:=tmpstr+'8'; + 9: tmpstr:=tmpstr+'9'; + 10: tmpstr:=tmpstr+'a'; + 11: tmpstr:=tmpstr+'b'; + 12: tmpstr:=tmpstr+'c'; + 13: tmpstr:=tmpstr+'d'; + 14: tmpstr:=tmpstr+'e'; + 15: tmpstr:=tmpstr+'f'; + end; + end; + inttohexstr:=pchar(tmpstr); +end; + +procedure TScreenCredits.onShow; +begin + CRDTS_Stage:=InitialDelay; + Credits_X := 580; + deluxe_slidein := 0; + Credits_Alpha := 0; + //Music.SetLoop(true); Loop looped ned, so ne scheisse + Music.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! +// Music.Play; + CTime:=0; +// setlength(CTime_hold,0); + + mysdlimage:=IMG_Load('test.png'); + if assigned(mysdlimage) then + begin + {$IFNDEF FPC} + showmessage('opened image via SDL_Image'+#13#10+ + 'Width: '+inttostr(mysdlimage^.w)+#13#10+ + 'Height: '+inttostr(mysdlimage^.h)+#13#10+ + 'BitsPP: '+inttostr(mysdlimage^.format.BitsPerPixel)+#13#10+ + 'BytesPP: '+inttostr(mysdlimage^.format.BytesPerPixel)+#13#10+ + 'Rloss: '+inttostr(mysdlimage^.format.Rloss)+#13#10+ + 'Gloss: '+inttostr(mysdlimage^.format.Gloss)+#13#10+ + 'Bloss: '+inttostr(mysdlimage^.format.Bloss)+#13#10+ + 'Aloss: '+inttostr(mysdlimage^.format.Aloss)+#13#10+ + 'Rshift: '+inttostr(mysdlimage^.format.Rshift)+#13#10+ + 'Gshift: '+inttostr(mysdlimage^.format.Gshift)+#13#10+ + 'Bshift: '+inttostr(mysdlimage^.format.Bshift)+#13#10+ + 'Ashift: '+inttostr(mysdlimage^.format.Ashift)+#13#10+ + 'Rmask: '+inttohexstr(mysdlimage^.format.Rmask)+#13#10+ + 'Gmask: '+inttohexstr(mysdlimage^.format.Gmask)+#13#10+ + 'Bmask: '+inttohexstr(mysdlimage^.format.Bmask)+#13#10+ + 'Amask: '+inttohexstr(mysdlimage^.format.Amask)+#13#10+ + 'ColKey: '+inttostr(mysdlimage^.format.Colorkey)+#13#10+ + 'Alpha: '+inttostr(mysdlimage^.format.Alpha)); + + if pixfmt_eq(mysdlimage^.format^,sdl32bpprgba) then + showmessage('equal pixelformats') + else + showmessage('different pixelformats'); + {$ENDIF} + + myconvertedsdlimage:=SDL_ConvertSurface(mysdlimage,@sdl32bpprgba,SDL_SWSURFACE); + glGenTextures(1,@myTex); + glBindTexture(GL_TEXTURE_2D, myTex); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + glTexImage2D( GL_TEXTURE_2D, 0, 4, myconvertedsdlimage^.w, myconvertedsdlimage^.h, 0, + GL_RGBA, GL_UNSIGNED_BYTE, myconvertedsdlimage^.pixels ); + SDL_FreeSurface(mysdlimage); + SDL_FreeSurface(myconvertedsdlimage); + end + else + {$IFDEF FPC} + writeln( 'could not open file - test.png'); + {$ELSE} + showmessage('could not open file - test.png'); + {$ENDIF} + +end; + +procedure TScreenCredits.onHide; +begin + Music.Stop; +end; + +Procedure TScreenCredits.Draw_FunkyText; +var + S: Integer; + X,Y,A: Real; + visibleText: PChar; +begin + SetFontSize(10); + //Init ScrollingText + if (CTime = Timings[7]) then + begin + //Set Position of Text + Credits_X := 600; + CurrentScrollStart:=1; + CurrentScrollEnd:=1; + end; + + if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then + begin + X:=0; + visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); + for S := 0 to length(visibleText)-1 do begin + Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); + SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); + A:=0; + if (Credits_X+X < 15) then A:=0; + if (Credits_X+X >=15) then A:=Credits_X+X-15; + if Credits_X+X > 32 then A:=17; + glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17); + glPrintLetter(visibleText[S]); + X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + end; + if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin + Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + inc(CurrentScrollStart); + end; + visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); + if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin + inc(CurrentScrollEnd); + end; + end; +{ // timing hack + X:=5; + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + glColor4f(1, 1, 1, 1); + for S:=0 to high(CTime_hold) do begin + visibleText:=pchar(inttostr(CTime_hold[S])); + SetFontPos (500, X); + glPrint (Addr(visibleText[0])); + X:=X+20; + end;} +end; + +procedure Start3D; +begin + glMatrixMode(GL_PROJECTION); + glPushMatrix; + glLoadIdentity; + glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity; +end; +procedure End3D; +begin + glMatrixMode(GL_PROJECTION); + glPopMatrix; + glMatrixMode(GL_MODELVIEW); +end; + +procedure TScreenCredits.DrawCredits; +var + T,I: Cardinal; + X: Real; + Ver: PChar; + RuntimeStr: AnsiString; + Data: TFFTData; + j,k,l:cardinal; + f,g,h: Real; + STime:cardinal; + Delay:cardinal; + + myPixel: longword; + myColor: Cardinal; + myScale: Real; + myAngle: Real; + + +const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24), + (154,31),(156,58),(168,32),(203,36), + (258,34),(251,50),(274,93),(294,84), + (232,54),(278,62),(319,34),(336,92), + (347,23),(374,32),(377,58),(361,83), + (385,91),(405,91),(429,35),(423,51), + (450,32),(485,34),(444,91),(486,93)); + +begin + //dis does teh muiwk y0r + Data := Music.GetFFTData; + + T := GetTickCount div 33; + if T <> Credits_Time then + begin + Credits_Time := T; + inc(CTime); + inc(CTime_hold); + Credits_X := Credits_X-2; + if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then + begin +// CTime:=Timings[20]; +// CRDTS_Stage:=Outro; + + CRDTS_Stage:=Intro; + CTime:=0; + Music.Play; + + end; + if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then + begin + CRDTS_Stage:=MainPart; + end; + if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then + begin + CRDTS_Stage:=Outro; + end; + end; + + //draw background + if CRDTS_Stage=InitialDelay then + begin + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end + else + if CRDTS_Stage=Intro then + begin + Start3D; + glPushMatrix; + + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + if CTime < Timings[1] then begin + myScale:= 0.5+0.5*(Timings[1]-CTime)/(Timings[1]); // slowly move layers together + myAngle:=cos((CTime)*pi/((Timings[1])*2)); // and make logo face towards camera + end else begin // this is the part when the logo stands still + myScale:=0.5; + myAngle:=0; + end; + if CTime > Timings[2] then begin + myScale:= 0.5+0.5*(CTime-Timings[2])/(Timings[3]-Timings[2]); // get some space between layers + myAngle:=0; + end; +// if CTime > Timings[3] then myScale:=1; // keep the space between layers + glTranslatef(0,0,-5+0.5*myScale); + if CTime > Timings[3] then myScale:=1; // keep the space between layers + if CTime > Timings[3] then begin // make logo rotate left and grow +// myScale:=(CTime-Timings[4])/(Timings[7]-Timings[4]); + glRotatef(20*sqr(CTime-Timings[3])/sqr((Timings[7]-Timings[3])/2),0,0,1); + glScalef(1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1); + end; + if CTime < Timings[2] then + glRotatef(30*myAngle,0.5*myScale+myScale,1+myScale,0); +// glScalef(0.5,0.5,0.5); + glScalef(4/3,-1,1); + glColor4f(1, 1, 1, 1); + + glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.4 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.4 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.4 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.4 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.22 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.22 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.22 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.22 * myScale); + glEnd; + gldisable(gl_texture_2d); + glDisable(GL_BLEND); + + glPopMatrix; + End3D; + + // do some sparkling effects + if (CTime < Timings[1]) and (CTime > Timings[21]) then + begin + for k:=1 to 3 do begin + l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5); + j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301); + GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0); + end; + end; + + // fade to white at end + if Ctime > Timings[6] then + begin + glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + + end; + if (CRDTS_Stage=MainPart) then + // main credits screen background, scroller, logo and girl + begin + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // draw scroller + Draw_FunkyText; + +//######################################################################### +// draw credits names + +// BlindGuard (von links oben reindrehen, nach rechts unten rausdrehen) + STime:=Timings[9]-10; + Delay:=Timings[10]-Timings[9]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(0,329,0); + if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end; + gltranslatef(223,0,0); + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + gltranslatef(223,0,0); + glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1); + gltranslatef(-223,0,0); + end; + glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Blindy (zoom von 0 auf volle grösse und drehung, zoom auf doppelte grösse und nach rechts oben schieben) + STime:=Timings[10]-10; + Delay:=Timings[11]-Timings[10]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+20) and (CTime<=STime+22) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+20 then begin + j:=CTime-Stime; + glscalef(j*j/400,j*j/400,j*j/400); + glrotatef(j*18.0,0,0,1); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(f*3,-f,0); + glscalef(1+j/10,1+j/10,1+j/10); + glrotatef(j*9.0,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Canni (von links reinschieben, nach rechts oben rausschieben) + STime:=Timings[11]-10; + Delay:=Timings[12]-Timings[11]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(((CTime-STime)*21.0)-210,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=(CTime-(STime+Delay-10))*21; + gltranslatef(j,-j/2,0); + end; + glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Commandio (von unten reinklappen, nach rechts oben rausklappen) + STime:=Timings[12]-10; + Delay:=Timings[13]-Timings[12]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=258.0-25.8*(CTime-STime) + else + f:=0; + g:=0; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end; + glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163+g-f*1.5, -129+f*1.5-g/2); + glTexCoord2f(0,1);glVertex2f(-163+g*1.5, 129-(g*1.5*258/326)); + glTexCoord2f(1,1); glVertex2f(163+g, 129+g/4); + glTexCoord2f(1,0);glVertex2f(163+f*1.5+g/4, -129+f*1.5-g/4); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing) + STime:=Timings[13]-35; + Delay:=Timings[14]-Timings[13]+5; + if CTime > STime then + begin + k:=0; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20; + ESC_Alpha:=10; + f:=CTime-STime; + if CTime <=STime+40 then j:=CTime-STime else j:=40; + if (CTime >=STime+Delay-40) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j*j/1600); + + glPushMatrix; + gltranslatef(180+(f-70),329,0); + glBindTexture(GL_TEXTURE_2D, credits_lazyjoker.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Mog (von links reinklappen, nach rechts unten rausklappen) + STime:=Timings[14]-10; + Delay:=Timings[15]-Timings[14]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) + else + f:=0; + + g:=0; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end; + glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163+g*1.5, -129+g*1.5); + glTexCoord2f(0,1);glVertex2f(-163+g*1.2, 129+g); + glTexCoord2f(1,1); glVertex2f(163-f+g/2, 129+f*1.5+g/4); + glTexCoord2f(1,0);glVertex2f(163-f+g*1.5, -129-f*1.5); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Mota (von rechts oben reindrehen, nach links unten rausschieben und verkleinern und dabei drehen) + STime:=Timings[15]-10; + Delay:=Timings[16]-Timings[15]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(223,0,0); + glrotatef((10-(CTime-STime))*9,0,0,1); + gltranslatef(-223,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(-f*2,-f,0); + glscalef(1-j/10,1-j/10,1-j/10); + glrotatef(-j*9.0,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Skillmaster (von rechts unten reinschieben, nach rechts oben rausdrehen) + STime:=Timings[16]-10; + Delay:=Timings[17]-Timings[16]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + j:=STime+10-CTime; + f:=j*10.0; + gltranslatef(+f*2,+f/2,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + gltranslatef(0,-223,0); + glrotatef(integer(j)*-9,0,0,1); + gltranslatef(0,223,0); + glrotatef(j*9,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// WhiteShark (von links unten reinklappen, nach rechts oben rausklappen) + STime:=Timings[17]-10; + Delay:=Timings[18]-Timings[17]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) + else + f:=0; + + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end else + g:=0; + glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2); + glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4); + glTexCoord2f(1,1); glVertex2f(163-f*1.2+g/4, 129+f/2-g/4); + glTexCoord2f(1,0);glVertex2f(163-f*1.5+g/4, -129+f*1.5+g/4); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + + +// #################################################################### +// do some twinkle stuff (kinda on beat) + if (CTime>Timings[8]) and (CTime < Timings[19]) then begin + k:=0; + for j:=0 to 40 do + if Data[j]>=Data[k] then k:=j; + if Data[k]>0.2 then begin + l:=RandomRange(6,16); + j:=RandomRange(0,27); + GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); + end; + end; + +//################################################# +// draw the rest of the main screen (girl and logo + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(800-393, 0); + glTexCoord2f(0,600/1024);glVertex2f(800-393, 600); + glTexCoord2f(393/512,600/1024); glVertex2f(800, 600); + glTexCoord2f(393/512,0);glVertex2f(800, 0); + glEnd; +{ glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,112/128);glVertex2f(0, 112); + glTexCoord2f(497/512,112/128); glVertex2f(497, 112); + glTexCoord2f(497/512,0);glVertex2f(497, 0); + glEnd; +} + gldisable(gl_texture_2d); + glDisable(GL_BLEND); + + // fade out at end of main part + if Ctime > Timings[19] then + begin + glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + end + else + if (CRDTS_Stage=Outro) then + begin + if CTime=Timings[20] then begin + CTime_hold:=0; + Music.Stop; + Music.Open(soundpath + 'credits-outro-tune.mp3'); + Music.Play; + Music.SetVolume(20); + Music.SetLoop(True); + end; + if CTime_hold > 231 then begin + Music.Play; + Ctime_hold:=0; + end; + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + // do something useful + // outro background + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); + glEnd; + + //outro overlays + glColor4f(1, 1, 1, (1+sin(CTime/15))/3+1/3); + glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,223/256);glVertex2f(0, 223); + glTexCoord2f(487/512,223/256); glVertex2f(487, 223); + glTexCoord2f(487/512,0);glVertex2f(487, 0); + glEnd; + + ESC_Alpha:=20; + if (RandomRange(0,20) > 18) and (ESC_Alpha=20) then + ESC_Alpha:=0 + else inc(ESC_Alpha); + if ESC_Alpha > 20 then ESC_Alpha:=20; + glColor4f(1, 1, 1, ESC_Alpha/20); + glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(800-310, 600-247); + glTexCoord2f(0,247/256);glVertex2f(800-310, 600); + glTexCoord2f(310/512,247/256); glVertex2f(800, 600); + glTexCoord2f(310/512,0);glVertex2f(800, 600-247); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // outro scrollers? + // ... + end; + +{ // draw credits runtime counter + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (5, 5); + glColor4f(1, 1, 1, 1); +// RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10); + RuntimeStr:='CTime: '+inttostr(CTime); + glPrint (Addr(RuntimeStr[1])); +} + + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, myTex); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(100, 100); + glTexCoord2f(0,1);glVertex2f(100, 200); + glTexCoord2f(1,1); glVertex2f(200, 200); + glTexCoord2f(1,0);glVertex2f(200, 100); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + + // make the stars shine + GoldenRec.Draw; +end; + +end. -- cgit v1.2.3 From fac1634f48835f46249ec25d2758c81addd09d52 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sun, 30 Sep 2007 05:56:29 +0000 Subject: some minor bug fixes.. added Installer script.. for NSIS install compiler. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@451 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenScore.pas | 119 ++++--------------------------------- 1 file changed, 11 insertions(+), 108 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 222879ba..0182bbd2 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -192,7 +192,8 @@ var MaxH: real; // maximum height of score bar Wsp: real; begin -{ CountSkipTimeSet; +{* + CountSkipTimeSet; Animation := 0; Fadeout := false; @@ -224,7 +225,8 @@ begin 9010..10000: Text[3].Text := ' Superstar'; end; - Music.PlayShuffle;} + Music.PlayShuffle; +*} // Singstar Fadeout := false; @@ -300,112 +302,7 @@ begin Static[StaticLevel[P]].Visible := false; //V[P]; Static[StaticLevelRound[P]].Visible := false; //V[P]; end; -{ - if PlayersPlay <= 3 then begin // only for 1 screen mode - for P := 0 to PlayersPlay-1 do begin - case PlayersPlay of - 1: PP := 1; - 2: PP := P + 2; - 3: PP := P + 4; - end; - //PP := 1; - - Text[TextName[PP]].Text := Ini.Name[P]; - - //{$IFDEF TRANSLATE} -{ case (Player[P].ScoreTotalI) of - 0..2000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_TONE_DEAF'); - 2010..4000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_AMATEUR'); - 4010..6000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_RISING_STAR'); - 6010..8000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_LEAD_SINGER'); - 8010..9000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_HIT_ARTIST'); - 9010..9800: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_SUPERSTAR'); - 9810..10000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_ULTRASTAR'); - end; - (* {$ELSE}{ - case (Player[P].ScoreTotalI) of - 0..2000: Text[TextScore[PP]].Text := 'Tone Deaf'; - 2010..4000: Text[TextScore[PP]].Text := 'Amateur'; - 4010..6000: Text[TextScore[PP]].Text := 'Rising Star'; - 6010..8000: Text[TextScore[PP]].Text := 'Lead Singer'; - 8010..9000: Text[TextScore[PP]].Text := 'Hit Artist'; - 9010..9800: Text[TextScore[PP]].Text := 'Superstar'; - 9810..10000: Text[TextScore[PP]].Text := 'Ultrastar'; - end; -{ {$ENDIF} -//*) - -{ S := IntToStr(Player[P].ScoreI); - while (Length(S)<4) do S := '0' + S; - Text[TextNotesScore[PP]].Text := S; - S := IntToStr(Player[P].ScoreLineI); - while (Length(S)<4) do S := '0' + S; - Text[TextLineBonusScore[PP]].Text := S; - - S := IntToStr(Player[P].ScoreGoldenI); - while (Length(S)<4) do S := '0' + S; - Text[TextGoldenNotesScore[PP]].Text := S; - - S := IntToStr(Player[P].ScoreTotalI); - while (Length(S)<5) do S := '0' + S; - Text[TextTotalScore[PP]].Text := S; - - // Level bar length -(* - Lev := ((Round(Player[P].Punkty) div 10) * 10) / 10000; - Static[StaticLevel[PP]].Texture.H := Round(Static[StaticBackLevel[PP]].Texture.H * Lev); - Static[StaticLevel[PP]].Texture.Y := Static[StaticBackLevel[PP]].Texture.Y + Static[StaticBackLevel[PP]].Texture.H - Static[StaticLevel[PP]].Texture.H; - Static[StaticLevelRound[PP]].Texture.Y := Static[StaticLevel[PP]].Texture.Y - Static[StaticLevelRound[PP]].Texture.H;} -//*) - // doesn't align too much... (to fix) - // hint: play with wrapping textures - // resolution: setting TexY1 and TexY2 to 0.1 and 0.9 - -{ Lev := Player[P].ScoreTotalI / 10000; - MaxH := Static[StaticBackLevel[PP]].Texture.H + Static[StaticBackLevelRound[PP]].Texture.H / 2; - - // developer note (Polish): - // w sumie np. 120 pix - // ten static moze miec 100 pix - // wlacza sie od 20 pix i rosnie do 120 pix - // wiec wysokosc = wyznaczona ilosc - 20 - // nie moze byc mniejsze od 0 - // Lev * MaxH = total number of pixels to draw - Static[StaticLevel[PP]].Visible := true; - Static[StaticLevel[PP]].Texture.H := Lev * MaxH - Static[StaticBackLevelRound[PP]].Texture.H / 2; - if Static[StaticLevel[PP]].Texture.H < 0 then Static[StaticLevel[PP]].Visible := false; - - // Y doesn't change and depend on the back texture coordinate - Static[StaticLevel[PP]].Texture.Y := Static[StaticBackLevel[PP]].Texture.Y + Static[StaticBackLevel[PP]].Texture.H - Static[StaticLevel[PP]].Texture.H; - - // we modify LevelRound texture by changing it's Y. TexY1 and TexY2 change when the height to draw is lower than 20 - if Lev * MaxH < Static[StaticBackLevelRound[PP]].Texture.H / 2 then begin - // when it's lower than 20 => we move TexY1 and TexY2 higher to show only part of this texture - Static[StaticLevelRound[PP]].Texture.Y := Static[StaticBackLevel[PP]].Texture.Y + Static[StaticBackLevel[PP]].Texture.H - Static[StaticBackLevelRound[PP]].Texture.H; - // - 0.25 when points = 0 - // - 0 wnen there are more points - // if Lev * MaxH = Static[StaticBackLevelRound[PP]].Texture.H / 2) then we do not change it - // if Lev * MaxH = 0 then we substract 0.25 - // we substract (0.25 - 0.25 * (Lev * MaxH)/Static[StaticBackLevelRound[PP]].Texture.H / 2) - Wsp := Lev * MaxH / (Static[StaticBackLevelRound[PP]].Texture.H / 2); - Static[StaticLevelRound[PP]].Texture.TexY1 := Static[StaticBackLevelRound[PP]].Texture.TexY1 - 0.25 + 0.25 * Wsp; - Static[StaticLevelRound[PP]].Texture.TexY2 := Static[StaticBackLevelRound[PP]].Texture.TexY2 - 0.25 + 0.25 * Wsp; - end else begin - // when it's higher or equal 20 => full texture is being shown - Static[StaticLevelRound[PP]].Texture.TexY1 := Static[StaticBackLevelRound[PP]].Texture.TexY1; - Static[StaticLevelRound[PP]].Texture.TexY2 := Static[StaticBackLevelRound[PP]].Texture.TexY2; - Static[StaticLevelRound[PP]].Texture.Y := Static[StaticLevel[PP]].Texture.Y - Static[StaticBackLevelRound[PP]].Texture.H; - end; - - end; // for - end; // if - - LCD.HideCursor; - LCD.Clear; - LCD.WriteText(1, Ini.Name[0]); - LCD.WriteText(2, 'Score: ' + Text[TextTotalScore[1]].Text); -} end; procedure TScreenScore.onShowFinish; @@ -684,6 +581,7 @@ const RaiseSmoothness : integer = 100; var RaiseStep : Real; + lTmpA : Real; begin // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps RaiseStep := EaseOut_Step; @@ -695,7 +593,12 @@ begin // quadratic easing out - decelerating to zero velocity // -end_position * current_time * ( current_time - 2 ) + start_postion - Result := floor((-ScoreReached * RaiseStep * (RaiseStep - 20)) / RaiseSmoothness); + lTmpA := (-ScoreReached * RaiseStep * (RaiseStep - 20)); + if ( lTmpA > 0 ) AND + ( RaiseSmoothness > 0 ) THEN + begin + Result := floor( lTmpA / RaiseSmoothness); + end; end else begin -- cgit v1.2.3 From b29759fbfdd8a013e3d0a85b578934ebec028c41 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 2 Oct 2007 04:39:22 +0000 Subject: Fixed linux compilation. Linux is now running in the main loop fine. * no audio playback or input yet... * Timing hack inplace.. that must be replace * bunch of textures not working.. however the play screen is looking similar to windows builds. I hope this dosnt break windows builds to much. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@460 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenOptionsRecord.pas | 270 +++--- Game/Code/Screens/UScreenScore.pas | 1335 ++++++++++++++-------------- Game/Code/Screens/UScreenTop5.pas | 336 +++---- 3 files changed, 978 insertions(+), 963 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index 2ff989fa..ef8b31d1 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -1,132 +1,138 @@ -unit UScreenOptionsRecord; - -interface - -uses - UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; - -type - TScreenOptionsRecord = class(TMenu) - private - SelectSlideInput: integer; - SelectSlideChannelL: integer; - SelectSlideChannelR: integer; - public - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - procedure onShow; override; - procedure UpdateCard; - end; - -implementation - -uses SysUtils, UGraphic, URecord, ULog; - -function TScreenOptionsRecord.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 - Ini.Save; - Music.PlayBack; - FadeTo(@ScreenOptions); - end; - SDLK_RETURN: - begin - if SelInteraction = 4 then begin - Ini.Save; - Music.PlayBack; - FadeTo(@ScreenOptions); - end; - end; - SDLK_DOWN: - InteractNext; - SDLK_UP : - InteractPrev; - SDLK_RIGHT: - begin - if (SelInteraction >= 0) and (SelInteraction <= 3) then begin - Music.PlayOption; - InteractInc; - end; - if SelInteraction = 0 then UpdateCard; - end; - SDLK_LEFT: - begin - if (SelInteraction >= 0) and (SelInteraction <= 3) then begin - Music.PlayOption; - InteractDec; - end; - if SelInteraction = 0 then UpdateCard; - end; - end; - end; -end; - -constructor TScreenOptionsRecord.Create; -var - I: integer; - SC: integer; - SCI: integer; -begin - inherited Create; - - LoadFromTheme(Theme.OptionsRecord); - - SetLength(ICard, Length(Recording.SoundCard)); - for SC := 0 to High(Recording.SoundCard) do - ICard[SC] := Recording.SoundCard[SC].Description; -// end; - -// if Length(Recording.SoundCard[Ini.Card].Input) > 0 then begin - SetLength(IInput, Length(Recording.SoundCard[Ini.Card].Input)); - for SCI := 0 to High(Recording.SoundCard[Ini.Card].Input) do - IInput[SCI] := Recording.SoundCard[Ini.Card].Input[SCI].Name; -// end; - - - AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, Ini.Card, ICard); - SelectSlideInput := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, Ini.CardList[0].Input, IInput); - SelectSlideChannelL := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelL, Ini.CardList[0].ChannelL, IChannel); - SelectSlideChannelR := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelR, Ini.CardList[0].ChannelR, IChannel); - - AddButton(Theme.OptionsRecord.ButtonExit); - if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[7]); - - Interaction := 0; -end; - -procedure TScreenOptionsRecord.onShow; -begin - Interaction := 0; -end; - -procedure TScreenOptionsRecord.UpdateCard; -var - SC: integer; - SCI: integer; -begin - SC := Ini.Card; -// if SC = 1 then beep; - - SetLength(IInput, Length(Recording.SoundCard[SC].Input)); - for SCI := 0 to High(Recording.SoundCard[SC].Input) do begin - IInput[SCI] := Recording.SoundCard[SC].Input[SCI].Name; -// Log.LogError(IInput[SCI]); - end; - - UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideInput, SelectSlideInput, IInput, Ini.CardList[SC].Input); - UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelL, SelectSlideChannelL, IChannel, Ini.CardList[SC].ChannelL); - UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelR, SelectSlideChannelR, IChannel, Ini.CardList[SC].ChannelR); -end; - -end. \ No newline at end of file +unit UScreenOptionsRecord; + +interface + +uses + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; + +type + TScreenOptionsRecord = class(TMenu) + private + SelectSlideInput: integer; + SelectSlideChannelL: integer; + SelectSlideChannelR: integer; + public + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure UpdateCard; + end; + +implementation + +uses SysUtils, UGraphic, URecord, ULog; + +function TScreenOptionsRecord.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 + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 4 then begin + Ini.Save; + Music.PlayBack; + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + Music.PlayOption; + InteractInc; + end; + if SelInteraction = 0 then UpdateCard; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + Music.PlayOption; + InteractDec; + end; + if SelInteraction = 0 then UpdateCard; + end; + end; + end; +end; + +constructor TScreenOptionsRecord.Create; +var + I: integer; + SC: integer; + SCI: integer; +begin + inherited Create; + + LoadFromTheme(Theme.OptionsRecord); + + SetLength(ICard, Length(Recording.SoundCard)); + for SC := 0 to High(Recording.SoundCard) do + ICard[SC] := Recording.SoundCard[SC].Description; +// end; + +// if Length(Recording.SoundCard[Ini.Card].Input) > 0 then begin + + {$IFDEF win32} + // TODO : JB_Linux .... Audio Input ... had to remove to get it to run ??? + + SetLength(IInput, Length(Recording.SoundCard[Ini.Card].Input)); + for SCI := 0 to High(Recording.SoundCard[Ini.Card].Input) do + IInput[SCI] := Recording.SoundCard[Ini.Card].Input[SCI].Name; +// end; + + AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, Ini.Card, ICard); + SelectSlideInput := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, Ini.CardList[0].Input, IInput); + SelectSlideChannelL := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelL, Ini.CardList[0].ChannelL, IChannel); + SelectSlideChannelR := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelR, Ini.CardList[0].ChannelR, IChannel); + + {$ENDIF} + + + AddButton(Theme.OptionsRecord.ButtonExit); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[7]); + + Interaction := 0; +end; + +procedure TScreenOptionsRecord.onShow; +begin + Interaction := 0; +end; + +procedure TScreenOptionsRecord.UpdateCard; +var + SC: integer; + SCI: integer; +begin + SC := Ini.Card; +// if SC = 1 then beep; + + SetLength(IInput, Length(Recording.SoundCard[SC].Input)); + for SCI := 0 to High(Recording.SoundCard[SC].Input) do begin + IInput[SCI] := Recording.SoundCard[SC].Input[SCI].Name; +// Log.LogError(IInput[SCI]); + end; + + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideInput, SelectSlideInput, IInput, Ini.CardList[SC].Input); + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelL, SelectSlideChannelL, IChannel, Ini.CardList[SC].ChannelL); + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelR, SelectSlideChannelR, IChannel, Ini.CardList[SC].ChannelR); +end; + +end. diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 0182bbd2..c53e8b32 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -1,663 +1,672 @@ -unit UScreenScore; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -uses - UMenu, - SDL, - SysUtils, - UDisplay, - UMusic, - USongs, - UThemes, - OpenGL12, - Windows, - math, - ULCD; - -// OpenGL; - -type - TScreenScore = class(TMenu) - public - TextArtist: integer; - TextTitle: integer; - - TextArtistTitle : integer; - - TextName: array[1..6] of integer; - TextScore: array[1..6] of integer; - - TextNotes: array[1..6] of integer; - TextNotesScore: array[1..6] of integer; - TextLineBonus: array[1..6] of integer; - TextLineBonusScore: array[1..6] of integer; - TextGoldenNotes: array[1..6] of integer; - TextGoldenNotesScore: array[1..6] of integer; - TextTotal: array[1..6] of integer; - TextTotalScore: array[1..6] of integer; - - PlayerStatic: array[1..6] of array of integer; - PlayerTexts : array[1..6] of array of integer; - - - StaticBoxLightest: array[1..6] of integer; - StaticBoxLight: array[1..6] of integer; - StaticBoxDark: array[1..6] of integer; - - StaticBackLevel: array[1..6] of integer; - StaticBackLevelRound: array[1..6] of integer; - StaticLevel: array[1..6] of integer; - StaticLevelRound: array[1..6] of integer; - - Animation: real; - Fadeout: boolean; - - BarScore_ActualHeight : array[1..6] of real; - BarPhrase_ActualHeight : array[1..6] of real; - BarGolden_ActualHeight : array[1..6] of real; - - BarScore_EaseOut_Step : real; - BarPhrase_EaseOut_Step : real; - BarGolden_EaseOut_Step : real; - - TextScore_ActualValue : array[1..6] of integer; - TextPhrase_ActualValue : array[1..6] of integer; - TextGolden_ActualValue : array[1..6] of integer; - - EaseOut_MaxSteps : real; - - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - procedure onShow; override; - procedure onShowFinish; override; - function Draw: boolean; override; - procedure FillPlayer(Item, P: integer); - - function RaiseBar(PlayerNumber: integer; BarStartPosY: Single; ActualHeight: real; Score: integer; ColorBrightness : String; EaseOut_Step: Real) : real; - function IncrementScore(PlayerNumber: integer; ActualScoreValue: Integer; ScoreReached: integer; EaseOut_Step: Real) : integer; - end; - -implementation - -//{$IFDEF TRANSLATE} -uses UGraphic, UScreenSong, UMenuStatic, UTime, UMain, UIni, ULanguage; -//{$ELSE} -//uses UGraphic, UScreenSong, UMenuStatic, UTime, UMain, UIni; -//{$ENDIF} -function TScreenScore.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then begin - case PressedKey of - SDLK_Q: - begin - Result := false; - end; - - SDLK_ESCAPE, - SDLK_BACKSPACE : - - begin - if (not Fadeout) then begin -// Music.StopShuffle; - FadeTo(@ScreenTop5); - Fadeout := true; - end; - end; - SDLK_RETURN: - begin - if (not Fadeout) then begin -// Music.StopShuffle; - FadeTo(@ScreenTop5); - Fadeout := true; - end; - end; -{ SDLK_SYSREQ: - begin - beep; - end;} - SDLK_SYSREQ: - begin - Display.PrintScreen; - end; - end; - end; -end; - -constructor TScreenScore.Create; -var - P: integer; - I, C: integer; -begin - inherited Create; - - LoadFromTheme(Theme.Score); - - TextArtist := AddText(Theme.Score.TextArtist); - TextTitle := AddText(Theme.Score.TextTitle); - - TextArtistTitle := AddText(Theme.Score.TextArtistTitle); - - for P := 1 to 6 do begin - TextName[P] := AddText(Theme.Score.TextName[P]); - TextScore[P] := AddText(Theme.Score.TextScore[P]); - - TextNotes[P] := AddText(Theme.Score.TextNotes[P]); - TextNotesScore[P] := AddText(Theme.Score.TextNotesScore[P]); - TextLineBonus[P] := AddText(Theme.Score.TextLineBonus[P]); - TextLineBonusScore[P] := AddText(Theme.Score.TextLineBonusScore[P]); - TextGoldenNotes[P] := AddText(Theme.Score.TextGoldenNotes[P]); - TextGoldenNotesScore[P] := AddText(Theme.Score.TextGoldenNotesScore[P]); - TextTotal[P] := AddText(Theme.Score.TextTotal[P]); - TextTotalScore[P] := AddText(Theme.Score.TextTotalScore[P]); - - SetLength(PlayerStatic[P], Length(Theme.Score.PlayerStatic[P])); - - SetLength(PlayerTexts[P], Length(Theme.Score.PlayerTexts[P])); - - for I := 0 to High(Theme.Score.PlayerStatic[P]) do - PlayerStatic[P, I] := AddStatic(Theme.Score.PlayerStatic[P, I]); - - - //added by mog - for C := 0 to High(Theme.Score.PlayerTexts[P]) do - PlayerTexts[P, C] := AddText(Theme.Score.PlayerTexts[P, C]); - // more skinable now - - StaticBoxLightest[P] := AddStatic(Theme.Score.StaticBoxLightest[P]); - StaticBoxLight[P] := AddStatic(Theme.Score.StaticBoxLight[P]); - StaticBoxDark[P] := AddStatic(Theme.Score.StaticBoxDark[P]); - - StaticBackLevel[P] := AddStatic(Theme.Score.StaticBackLevel[P]); - StaticBackLevelRound[P] := AddStatic(Theme.Score.StaticBackLevelRound[P]); - StaticLevel[P] := AddStatic(Theme.Score.StaticLevel[P]); - StaticLevelRound[P] := AddStatic(Theme.Score.StaticLevelRound[P]); - end; -end; - -procedure TScreenScore.onShow; -var - P: integer; // player - PP: integer; // another player variable - S: string; - I: integer; - Lev: real; - Skip: integer; - V: array[1..6] of boolean; // visibility array - MaxH: real; // maximum height of score bar - Wsp: real; -begin -{* - CountSkipTimeSet; - - Animation := 0; - Fadeout := false; - - Text[1].Text := AktSong.Artist + ' - ' + AktSong.Title; - Text[2].Text := ' ' + IntToStr((Round(Gracz[0].Punkty) div 10) * 10) + ' points'; - - Static[0].Texture.X := -2000; - Static[1].Texture.X := -2000; - Static[2].Texture.X := -2000; - Static[3].Texture.X := -2000; - Static[4].Texture.X := -2000; - Static[5].Texture.X := -2000; - Static[6].Texture.X := -2000; - Static[7].Texture.X := -2000; - - Text[0].X := -2000; - Text[1].X := -2000; - Text[2].X := -2000; - Text[3].X := -2000; - - - case (Round(Gracz[0].Punkty) div 10) * 10 of - 0..1000: Text[3].Text := ' Tone Deaf'; - 2010..4000: Text[3].Text := ' Amateur'; - 4010..6000: Text[3].Text := ' Rising Star'; - 6010..8000: Text[3].Text := ' Lead Singer'; - 8010..9000: Text[3].Text := ' Hit Artist'; - 9010..10000: Text[3].Text := ' Superstar'; - end; - - Music.PlayShuffle; -*} - - // Singstar - Fadeout := false; - - Text[TextArtist].Text := AktSong.Artist; - Text[TextTitle].Text := AktSong.Title; - Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; - - // set visibility - case PlayersPlay of - 1: begin - V[1] := true; - V[2] := false; - V[3] := false; - V[4] := false; - V[5] := false; - V[6] := false; - end; - 2, 4: begin - V[1] := false; - V[2] := true; - V[3] := true; - V[4] := false; - V[5] := false; - V[6] := false; - end; - 3, 6: begin - V[1] := false; - V[2] := false; - V[3] := false; - V[4] := true; - V[5] := true; - V[6] := true; - end; - end; - - for P := 1 to 6 do begin - Text[TextName[P]].Visible := V[P]; - Text[TextScore[P]].Visible := V[P]; - - // We set alpha to 0 , so we can nicely blend them in when we need them - Text[TextScore[P]].Alpha := 0; - Text[TextNotesScore[P]].Alpha := 0; - Text[TextNotes[P]].Alpha := 0; - Text[TextLineBonus[P]].Alpha := 0; - Text[TextLineBonusScore[P]].Alpha := 0; - Text[TextGoldenNotes[P]].Alpha := 0; - Text[TextGoldenNotesScore[P]].Alpha := 0; - Text[TextTotal[P]].Alpha := 0; - Text[TextTotalScore[P]].Alpha := 0; - - Text[TextNotes[P]].Visible := V[P]; - Text[TextNotesScore[P]].Visible := V[P]; - Text[TextLineBonus[P]].Visible := V[P]; - Text[TextLineBonusScore[P]].Visible := V[P]; - Text[TextGoldenNotes[P]].Visible := V[P]; - Text[TextGoldenNotesScore[P]].Visible := V[P]; - Text[TextTotal[P]].Visible := V[P]; - Text[TextTotalScore[P]].Visible := V[P]; - - for I := 0 to high(PlayerStatic[P]) do - Static[PlayerStatic[P, I]].Visible := V[P]; - - for I := 0 to high(PlayerTexts[P]) do - Text[PlayerTexts[P, I]].Visible := V[P]; - - Static[StaticBoxLightest[P]].Visible := V[P]; - Static[StaticBoxLight[P]].Visible := V[P]; - Static[StaticBoxDark[P]].Visible := V[P]; - - Static[StaticBackLevel[P]].Visible := false; //V[P]; - Static[StaticBackLevelRound[P]].Visible := false; //V[P]; - Static[StaticLevel[P]].Visible := false; //V[P]; - Static[StaticLevelRound[P]].Visible := false; //V[P]; - end; - -end; - -procedure TScreenScore.onShowFinish; -var - index : integer; -begin -for index := 1 to 2 do - begin - BarScore_ActualHeight[index] := 0; - BarPhrase_ActualHeight[index] := 0; - BarGolden_ActualHeight[index] := 0; - - TextScore_ActualValue[index] := 0; - TextPhrase_ActualValue[index] := 0; - TextGolden_ActualValue[index] := 0; - end; - - - BarScore_EaseOut_Step := 1; - BarPhrase_EaseOut_Step := 1; - BarGolden_EaseOut_Step := 1; - - EaseOut_MaxSteps := 100; -end; - -function TScreenScore.Draw: boolean; -var -{ Min: real; - Max: real; - Wsp: real; - Wsp2: real; - Pet: integer;} - - ActualTime, OldTime : Integer; - - Item: integer; - P: integer; - C: integer; - - katze : integer; -begin - - // 0.5.0: try also use 4 players screen with nicks - if PlayersPlay = 4 then begin - for Item := 2 to 3 do begin - if ScreenAct = 1 then P := Item-2; - if ScreenAct = 2 then P := Item; - - FillPlayer(Item, P); - end; - end; - - - // Singstar - let it be...... with 6 statics - if PlayersPlay = 6 then begin - for Item := 4 to 6 do begin - if ScreenAct = 1 then P := Item-4; - if ScreenAct = 2 then P := Item-1; - - FillPlayer(Item, P); - -{ if ScreenAct = 1 then begin - LoadColor( - Static[StaticBoxLightest[Item]].Texture.ColR, - Static[StaticBoxLightest[Item]].Texture.ColG, - Static[StaticBoxLightest[Item]].Texture.ColB, - 'P1Dark'); - end; - - if ScreenAct = 2 then begin - LoadColor( - Static[StaticBoxLightest[Item]].Texture.ColR, - Static[StaticBoxLightest[Item]].Texture.ColG, - Static[StaticBoxLightest[Item]].Texture.ColB, - 'P4Dark'); - end;} - - end; - end; - - inherited Draw; -{ - player[1].ScoreI := 7000; - player[1].ScoreLineI := 2000; - player[1].ScoreGoldenI := 1000; - - player[2].ScoreI := 2500; - player[2].ScoreLineI := 1100; - player[2].ScoreGoldenI := 900; - } -// Let's arise the bars - ActualTime := GetTickCount div 33; - if ((ActualTime <> OldTime) and ShowFinish )then - begin - OldTime := ActualTime; - - For katze:= 0 to 5 do - begin - - // We actually araise them in the right order, but we have to draw them in reverse order (golden -> phrase -> mainscore) - Case BarScore_EaseOut_Step < EaseOut_MaxSteps * 10 of - true : BarScore_EaseOut_Step := BarScore_EaseOut_Step + 1; - end; - - // PhrasenBonus - if (BarScore_EaseOut_Step >= (EaseOut_MaxSteps * 10)) then - begin - Case BarPhrase_EaseOut_Step < EaseOut_MaxSteps * 10 of - true : BarPhrase_EaseOut_Step := BarPhrase_EaseOut_Step + 1; - end; - - // GoldenNotebonus - if (BarPhrase_EaseOut_Step >= (EaseOut_MaxSteps * 10)) then - begin - Case BarGolden_EaseOut_Step < EaseOut_MaxSteps * 10 of - true : BarGolden_EaseOut_Step := BarGolden_EaseOut_Step + 1; - end; - - //######################## - // Draw golden score bar # - //######################## - - BarGolden_ActualHeight[katze] := RaiseBar(katze, - Static[StaticBackLevel[katze+1]].Texture.y - BarScore_ActualHeight[katze] - BarPhrase_ActualHeight[katze], - BarGolden_ActualHeight[katze], - player[katze+1].ScoreGoldenI, - 'Lightest', - BarGolden_EaseOut_Step); - - // Increment and show total score and plain score - TextGolden_ActualValue[katze] := IncrementScore(katze, - TextGolden_ActualValue[katze], - Player[katze+1].ScoreGoldenI, - BarGolden_EaseOut_Step); - Text[TextGoldenNotesScore[katze+1]].Text := IntToStr(TextGolden_ActualValue[katze]); - - // Blend in - Text[TextGoldenNotesScore[katze+1]].Alpha := (BarGolden_EaseOut_Step / 100); - Text[TextGoldenNotes[katze+1]].Alpha := (BarGolden_EaseOut_Step / 100); - - end; - //######################## - // Draw phrase score bar # - //######################## - BarPhrase_ActualHeight[katze] := RaiseBar(katze, - Static[StaticBackLevel[katze+1]].Texture.y - BarScore_ActualHeight[katze], - BarPhrase_ActualHeight[katze], - Player[katze+1].ScoreLineI, - 'Light', - BarPhrase_EaseOut_Step); - - // Increment and show total score and plain score - TextPhrase_ActualValue[katze] := IncrementScore(katze, - TextPhrase_ActualValue[katze], - Player[katze+1].ScoreLineI, - BarPhrase_EaseOut_Step); - Text[TextLineBonusScore[katze+1]].Text := IntToStr(TextPhrase_ActualValue[katze]); - - //Blend in - Text[TextLineBonusScore[katze+1]].Alpha := (BarPhrase_EaseOut_Step / 100); - Text[TextLineBonus[katze+1]].Alpha := (BarPhrase_EaseOut_Step / 100); - - - end; - //####################### - // Draw plain score bar # - //####################### - BarScore_ActualHeight[katze] := RaiseBar(katze, - Static[StaticBackLevel[katze+1]].Texture.y, - BarScore_ActualHeight[katze], - Player[katze+1].ScoreI, - 'Dark', - BarScore_EaseOut_Step); - // Increment and show total score and plain score - TextScore_ActualValue[katze] := IncrementScore(katze, - TextScore_ActualValue[katze], - Player[katze+1].ScoreI, - BarScore_EaseOut_Step); - Text[TextNotesScore[katze+1]].Text := IntToStr(TextScore_ActualValue[katze]); - - Text[TextTotalScore[katze+1]].Text := IntToStr(TextScore_ActualValue[katze] + TextPhrase_ActualValue[katze] + TextGolden_ActualValue[katze]); - - //Blend em in - Text[TextTotalScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextTotal[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextNotesScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextNotes[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); - - end; // me loop - end; -end; - - -function TscreenScore.RaiseBar(PlayerNumber: integer; BarStartPosY: Single; ActualHeight: real; Score: integer; ColorBrightness : String; EaseOut_Step: Real) : real; -const - RaiseSmoothness : integer = 100; -var - MaxHeight : real; - NewHeight : real; - Width : real; - - Height2Reach : real; - - RaiseStep : real; - - BarStartPosX : Single; - - R,G,B : real; -begin - - MaxHeight := Static[StaticBackLevel[PlayerNumber + 1]].Texture.H; - Width := Static[StaticBackLevel[PlayerNumber + 1]].Texture.W; - - BarStartPosX := Static[StaticBackLevel[PlayerNumber + 1]].Texture.X; - - BarStartPosY := BarStartPosY + MaxHeight; // The texture starts in the upper left corner, so let's subtract the height - so we can arise it - - // the height dependend of the score - Height2Reach := (Score / 10000) * MaxHeight; - - // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps - RaiseStep := EaseOut_Step; - - if (ActualHeight < Height2Reach) then - begin - // Check http://proto.layer51.com/d.aspx?f=400 for more info on easing functions - // Calculate the actual step according to the maxsteps - RaiseStep := RaiseStep / EaseOut_MaxSteps; - - // quadratic easing out - decelerating to zero velocity - // -end_position * current_time * ( current_time - 2 ) + start_postion - NewHeight := (-Height2Reach * RaiseStep * (RaiseStep - 20) + BarStartPosY) / RaiseSmoothness; - end - else - begin - NewHeight := Height2Reach; - end; - //+1 - LoadColor(R, G, B, 'P' + inttostr(PlayerNumber+1) + ColorBrightness); //dark, light, lightest - glColor4f(R, G, B, 1); - - //the actual bar - glBindTexture(GL_TEXTURE_2D, Static[StaticLevel[PlayerNumber + 1]].Texture.TexNum); - - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(BarStartPosX, BarStartPosY - NewHeight); - glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, BarStartPosY - NewHeight); - glTexCoord2f(1, 1); glVertex2f(BarStartPosX + Width, BarStartPosY); - glTexCoord2f(0, 1); glVertex2f(BarStartPosX, BarStartPosY); - glEnd; - - //the round thing on top - glBindTexture(GL_TEXTURE_2D, Static[StaticLevelRound[PlayerNumber + 1]].Texture.TexNum); - - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(BarStartPosX, (BarStartPosY - Static[StaticLevelRound[PlayerNumber + 1]].Texture.h) - NewHeight); - glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, (BarStartPosY - Static[StaticLevelRound[PlayerNumber + 1]].Texture.h) - NewHeight); - glTexCoord2f(1, 1); glVertex2f(BarStartPosX + Width, BarStartPosY - NewHeight); - glTexCoord2f(0, 1); glVertex2f(BarStartPosX, BarStartPosY - NewHeight); - glEnd; - - Result := NewHeight; -end; - -function TScreenScore.IncrementScore(PlayerNumber: integer; ActualScoreValue: Integer; ScoreReached: integer; EaseOut_Step: Real) : integer; -const - RaiseSmoothness : integer = 100; -var - RaiseStep : Real; - lTmpA : Real; -begin - // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps - RaiseStep := EaseOut_Step; - - if (ActualScoreValue < ScoreReached) then - begin - // Calculate the actual step according to the maxsteps - RaiseStep := RaiseStep / EaseOut_MaxSteps; - - // quadratic easing out - decelerating to zero velocity - // -end_position * current_time * ( current_time - 2 ) + start_postion - lTmpA := (-ScoreReached * RaiseStep * (RaiseStep - 20)); - if ( lTmpA > 0 ) AND - ( RaiseSmoothness > 0 ) THEN - begin - Result := floor( lTmpA / RaiseSmoothness); - end; - end - else - begin - Result := ScoreReached; - end; - -end; - -procedure TScreenScore.FillPlayer(Item, P: integer); -var - S: string; -begin - Text[TextName[Item]].Text := Ini.Name[P]; - - S := IntToStr((Round(Player[P].Score) div 10) * 10); - while (Length(S)<4) do S := '0' + S; - Text[TextNotesScore[Item]].Text := S; - -// while (Length(S)<5) do S := '0' + S; -// Text[TextTotalScore[Item]].Text := S; - -//fixed: line bonus and golden notes don't show up, -// another bug: total score was shown without added golden-, linebonus - S := IntToStr(Player[P].ScoreTotalI); - while (Length(S)<5) do S := '0' + S; - Text[TextTotalScore[Item]].Text := S; - - S := IntToStr(Player[P].ScoreLineI); - while (Length(S)<4) do S := '0' + S; - Text[TextLineBonusScore[Item]].Text := S; - - S := IntToStr(Player[P].ScoreGoldenI); - while (Length(S)<4) do S := '0' + S; - Text[TextGoldenNotesScore[Item]].Text := S; -//end of fix - - LoadColor( - Text[TextName[Item]].ColR, - Text[TextName[Item]].ColG, - Text[TextName[Item]].ColB, - 'P' + IntToStr(P+1) + 'Dark'); - - LoadColor( - Static[StaticBoxLightest[Item]].Texture.ColR, - Static[StaticBoxLightest[Item]].Texture.ColG, - Static[StaticBoxLightest[Item]].Texture.ColB, - 'P' + IntToStr(P+1) + 'Lightest'); - - LoadColor( - Static[StaticBoxLight[Item]].Texture.ColR, - Static[StaticBoxLight[Item]].Texture.ColG, - Static[StaticBoxLight[Item]].Texture.ColB, - 'P' + IntToStr(P+1) + 'Light'); - - LoadColor( - Static[StaticBoxDark[Item]].Texture.ColR, - Static[StaticBoxDark[Item]].Texture.ColG, - Static[StaticBoxDark[Item]].Texture.ColB, - 'P' + IntToStr(P+1) + 'Dark'); -end; - -end. +unit UScreenScore; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses + UMenu, + SDL, + SysUtils, + UDisplay, + UMusic, + USongs, + UThemes, + OpenGL12, + {$ifdef win32} + Windows, + {$endif} + math, + ULCD; + +// OpenGL; + +type + TScreenScore = class(TMenu) + public + TextArtist: integer; + TextTitle: integer; + + TextArtistTitle : integer; + + TextName: array[1..6] of integer; + TextScore: array[1..6] of integer; + + TextNotes: array[1..6] of integer; + TextNotesScore: array[1..6] of integer; + TextLineBonus: array[1..6] of integer; + TextLineBonusScore: array[1..6] of integer; + TextGoldenNotes: array[1..6] of integer; + TextGoldenNotesScore: array[1..6] of integer; + TextTotal: array[1..6] of integer; + TextTotalScore: array[1..6] of integer; + + PlayerStatic: array[1..6] of array of integer; + PlayerTexts : array[1..6] of array of integer; + + + StaticBoxLightest: array[1..6] of integer; + StaticBoxLight: array[1..6] of integer; + StaticBoxDark: array[1..6] of integer; + + StaticBackLevel: array[1..6] of integer; + StaticBackLevelRound: array[1..6] of integer; + StaticLevel: array[1..6] of integer; + StaticLevelRound: array[1..6] of integer; + + Animation: real; + Fadeout: boolean; + + BarScore_ActualHeight : array[1..6] of real; + BarPhrase_ActualHeight : array[1..6] of real; + BarGolden_ActualHeight : array[1..6] of real; + + BarScore_EaseOut_Step : real; + BarPhrase_EaseOut_Step : real; + BarGolden_EaseOut_Step : real; + + TextScore_ActualValue : array[1..6] of integer; + TextPhrase_ActualValue : array[1..6] of integer; + TextGolden_ActualValue : array[1..6] of integer; + + EaseOut_MaxSteps : real; + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure onShowFinish; override; + function Draw: boolean; override; + procedure FillPlayer(Item, P: integer); + + function RaiseBar(PlayerNumber: integer; BarStartPosY: Single; ActualHeight: real; Score: integer; ColorBrightness : String; EaseOut_Step: Real) : real; + function IncrementScore(PlayerNumber: integer; ActualScoreValue: Integer; ScoreReached: integer; EaseOut_Step: Real) : integer; + end; + +implementation + + +uses UGraphic, + UScreenSong, + UMenuStatic, + UTime, + UMain, + UIni, + {$IFNDEF win32} + lclintf, + {$ENDIF} + ULanguage; + +function TScreenScore.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then begin + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE, + SDLK_BACKSPACE : + + begin + if (not Fadeout) then begin +// Music.StopShuffle; + FadeTo(@ScreenTop5); + Fadeout := true; + end; + end; + SDLK_RETURN: + begin + if (not Fadeout) then begin +// Music.StopShuffle; + FadeTo(@ScreenTop5); + Fadeout := true; + end; + end; +{ SDLK_SYSREQ: + begin + beep; + end;} + SDLK_SYSREQ: + begin + Display.PrintScreen; + end; + end; + end; +end; + +constructor TScreenScore.Create; +var + P: integer; + I, C: integer; +begin + inherited Create; + + LoadFromTheme(Theme.Score); + + TextArtist := AddText(Theme.Score.TextArtist); + TextTitle := AddText(Theme.Score.TextTitle); + + TextArtistTitle := AddText(Theme.Score.TextArtistTitle); + + for P := 1 to 6 do begin + TextName[P] := AddText(Theme.Score.TextName[P]); + TextScore[P] := AddText(Theme.Score.TextScore[P]); + + TextNotes[P] := AddText(Theme.Score.TextNotes[P]); + TextNotesScore[P] := AddText(Theme.Score.TextNotesScore[P]); + TextLineBonus[P] := AddText(Theme.Score.TextLineBonus[P]); + TextLineBonusScore[P] := AddText(Theme.Score.TextLineBonusScore[P]); + TextGoldenNotes[P] := AddText(Theme.Score.TextGoldenNotes[P]); + TextGoldenNotesScore[P] := AddText(Theme.Score.TextGoldenNotesScore[P]); + TextTotal[P] := AddText(Theme.Score.TextTotal[P]); + TextTotalScore[P] := AddText(Theme.Score.TextTotalScore[P]); + + SetLength(PlayerStatic[P], Length(Theme.Score.PlayerStatic[P])); + + SetLength(PlayerTexts[P], Length(Theme.Score.PlayerTexts[P])); + + for I := 0 to High(Theme.Score.PlayerStatic[P]) do + PlayerStatic[P, I] := AddStatic(Theme.Score.PlayerStatic[P, I]); + + + //added by mog + for C := 0 to High(Theme.Score.PlayerTexts[P]) do + PlayerTexts[P, C] := AddText(Theme.Score.PlayerTexts[P, C]); + // more skinable now + + StaticBoxLightest[P] := AddStatic(Theme.Score.StaticBoxLightest[P]); + StaticBoxLight[P] := AddStatic(Theme.Score.StaticBoxLight[P]); + StaticBoxDark[P] := AddStatic(Theme.Score.StaticBoxDark[P]); + + StaticBackLevel[P] := AddStatic(Theme.Score.StaticBackLevel[P]); + StaticBackLevelRound[P] := AddStatic(Theme.Score.StaticBackLevelRound[P]); + StaticLevel[P] := AddStatic(Theme.Score.StaticLevel[P]); + StaticLevelRound[P] := AddStatic(Theme.Score.StaticLevelRound[P]); + end; +end; + +procedure TScreenScore.onShow; +var + P: integer; // player + PP: integer; // another player variable + S: string; + I: integer; + Lev: real; + Skip: integer; + V: array[1..6] of boolean; // visibility array + MaxH: real; // maximum height of score bar + Wsp: real; +begin +{* + CountSkipTimeSet; + + Animation := 0; + Fadeout := false; + + Text[1].Text := AktSong.Artist + ' - ' + AktSong.Title; + Text[2].Text := ' ' + IntToStr((Round(Gracz[0].Punkty) div 10) * 10) + ' points'; + + Static[0].Texture.X := -2000; + Static[1].Texture.X := -2000; + Static[2].Texture.X := -2000; + Static[3].Texture.X := -2000; + Static[4].Texture.X := -2000; + Static[5].Texture.X := -2000; + Static[6].Texture.X := -2000; + Static[7].Texture.X := -2000; + + Text[0].X := -2000; + Text[1].X := -2000; + Text[2].X := -2000; + Text[3].X := -2000; + + + case (Round(Gracz[0].Punkty) div 10) * 10 of + 0..1000: Text[3].Text := ' Tone Deaf'; + 2010..4000: Text[3].Text := ' Amateur'; + 4010..6000: Text[3].Text := ' Rising Star'; + 6010..8000: Text[3].Text := ' Lead Singer'; + 8010..9000: Text[3].Text := ' Hit Artist'; + 9010..10000: Text[3].Text := ' Superstar'; + end; + + Music.PlayShuffle; +*} + + // Singstar + Fadeout := false; + + Text[TextArtist].Text := AktSong.Artist; + Text[TextTitle].Text := AktSong.Title; + Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; + + // set visibility + case PlayersPlay of + 1: begin + V[1] := true; + V[2] := false; + V[3] := false; + V[4] := false; + V[5] := false; + V[6] := false; + end; + 2, 4: begin + V[1] := false; + V[2] := true; + V[3] := true; + V[4] := false; + V[5] := false; + V[6] := false; + end; + 3, 6: begin + V[1] := false; + V[2] := false; + V[3] := false; + V[4] := true; + V[5] := true; + V[6] := true; + end; + end; + + for P := 1 to 6 do begin + Text[TextName[P]].Visible := V[P]; + Text[TextScore[P]].Visible := V[P]; + + // We set alpha to 0 , so we can nicely blend them in when we need them + Text[TextScore[P]].Alpha := 0; + Text[TextNotesScore[P]].Alpha := 0; + Text[TextNotes[P]].Alpha := 0; + Text[TextLineBonus[P]].Alpha := 0; + Text[TextLineBonusScore[P]].Alpha := 0; + Text[TextGoldenNotes[P]].Alpha := 0; + Text[TextGoldenNotesScore[P]].Alpha := 0; + Text[TextTotal[P]].Alpha := 0; + Text[TextTotalScore[P]].Alpha := 0; + + Text[TextNotes[P]].Visible := V[P]; + Text[TextNotesScore[P]].Visible := V[P]; + Text[TextLineBonus[P]].Visible := V[P]; + Text[TextLineBonusScore[P]].Visible := V[P]; + Text[TextGoldenNotes[P]].Visible := V[P]; + Text[TextGoldenNotesScore[P]].Visible := V[P]; + Text[TextTotal[P]].Visible := V[P]; + Text[TextTotalScore[P]].Visible := V[P]; + + for I := 0 to high(PlayerStatic[P]) do + Static[PlayerStatic[P, I]].Visible := V[P]; + + for I := 0 to high(PlayerTexts[P]) do + Text[PlayerTexts[P, I]].Visible := V[P]; + + Static[StaticBoxLightest[P]].Visible := V[P]; + Static[StaticBoxLight[P]].Visible := V[P]; + Static[StaticBoxDark[P]].Visible := V[P]; + + Static[StaticBackLevel[P]].Visible := false; //V[P]; + Static[StaticBackLevelRound[P]].Visible := false; //V[P]; + Static[StaticLevel[P]].Visible := false; //V[P]; + Static[StaticLevelRound[P]].Visible := false; //V[P]; + end; + +end; + +procedure TScreenScore.onShowFinish; +var + index : integer; +begin +for index := 1 to 2 do + begin + BarScore_ActualHeight[index] := 0; + BarPhrase_ActualHeight[index] := 0; + BarGolden_ActualHeight[index] := 0; + + TextScore_ActualValue[index] := 0; + TextPhrase_ActualValue[index] := 0; + TextGolden_ActualValue[index] := 0; + end; + + + BarScore_EaseOut_Step := 1; + BarPhrase_EaseOut_Step := 1; + BarGolden_EaseOut_Step := 1; + + EaseOut_MaxSteps := 100; +end; + +function TScreenScore.Draw: boolean; +var +{ Min: real; + Max: real; + Wsp: real; + Wsp2: real; + Pet: integer;} + + ActualTime, OldTime : Integer; + + Item: integer; + P: integer; + C: integer; + + katze : integer; +begin + + // 0.5.0: try also use 4 players screen with nicks + if PlayersPlay = 4 then begin + for Item := 2 to 3 do begin + if ScreenAct = 1 then P := Item-2; + if ScreenAct = 2 then P := Item; + + FillPlayer(Item, P); + end; + end; + + + // Singstar - let it be...... with 6 statics + if PlayersPlay = 6 then begin + for Item := 4 to 6 do begin + if ScreenAct = 1 then P := Item-4; + if ScreenAct = 2 then P := Item-1; + + FillPlayer(Item, P); + +{ if ScreenAct = 1 then begin + LoadColor( + Static[StaticBoxLightest[Item]].Texture.ColR, + Static[StaticBoxLightest[Item]].Texture.ColG, + Static[StaticBoxLightest[Item]].Texture.ColB, + 'P1Dark'); + end; + + if ScreenAct = 2 then begin + LoadColor( + Static[StaticBoxLightest[Item]].Texture.ColR, + Static[StaticBoxLightest[Item]].Texture.ColG, + Static[StaticBoxLightest[Item]].Texture.ColB, + 'P4Dark'); + end;} + + end; + end; + + inherited Draw; +{ + player[1].ScoreI := 7000; + player[1].ScoreLineI := 2000; + player[1].ScoreGoldenI := 1000; + + player[2].ScoreI := 2500; + player[2].ScoreLineI := 1100; + player[2].ScoreGoldenI := 900; + } +// Let's arise the bars + ActualTime := GetTickCount div 33; + if ((ActualTime <> OldTime) and ShowFinish )then + begin + OldTime := ActualTime; + + For katze:= 0 to 5 do + begin + + // We actually araise them in the right order, but we have to draw them in reverse order (golden -> phrase -> mainscore) + Case BarScore_EaseOut_Step < EaseOut_MaxSteps * 10 of + true : BarScore_EaseOut_Step := BarScore_EaseOut_Step + 1; + end; + + // PhrasenBonus + if (BarScore_EaseOut_Step >= (EaseOut_MaxSteps * 10)) then + begin + Case BarPhrase_EaseOut_Step < EaseOut_MaxSteps * 10 of + true : BarPhrase_EaseOut_Step := BarPhrase_EaseOut_Step + 1; + end; + + // GoldenNotebonus + if (BarPhrase_EaseOut_Step >= (EaseOut_MaxSteps * 10)) then + begin + Case BarGolden_EaseOut_Step < EaseOut_MaxSteps * 10 of + true : BarGolden_EaseOut_Step := BarGolden_EaseOut_Step + 1; + end; + + //######################## + // Draw golden score bar # + //######################## + + BarGolden_ActualHeight[katze] := RaiseBar(katze, + Static[StaticBackLevel[katze+1]].Texture.y - BarScore_ActualHeight[katze] - BarPhrase_ActualHeight[katze], + BarGolden_ActualHeight[katze], + player[katze+1].ScoreGoldenI, + 'Lightest', + BarGolden_EaseOut_Step); + + // Increment and show total score and plain score + TextGolden_ActualValue[katze] := IncrementScore(katze, + TextGolden_ActualValue[katze], + Player[katze+1].ScoreGoldenI, + BarGolden_EaseOut_Step); + Text[TextGoldenNotesScore[katze+1]].Text := IntToStr(TextGolden_ActualValue[katze]); + + // Blend in + Text[TextGoldenNotesScore[katze+1]].Alpha := (BarGolden_EaseOut_Step / 100); + Text[TextGoldenNotes[katze+1]].Alpha := (BarGolden_EaseOut_Step / 100); + + end; + //######################## + // Draw phrase score bar # + //######################## + BarPhrase_ActualHeight[katze] := RaiseBar(katze, + Static[StaticBackLevel[katze+1]].Texture.y - BarScore_ActualHeight[katze], + BarPhrase_ActualHeight[katze], + Player[katze+1].ScoreLineI, + 'Light', + BarPhrase_EaseOut_Step); + + // Increment and show total score and plain score + TextPhrase_ActualValue[katze] := IncrementScore(katze, + TextPhrase_ActualValue[katze], + Player[katze+1].ScoreLineI, + BarPhrase_EaseOut_Step); + Text[TextLineBonusScore[katze+1]].Text := IntToStr(TextPhrase_ActualValue[katze]); + + //Blend in + Text[TextLineBonusScore[katze+1]].Alpha := (BarPhrase_EaseOut_Step / 100); + Text[TextLineBonus[katze+1]].Alpha := (BarPhrase_EaseOut_Step / 100); + + + end; + //####################### + // Draw plain score bar # + //####################### + BarScore_ActualHeight[katze] := RaiseBar(katze, + Static[StaticBackLevel[katze+1]].Texture.y, + BarScore_ActualHeight[katze], + Player[katze+1].ScoreI, + 'Dark', + BarScore_EaseOut_Step); + // Increment and show total score and plain score + TextScore_ActualValue[katze] := IncrementScore(katze, + TextScore_ActualValue[katze], + Player[katze+1].ScoreI, + BarScore_EaseOut_Step); + Text[TextNotesScore[katze+1]].Text := IntToStr(TextScore_ActualValue[katze]); + + Text[TextTotalScore[katze+1]].Text := IntToStr(TextScore_ActualValue[katze] + TextPhrase_ActualValue[katze] + TextGolden_ActualValue[katze]); + + //Blend em in + Text[TextTotalScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextTotal[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextNotesScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextNotes[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + + end; // me loop + end; +end; + + +function TscreenScore.RaiseBar(PlayerNumber: integer; BarStartPosY: Single; ActualHeight: real; Score: integer; ColorBrightness : String; EaseOut_Step: Real) : real; +const + RaiseSmoothness : integer = 100; +var + MaxHeight : real; + NewHeight : real; + Width : real; + + Height2Reach : real; + + RaiseStep : real; + + BarStartPosX : Single; + + R,G,B : real; +begin + + MaxHeight := Static[StaticBackLevel[PlayerNumber + 1]].Texture.H; + Width := Static[StaticBackLevel[PlayerNumber + 1]].Texture.W; + + BarStartPosX := Static[StaticBackLevel[PlayerNumber + 1]].Texture.X; + + BarStartPosY := BarStartPosY + MaxHeight; // The texture starts in the upper left corner, so let's subtract the height - so we can arise it + + // the height dependend of the score + Height2Reach := (Score / 10000) * MaxHeight; + + // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps + RaiseStep := EaseOut_Step; + + if (ActualHeight < Height2Reach) then + begin + // Check http://proto.layer51.com/d.aspx?f=400 for more info on easing functions + // Calculate the actual step according to the maxsteps + RaiseStep := RaiseStep / EaseOut_MaxSteps; + + // quadratic easing out - decelerating to zero velocity + // -end_position * current_time * ( current_time - 2 ) + start_postion + NewHeight := (-Height2Reach * RaiseStep * (RaiseStep - 20) + BarStartPosY) / RaiseSmoothness; + end + else + begin + NewHeight := Height2Reach; + end; + //+1 + LoadColor(R, G, B, 'P' + inttostr(PlayerNumber+1) + ColorBrightness); //dark, light, lightest + glColor4f(R, G, B, 1); + + //the actual bar + glBindTexture(GL_TEXTURE_2D, Static[StaticLevel[PlayerNumber + 1]].Texture.TexNum); + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(BarStartPosX, BarStartPosY - NewHeight); + glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, BarStartPosY - NewHeight); + glTexCoord2f(1, 1); glVertex2f(BarStartPosX + Width, BarStartPosY); + glTexCoord2f(0, 1); glVertex2f(BarStartPosX, BarStartPosY); + glEnd; + + //the round thing on top + glBindTexture(GL_TEXTURE_2D, Static[StaticLevelRound[PlayerNumber + 1]].Texture.TexNum); + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(BarStartPosX, (BarStartPosY - Static[StaticLevelRound[PlayerNumber + 1]].Texture.h) - NewHeight); + glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, (BarStartPosY - Static[StaticLevelRound[PlayerNumber + 1]].Texture.h) - NewHeight); + glTexCoord2f(1, 1); glVertex2f(BarStartPosX + Width, BarStartPosY - NewHeight); + glTexCoord2f(0, 1); glVertex2f(BarStartPosX, BarStartPosY - NewHeight); + glEnd; + + Result := NewHeight; +end; + +function TScreenScore.IncrementScore(PlayerNumber: integer; ActualScoreValue: Integer; ScoreReached: integer; EaseOut_Step: Real) : integer; +const + RaiseSmoothness : integer = 100; +var + RaiseStep : Real; + lTmpA : Real; +begin + // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps + RaiseStep := EaseOut_Step; + + if (ActualScoreValue < ScoreReached) then + begin + // Calculate the actual step according to the maxsteps + RaiseStep := RaiseStep / EaseOut_MaxSteps; + + // quadratic easing out - decelerating to zero velocity + // -end_position * current_time * ( current_time - 2 ) + start_postion + lTmpA := (-ScoreReached * RaiseStep * (RaiseStep - 20)); + if ( lTmpA > 0 ) AND + ( RaiseSmoothness > 0 ) THEN + begin + Result := floor( lTmpA / RaiseSmoothness); + end; + end + else + begin + Result := ScoreReached; + end; + +end; + +procedure TScreenScore.FillPlayer(Item, P: integer); +var + S: string; +begin + Text[TextName[Item]].Text := Ini.Name[P]; + + S := IntToStr((Round(Player[P].Score) div 10) * 10); + while (Length(S)<4) do S := '0' + S; + Text[TextNotesScore[Item]].Text := S; + +// while (Length(S)<5) do S := '0' + S; +// Text[TextTotalScore[Item]].Text := S; + +//fixed: line bonus and golden notes don't show up, +// another bug: total score was shown without added golden-, linebonus + S := IntToStr(Player[P].ScoreTotalI); + while (Length(S)<5) do S := '0' + S; + Text[TextTotalScore[Item]].Text := S; + + S := IntToStr(Player[P].ScoreLineI); + while (Length(S)<4) do S := '0' + S; + Text[TextLineBonusScore[Item]].Text := S; + + S := IntToStr(Player[P].ScoreGoldenI); + while (Length(S)<4) do S := '0' + S; + Text[TextGoldenNotesScore[Item]].Text := S; +//end of fix + + LoadColor( + Text[TextName[Item]].ColR, + Text[TextName[Item]].ColG, + Text[TextName[Item]].ColB, + 'P' + IntToStr(P+1) + 'Dark'); + + LoadColor( + Static[StaticBoxLightest[Item]].Texture.ColR, + Static[StaticBoxLightest[Item]].Texture.ColG, + Static[StaticBoxLightest[Item]].Texture.ColB, + 'P' + IntToStr(P+1) + 'Lightest'); + + LoadColor( + Static[StaticBoxLight[Item]].Texture.ColR, + Static[StaticBoxLight[Item]].Texture.ColG, + Static[StaticBoxLight[Item]].Texture.ColB, + 'P' + IntToStr(P+1) + 'Light'); + + LoadColor( + Static[StaticBoxDark[Item]].Texture.ColR, + Static[StaticBoxDark[Item]].Texture.ColG, + Static[StaticBoxDark[Item]].Texture.ColB, + 'P' + IntToStr(P+1) + 'Dark'); +end; + +end. diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas index 4971d12a..d0fe15c8 100644 --- a/Game/Code/Screens/UScreenTop5.pas +++ b/Game/Code/Screens/UScreenTop5.pas @@ -1,168 +1,168 @@ -unit UScreenTop5; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - -uses - UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes, ULCD; - -type - TScreenTop5 = class(TMenu) - public - TextLevel: integer; - TextArtistTitle: integer; - - StaticNumber: array[1..5] of integer; - TextNumber: array[1..5] of integer; - TextName: array[1..5] of integer; - TextScore: array[1..5] of integer; - - Fadeout: boolean; - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - procedure onShow; override; - function Draw: boolean; override; - end; - -implementation - -uses UGraphic, UDataBase, UMain, UIni; - -function TScreenTop5.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then begin - case PressedKey of - SDLK_Q: - begin - Result := false; - end; - - - SDLK_ESCAPE, - SDLK_BACKSPACE, - SDLK_RETURN: - begin - if (not Fadeout) then begin - FadeTo(@ScreenSong); - Fadeout := true; - end; - end; - SDLK_SYSREQ: - begin - Display.PrintScreen; - end; - end; - end; -end; - -constructor TScreenTop5.Create; -var - I: integer; -begin - inherited Create; - - LoadFromTheme(Theme.Top5); - - - TextLevel := AddText(Theme.Top5.TextLevel); - TextArtistTitle := AddText(Theme.Top5.TextArtistTitle); - - for I := 0 to 4 do - StaticNumber[I+1] := AddStatic(Theme.Top5.StaticNumber[I]); - - for I := 0 to 4 do - TextNumber[I+1] := AddText(Theme.Top5.TextNumber[I]); - for I := 0 to 4 do - TextName[I+1] := AddText(Theme.Top5.TextName[I]); - for I := 0 to 4 do - TextScore[I+1] := AddText(Theme.Top5.TextScore[I]); - -end; - -procedure TScreenTop5.onShow; -var - I: integer; - PMax: integer; -begin - Fadeout := false; - - //ReadScore(AktSong); - - PMax := Ini.Players; - if Ini.Players = 4 then Ini.Players := 5; - for I := 0 to PMax do - DataBase.AddScore(AktSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalI)); - - DataBase.WriteScore(AktSong); - DataBase.ReadScore(AktSong); - - Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; - - for I := 1 to Length(AktSong.Score[Ini.Difficulty]) do begin - Static[StaticNumber[I]].Visible := true; - Text[TextNumber[I]].Visible := true; - Text[TextName[I]].Visible := true; - Text[TextScore[I]].Visible := true; - - Text[TextName[I]].Text := AktSong.Score[Ini.Difficulty, I-1].Name; - Text[TextScore[I]].Text := IntToStr(AktSong.Score[Ini.Difficulty, I-1].Score); - end; - - for I := Length(AktSong.Score[Ini.Difficulty])+1 to 5 do begin - Static[StaticNumber[I]].Visible := false; - Text[TextNumber[I]].Visible := false; - Text[TextName[I]].Visible := false; - Text[TextScore[I]].Visible := false; - end; - - Text[TextLevel].Text := IDifficulty[Ini.Difficulty]; -end; - -function TScreenTop5.Draw: boolean; -//var -{ Min: real; - Max: real; - Wsp: real; - Wsp2: real; - Pet: integer;} - -{ Item: integer; - P: integer; - C: integer;} -begin - // Singstar - let it be...... with 6 statics -(* if PlayersPlay = 6 then begin - for Item := 4 to 6 do begin - if ScreenAct = 1 then P := Item-4; - if ScreenAct = 2 then P := Item-1; - - FillPlayer(Item, P); - -{ if ScreenAct = 1 then begin - LoadColor( - Static[StaticBoxLightest[Item]].Texture.ColR, - Static[StaticBoxLightest[Item]].Texture.ColG, - Static[StaticBoxLightest[Item]].Texture.ColB, - 'P1Dark'); - end; - - if ScreenAct = 2 then begin - LoadColor( - Static[StaticBoxLightest[Item]].Texture.ColR, - Static[StaticBoxLightest[Item]].Texture.ColG, - Static[StaticBoxLightest[Item]].Texture.ColB, - 'P4Dark'); - end; } - - end; - end; *) - - inherited Draw; -end; - -end. +unit UScreenTop5; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +uses + UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes, ULCD; + +type + TScreenTop5 = class(TMenu) + public + TextLevel: integer; + TextArtistTitle: integer; + + StaticNumber: array[1..5] of integer; + TextNumber: array[1..5] of integer; + TextName: array[1..5] of integer; + TextScore: array[1..5] of integer; + + Fadeout: boolean; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + function Draw: boolean; override; + end; + +implementation + +uses UGraphic, UDataBase, UMain, UIni; + +function TScreenTop5.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then begin + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + + SDLK_ESCAPE, + SDLK_BACKSPACE, + SDLK_RETURN: + begin + if (not Fadeout) then begin + FadeTo(@ScreenSong); + Fadeout := true; + end; + end; + SDLK_SYSREQ: + begin + Display.PrintScreen; + end; + end; + end; +end; + +constructor TScreenTop5.Create; +var + I: integer; +begin + inherited Create; + + LoadFromTheme(Theme.Top5); + + + TextLevel := AddText(Theme.Top5.TextLevel); + TextArtistTitle := AddText(Theme.Top5.TextArtistTitle); + + for I := 0 to 4 do + StaticNumber[I+1] := AddStatic( Theme.Top5.StaticNumber[I] ); + + for I := 0 to 4 do + TextNumber[I+1] := AddText(Theme.Top5.TextNumber[I]); + for I := 0 to 4 do + TextName[I+1] := AddText(Theme.Top5.TextName[I]); + for I := 0 to 4 do + TextScore[I+1] := AddText(Theme.Top5.TextScore[I]); + +end; + +procedure TScreenTop5.onShow; +var + I: integer; + PMax: integer; +begin + Fadeout := false; + + //ReadScore(AktSong); + + PMax := Ini.Players; + if Ini.Players = 4 then Ini.Players := 5; + for I := 0 to PMax do + DataBase.AddScore(AktSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalI)); + + DataBase.WriteScore(AktSong); + DataBase.ReadScore(AktSong); + + Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; + + for I := 1 to Length(AktSong.Score[Ini.Difficulty]) do begin + Static[StaticNumber[I]].Visible := true; + Text[TextNumber[I]].Visible := true; + Text[TextName[I]].Visible := true; + Text[TextScore[I]].Visible := true; + + Text[TextName[I]].Text := AktSong.Score[Ini.Difficulty, I-1].Name; + Text[TextScore[I]].Text := IntToStr(AktSong.Score[Ini.Difficulty, I-1].Score); + end; + + for I := Length(AktSong.Score[Ini.Difficulty])+1 to 5 do begin + Static[StaticNumber[I]].Visible := false; + Text[TextNumber[I]].Visible := false; + Text[TextName[I]].Visible := false; + Text[TextScore[I]].Visible := false; + end; + + Text[TextLevel].Text := IDifficulty[Ini.Difficulty]; +end; + +function TScreenTop5.Draw: boolean; +//var +{ Min: real; + Max: real; + Wsp: real; + Wsp2: real; + Pet: integer;} + +{ Item: integer; + P: integer; + C: integer;} +begin + // Singstar - let it be...... with 6 statics +(* if PlayersPlay = 6 then begin + for Item := 4 to 6 do begin + if ScreenAct = 1 then P := Item-4; + if ScreenAct = 2 then P := Item-1; + + FillPlayer(Item, P); + +{ if ScreenAct = 1 then begin + LoadColor( + Static[StaticBoxLightest[Item]].Texture.ColR, + Static[StaticBoxLightest[Item]].Texture.ColG, + Static[StaticBoxLightest[Item]].Texture.ColB, + 'P1Dark'); + end; + + if ScreenAct = 2 then begin + LoadColor( + Static[StaticBoxLightest[Item]].Texture.ColR, + Static[StaticBoxLightest[Item]].Texture.ColG, + Static[StaticBoxLightest[Item]].Texture.ColB, + 'P4Dark'); + end; } + + end; + end; *) + + inherited Draw; +end; + +end. -- cgit v1.2.3 From 979d59410f1625a4943a8a84e0f204465800453f Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 8 Oct 2007 00:19:58 +0000 Subject: fixed some stuff for linux build... now its getting close to the look of the windows build... YAY ! see http://www.flickr.com/photos/31428768@N00/sets/72157602234125005/ git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@468 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 2659 ++++++++++++++++++---------------- 1 file changed, 1402 insertions(+), 1257 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 9c571b2b..2bd0156a 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -1,1257 +1,1402 @@ -unit UScreenCredits; - -interface - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - -{$I switches.inc} - - -uses - UMenu, - SDL, - SDL_Image, - UDisplay, - UTexture, - OpenGL12, - UMusic, - UFiles, - SysUtils, - UThemes, - ULCD, - ULight, - UGraphicClasses; - -type - TCreditsStages=(InitialDelay,Intro,MainPart,Outro); - - TScreenCredits = class(TMenu) - public - - Credits_X: Real; - Credits_Time: Cardinal; - Credits_Alpha: Cardinal; - CTime: Cardinal; - CTime_hold: Cardinal; - ESC_Alpha: Integer; - - credits_entry_tex: TTexture; - credits_entry_dx_tex: TTexture; - credits_bg_tex: TTexture; - credits_bg_ovl: TTexture; -// credits_bg_logo: TTexture; - credits_bg_scrollbox_left: TTexture; - credits_blindguard: TTexture; - credits_blindy: TTexture; - credits_canni: TTexture; - credits_commandio: TTexture; - credits_lazyjoker: TTexture; - credits_mog: TTexture; - credits_mota: TTexture; - credits_skillmaster: TTexture; - credits_whiteshark: TTexture; - intro_layer01: TTexture; - intro_layer02: TTexture; - intro_layer03: TTexture; - intro_layer04: TTexture; - intro_layer05: TTexture; - intro_layer06: TTexture; - intro_layer07: TTexture; - intro_layer08: TTexture; - intro_layer09: TTexture; - outro_bg: TTexture; - outro_esc: TTexture; - outro_exd: TTexture; - - deluxe_slidein: cardinal; - - CurrentScrollText: String; - NextScrollUpdate: Real; - EndofLastScrollingPart: Cardinal; - CurrentScrollStart, CurrentScrollEnd: Integer; - - CRDTS_Stage: TCreditsStages; - - myTex: glUint; - mysdlimage,myconvertedsdlimage: PSDL_Surface; - - Fadeout: boolean; - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure onShow; override; - procedure onHide; override; - procedure DrawCredits; - procedure Draw_FunkyText; - end; - -const - Funky_Text: AnsiString = - 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+ - 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+ - 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+ - 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..'; - - - Timings: array[0..21] of Cardinal=( - 20, // 0 Delay vor Start - - 149, // 1 Ende erster Intro Zoom - 155, // 2 Start 2. Action im Intro - 170, // 3 Ende Separation im Intro - 271, // 4 Anfang Zoomout im Intro - 0, // 5 unused - 261, // 6 Start fade-to-white im Intro - - 271, // 7 Start Main Part - 280, // 8 Start On-Beat-Sternchen Main Part - - 396, // 9 Start BlindGuard - 666, // 10 Start blindy - 936, // 11 Start Canni - 1206, // 12 Start Commandio - 1476, // 13 Start LazyJoker - 1746, // 14 Start Mog - 2016, // 15 Start Mota - 2286, // 16 Start SkillMaster - 2556, // 17 Start WhiteShark - 2826, // 18 Ende Whiteshark - 3096, // 19 Start FadeOut Mainscreen - 3366, // 20 Ende Credits Tune - 60); // 21 start flare im intro - - - sdl32bpprgba: TSDL_Pixelformat=(palette: nil; - BitsPerPixel: 32; - BytesPerPixel: 4; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 24; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $ff000000; - colorkey: 0; - alpha: 255 ); - - -implementation - -uses {$IFDEF win32} - windows, - {$ELSE} - lclintf, - {$ENDIF} - UGraphic, - UMain, - UIni, - USongs, - Textgl, - ULanguage, - UCommon, - Math, - dialogs; - - -function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then - begin // Key Down - case PressedKey of - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - FadeTo(@ScreenMain); - Music.PlayBack; - end; -{ SDLK_SPACE: - begin - setlength(CTime_hold,length(CTime_hold)+1); - CTime_hold[high(CTime_hold)]:=CTime; - end; -} - end;//esac - end; //fi -end; - -constructor TScreenCredits.Create; -begin - inherited Create; - - credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0); - credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0); - - credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', 'PNG', 'Font Black', 0); - credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0); - credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0); - credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', 'PNG', 'Font Black', 0); - credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', 'PNG', 'Font Black', 0); - credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', 'Font Black', 0); - credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', 'PNG', 'Font Black', 0); - credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', 'PNG', 'Font Black', 0); - credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', 'PNG', 'Font Black', 0); - - intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', 'PNG', 'Transparent', 0); - intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', 'PNG', 'Transparent', 0); - intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', 'PNG', 'Transparent', 0); - intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', 'PNG', 'Transparent', 0); - intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', 'PNG', 'Transparent', 0); - intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', 'PNG', 'Transparent', 0); - intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', 'PNG', 'Transparent', 0); - intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', 'PNG', 'Transparent', 0); - intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', 'PNG', 'Transparent', 0); - - outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0); - outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0); - outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Transparent', 0); - - CRDTS_Stage:=InitialDelay; -end; - -function TScreenCredits.Draw: boolean; -begin - DrawCredits; - Draw:=true; -end; - -function pixfmt_eq(fmt1,fmt2: TSDL_Pixelformat): boolean; -begin - if (fmt1.BitsPerPixel = fmt2.BitsPerPixel) and - (fmt1.BytesPerPixel = fmt2.BytesPerPixel) and - (fmt1.Rloss = fmt2.Rloss) and - (fmt1.Gloss = fmt2.Gloss) and - (fmt1.Bloss = fmt2.Bloss) and - (fmt1.Rmask = fmt2.Rmask) and - (fmt1.Gmask = fmt2.Gmask) and - (fmt1.Bmask = fmt2.Bmask) and - (fmt1.Rshift = fmt2.Rshift) and - (fmt1.Gshift = fmt2.Gshift) and - (fmt1.Bshift = fmt2.Bshift) - then - pixfmt_eq:=True - else - pixfmt_eq:=False; -end; - -function inttohexstr(i: cardinal):pchar; -var helper, i2, c:cardinal; - tmpstr: string; -begin - helper:=0; - i2:=i; - tmpstr:=''; - for c:=1 to 8 do - begin - helper:=(helper shl 4) or (i2 and $f); - i2:=i2 shr 4; - end; - for c:=1 to 8 do - begin - i2:=helper and $f; - helper := helper shr 4; - case i2 of - 0: tmpstr:=tmpstr+'0'; - 1: tmpstr:=tmpstr+'1'; - 2: tmpstr:=tmpstr+'2'; - 3: tmpstr:=tmpstr+'3'; - 4: tmpstr:=tmpstr+'4'; - 5: tmpstr:=tmpstr+'5'; - 6: tmpstr:=tmpstr+'6'; - 7: tmpstr:=tmpstr+'7'; - 8: tmpstr:=tmpstr+'8'; - 9: tmpstr:=tmpstr+'9'; - 10: tmpstr:=tmpstr+'a'; - 11: tmpstr:=tmpstr+'b'; - 12: tmpstr:=tmpstr+'c'; - 13: tmpstr:=tmpstr+'d'; - 14: tmpstr:=tmpstr+'e'; - 15: tmpstr:=tmpstr+'f'; - end; - end; - inttohexstr:=pchar(tmpstr); -end; - -procedure TScreenCredits.onShow; -begin - CRDTS_Stage:=InitialDelay; - Credits_X := 580; - deluxe_slidein := 0; - Credits_Alpha := 0; - //Music.SetLoop(true); Loop looped ned, so ne scheisse - Music.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! -// Music.Play; - CTime:=0; -// setlength(CTime_hold,0); - - mysdlimage:=IMG_Load('test.png'); - if assigned(mysdlimage) then - begin - {$IFNDEF FPC} - showmessage('opened image via SDL_Image'+#13#10+ - 'Width: '+inttostr(mysdlimage^.w)+#13#10+ - 'Height: '+inttostr(mysdlimage^.h)+#13#10+ - 'BitsPP: '+inttostr(mysdlimage^.format.BitsPerPixel)+#13#10+ - 'BytesPP: '+inttostr(mysdlimage^.format.BytesPerPixel)+#13#10+ - 'Rloss: '+inttostr(mysdlimage^.format.Rloss)+#13#10+ - 'Gloss: '+inttostr(mysdlimage^.format.Gloss)+#13#10+ - 'Bloss: '+inttostr(mysdlimage^.format.Bloss)+#13#10+ - 'Aloss: '+inttostr(mysdlimage^.format.Aloss)+#13#10+ - 'Rshift: '+inttostr(mysdlimage^.format.Rshift)+#13#10+ - 'Gshift: '+inttostr(mysdlimage^.format.Gshift)+#13#10+ - 'Bshift: '+inttostr(mysdlimage^.format.Bshift)+#13#10+ - 'Ashift: '+inttostr(mysdlimage^.format.Ashift)+#13#10+ - 'Rmask: '+inttohexstr(mysdlimage^.format.Rmask)+#13#10+ - 'Gmask: '+inttohexstr(mysdlimage^.format.Gmask)+#13#10+ - 'Bmask: '+inttohexstr(mysdlimage^.format.Bmask)+#13#10+ - 'Amask: '+inttohexstr(mysdlimage^.format.Amask)+#13#10+ - 'ColKey: '+inttostr(mysdlimage^.format.Colorkey)+#13#10+ - 'Alpha: '+inttostr(mysdlimage^.format.Alpha)); - - if pixfmt_eq(mysdlimage^.format^,sdl32bpprgba) then - showmessage('equal pixelformats') - else - showmessage('different pixelformats'); - {$ENDIF} - - myconvertedsdlimage:=SDL_ConvertSurface(mysdlimage,@sdl32bpprgba,SDL_SWSURFACE); - glGenTextures(1,@myTex); - glBindTexture(GL_TEXTURE_2D, myTex); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - glTexImage2D( GL_TEXTURE_2D, 0, 4, myconvertedsdlimage^.w, myconvertedsdlimage^.h, 0, - GL_RGBA, GL_UNSIGNED_BYTE, myconvertedsdlimage^.pixels ); - SDL_FreeSurface(mysdlimage); - SDL_FreeSurface(myconvertedsdlimage); - end - else - {$IFDEF FPC} - writeln( 'could not open file - test.png'); - {$ELSE} - showmessage('could not open file - test.png'); - {$ENDIF} - -end; - -procedure TScreenCredits.onHide; -begin - Music.Stop; -end; - -Procedure TScreenCredits.Draw_FunkyText; -var - S: Integer; - X,Y,A: Real; - visibleText: PChar; -begin - SetFontSize(10); - //Init ScrollingText - if (CTime = Timings[7]) then - begin - //Set Position of Text - Credits_X := 600; - CurrentScrollStart:=1; - CurrentScrollEnd:=1; - end; - - if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then - begin - X:=0; - visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); - for S := 0 to length(visibleText)-1 do begin - Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); - SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); - A:=0; - if (Credits_X+X < 15) then A:=0; - if (Credits_X+X >=15) then A:=Credits_X+X-15; - if Credits_X+X > 32 then A:=17; - glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17); - glPrintLetter(visibleText[S]); - X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; - end; - if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin - Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; - inc(CurrentScrollStart); - end; - visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); - if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin - inc(CurrentScrollEnd); - end; - end; -{ // timing hack - X:=5; - SetFontStyle (2); - SetFontItalic(False); - SetFontSize(9); - glColor4f(1, 1, 1, 1); - for S:=0 to high(CTime_hold) do begin - visibleText:=pchar(inttostr(CTime_hold[S])); - SetFontPos (500, X); - glPrint (Addr(visibleText[0])); - X:=X+20; - end;} -end; - -procedure Start3D; -begin - glMatrixMode(GL_PROJECTION); - glPushMatrix; - glLoadIdentity; - glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity; -end; -procedure End3D; -begin - glMatrixMode(GL_PROJECTION); - glPopMatrix; - glMatrixMode(GL_MODELVIEW); -end; - -procedure TScreenCredits.DrawCredits; -var - T,I: Cardinal; - X: Real; - Ver: PChar; - RuntimeStr: AnsiString; - Data: TFFTData; - j,k,l:cardinal; - f,g,h: Real; - STime:cardinal; - Delay:cardinal; - - myPixel: longword; - myColor: Cardinal; - myScale: Real; - myAngle: Real; - - -const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24), - (154,31),(156,58),(168,32),(203,36), - (258,34),(251,50),(274,93),(294,84), - (232,54),(278,62),(319,34),(336,92), - (347,23),(374,32),(377,58),(361,83), - (385,91),(405,91),(429,35),(423,51), - (450,32),(485,34),(444,91),(486,93)); - -begin - //dis does teh muiwk y0r - Data := Music.GetFFTData; - - T := GetTickCount div 33; - if T <> Credits_Time then - begin - Credits_Time := T; - inc(CTime); - inc(CTime_hold); - Credits_X := Credits_X-2; - if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then - begin -// CTime:=Timings[20]; -// CRDTS_Stage:=Outro; - - CRDTS_Stage:=Intro; - CTime:=0; - Music.Play; - - end; - if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then - begin - CRDTS_Stage:=MainPart; - end; - if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then - begin - CRDTS_Stage:=Outro; - end; - end; - - //draw background - if CRDTS_Stage=InitialDelay then - begin - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - end - else - if CRDTS_Stage=Intro then - begin - Start3D; - glPushMatrix; - - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - if CTime < Timings[1] then begin - myScale:= 0.5+0.5*(Timings[1]-CTime)/(Timings[1]); // slowly move layers together - myAngle:=cos((CTime)*pi/((Timings[1])*2)); // and make logo face towards camera - end else begin // this is the part when the logo stands still - myScale:=0.5; - myAngle:=0; - end; - if CTime > Timings[2] then begin - myScale:= 0.5+0.5*(CTime-Timings[2])/(Timings[3]-Timings[2]); // get some space between layers - myAngle:=0; - end; -// if CTime > Timings[3] then myScale:=1; // keep the space between layers - glTranslatef(0,0,-5+0.5*myScale); - if CTime > Timings[3] then myScale:=1; // keep the space between layers - if CTime > Timings[3] then begin // make logo rotate left and grow -// myScale:=(CTime-Timings[4])/(Timings[7]-Timings[4]); - glRotatef(20*sqr(CTime-Timings[3])/sqr((Timings[7]-Timings[3])/2),0,0,1); - glScalef(1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1); - end; - if CTime < Timings[2] then - glRotatef(30*myAngle,0.5*myScale+myScale,1+myScale,0); -// glScalef(0.5,0.5,0.5); - glScalef(4/3,-1,1); - glColor4f(1, 1, 1, 1); - - glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.4 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.4 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.4 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.4 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.3 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.3 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.3 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.3 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.2 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.2 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.2 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.2 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.1 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.1 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.1 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.1 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.1 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.1 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.1 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.1 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.2 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.2 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.2 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.2 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.3 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.3 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.3 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.3 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.22 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.22 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.22 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.22 * myScale); - glEnd; - gldisable(gl_texture_2d); - glDisable(GL_BLEND); - - glPopMatrix; - End3D; - - // do some sparkling effects - if (CTime < Timings[1]) and (CTime > Timings[21]) then - begin - for k:=1 to 3 do begin - l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5); - j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301); - GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0); - end; - end; - - // fade to white at end - if Ctime > Timings[6] then - begin - glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6])); - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glVertex2f(0,0); - glVertex2f(0,600); - glVertex2f(800,600); - glVertex2f(800,0); - glEnd; - glDisable(GL_BLEND); - end; - - end; - if (CRDTS_Stage=MainPart) then - // main credits screen background, scroller, logo and girl - begin - - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,600/1024);glVertex2f(0, 600); - glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); - glTexCoord2f(800/1024,0);glVertex2f(800, 0); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - // draw scroller - Draw_FunkyText; - -//######################################################################### -// draw credits names - -// BlindGuard (von links oben reindrehen, nach rechts unten rausdrehen) - STime:=Timings[9]-10; - Delay:=Timings[10]-Timings[9]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(0,329,0); - if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end; - gltranslatef(223,0,0); - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - gltranslatef(223,0,0); - glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1); - gltranslatef(-223,0,0); - end; - glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Blindy (zoom von 0 auf volle grösse und drehung, zoom auf doppelte grösse und nach rechts oben schieben) - STime:=Timings[10]-10; - Delay:=Timings[11]-Timings[10]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+20) and (CTime<=STime+22) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+20 then begin - j:=CTime-Stime; - glscalef(j*j/400,j*j/400,j*j/400); - glrotatef(j*18.0,0,0,1); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - f:=j*10.0; - gltranslatef(f*3,-f,0); - glscalef(1+j/10,1+j/10,1+j/10); - glrotatef(j*9.0,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Canni (von links reinschieben, nach rechts oben rausschieben) - STime:=Timings[11]-10; - Delay:=Timings[12]-Timings[11]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - gltranslatef(((CTime-STime)*21.0)-210,0,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=(CTime-(STime+Delay-10))*21; - gltranslatef(j,-j/2,0); - end; - glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Commandio (von unten reinklappen, nach rechts oben rausklappen) - STime:=Timings[12]-10; - Delay:=Timings[13]-Timings[12]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=258.0-25.8*(CTime-STime) - else - f:=0; - g:=0; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end; - glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163+g-f*1.5, -129+f*1.5-g/2); - glTexCoord2f(0,1);glVertex2f(-163+g*1.5, 129-(g*1.5*258/326)); - glTexCoord2f(1,1); glVertex2f(163+g, 129+g/4); - glTexCoord2f(1,0);glVertex2f(163+f*1.5+g/4, -129+f*1.5-g/4); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing) - STime:=Timings[13]-35; - Delay:=Timings[14]-Timings[13]+5; - if CTime > STime then - begin - k:=0; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20; - ESC_Alpha:=10; - f:=CTime-STime; - if CTime <=STime+40 then j:=CTime-STime else j:=40; - if (CTime >=STime+Delay-40) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j*j/1600); - - glPushMatrix; - gltranslatef(180+(f-70),329,0); - glBindTexture(GL_TEXTURE_2D, credits_lazyjoker.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Mog (von links reinklappen, nach rechts unten rausklappen) - STime:=Timings[14]-10; - Delay:=Timings[15]-Timings[14]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=326.0-32.6*(CTime-STime) - else - f:=0; - - g:=0; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end; - glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163+g*1.5, -129+g*1.5); - glTexCoord2f(0,1);glVertex2f(-163+g*1.2, 129+g); - glTexCoord2f(1,1); glVertex2f(163-f+g/2, 129+f*1.5+g/4); - glTexCoord2f(1,0);glVertex2f(163-f+g*1.5, -129-f*1.5); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Mota (von rechts oben reindrehen, nach links unten rausschieben und verkleinern und dabei drehen) - STime:=Timings[15]-10; - Delay:=Timings[16]-Timings[15]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - gltranslatef(223,0,0); - glrotatef((10-(CTime-STime))*9,0,0,1); - gltranslatef(-223,0,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - f:=j*10.0; - gltranslatef(-f*2,-f,0); - glscalef(1-j/10,1-j/10,1-j/10); - glrotatef(-j*9.0,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Skillmaster (von rechts unten reinschieben, nach rechts oben rausdrehen) - STime:=Timings[16]-10; - Delay:=Timings[17]-Timings[16]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - j:=STime+10-CTime; - f:=j*10.0; - gltranslatef(+f*2,+f/2,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - gltranslatef(0,-223,0); - glrotatef(integer(j)*-9,0,0,1); - gltranslatef(0,223,0); - glrotatef(j*9,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// WhiteShark (von links unten reinklappen, nach rechts oben rausklappen) - STime:=Timings[17]-10; - Delay:=Timings[18]-Timings[17]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=326.0-32.6*(CTime-STime) - else - f:=0; - - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end else - g:=0; - glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2); - glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4); - glTexCoord2f(1,1); glVertex2f(163-f*1.2+g/4, 129+f/2-g/4); - glTexCoord2f(1,0);glVertex2f(163-f*1.5+g/4, -129+f*1.5+g/4); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - - -// #################################################################### -// do some twinkle stuff (kinda on beat) - if (CTime>Timings[8]) and (CTime < Timings[19]) then begin - k:=0; - for j:=0 to 40 do - if Data[j]>=Data[k] then k:=j; - if Data[k]>0.2 then begin - l:=RandomRange(6,16); - j:=RandomRange(0,27); - GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); - end; - end; - -//################################################# -// draw the rest of the main screen (girl and logo - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(800-393, 0); - glTexCoord2f(0,600/1024);glVertex2f(800-393, 600); - glTexCoord2f(393/512,600/1024); glVertex2f(800, 600); - glTexCoord2f(393/512,0);glVertex2f(800, 0); - glEnd; -{ glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,112/128);glVertex2f(0, 112); - glTexCoord2f(497/512,112/128); glVertex2f(497, 112); - glTexCoord2f(497/512,0);glVertex2f(497, 0); - glEnd; -} - gldisable(gl_texture_2d); - glDisable(GL_BLEND); - - // fade out at end of main part - if Ctime > Timings[19] then - begin - glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19])); - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glVertex2f(0,0); - glVertex2f(0,600); - glVertex2f(800,600); - glVertex2f(800,0); - glEnd; - glDisable(GL_BLEND); - end; - end - else - if (CRDTS_Stage=Outro) then - begin - if CTime=Timings[20] then begin - CTime_hold:=0; - Music.Stop; - Music.Open(soundpath + 'credits-outro-tune.mp3'); - Music.Play; - Music.SetVolume(20); - Music.SetLoop(True); - end; - if CTime_hold > 231 then begin - Music.Play; - Ctime_hold:=0; - end; - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - - // do something useful - // outro background - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,600/1024);glVertex2f(0, 600); - glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); - glTexCoord2f(800/1024,0);glVertex2f(800, 0); - glEnd; - - //outro overlays - glColor4f(1, 1, 1, (1+sin(CTime/15))/3+1/3); - glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,223/256);glVertex2f(0, 223); - glTexCoord2f(487/512,223/256); glVertex2f(487, 223); - glTexCoord2f(487/512,0);glVertex2f(487, 0); - glEnd; - - ESC_Alpha:=20; - if (RandomRange(0,20) > 18) and (ESC_Alpha=20) then - ESC_Alpha:=0 - else inc(ESC_Alpha); - if ESC_Alpha > 20 then ESC_Alpha:=20; - glColor4f(1, 1, 1, ESC_Alpha/20); - glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(800-310, 600-247); - glTexCoord2f(0,247/256);glVertex2f(800-310, 600); - glTexCoord2f(310/512,247/256); glVertex2f(800, 600); - glTexCoord2f(310/512,0);glVertex2f(800, 600-247); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - // outro scrollers? - // ... - end; - -{ // draw credits runtime counter - SetFontStyle (2); - SetFontItalic(False); - SetFontSize(9); - SetFontPos (5, 5); - glColor4f(1, 1, 1, 1); -// RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10); - RuntimeStr:='CTime: '+inttostr(CTime); - glPrint (Addr(RuntimeStr[1])); -} - - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, myTex); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(100, 100); - glTexCoord2f(0,1);glVertex2f(100, 200); - glTexCoord2f(1,1); glVertex2f(200, 200); - glTexCoord2f(1,0);glVertex2f(200, 100); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - - // make the stars shine - GoldenRec.Draw; -end; - -end. +unit UScreenCredits; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +{$I switches.inc} + + +uses + UMenu, + SDL, + SDL_Image, + UDisplay, + UTexture, + OpenGL12, + UMusic, + UFiles, + SysUtils, + UThemes, + ULCD, + ULight, + UGraphicClasses; + +type + TCreditsStages=(InitialDelay,Intro,MainPart,Outro); + + TScreenCredits = class(TMenu) + public + + Credits_X: Real; + Credits_Time: Cardinal; + Credits_Alpha: Cardinal; + CTime: Cardinal; + CTime_hold: Cardinal; + ESC_Alpha: Integer; + + credits_entry_tex: TTexture; + credits_entry_dx_tex: TTexture; + credits_bg_tex: TTexture; + credits_bg_ovl: TTexture; +// credits_bg_logo: TTexture; + credits_bg_scrollbox_left: TTexture; + credits_blindguard: TTexture; + credits_blindy: TTexture; + credits_canni: TTexture; + credits_commandio: TTexture; + credits_lazyjoker: TTexture; + credits_mog: TTexture; + credits_mota: TTexture; + credits_skillmaster: TTexture; + credits_whiteshark: TTexture; + intro_layer01: TTexture; + intro_layer02: TTexture; + intro_layer03: TTexture; + intro_layer04: TTexture; + intro_layer05: TTexture; + intro_layer06: TTexture; + intro_layer07: TTexture; + intro_layer08: TTexture; + intro_layer09: TTexture; + outro_bg: TTexture; + outro_esc: TTexture; + outro_exd: TTexture; + + deluxe_slidein: cardinal; + + CurrentScrollText: String; + NextScrollUpdate: Real; + EndofLastScrollingPart: Cardinal; + CurrentScrollStart, CurrentScrollEnd: Integer; + + CRDTS_Stage: TCreditsStages; + + myTex: glUint; + mysdlimage,myconvertedsdlimage: PSDL_Surface; + + Fadeout: boolean; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure DrawCredits; + procedure Draw_FunkyText; + end; + +const + Funky_Text: AnsiString = + 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+ + 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+ + 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+ + 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..'; + + + Timings: array[0..21] of Cardinal=( + 20, // 0 Delay vor Start + + 149, // 1 Ende erster Intro Zoom + 155, // 2 Start 2. Action im Intro + 170, // 3 Ende Separation im Intro + 271, // 4 Anfang Zoomout im Intro + 0, // 5 unused + 261, // 6 Start fade-to-white im Intro + + 271, // 7 Start Main Part + 280, // 8 Start On-Beat-Sternchen Main Part + + 396, // 9 Start BlindGuard + 666, // 10 Start blindy + 936, // 11 Start Canni + 1206, // 12 Start Commandio + 1476, // 13 Start LazyJoker + 1746, // 14 Start Mog + 2016, // 15 Start Mota + 2286, // 16 Start SkillMaster + 2556, // 17 Start WhiteShark + 2826, // 18 Ende Whiteshark + 3096, // 19 Start FadeOut Mainscreen + 3366, // 20 Ende Credits Tune + 60); // 21 start flare im intro + + + sdl32bpprgba: TSDL_Pixelformat=(palette: nil; + BitsPerPixel: 32; + BytesPerPixel: 4; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 24; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $ff000000; + colorkey: 0; + alpha: 255 ); + + +implementation + +uses {$IFDEF win32} + windows, + {$ELSE} + lclintf, + {$ENDIF} + ULog, + UGraphic, + UMain, + UIni, + USongs, + Textgl, + ULanguage, + UCommon, + Math, + dialogs; + + +function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + FadeTo(@ScreenMain); + Music.PlayBack; + end; +{ SDLK_SPACE: + begin + setlength(CTime_hold,length(CTime_hold)+1); + CTime_hold[high(CTime_hold)]:=CTime; + end; +} + end;//esac + end; //fi +end; + +constructor TScreenCredits.Create; +begin + inherited Create; + + credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0); + credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0); + + credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', 'PNG', 'Font Black', 0); + credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0); + credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0); + credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', 'PNG', 'Font Black', 0); + credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', 'PNG', 'Font Black', 0); + credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', 'Font Black', 0); + credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', 'PNG', 'Font Black', 0); + credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', 'PNG', 'Font Black', 0); + credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', 'PNG', 'Font Black', 0); + + intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', 'PNG', 'Transparent', 0); + intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', 'PNG', 'Transparent', 0); + intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', 'PNG', 'Transparent', 0); + intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', 'PNG', 'Transparent', 0); + intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', 'PNG', 'Transparent', 0); + intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', 'PNG', 'Transparent', 0); + intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', 'PNG', 'Transparent', 0); + intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', 'PNG', 'Transparent', 0); + intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', 'PNG', 'Transparent', 0); + + outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0); + outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0); + outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Transparent', 0); + + CRDTS_Stage:=InitialDelay; +end; + +function TScreenCredits.Draw: boolean; +begin + DrawCredits; + Draw:=true; +end; + +function pixfmt_eq(fmt1,fmt2: TSDL_Pixelformat): boolean; +begin + if (fmt1.BitsPerPixel = fmt2.BitsPerPixel) and + (fmt1.BytesPerPixel = fmt2.BytesPerPixel) and + (fmt1.Rloss = fmt2.Rloss) and + (fmt1.Gloss = fmt2.Gloss) and + (fmt1.Bloss = fmt2.Bloss) and + (fmt1.Rmask = fmt2.Rmask) and + (fmt1.Gmask = fmt2.Gmask) and + (fmt1.Bmask = fmt2.Bmask) and + (fmt1.Rshift = fmt2.Rshift) and + (fmt1.Gshift = fmt2.Gshift) and + (fmt1.Bshift = fmt2.Bshift) + then + pixfmt_eq:=True + else + pixfmt_eq:=False; +end; + +function inttohexstr(i: cardinal):pchar; +var helper, i2, c:cardinal; + tmpstr: string; +begin + helper:=0; + i2:=i; + tmpstr:=''; + for c:=1 to 8 do + begin + helper:=(helper shl 4) or (i2 and $f); + i2:=i2 shr 4; + end; + for c:=1 to 8 do + begin + i2:=helper and $f; + helper := helper shr 4; + case i2 of + 0: tmpstr:=tmpstr+'0'; + 1: tmpstr:=tmpstr+'1'; + 2: tmpstr:=tmpstr+'2'; + 3: tmpstr:=tmpstr+'3'; + 4: tmpstr:=tmpstr+'4'; + 5: tmpstr:=tmpstr+'5'; + 6: tmpstr:=tmpstr+'6'; + 7: tmpstr:=tmpstr+'7'; + 8: tmpstr:=tmpstr+'8'; + 9: tmpstr:=tmpstr+'9'; + 10: tmpstr:=tmpstr+'a'; + 11: tmpstr:=tmpstr+'b'; + 12: tmpstr:=tmpstr+'c'; + 13: tmpstr:=tmpstr+'d'; + 14: tmpstr:=tmpstr+'e'; + 15: tmpstr:=tmpstr+'f'; + end; + end; + inttohexstr:=pchar(tmpstr); +end; + +procedure TScreenCredits.onShow; +begin + CRDTS_Stage:=InitialDelay; + Credits_X := 580; + deluxe_slidein := 0; + Credits_Alpha := 0; + //Music.SetLoop(true); Loop looped ned, so ne scheisse + Music.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! +// Music.Play; + CTime:=0; +// setlength(CTime_hold,0); + + mysdlimage:=IMG_Load('test.png'); + if assigned(mysdlimage) then + begin + {$IFNDEF FPC} + showmessage('opened image via SDL_Image'+#13#10+ + 'Width: '+inttostr(mysdlimage^.w)+#13#10+ + 'Height: '+inttostr(mysdlimage^.h)+#13#10+ + 'BitsPP: '+inttostr(mysdlimage^.format.BitsPerPixel)+#13#10+ + 'BytesPP: '+inttostr(mysdlimage^.format.BytesPerPixel)+#13#10+ + 'Rloss: '+inttostr(mysdlimage^.format.Rloss)+#13#10+ + 'Gloss: '+inttostr(mysdlimage^.format.Gloss)+#13#10+ + 'Bloss: '+inttostr(mysdlimage^.format.Bloss)+#13#10+ + 'Aloss: '+inttostr(mysdlimage^.format.Aloss)+#13#10+ + 'Rshift: '+inttostr(mysdlimage^.format.Rshift)+#13#10+ + 'Gshift: '+inttostr(mysdlimage^.format.Gshift)+#13#10+ + 'Bshift: '+inttostr(mysdlimage^.format.Bshift)+#13#10+ + 'Ashift: '+inttostr(mysdlimage^.format.Ashift)+#13#10+ + 'Rmask: '+inttohexstr(mysdlimage^.format.Rmask)+#13#10+ + 'Gmask: '+inttohexstr(mysdlimage^.format.Gmask)+#13#10+ + 'Bmask: '+inttohexstr(mysdlimage^.format.Bmask)+#13#10+ + 'Amask: '+inttohexstr(mysdlimage^.format.Amask)+#13#10+ + 'ColKey: '+inttostr(mysdlimage^.format.Colorkey)+#13#10+ + 'Alpha: '+inttostr(mysdlimage^.format.Alpha)); + + if pixfmt_eq(mysdlimage^.format^,sdl32bpprgba) then + showmessage('equal pixelformats') + else + showmessage('different pixelformats'); + {$ENDIF} + + myconvertedsdlimage:=SDL_ConvertSurface(mysdlimage,@sdl32bpprgba,SDL_SWSURFACE); + glGenTextures(1,@myTex); + glBindTexture(GL_TEXTURE_2D, myTex); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + glTexImage2D( GL_TEXTURE_2D, 0, 4, myconvertedsdlimage^.w, myconvertedsdlimage^.h, 0, + GL_RGBA, GL_UNSIGNED_BYTE, myconvertedsdlimage^.pixels ); + SDL_FreeSurface(mysdlimage); + SDL_FreeSurface(myconvertedsdlimage); + end + else + {$IFDEF FPC} + writeln( 'could not open file - test.png'); + {$ELSE} + showmessage('could not open file - test.png'); + {$ENDIF} + +end; + +procedure TScreenCredits.onHide; +begin + Music.Stop; +end; + +Procedure TScreenCredits.Draw_FunkyText; +var + S: Integer; + X,Y,A: Real; + visibleText: PChar; +begin + SetFontSize(10); + //Init ScrollingText + if (CTime = Timings[7]) then + begin + //Set Position of Text + Credits_X := 600; + CurrentScrollStart:=1; + CurrentScrollEnd:=1; + end; + + if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then + begin + X:=0; + visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); + for S := 0 to length(visibleText)-1 do begin + Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); + SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); + A:=0; + if (Credits_X+X < 15) then A:=0; + if (Credits_X+X >=15) then A:=Credits_X+X-15; + if Credits_X+X > 32 then A:=17; + glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17); + glPrintLetter(visibleText[S]); + X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + end; + if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin + Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + inc(CurrentScrollStart); + end; + visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); + if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin + inc(CurrentScrollEnd); + end; + end; +{ // timing hack + X:=5; + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + glColor4f(1, 1, 1, 1); + for S:=0 to high(CTime_hold) do begin + visibleText:=pchar(inttostr(CTime_hold[S])); + SetFontPos (500, X); + glPrint (Addr(visibleText[0])); + X:=X+20; + end;} +end; + +procedure Start3D; +begin + glMatrixMode(GL_PROJECTION); + glPushMatrix; + glLoadIdentity; + glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity; +end; +procedure End3D; +begin + glMatrixMode(GL_PROJECTION); + glPopMatrix; + glMatrixMode(GL_MODELVIEW); +end; + +procedure TScreenCredits.DrawCredits; +var + T,I: Cardinal; + X: Real; + Ver: PChar; + RuntimeStr: AnsiString; + Data: TFFTData; + j,k,l:cardinal; + f,g,h: Real; + STime:cardinal; + Delay:cardinal; + + myPixel: longword; + myColor: Cardinal; + myScale: Real; + myAngle: Real; + + +const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24), + (154,31),(156,58),(168,32),(203,36), + (258,34),(251,50),(274,93),(294,84), + (232,54),(278,62),(319,34),(336,92), + (347,23),(374,32),(377,58),(361,83), + (385,91),(405,91),(429,35),(423,51), + (450,32),(485,34),(444,91),(486,93)); + +begin + //dis does teh muiwk y0r + Data := Music.GetFFTData; + + Log.LogStatus('',' JB-1'); + + T := GetTickCount div 33; + if T <> Credits_Time then + begin + Credits_Time := T; + inc(CTime); + inc(CTime_hold); + Credits_X := Credits_X-2; + + Log.LogStatus('',' JB-2'); + if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then + begin +// CTime:=Timings[20]; +// CRDTS_Stage:=Outro; + + CRDTS_Stage:=Intro; + CTime:=0; + Music.Play; + + end; + if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then + begin + CRDTS_Stage:=MainPart; + end; + if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then + begin + CRDTS_Stage:=Outro; + end; + end; + + Log.LogStatus('',' JB-3'); + + //draw background + if CRDTS_Stage=InitialDelay then + begin + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end + else + if CRDTS_Stage=Intro then + begin + Start3D; + glPushMatrix; + + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + if CTime < Timings[1] then begin + myScale:= 0.5+0.5*(Timings[1]-CTime)/(Timings[1]); // slowly move layers together + myAngle:=cos((CTime)*pi/((Timings[1])*2)); // and make logo face towards camera + end else begin // this is the part when the logo stands still + myScale:=0.5; + myAngle:=0; + end; + if CTime > Timings[2] then begin + myScale:= 0.5+0.5*(CTime-Timings[2])/(Timings[3]-Timings[2]); // get some space between layers + myAngle:=0; + end; +// if CTime > Timings[3] then myScale:=1; // keep the space between layers + glTranslatef(0,0,-5+0.5*myScale); + if CTime > Timings[3] then myScale:=1; // keep the space between layers + if CTime > Timings[3] then begin // make logo rotate left and grow +// myScale:=(CTime-Timings[4])/(Timings[7]-Timings[4]); + glRotatef(20*sqr(CTime-Timings[3])/sqr((Timings[7]-Timings[3])/2),0,0,1); + glScalef(1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1); + end; + if CTime < Timings[2] then + glRotatef(30*myAngle,0.5*myScale+myScale,1+myScale,0); +// glScalef(0.5,0.5,0.5); + glScalef(4/3,-1,1); + glColor4f(1, 1, 1, 1); + + glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.4 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.4 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.4 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.4 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.22 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.22 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.22 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.22 * myScale); + glEnd; + gldisable(gl_texture_2d); + glDisable(GL_BLEND); + + glPopMatrix; + End3D; + + // do some sparkling effects + if (CTime < Timings[1]) and (CTime > Timings[21]) then + begin + for k:=1 to 3 do begin + l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5); + j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301); + GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0); + end; + end; + + // fade to white at end + if Ctime > Timings[6] then + begin + glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + + end; + if (CRDTS_Stage=MainPart) then + // main credits screen background, scroller, logo and girl + begin + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // draw scroller + Draw_FunkyText; + +//######################################################################### +// draw credits names + + +Log.LogStatus('',' JB-4'); + +// BlindGuard (von links oben reindrehen, nach rechts unten rausdrehen) + STime:=Timings[9]-10; + Delay:=Timings[10]-Timings[9]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(0,329,0); + if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end; + gltranslatef(223,0,0); + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + gltranslatef(223,0,0); + glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1); + gltranslatef(-223,0,0); + end; + glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Blindy (zoom von 0 auf volle grösse und drehung, zoom auf doppelte grösse und nach rechts oben schieben) + STime:=Timings[10]-10; + Delay:=Timings[11]-Timings[10]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+20) and (CTime<=STime+22) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+20 then begin + j:=CTime-Stime; + glscalef(j*j/400,j*j/400,j*j/400); + glrotatef(j*18.0,0,0,1); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(f*3,-f,0); + glscalef(1+j/10,1+j/10,1+j/10); + glrotatef(j*9.0,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Canni (von links reinschieben, nach rechts oben rausschieben) + STime:=Timings[11]-10; + Delay:=Timings[12]-Timings[11]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(((CTime-STime)*21.0)-210,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=(CTime-(STime+Delay-10))*21; + gltranslatef(j,-j/2,0); + end; + glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Commandio (von unten reinklappen, nach rechts oben rausklappen) + STime:=Timings[12]-10; + Delay:=Timings[13]-Timings[12]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=258.0-25.8*(CTime-STime) + else + f:=0; + g:=0; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end; + glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163+g-f*1.5, -129+f*1.5-g/2); + glTexCoord2f(0,1);glVertex2f(-163+g*1.5, 129-(g*1.5*258/326)); + glTexCoord2f(1,1); glVertex2f(163+g, 129+g/4); + glTexCoord2f(1,0);glVertex2f(163+f*1.5+g/4, -129+f*1.5-g/4); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing) + STime:=Timings[13]-35; + Delay:=Timings[14]-Timings[13]+5; + if CTime > STime then + begin + k:=0; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20; + ESC_Alpha:=10; + f:=CTime-STime; + if CTime <=STime+40 then j:=CTime-STime else j:=40; + if (CTime >=STime+Delay-40) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j*j/1600); + + glPushMatrix; + gltranslatef(180+(f-70),329,0); + glBindTexture(GL_TEXTURE_2D, credits_lazyjoker.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Mog (von links reinklappen, nach rechts unten rausklappen) + STime:=Timings[14]-10; + Delay:=Timings[15]-Timings[14]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) + else + f:=0; + + g:=0; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end; + glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163+g*1.5, -129+g*1.5); + glTexCoord2f(0,1);glVertex2f(-163+g*1.2, 129+g); + glTexCoord2f(1,1); glVertex2f(163-f+g/2, 129+f*1.5+g/4); + glTexCoord2f(1,0);glVertex2f(163-f+g*1.5, -129-f*1.5); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Mota (von rechts oben reindrehen, nach links unten rausschieben und verkleinern und dabei drehen) + STime:=Timings[15]-10; + Delay:=Timings[16]-Timings[15]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(223,0,0); + glrotatef((10-(CTime-STime))*9,0,0,1); + gltranslatef(-223,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(-f*2,-f,0); + glscalef(1-j/10,1-j/10,1-j/10); + glrotatef(-j*9.0,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Skillmaster (von rechts unten reinschieben, nach rechts oben rausdrehen) + STime:=Timings[16]-10; + Delay:=Timings[17]-Timings[16]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + j:=STime+10-CTime; + f:=j*10.0; + gltranslatef(+f*2,+f/2,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + gltranslatef(0,-223,0); + glrotatef(integer(j)*-9,0,0,1); + gltranslatef(0,223,0); + glrotatef(j*9,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// WhiteShark (von links unten reinklappen, nach rechts oben rausklappen) + STime:=Timings[17]-10; + Delay:=Timings[18]-Timings[17]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) + else + f:=0; + + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end else + g:=0; + glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2); + glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4); + glTexCoord2f(1,1); glVertex2f(163-f*1.2+g/4, 129+f/2-g/4); + glTexCoord2f(1,0);glVertex2f(163-f*1.5+g/4, -129+f*1.5+g/4); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + + + Log.LogStatus('',' JB-103'); + +// #################################################################### +// do some twinkle stuff (kinda on beat) + if (CTime > Timings[8] ) and + (CTime < Timings[19] ) then + begin + k := 0; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + if Data[k]>0.2 then + begin + l := RandomRange(6,16); + j := RandomRange(0,27); + + GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); + end; + end; + +//################################################# +// draw the rest of the main screen (girl and logo + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(800-393, 0); + glTexCoord2f(0,600/1024);glVertex2f(800-393, 600); + glTexCoord2f(393/512,600/1024); glVertex2f(800, 600); + glTexCoord2f(393/512,0);glVertex2f(800, 0); + glEnd; +{ glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,112/128);glVertex2f(0, 112); + glTexCoord2f(497/512,112/128); glVertex2f(497, 112); + glTexCoord2f(497/512,0);glVertex2f(497, 0); + glEnd; +} + gldisable(gl_texture_2d); + glDisable(GL_BLEND); + + // fade out at end of main part + if Ctime > Timings[19] then + begin + glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + end + else + if (CRDTS_Stage=Outro) then + begin + if CTime=Timings[20] then begin + CTime_hold:=0; + Music.Stop; + Music.Open(soundpath + 'credits-outro-tune.mp3'); + Music.Play; + Music.SetVolume(20); + Music.SetLoop(True); + end; + if CTime_hold > 231 then begin + Music.Play; + Ctime_hold:=0; + end; + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + // do something useful + // outro background + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); + glEnd; + + //outro overlays + glColor4f(1, 1, 1, (1+sin(CTime/15))/3+1/3); + glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,223/256);glVertex2f(0, 223); + glTexCoord2f(487/512,223/256); glVertex2f(487, 223); + glTexCoord2f(487/512,0);glVertex2f(487, 0); + glEnd; + + ESC_Alpha:=20; + if (RandomRange(0,20) > 18) and (ESC_Alpha=20) then + ESC_Alpha:=0 + else inc(ESC_Alpha); + if ESC_Alpha > 20 then ESC_Alpha:=20; + glColor4f(1, 1, 1, ESC_Alpha/20); + glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(800-310, 600-247); + glTexCoord2f(0,247/256);glVertex2f(800-310, 600); + glTexCoord2f(310/512,247/256); glVertex2f(800, 600); + glTexCoord2f(310/512,0);glVertex2f(800, 600-247); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // outro scrollers? + // ... + end; + +{ // draw credits runtime counter + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (5, 5); + glColor4f(1, 1, 1, 1); +// RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10); + RuntimeStr:='CTime: '+inttostr(CTime); + glPrint (Addr(RuntimeStr[1])); +} + + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, myTex); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(100, 100); + glTexCoord2f(0,1);glVertex2f(100, 200); + glTexCoord2f(1,1); glVertex2f(200, 200); + glTexCoord2f(1,0);glVertex2f(200, 100); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + + // make the stars shine + GoldenRec.Draw; +end; + +end. -- cgit v1.2.3 From 4d693075a4b5078a9e08430d003e2bdb918b68c2 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 8 Oct 2007 02:02:07 +0000 Subject: trying to fix linux runtime errors with database ( Stats screen ) and Song Selection screen ( now back to kina working ) Testing Fisheye Links (please ignore): jira#USDX-1 sf#1790165 build#USDX-DELPHI-26 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@469 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 4108 +++++++++++++++++++------------------ 1 file changed, 2067 insertions(+), 2041 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 0a3c1d02..859d5026 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1,2041 +1,2067 @@ -unit UScreenSong; - -interface -{$I switches.inc} - -uses - UMenu, - SDL, - UMusic, - UFiles, - UTime, - UDisplay, - USongs, - SysUtils, - ULog, - UThemes, - UTexture, - ULanguage, - ULCD, - ULight, - UIni; - -type - TScreenSong = class(TMenu) - public - TextArtist: integer; - TextTitle: integer; - TextNumber: integer; - - //Video Icon Mod - VideoIcon: Cardinal; - - TextCat: integer; - StaticCat: integer; - - SongCurrent: real; - SongTarget: real; - - HighSpeed: boolean; - CoverFull: boolean; - CoverTime: real; - CoverX: integer; - CoverY: integer; - CoverW: integer; - is_jump: boolean; // Jump to Song Mod - is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title - - EqualizerBands: array of Byte; - EqualizerTime: Cardinal; - EqualizerTime2: Byte; - - //Party Mod - Mode: Byte; //0 = Standard, 1= Go to PartyMode after Selection + Change to Random Song at Show - //party Statics (Joker) - StaticTeam1Joker1: Cardinal; - StaticTeam1Joker2: Cardinal; - StaticTeam1Joker3: Cardinal; - StaticTeam1Joker4: Cardinal; - StaticTeam1Joker5: Cardinal; - - StaticTeam2Joker1: Cardinal; - StaticTeam2Joker2: Cardinal; - StaticTeam2Joker3: Cardinal; - StaticTeam2Joker4: Cardinal; - StaticTeam2Joker5: Cardinal; - - StaticTeam3Joker1: Cardinal; - StaticTeam3Joker2: Cardinal; - StaticTeam3Joker3: Cardinal; - StaticTeam3Joker4: Cardinal; - StaticTeam3Joker5: Cardinal; - - StaticParty: Array of Cardinal; - TextParty: Array of Cardinal; - StaticNonParty: Array of Cardinal; - TextNonParty: Array of Cardinal; - - - constructor Create; override; - procedure SetScroll; - procedure SetScroll1; - procedure SetScroll2; - procedure SetScroll3; - procedure SetScroll4; - procedure SetScroll5; - procedure SetScroll6; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure onShow; override; - procedure onHide; override; - procedure SelectNext; - procedure SelectPrev; - procedure UpdateLCD; - procedure SkipTo(Target: Cardinal); - procedure FixSelected; //Show Wrong Song when Tabs on Fix - procedure FixSelected2; //Show Wrong Song when Tabs on Fix - procedure ShowCatTL(Cat: Integer);// Show Cat in Top left - procedure ShowCatTLCustom(Caption: String);// Show Custom Text in Top left - procedure HideCatTL;// Show Cat in Tob left - procedure Refresh; //Refresh Song Sorting - procedure DrawEqualizer; - procedure ChangeMusic; - //Party Mode - procedure SelectRandomSong; - procedure SetJoker; - procedure SetStatics; - //procedures for Menu - procedure StartSong; - procedure OpenEditor; - procedure DoJoker(Team: Byte); - procedure SelectPlayers; - - procedure UnLoadDetailedCover; - - //Extensions - procedure DrawExtensions; - end; - -implementation -uses UGraphic, - UMain, - UCovers, - math, - OpenGL12, - {$IFDEF win32} - windows, - {$ELSE} - lclintf, - {$ENDIF} - USkins, - UDLLManager, - UParty, - UPlaylist, - UScreenSongMenu; - -// ***** Public methods ****** // - -//Show Wrong Song when Tabs on Fix -procedure TScreenSong.FixSelected; -var I, I2: Integer; - begin - if CatSongs.VisibleSongs > 0 then - begin - I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do - begin - if CatSongs.Song[I].Visible then - inc(I2); - - if I = Interaction - 1 then - break; - end; - - SongCurrent := I2; - SongTarget := I2; - end; - end; - -procedure TScreenSong.FixSelected2; -var I, I2: Integer; - begin - if CatSongs.VisibleSongs > 0 then - begin - I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do - begin - if CatSongs.Song[I].Visible then - inc(I2); - - if I = Interaction - 1 then - break; - end; - - SongTarget := I2; - end; - end; -//Show Wrong Song when Tabs on Fix End - - procedure TScreenSong.ShowCatTLCustom(Caption: String);// Show Custom Text in Top left - begin - Text[TextCat].Text := Caption; - Text[TextCat].Visible := true; - Static[StaticCat].Visible := False; - end; - - //Show Cat in Top Left Mod - procedure TScreenSong.ShowCatTL(Cat: Integer); - begin - //Change - Text[TextCat].Text := CatSongs.Song[Cat].Artist; - //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover); - //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); - - Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); - //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false); - //Button[Cat]. - //Cover - - - //Show - Text[TextCat].Visible := true; - Static[StaticCat].Visible := True; - end; - - procedure TScreenSong.HideCatTL; - begin - //Hide - //Text[TextCat].Visible := false; - Static[StaticCat].Visible := false; - //New -> Show Text specified in Theme - Text[TextCat].Visible := True; - Text[TextCat].Text := Theme.Song.TextCat.Text; - end; - //Show Cat in Top Left Mod End - - -// Method for input parsing. If False is returned, GetNextWindow -// should be checked to know the next window to load; -function TScreenSong.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -var - I: integer; - I2: integer; - HS: integer; - SDL_ModState: Word; - Letter: Char; -begin - Result := true; - - //Song Screen Extensions (Jumpto + Menu) - if (ScreenSongMenu.Visible) then - begin - Result := ScreenSongMenu.ParseInput(PressedKey, ScanCode, PressedDown); - Exit; - end - else if (ScreenSongJumpto.Visible) then - begin - Result := ScreenSongJumpto.ParseInput(PressedKey, ScanCode, PressedDown); - Exit; - end; - - If (PressedDown) Then - begin // Key Down - - SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT - + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); - - //Jump to Artist/Titel - if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then - begin - Letter := UpCase(Chr(ScanCode)); - I2 := Length(CatSongs.Song); - - //Jump To Titel - if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then - begin - For I := 1 to high(CatSongs.Song) do - begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then - begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - - Music.PlayChange; - - ChangeMusic; - SetScroll4; - UpdateLCD; - //Break and Exit - Exit; - end; - end; - end - //Jump to Artist - else if (SDL_ModState = KMOD_LALT) then - begin - For I := 1 to high(CatSongs.Song) do - begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Artist[1]) = Letter) then - begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - - Music.PlayChange; - - ChangeMusic; - SetScroll4; - UpdateLCD; - - //Break and Exit - Exit; - end; - end; - end; - Exit; - end; - - case PressedKey of - SDLK_Q: - begin - Result := false; - end; - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - if (Mode = 0) then - begin - //On Escape goto Cat-List Hack - if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then - begin - //Find Category - I := Interaction; - while not catsongs.Song[I].Main do - begin - Dec (I); - if (I < low(catsongs.Song)) then - break; - end; - if (I<= 1) then - Interaction := high(catsongs.Song) - else - Interaction := I - 1; - - //Stop Music - Music.Stop; - - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - HideCatTL; - - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - //SelectPrev; - //CatSongs.Song[0].Visible := False; - end - else - begin - //On Escape goto Cat-List Hack End - //Tabs off and in Search or Playlist -> Go back to Song view - if (CatSongs.CatNumShow < -1) then - begin - //Atm: Set Empty Filter - CatSongs.SetFilter('', 0); - - //Show Cat in Top Left Mod - HideCatTL; - Interaction := 0; - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - - ChangeMusic; - end - else - begin - Music.Stop; - Music.PlayBack; - - FadeTo(@ScreenMain); - end; - - end; - end - //When in party Mode then Ask before Close - else if (Mode = 1) then - begin - Music.PlayBack; - CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); - end; - end; - SDLK_RETURN: - begin - if Length(Songs.Song) > 0 then - begin - {$IFDEF UseSerialPort} - // PortWriteB($378, 0); - {$ENDIF} - if CatSongs.Song[Interaction].Main then - begin // clicked on Category Button - - //Show Cat in Top Left Mod - ShowCatTL (Interaction); - - //I := CatSongs.VisibleIndex(Interaction); - CatSongs.ClickCategoryButton(Interaction); - {I2 := CatSongs.VisibleIndex(Interaction); - SongCurrent := SongCurrent - I + I2; - SongTarget := SongTarget - I + I2; } - -// if I<>I2 then beep; - // SetScroll4; - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - - //Play Music: - ChangeMusic; - - end else begin // clicked on song - if (Mode = 0) then //Normal Mode -> Start Song - begin - //Do the Action that is specified in Ini - case Ini.OnSongClick of - 0: StartSong; - 1: SelectPlayers; - 2:begin - If (CatSongs.CatNumShow = -3) then - ScreenSongMenu.MenuShow(SM_Playlist) - else - ScreenSongMenu.MenuShow(SM_Main); - end; - end; - end - else if (Mode = 1) then //PartyMode -> Show Menu - begin - if (Ini.PartyPopup = 1) then - ScreenSongMenu.MenuShow(SM_Party_Main) - else - ScreenSong.StartSong; - end; - end; - end; - end; - - SDLK_M: //Show SongMenu - begin - if (Length(Songs.Song) > 0) then begin - if (Mode = 0) then begin - if not CatSongs.Song[Interaction].Main then begin // clicked on Song - if CatSongs.CatNumShow = -3 then - ScreenSongMenu.MenuShow(SM_Playlist) - else - ScreenSongMenu.MenuShow(SM_Main); - end - else - begin - ScreenSongMenu.MenuShow(SM_Playlist_Load); - end; - end //Party Mode -> Show Party Menu - else ScreenSongMenu.MenuShow(SM_Party_Main); - end; - end; - - SDLK_P: //Show Playlist Menu - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin - ScreenSongMenu.MenuShow(SM_Playlist_Load); - end; - end; - - SDLK_J: //Show Jumpto Menu - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then - begin - ScreenSongJumpto.Visible := True; - end; - end; - - SDLK_DOWN: - begin - if (Mode = 0) then - begin - //Only Change Cat when not in Playlist or Search Mode - if (CatSongs.CatNumShow > -2) then - begin - //Cat Change Hack - if Ini.Tabs_at_startup = 1 then - begin - I := Interaction; - if I <= 0 then I := 1; - - while not catsongs.Song[I].Main do - begin - Inc (I); - if (I > high(catsongs.Song)) then - I := low(catsongs.Song); - end; - - Interaction := I; - - //Show Cat in Top Left Mod - ShowCatTL (Interaction); - - CatSongs.ClickCategoryButton(Interaction); - SelectNext; - FixSelected; - - //Play Music: - Music.PlayChange; - ChangeMusic; - - end; - - // - //Cat Change Hack End} - end; - end; - end; - SDLK_UP: - begin - if (Mode = 0) then - begin - //Only Change Cat when not in Playlist or Search Mode - if (CatSongs.CatNumShow > -2) then - begin - //Cat Change Hack - if Ini.Tabs_at_startup = 1 then - begin - I := Interaction; - I2 := 0; - if I <= 0 then I := 1; - - while not catsongs.Song[I].Main or (I2 = 0) do - begin - if catsongs.Song[I].Main then - Inc(I2); - Dec (I); - if (I < low(catsongs.Song)) then - I := high(catsongs.Song); - end; - - Interaction := I; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - FixSelected; - - //Play Music: - Music.PlayChange; - ChangeMusic; - end; - end; - //Cat Change Hack End} - end; - end; - - SDLK_RIGHT: - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin - Music.PlayChange; - SelectNext; -// InteractNext; -// SongTarget := Interaction; - ChangeMusic; - SetScroll4; - UpdateLCD; - Light.LightOne(1, 200); - end; - end; - - SDLK_LEFT: - begin - if (Length(Songs.Song) > 0)AND (Mode = 0) then begin - Music.PlayChange; - SelectPrev; - ChangeMusic; - SetScroll4; - UpdateLCD; - Light.LightOne(0, 200); - end; - end; - - SDLK_E: - begin - OpenEditor; - end; - - SDLK_R: - begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin - - if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category - begin - I2 := 0; //Count Cats - for I:= low(CatSongs.Song) to high (CatSongs.Song) do - if CatSongs.Song[I].Main then Inc(I2); - - I2 := Random (I2)+1; //Zufall - - //Find Cat: - for I:= low(CatSongs.Song) to high (CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - Dec(I2); - if (I2<=0) then - begin - //Show Cat in Top Left Mod - ShowCatTL (I); - - Interaction := I; - - CatSongs.ShowCategoryList; - CatSongs.ClickCategoryButton(I); - SelectNext; - FixSelected; - break; - end; - end; - - - end - else if (SDL_ModState = KMOD_LCTRL) AND (Ini.Tabs_at_startup = 1) then //random in All Categorys - begin - repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; - - //Search Cat - for I := I2 downto low(CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - break; - end; - //In I ist jetzt die Kategorie in I2 der Song - - //Choose Cat - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - - //Fix: Not Existing Song selected: - //if (I+1=I2) then Inc(I2); - - //Choose Song - SkipTo(I2-I); - - end - else //Random in one Category - begin - SkipTo(Random(CatSongs.VisibleSongs)); - end; - Music.PlayChange; - - ChangeMusic; - SetScroll4; - UpdateLCD; - end; - end; - - SDLK_1: - begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[0].Joker); - SelectRandomSong; - SetJoker; - end; - end; - - SDLK_2: - begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[1].Joker); - SelectRandomSong; - SetJoker; - end; - end; - - SDLK_3: - begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[2].Joker); - SelectRandomSong; - SetJoker; - end; - end; - end; - end; -end; - -constructor TScreenSong.Create; -var - Pet: integer; - I: integer; -Label CreateSongButtons; -begin - inherited Create; - - LoadFromTheme(Theme.Song); - - TextArtist := AddText(Theme.Song.TextArtist); - TextTitle := AddText(Theme.Song.TextTitle); - TextNumber := AddText(Theme.Song.TextNumber); - - //Show Cat in Top Left mod - TextCat := AddText(Theme.Song.TextCat); - StaticCat := AddStatic(Theme.Song.StaticCat); - - //Show Video Icon Mod - VideoIcon := AddStatic(Theme.Song.VideoIcon); - - //Party Mode - StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1); - StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2); - StaticTeam1Joker3 := AddStatic(Theme.Song.StaticTeam1Joker3); - StaticTeam1Joker4 := AddStatic(Theme.Song.StaticTeam1Joker4); - StaticTeam1Joker5 := AddStatic(Theme.Song.StaticTeam1Joker5); - - StaticTeam2Joker1 := AddStatic(Theme.Song.StaticTeam2Joker1); - StaticTeam2Joker2 := AddStatic(Theme.Song.StaticTeam2Joker2); - StaticTeam2Joker3 := AddStatic(Theme.Song.StaticTeam2Joker3); - StaticTeam2Joker4 := AddStatic(Theme.Song.StaticTeam2Joker4); - StaticTeam2Joker5 := AddStatic(Theme.Song.StaticTeam2Joker5); - - StaticTeam3Joker1 := AddStatic(Theme.Song.StaticTeam3Joker1); - StaticTeam3Joker2 := AddStatic(Theme.Song.StaticTeam3Joker2); - StaticTeam3Joker3 := AddStatic(Theme.Song.StaticTeam3Joker3); - StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); - StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); - - //Load Party or NonParty specific Statics and Texts - SetLength(StaticParty, Length(Theme.Song.StaticParty)); - for I := 0 to High(Theme.Song.StaticParty) do - StaticParty[I] := AddStatic(Theme.Song.StaticParty[I]); - - SetLength(TextParty, Length(Theme.Song.TextParty)); - for I := 0 to High(Theme.Song.TextParty) do - TextParty[I] := AddText(Theme.Song.TextParty[I]); - - SetLength(StaticNonParty, Length(Theme.Song.StaticNonParty)); - for I := 0 to High(Theme.Song.StaticNonParty) do - StaticNonParty[I] := AddStatic(Theme.Song.StaticNonParty[I]); - - SetLength(TextNonParty, Length(Theme.Song.TextNonParty)); - for I := 0 to High(Theme.Song.TextNonParty) do - TextNonParty[I] := AddText(Theme.Song.TextNonParty[I]); - - // Song List -// Songs.LoadSongList; // moved to the UltraStar unit - CatSongs.Refresh; - - if (length(CatSongs.Song) > 0) then - begin - //Set Length of Button Array one Time Instead of one time for every Song - SetButtonLength(Length(CatSongs.Song)); - - I := 0; - CreateSongButtons: - - try - for Pet := I to High(CatSongs.Song) do begin // creating all buttons - // new - Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 - - if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then - CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' - - if CatSongs.Song[Pet].Cover = '' then - AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) - else begin - // cache texture if there is a need to this - if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then - begin - Texture.CreateCacheMipmap := true; - Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap - Texture.CreateCacheMipmap := false; - - // puts this texture to the cache file - Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); - - // unload full size texture - Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); - - // we should also add mipmap texture by calling createtexture and use mipmap cache as data source - end; - - // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) - AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); - end; - Texture.Limit := 1024*1024; - I := -1; - end; - except - //When Error is reported the First time for this Song - if (I <> Pet) then - begin - //Some Error reporting: - Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); - - //Change Cover to NoCover and Continue Loading - CatSongs.Song[Pet].Cover := ''; - I := Pet; - end - else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song - begin - Log.LogError('NoCover Cover is damaged!'); - try - AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); - except - {$IFDEF win32} - Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); - {$ELSE} - // TODO : JB_linux - better handle this message and display to user.. - writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'); - Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' ); - {$ENDIF} - Halt; - end; - I := Pet + 1; - end; - end; - - if (I <> -1) then - GoTo CreateSongButtons; - - end; - - // Randomize Patch - Randomize; - //Equalizer - SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); - //ClearArray - For I := low(EqualizerBands) to high(EqualizerBands) do - EqualizerBands[I] := 3; - - if (Length(CatSongs.Song) > 0) then - Interaction := 0; -end; - -procedure TScreenSong.SetScroll; -var - VS, B: Integer; -begin - VS := CatSongs.VisibleSongs; - if VS > 0 then - begin - //Set Positions - Case Theme.Song.Cover.Style of - 3: SetScroll3; - 5:begin - if VS > 5 then - SetScroll5 - else - SetScroll4; - end; - 6: SetScroll6; - else SetScroll4; - end; - //Set Visibility of Video Icon - Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> ''); - - //Set Texts: - Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; - Text[TextTitle].Text := CatSongs.Song[Interaction].Title; - if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then - begin - Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); - Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; - end - else if (CatSongs.CatNumShow = -2) then - Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) - else if (CatSongs.CatNumShow = -3) then - Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) - else if (Ini.Tabs_at_startup = 1) then - Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) - else - Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); - end - else - begin - Text[TextNumber].Text := '0/0'; - Text[TextArtist].Text := ''; - Text[TextTitle].Text := ''; - for B := 0 to High(Button) do - Button[B].Visible := False; - - end; -end; - -procedure TScreenSong.SetScroll1; -var - B: integer; // button - BMin: integer; // button min - BMax: integer; // button max - Src: integer; -// Dst: integer; - Count: integer; // Dst is not used. Count is used. - Ready: boolean; - - VisCount: integer; // count of visible (or selectable) buttons - VisInt: integer; // visible position of interacted button - Typ: integer; // 0 when all songs fits the screen - Placed: integer; // number of placed visible buttons -begin -// Src := 0; -// Dst := -1; - Count := 1; - Typ := 0; - Ready := false; - Placed := 0; - - VisCount := 0; - for B := 0 to High(Button) do - if CatSongs.Song[B].Visible then Inc(VisCount); - - VisInt := 0; - for B := 0 to Interaction-1 do - if CatSongs.Song[B].Visible then Inc(VisInt); - - - if VisCount <= 6 then begin - Typ := 0; - end else begin - if VisInt <= 3 then begin - Typ := 1; - Count := 7; - Ready := true; - end; - - if (VisCount - VisInt) <= 3 then begin - Typ := 2; - Count := 7; - Ready := true; - end; - - if not Ready then begin - Typ := 3; - Src := Interaction; - end; - end; - - - - // hide all buttons - for B := 0 to High(Button) do begin - Button[B].Visible := false; - Button[B].Selectable := CatSongs.Song[B].Visible; - end; - -{ for B := Src to Dst do begin -// Button[B].Visible := true; - Button[B].Visible := CatSongs.Song[B].Visible; - Button[B].Selectable := Button[B].Visible; - Button[B].Y := 140 + (B-Src) * 60; - end;} - - - if Typ = 0 then begin - for B := 0 to High(Button) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (Placed) * 60; - Inc(Placed); - end; - end; - end; - - if Typ = 1 then begin - B := 0; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Inc(B); - end; - end; - - if Typ = 2 then begin - B := High(Button); - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (6-Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Dec(B); - end; - end; - - if Typ = 3 then begin - B := Src; - Count := 4; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (3+Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Inc(B); - end; - - B := Src-1; - Placed := 0; - Count := 3; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (2-Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Dec(B); - end; - - end; - - if Length(Button) > 0 then - Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture -end; - -procedure TScreenSong.SetScroll2; -var - B: integer; - Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu - Wsp2: real; -begin - // liniowe - for B := 0 to High(Button) do - Button[B].X := 300 + (B - Interaction) * 260; - - if Length(Button) >= 3 then begin - if Interaction = 0 then - Button[High(Button)].X := 300 - 260; - - if Interaction = High(Button) then - Button[0].X := 300 + 260; - end; - - // kolowe -{ for B := 0 to High(Button) do begin - Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. - Wsp2 := Wsp / Length(Button); - Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); -// Button[B].Y := 140 + 50 * ; - end;} -end; - -procedure TScreenSong.SetScroll3; // with slide -var - B: integer; - Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu - Wsp2: real; -begin - SongTarget := Interaction; - - // liniowe - for B := 0 to High(Button) do - begin - Button[B].X := 300 + (B - SongCurrent) * 260; - if (Button[B].X < -Button[B].W) OR (Button[B].X > 800) then - Button[B].Visible := False - else - Button[B].Visible := True; - end; - -{ if Length(Button) >= 3 then begin - if Interaction = 0 then - Button[High(Button)].X := 300 - 260; - - if Interaction = High(Button) then - Button[0].X := 300 + 260; - end;} - - // kolowe -{ for B := 0 to High(Button) do begin - Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. - Wsp2 := Wsp / Length(Button); - Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); -// Button[B].Y := 140 + 50 * ; - end;} -end; - -procedure TScreenSong.SetScroll4; // rotate -var - B: integer; - Wsp: real; - Z, Z2: real; - VS: integer; -begin - VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important - - // kolowe - for B := 0 to High(Button) do begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2; - Z2 := (1 + 2*Z) / 3; - - - Button[B].X := Theme.Song.Cover.X + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - Button[B].Z := Z / 2 + 0.3; - - Button[B].W := Theme.Song.Cover.H * Z2; - -// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; - Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; - Button[B].H := Button[B].W; - end; - end; -end; - -(* -procedure TScreenSong.SetScroll4; // rotate -var - B: integer; - Wsp: real; - Z: real; - Z2, Z3: real; - VS: integer; - function modreal (const X, Y: real):real; - begin - Result := Frac(x / y) * y; - if Result < -3 then - Result := Result + Y - else if Result > 3 then - Result := Result - Y; - end; -begin - VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important - Z3 := 1; - if VS < 12 then - Z2 := VS - else - Z2 := 12; - - // kolowe - for B := 0 to High(Button) do begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - if ((ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)>-3) AND (ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)<3)) then - begin - if CatSongs.VisibleIndex(B)> SongCurrent then - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2 - else - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2; - - Z3 := 2; - Z := (1 + cos(Wsp)) / 2; - //Z2 := (1 + 2*Z) / 3; - //Z2 := (0.5 + Z/2); - //Z2 := sin(Wsp); - - //Z2 := Power (Z2,Z3); - - Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); - - //Button[B].X := Theme.Song.CoverX + ({Theme.Song.CoverX + Theme.Song.CoverW/2 + Theme.Song.CoverW*0.18 * VS {CatSongs.VisibleSongs {Length(Button) * sin(Wsp) {- Theme.Song.CoverX - Theme.Song.CoverW) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - if (sin(Wsp)<0) then - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W - else //*Theme.Song.CoverW*0.004*Z3 - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; - Button[B].Z := Z-0.00001; - -// Button[B].Y := {50 + 140 + 50 - 50 * Z2; - // Button[B].Y := (Theme.Song.CoverY + 40 + 50 - 50 * Z2); - Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); - Button[B].H := Button[B].W; - Button[B].Visible := True; - end - {else if (((CatSongs.VisibleIndex(B) - SongCurrent)>-3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) OR ((round (CatSongs.VisibleIndex(B) - SongCurrent) mod VS > -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) then - begin - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / 12 ;// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2 -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); - - if (sin(Wsp)<0) then - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W - else - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; - - Button[B].Z := Z; - - Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); - - Button[B].H := Button[B].W; - Button[B].Visible := True; - end - else Button[B].Visible := False; - end; - end; -end; *) - -procedure TScreenSong.SetScroll5; // rotate -var - B: integer; - Angle: real; - Pos: Real; - VS: integer; - diff: real; - X: Real; - helper: real; -begin - VS := CatSongs.VisibleSongs; // cache Visible Songs - {Vars - Theme.Song.CoverW: Radius des Kreises - Theme.Song.CoverX: X Pos Linke Kante des gewählten Covers - Theme.Song.CoverX: Y Pos Obere Kante des gewählten Covers - Theme.Song.CoverH: Höhe der Cover - - (CatSongs.VisibleIndex(B) - SongCurrent)/VS = Abstand zum MIttleren Cover in % - } - - //Change Pos of all Buttons - for B := low(Button) to high(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility - if Button[B].Visible then //Only Change Pos for Visible Buttons - begin - Pos := (CatSongs.VisibleIndex(B) - SongCurrent); - if (Pos < -VS/2) then - Pos := Pos + VS - else if (Pos > VS/2) then - Pos := Pos - VS; - - if (Abs(Pos) < 2.5) then {fixed Positions} - begin - Angle := Pi * (Pos / 5); -// Button[B].Visible := False; - - Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); - -// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Z := 0.95 - Abs(Pos) * 0.01; - - Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); - - Button[B].W := Button[B].H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - - X := Sin(Angle*1.3)*0.9; - - Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Diff; - - end - else - begin {Behind the Front Covers} - - // limit-bg-covers hack - if (abs(abs(Pos)-VS/2)>10) then Button[B].Visible:=False; - // end of limit-bg-covers hack - - if Pos < 0 then - Pos := (Pos - VS/2)/VS - else - Pos := (Pos + VS/2)/VS; - - Angle := pi * Pos*2; - if VS > 24 then - begin - if Angle < 0 then helper:=-1 else helper:=1; - Angle:=2*pi-abs(Angle); - Angle:=Angle*(VS/24); - Angle:=(2*pi-Angle)*helper; - end; - - Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); - - Button[B].W := Button[B].H; - - Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; - -// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*((Theme.Song.Cover.H)*sin(Angle/2)*1.52); - - end; - - //Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field -// Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); - - end; - end; -end; - -procedure TScreenSong.SetScroll6; // rotate (slotmachine style) -var - B: integer; - Angle: real; - Pos: Real; - VS: integer; - diff: real; - X: Real; - Wsp: real; - Z, Z2: real; -begin - VS := CatSongs.VisibleSongs; // cache Visible Songs - if VS <=5 then begin - // kolowe - for B := 0 to High(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2; - Z2 := (1 + 2*Z) / 3; - - - Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - Button[B].Z := Z / 2 + 0.3; - - Button[B].W := Theme.Song.Cover.H * Z2; - -// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; - Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; - Button[B].H := Button[B].W; - end; - end; - end - else begin - - //Change Pos of all Buttons - for B := low(Button) to high(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility - if Button[B].Visible then //Only Change Pos for Visible Buttons - begin - Pos := (CatSongs.VisibleIndex(B) - SongCurrent); - if (Pos < -VS/2) then - Pos := Pos + VS - else if (Pos > VS/2) then - Pos := Pos - VS; - - if (Abs(Pos) < 2.5) then {fixed Positions} - begin - Angle := Pi * (Pos / 5); -// Button[B].Visible := False; - - Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); - - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Z := 0.95 - Abs(Pos) * 0.01; - - Button[B].X := (Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); - - Button[B].W := Button[B].H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - - X := Sin(Angle*1.3)*0.9; - - Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff; - end - else - begin {Behind the Front Covers} - - // limit-bg-covers hack - if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; - if VS > 25 then VS:=25; - // end of limit-bg-covers hack - - if Pos < 0 then - Pos := (Pos - VS/2)/VS - else - Pos := (Pos + VS/2)/VS; - - Angle := pi * Pos*2; - - Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); - - Button[B].W := Button[B].H; - - Button[B].X := Theme.Song.Cover.X - (Button[B].H - Theme.Song.Cover.H)*0.5; - - - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Y := Theme.Song.Cover.Y+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*(Theme.Song.Cover.H*sin(Angle/2)*1.52); - end; - end; - end; - end; -end; - - -procedure TScreenSong.onShow; -begin - Music.Stop; - - if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; - if Ini.Players = 4 then PlayersPlay := 6; - - //Cat Mod etc - if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then - begin - CatSongs.ShowCategoryList; - FixSelected; - //Show Cat in Top Left Mod - HideCatTL; - end; - - - if Length(CatSongs.Song) > 0 then begin - //Load Music only when Song Preview is activated - if (Ini.PreviewVolume <> 0) then - begin - Music.SetLoop(false); - Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); - Music.MoveTo(Music.Length / 4); - Music.Play; - - //Set Preview Volume - Music.SetMusicVolume (Ini.PreviewVolume * 10); - {//if Music Fade is activated, Set Volume to 0 % - if (Ini.PreviewFading <> 0) then - Music.SetMusicVolume(0);} - end; - - SetScroll; - UpdateLCD; - end; - - //Playlist Mode - if (Mode = 0) then - begin - //If Playlist Shown -> Select Next automatically - if (CatSongs.CatNumShow = -3) then - begin - SelectNext; - ChangeMusic; - end; - end - //Party Mode - else if (Mode = 1) then - begin - - SelectRandomSong; - //Show Menu directly in PartyMode - //But only if selected in Options - if (Ini.PartyPopup = 1) then - begin - ScreenSongMenu.MenuShow(SM_Party_Main); - end; - - - end; - - SetJoker; - SetStatics; -end; - -procedure TScreenSong.onHide; -begin - //When Music Fading is activated, Turn Music to 100 % - If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then - Music.SetMusicVolume(100); - - //If Preview is deactivated: Load MUsicfile now - If (Ini.PreviewVolume = 0) then - Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); - - //When hide then Stop Music (For Party Mode Popup on Exit) - if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then - Music.Stop; -end; - -procedure TScreenSong.DrawExtensions; -begin - //Draw Song Menu - if (ScreenSongMenu.Visible) then - begin - ScreenSongMenu.Draw; - end - else if (ScreenSongJumpto.Visible) then - begin - ScreenSongJumpto.Draw; - end -end; - -function TScreenSong.Draw: boolean; -var - dx: real; - dt: real; - I: Integer; -begin - dx := SongTarget-SongCurrent; - dt := TimeSkip*7; - if dt > 1 then dt := 1; - SongCurrent := SongCurrent + dx*dt; - -{ if SongCurrent > Catsongs.VisibleSongs then begin - SongCurrent := SongCurrent - Catsongs.VisibleSongs; - SongTarget := SongTarget - Catsongs.VisibleSongs; - end;} - -// Log.BenchmarkStart(5); - SetScroll; -// Log.BenchmarkEnd(5); -// Log.LogBenchmark('SetScroll4', 5); - - //Fading Functions, Only if Covertime is under 5 Seconds - If (CoverTime < 5) then - begin - // 0.5.0: cover fade - if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin - // load new texture - Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); - Button[Interaction].Texture.Alpha := 1; - Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); - Button[Interaction].Texture2.Alpha := 1; - end; - - //Song Fade - if (CatSongs.VisibleSongs > 0) AND (Ini.PreviewVolume <> 0) AND (Not CatSongs.Song[Interaction].Main) AND (Ini.PreviewFading <> 0) then - begin - //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling - if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then - Music.Play; - - //Update Song Volume - if (CoverTime < Ini.PreviewFading) then - Music.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) - else - Music.SetMusicVolume(Ini.PreviewVolume * 10); - - end; - - - //Update Fading Time - CoverTime := CoverTime + TimeSkip; - - //Update Fading Texture - Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; - if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; - - end; - - //inherited Draw; - //heres a little Hack, that causes the Statics - //are Drawn after the Buttons because of some Blending Problems. - //This should cause no Problems because all Buttons on this screen - //Has Z Position. - //Draw BG - DrawBG; - - //Instead of Draw FG Procedure: - //We draw Buttons for our own - for I := 0 to Length(Button) - 1 do - Button[I].Draw; - - // Statics - for I := 0 to Length(Static) - 1 do - Static[I].Draw; - - // and texts - for I := 0 to Length(Text) - 1 do - Text[I].Draw; - - - //Draw Equalizer - if Theme.Song.Equalizer.Visible then - DrawEqualizer; - - DrawExtensions; - -end; - -procedure TScreenSong.SelectNext; -var - Skip: integer; - I: integer; - VS: Integer; -begin - VS := CatSongs.VisibleSongs; - - if VS > 0 then - begin - UnLoadDetailedCover; - - Skip := 1; - - // this 1 could be changed by CatSongs.FindNextVisible - while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); - - SongTarget := SongTarget + 1;//Skip; - - Interaction := (Interaction + Skip) mod Length(Interactions); - - // try to keep all at the beginning - if SongTarget > VS-1 then begin - SongTarget := SongTarget - VS; - SongCurrent := SongCurrent - VS; - end; - - end; - // Interaction -> Button, ktorego okladke przeczytamy - // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture -end; - -procedure TScreenSong.SelectPrev; -var - Skip: integer; - I: integer; - VS: Integer; -begin - VS := CatSongs.VisibleSongs; - - if VS > 0 then - begin - UnLoadDetailedCover; - - Skip := 1; - - while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); - SongTarget := SongTarget - 1;//Skip; - - Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); - - // try to keep all at the beginning - if SongTarget < 0 then begin - SongTarget := SongTarget + CatSongs.VisibleSongs; - SongCurrent := SongCurrent + CatSongs.VisibleSongs; - end; - - // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture - end; -end; - -procedure TScreenSong.UpdateLCD; -begin - LCD.HideCursor; - LCD.Clear; - LCD.WriteText(1, Text[TextArtist].Text); - LCD.WriteText(2, Text[TextTitle].Text); -end; - -//Procedure Change current played Preview -procedure TScreenSong.ChangeMusic; -begin - //When Music Preview is avtivated -> then Change Music - if (Ini.PreviewVolume <> 0) then - begin - if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then - begin - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); - //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal - if (Ini.PreviewFading = 0) then - Music.Play - else - Music.SetMusicVolume(0); - end; - end - else - Music.Stop; - end; -end; - -procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0 -var - Skip: integer; - I: integer; -begin - UnLoadDetailedCover; - - Interaction := High(CatSongs.Song); - SongTarget := 0; - - for I := 1 to Target+1 do - SelectNext; - - FixSelected2; -end; - -procedure TScreenSong.DrawEqualizer; -var - Data: TFFTData; //Audio Data - I, J: Integer; - Res: byte; - A, B: Integer; - PosX, PosY: Integer; - Pos: Real; -begin -if (not Music.Finished) AND (Theme.Song.Equalizer.Length > 0) then -begin - - - A := GetTickCount div 44; - - if (A <> EqualizerTime) then - begin - EqualizerTime := A; - Data := Music.GetFFTData; - - B:=0; - Pos := 0; - Res := ceil(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band - - //Change Lengths - for I := 0 to (Res * Theme.Song.Equalizer.Bands - 1) do - begin - A := floor(I/Res); - - if (A<>B) then //Band changed - begin - if (Pos <= Theme.Song.Equalizer.Length) then - begin - if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then - EqualizerBands[B] := EqualizerBands[B] - 1 - else - EqualizerBands[B] := floor(Pos); - end - else - EqualizerBands[B] := 1; - - B := A; - Pos := 0; - end; - - if I > 35 then - Data[i] := Data[i] * 8 - else if I > 11 then - Data[i] := Data[i] * 4.5 - else - Data[i] := Data[i] * 1.1; - - if (Data[i] >= 1) then - Data[i] := 0.9999999999999; - - if Data[i]*Theme.Song.Equalizer.Length > Pos then - Pos := Data[i]*Theme.Song.Equalizer.Length; - end; - - //Change Last Band - if (EqualizerBands[B] <= Theme.Song.Equalizer.Length) then - begin - if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then - EqualizerBands[B] := EqualizerBands[B] - 1 - else - EqualizerBands[B] := floor(Pos) - end - else - EqualizerBands[B] := 1; - end; - - //Draw every Channel - glColor4f(Theme.Song.Equalizer.ColR, Theme.Song.Equalizer.ColG, Theme.Song.Equalizer.ColB, Theme.Song.Equalizer.Alpha); //Set Color - glDisable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - - PosY := Theme.Song.Equalizer.Y; - PosX := Theme.Song.Equalizer.X; - - For I := 0 to Theme.Song.Equalizer.Bands-1 do - begin - if Theme.Song.Equalizer.Direction then - PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length - else - PosX := Theme.Song.Equalizer.X; - //Draw for every visible quad - for J := 1 to EqualizerBands[I] do - begin - glBegin(GL_QUADS); - glVertex3f(PosX, PosY, Theme.Song.Equalizer.Z); - glVertex3f(PosX, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); - glVertex3f(PosX+Theme.Song.Equalizer.W, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); - glVertex3f(PosX+Theme.Song.Equalizer.W, PosY, Theme.Song.Equalizer.Z); - glEnd; - - if Theme.Song.Equalizer.Direction then //Vertically - PosY := PosY - Theme.Song.Equalizer.H - Theme.Song.Equalizer.Space - else //Horizontally - PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space; - end; - if Theme.Song.Equalizer.Direction then //Horizontally - PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space - else //Vertically - PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space; - end; -end; -end; - -Procedure TScreenSong.SelectRandomSong; -var - I, I2: Integer; -begin - Case PlaylistMan.Mode of - 0: //All Songs Just Select Random Song - begin - //When Tabs are activated then use Tab Method - if (Ini.Tabs_at_startup = 1) then - begin - repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; - - //Search Cat - for I := I2 downto low(CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - break; - end; - //In I ist jetzt die Kategorie in I2 der Song - //I is the CatNum, I2 is the No of the Song within this Cat - - //Choose Cat - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - - //Choose Song - SkipTo(I2-I); - end - //When Tabs are deactivated use easy Method - else - SkipTo(Random(CatSongs.VisibleSongs)); - end; - 1: //One Category Select Category and Select Random Song - begin - CatSongs.ShowCategoryList; - CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); - ShowCatTL(PlaylistMan.CurPlayList); - - SelectNext; - FixSelected2; - - SkipTo(Random(CatSongs.VisibleSongs)); - end; - 2: //Playlist: Select Playlist and Select Random Song - begin - PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); - - SkipTo(Random(CatSongs.VisibleSongs)); - FixSelected2; - end; - end; - - Music.PlayChange; - ChangeMusic; - SetScroll; - UpdateLCD; -end; - -procedure TScreenSong.SetJoker; -begin - //If Party Mode - if Mode = 1 then //Show Joker that are available - begin - if (PartySession.Teams.NumTeams >= 1) then - begin - Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1); - Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2); - Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3); - Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4); - Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5); - end - else - begin - Static[StaticTeam1Joker1].Visible := False; - Static[StaticTeam1Joker2].Visible := False; - Static[StaticTeam1Joker3].Visible := False; - Static[StaticTeam1Joker4].Visible := False; - Static[StaticTeam1Joker5].Visible := False; - end; - - if (PartySession.Teams.NumTeams >= 2) then - begin - Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1); - Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2); - Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3); - Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4); - Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5); - end - else - begin - Static[StaticTeam2Joker1].Visible := False; - Static[StaticTeam2Joker2].Visible := False; - Static[StaticTeam2Joker3].Visible := False; - Static[StaticTeam2Joker4].Visible := False; - Static[StaticTeam2Joker5].Visible := False; - end; - - if (PartySession.Teams.NumTeams >= 3) then - begin - Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1); - Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2); - Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3); - Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4); - Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5); - end - else - begin - Static[StaticTeam3Joker1].Visible := False; - Static[StaticTeam3Joker2].Visible := False; - Static[StaticTeam3Joker3].Visible := False; - Static[StaticTeam3Joker4].Visible := False; - Static[StaticTeam3Joker5].Visible := False; - end; - end - else - begin //Hide all - Static[StaticTeam1Joker1].Visible := False; - Static[StaticTeam1Joker2].Visible := False; - Static[StaticTeam1Joker3].Visible := False; - Static[StaticTeam1Joker4].Visible := False; - Static[StaticTeam1Joker5].Visible := False; - - Static[StaticTeam2Joker1].Visible := False; - Static[StaticTeam2Joker2].Visible := False; - Static[StaticTeam2Joker3].Visible := False; - Static[StaticTeam2Joker4].Visible := False; - Static[StaticTeam2Joker5].Visible := False; - - Static[StaticTeam3Joker1].Visible := False; - Static[StaticTeam3Joker2].Visible := False; - Static[StaticTeam3Joker3].Visible := False; - Static[StaticTeam3Joker4].Visible := False; - Static[StaticTeam3Joker5].Visible := False; - end; -end; - -procedure TScreenSong.SetStatics; -var - I: Integer; - Visible: Boolean; -begin - //Set Visibility of Party Statics and Text - Visible := (Mode = 1); - - For I := 0 to high(StaticParty) do - Static[StaticParty[I]].Visible := Visible; - - For I := 0 to high(TextParty) do - Text[TextParty[I]].Visible := Visible; - - //Set Visibility of Non Party Statics and Text - Visible := not Visible; - - For I := 0 to high(StaticNonParty) do - Static[StaticNonParty[I]].Visible := Visible; - - For I := 0 to high(TextNonParty) do - Text[TextNonParty[I]].Visible := Visible; -end; - -//Procedures for Menu - -procedure TScreenSong.StartSong; -begin - CatSongs.Selected := Interaction; - Music.Stop; - //Party Mode - if (Mode = 1) then - begin - FadeTo(@ScreenSingModi); - end - else - begin - FadeTo(@ScreenSing); - end; -end; - -procedure TScreenSong.SelectPlayers; -begin - CatSongs.Selected := Interaction; - Music.Stop; - - ScreenName.Goto_SingScreen := True; - FadeTo(@ScreenName); -end; - -procedure TScreenSong.OpenEditor; -begin - if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin - Music.Stop; - Music.PlayStart; - ScreenEditSub.Path := CatSongs.Song[Interaction].Path; - ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName; - FadeTo(@ScreenEditSub); - end; -end; - -//Team No of Team (0-5) -procedure TScreenSong.DoJoker (Team: Byte); -begin - if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[Team].Joker); - SelectRandomSong; - SetJoker; - end; -end; - -//Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song -procedure TScreenSong.UnLoadDetailedCover; -begin - CoverTime := 0; - - Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture - Button[Interaction].Texture2.Alpha := 0; - - if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then - Texture.UnloadTexture(Button[Interaction].Texture.Name, false); -end; - -procedure TScreenSong.Refresh; -begin { -CatSongs.Refresh; -CatSongs.ShowCategoryList; -Interaction := 0; -SelectNext; -FixSelected; } - -end; - -end. +unit UScreenSong; + +interface +{$I switches.inc} + + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +uses + UMenu, + SDL, + UMusic, + UFiles, + UTime, + UDisplay, + USongs, + SysUtils, + ULog, + UThemes, + UTexture, + ULanguage, + ULCD, + ULight, + UIni; + +type + TScreenSong = class(TMenu) + public + TextArtist: integer; + TextTitle: integer; + TextNumber: integer; + + //Video Icon Mod + VideoIcon: Cardinal; + + TextCat: integer; + StaticCat: integer; + + SongCurrent: real; + SongTarget: real; + + HighSpeed: boolean; + CoverFull: boolean; + CoverTime: real; + CoverX: integer; + CoverY: integer; + CoverW: integer; + is_jump: boolean; // Jump to Song Mod + is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title + + EqualizerBands: array of Byte; + EqualizerTime: Cardinal; + EqualizerTime2: Byte; + + //Party Mod + Mode: Byte; //0 = Standard, 1= Go to PartyMode after Selection + Change to Random Song at Show + //party Statics (Joker) + StaticTeam1Joker1: Cardinal; + StaticTeam1Joker2: Cardinal; + StaticTeam1Joker3: Cardinal; + StaticTeam1Joker4: Cardinal; + StaticTeam1Joker5: Cardinal; + + StaticTeam2Joker1: Cardinal; + StaticTeam2Joker2: Cardinal; + StaticTeam2Joker3: Cardinal; + StaticTeam2Joker4: Cardinal; + StaticTeam2Joker5: Cardinal; + + StaticTeam3Joker1: Cardinal; + StaticTeam3Joker2: Cardinal; + StaticTeam3Joker3: Cardinal; + StaticTeam3Joker4: Cardinal; + StaticTeam3Joker5: Cardinal; + + StaticParty: Array of Cardinal; + TextParty: Array of Cardinal; + StaticNonParty: Array of Cardinal; + TextNonParty: Array of Cardinal; + + + constructor Create; override; + procedure SetScroll; + procedure SetScroll1; + procedure SetScroll2; + procedure SetScroll3; + procedure SetScroll4; + procedure SetScroll5; + procedure SetScroll6; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure SelectNext; + procedure SelectPrev; + procedure UpdateLCD; + procedure SkipTo(Target: Cardinal); + procedure FixSelected; //Show Wrong Song when Tabs on Fix + procedure FixSelected2; //Show Wrong Song when Tabs on Fix + procedure ShowCatTL(Cat: Integer);// Show Cat in Top left + procedure ShowCatTLCustom(Caption: String);// Show Custom Text in Top left + procedure HideCatTL;// Show Cat in Tob left + procedure Refresh; //Refresh Song Sorting + procedure DrawEqualizer; + procedure ChangeMusic; + //Party Mode + procedure SelectRandomSong; + procedure SetJoker; + procedure SetStatics; + //procedures for Menu + procedure StartSong; + procedure OpenEditor; + procedure DoJoker(Team: Byte); + procedure SelectPlayers; + + procedure UnLoadDetailedCover; + + //Extensions + procedure DrawExtensions; + end; + +implementation +uses UGraphic, + UMain, + UCovers, + math, + OpenGL12, + {$IFDEF win32} + windows, + {$ELSE} + lclintf, + {$ENDIF} + USkins, + UDLLManager, + UParty, + UPlaylist, + UScreenSongMenu; + +// ***** Public methods ****** // + +//Show Wrong Song when Tabs on Fix +procedure TScreenSong.FixSelected; +var I, I2: Integer; + begin + if CatSongs.VisibleSongs > 0 then + begin + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); + + if I = Interaction - 1 then + break; + end; + + SongCurrent := I2; + SongTarget := I2; + end; + end; + +procedure TScreenSong.FixSelected2; +var I, I2: Integer; + begin + if CatSongs.VisibleSongs > 0 then + begin + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); + + if I = Interaction - 1 then + break; + end; + + SongTarget := I2; + end; + end; +//Show Wrong Song when Tabs on Fix End + + procedure TScreenSong.ShowCatTLCustom(Caption: String);// Show Custom Text in Top left + begin + Text[TextCat].Text := Caption; + Text[TextCat].Visible := true; + Static[StaticCat].Visible := False; + end; + + //Show Cat in Top Left Mod + procedure TScreenSong.ShowCatTL(Cat: Integer); + begin + //Change + Text[TextCat].Text := CatSongs.Song[Cat].Artist; + //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover); + //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); + + Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); + //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false); + //Button[Cat]. + //Cover + + + //Show + Text[TextCat].Visible := true; + Static[StaticCat].Visible := True; + end; + + procedure TScreenSong.HideCatTL; + begin + //Hide + //Text[TextCat].Visible := false; + Static[StaticCat].Visible := false; + //New -> Show Text specified in Theme + Text[TextCat].Visible := True; + Text[TextCat].Text := Theme.Song.TextCat.Text; + end; + //Show Cat in Top Left Mod End + + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenSong.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var + I: integer; + I2: integer; + HS: integer; + SDL_ModState: Word; + Letter: Char; +begin + Result := true; + + //Song Screen Extensions (Jumpto + Menu) + if (ScreenSongMenu.Visible) then + begin + Result := ScreenSongMenu.ParseInput(PressedKey, ScanCode, PressedDown); + Exit; + end + else if (ScreenSongJumpto.Visible) then + begin + Result := ScreenSongJumpto.ParseInput(PressedKey, ScanCode, PressedDown); + Exit; + end; + + If (PressedDown) Then + begin // Key Down + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + + //Jump to Artist/Titel + if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then + begin + Letter := UpCase(Chr(ScanCode)); + I2 := Length(CatSongs.Song); + + //Jump To Titel + if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then + begin + For I := 1 to high(CatSongs.Song) do + begin + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + + Music.PlayChange; + + ChangeMusic; + SetScroll4; + UpdateLCD; + //Break and Exit + Exit; + end; + end; + end + //Jump to Artist + else if (SDL_ModState = KMOD_LALT) then + begin + For I := 1 to high(CatSongs.Song) do + begin + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Artist[1]) = Letter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + + Music.PlayChange; + + ChangeMusic; + SetScroll4; + UpdateLCD; + + //Break and Exit + Exit; + end; + end; + end; + Exit; + end; + + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + if (Mode = 0) then + begin + //On Escape goto Cat-List Hack + if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then + begin + //Find Category + I := Interaction; + while not catsongs.Song[I].Main do + begin + Dec (I); + if (I < low(catsongs.Song)) then + break; + end; + if (I<= 1) then + Interaction := high(catsongs.Song) + else + Interaction := I - 1; + + //Stop Music + Music.Stop; + + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + HideCatTL; + + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + //SelectPrev; + //CatSongs.Song[0].Visible := False; + end + else + begin + //On Escape goto Cat-List Hack End + //Tabs off and in Search or Playlist -> Go back to Song view + if (CatSongs.CatNumShow < -1) then + begin + //Atm: Set Empty Filter + CatSongs.SetFilter('', 0); + + //Show Cat in Top Left Mod + HideCatTL; + Interaction := 0; + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + + ChangeMusic; + end + else + begin + Music.Stop; + Music.PlayBack; + + FadeTo(@ScreenMain); + end; + + end; + end + //When in party Mode then Ask before Close + else if (Mode = 1) then + begin + Music.PlayBack; + CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); + end; + end; + SDLK_RETURN: + begin + if Length(Songs.Song) > 0 then + begin + {$IFDEF UseSerialPort} + // PortWriteB($378, 0); + {$ENDIF} + if CatSongs.Song[Interaction].Main then + begin // clicked on Category Button + + //Show Cat in Top Left Mod + ShowCatTL (Interaction); + + //I := CatSongs.VisibleIndex(Interaction); + CatSongs.ClickCategoryButton(Interaction); + {I2 := CatSongs.VisibleIndex(Interaction); + SongCurrent := SongCurrent - I + I2; + SongTarget := SongTarget - I + I2; } + +// if I<>I2 then beep; + // SetScroll4; + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + + //Play Music: + ChangeMusic; + + end else begin // clicked on song + if (Mode = 0) then //Normal Mode -> Start Song + begin + //Do the Action that is specified in Ini + case Ini.OnSongClick of + 0: StartSong; + 1: SelectPlayers; + 2:begin + If (CatSongs.CatNumShow = -3) then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end; + end; + end + else if (Mode = 1) then //PartyMode -> Show Menu + begin + if (Ini.PartyPopup = 1) then + ScreenSongMenu.MenuShow(SM_Party_Main) + else + ScreenSong.StartSong; + end; + end; + end; + end; + + SDLK_M: //Show SongMenu + begin + if (Length(Songs.Song) > 0) then begin + if (Mode = 0) then begin + if not CatSongs.Song[Interaction].Main then begin // clicked on Song + if CatSongs.CatNumShow = -3 then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end + else + begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); + end; + end //Party Mode -> Show Party Menu + else ScreenSongMenu.MenuShow(SM_Party_Main); + end; + end; + + SDLK_P: //Show Playlist Menu + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); + end; + end; + + SDLK_J: //Show Jumpto Menu + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then + begin + ScreenSongJumpto.Visible := True; + end; + end; + + SDLK_DOWN: + begin + if (Mode = 0) then + begin + //Only Change Cat when not in Playlist or Search Mode + if (CatSongs.CatNumShow > -2) then + begin + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then + begin + I := Interaction; + if I <= 0 then I := 1; + + while not catsongs.Song[I].Main do + begin + Inc (I); + if (I > high(catsongs.Song)) then + I := low(catsongs.Song); + end; + + Interaction := I; + + //Show Cat in Top Left Mod + ShowCatTL (Interaction); + + CatSongs.ClickCategoryButton(Interaction); + SelectNext; + FixSelected; + + //Play Music: + Music.PlayChange; + ChangeMusic; + + end; + + // + //Cat Change Hack End} + end; + end; + end; + SDLK_UP: + begin + if (Mode = 0) then + begin + //Only Change Cat when not in Playlist or Search Mode + if (CatSongs.CatNumShow > -2) then + begin + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then + begin + I := Interaction; + I2 := 0; + if I <= 0 then I := 1; + + while not catsongs.Song[I].Main or (I2 = 0) do + begin + if catsongs.Song[I].Main then + Inc(I2); + Dec (I); + if (I < low(catsongs.Song)) then + I := high(catsongs.Song); + end; + + Interaction := I; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + + //Play Music: + Music.PlayChange; + ChangeMusic; + end; + end; + //Cat Change Hack End} + end; + end; + + SDLK_RIGHT: + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + Music.PlayChange; + SelectNext; +// InteractNext; +// SongTarget := Interaction; + ChangeMusic; + SetScroll4; + UpdateLCD; + Light.LightOne(1, 200); + end; + end; + + SDLK_LEFT: + begin + if (Length(Songs.Song) > 0)AND (Mode = 0) then begin + Music.PlayChange; + SelectPrev; + ChangeMusic; + SetScroll4; + UpdateLCD; + Light.LightOne(0, 200); + end; + end; + + SDLK_E: + begin + OpenEditor; + end; + + SDLK_R: + begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + + if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category + begin + I2 := 0; //Count Cats + for I:= low(CatSongs.Song) to high (CatSongs.Song) do + if CatSongs.Song[I].Main then Inc(I2); + + I2 := Random (I2)+1; //Zufall + + //Find Cat: + for I:= low(CatSongs.Song) to high (CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + Dec(I2); + if (I2<=0) then + begin + //Show Cat in Top Left Mod + ShowCatTL (I); + + Interaction := I; + + CatSongs.ShowCategoryList; + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + break; + end; + end; + + + end + else if (SDL_ModState = KMOD_LCTRL) AND (Ini.Tabs_at_startup = 1) then //random in All Categorys + begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; + + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + + //Choose Cat + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Fix: Not Existing Song selected: + //if (I+1=I2) then Inc(I2); + + //Choose Song + SkipTo(I2-I); + + end + else //Random in one Category + begin + SkipTo(Random(CatSongs.VisibleSongs)); + end; + Music.PlayChange; + + ChangeMusic; + SetScroll4; + UpdateLCD; + end; + end; + + SDLK_1: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[0].Joker); + SelectRandomSong; + SetJoker; + end; + end; + + SDLK_2: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[1].Joker); + SelectRandomSong; + SetJoker; + end; + end; + + SDLK_3: + begin //Jocker + if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[2].Joker); + SelectRandomSong; + SetJoker; + end; + end; + end; + end; +end; + +constructor TScreenSong.Create; +var + Pet: integer; + I: integer; +Label CreateSongButtons; +begin + inherited Create; + + LoadFromTheme(Theme.Song); + + TextArtist := AddText(Theme.Song.TextArtist); + TextTitle := AddText(Theme.Song.TextTitle); + TextNumber := AddText(Theme.Song.TextNumber); + + //Show Cat in Top Left mod + TextCat := AddText(Theme.Song.TextCat); + StaticCat := AddStatic(Theme.Song.StaticCat); + + //Show Video Icon Mod + VideoIcon := AddStatic(Theme.Song.VideoIcon); + + //Party Mode + StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1); + StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2); + StaticTeam1Joker3 := AddStatic(Theme.Song.StaticTeam1Joker3); + StaticTeam1Joker4 := AddStatic(Theme.Song.StaticTeam1Joker4); + StaticTeam1Joker5 := AddStatic(Theme.Song.StaticTeam1Joker5); + + StaticTeam2Joker1 := AddStatic(Theme.Song.StaticTeam2Joker1); + StaticTeam2Joker2 := AddStatic(Theme.Song.StaticTeam2Joker2); + StaticTeam2Joker3 := AddStatic(Theme.Song.StaticTeam2Joker3); + StaticTeam2Joker4 := AddStatic(Theme.Song.StaticTeam2Joker4); + StaticTeam2Joker5 := AddStatic(Theme.Song.StaticTeam2Joker5); + + StaticTeam3Joker1 := AddStatic(Theme.Song.StaticTeam3Joker1); + StaticTeam3Joker2 := AddStatic(Theme.Song.StaticTeam3Joker2); + StaticTeam3Joker3 := AddStatic(Theme.Song.StaticTeam3Joker3); + StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); + StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); + + //Load Party or NonParty specific Statics and Texts + SetLength(StaticParty, Length(Theme.Song.StaticParty)); + for I := 0 to High(Theme.Song.StaticParty) do + StaticParty[I] := AddStatic(Theme.Song.StaticParty[I]); + + SetLength(TextParty, Length(Theme.Song.TextParty)); + for I := 0 to High(Theme.Song.TextParty) do + TextParty[I] := AddText(Theme.Song.TextParty[I]); + + SetLength(StaticNonParty, Length(Theme.Song.StaticNonParty)); + for I := 0 to High(Theme.Song.StaticNonParty) do + StaticNonParty[I] := AddStatic(Theme.Song.StaticNonParty[I]); + + SetLength(TextNonParty, Length(Theme.Song.TextNonParty)); + for I := 0 to High(Theme.Song.TextNonParty) do + TextNonParty[I] := AddText(Theme.Song.TextNonParty[I]); + + // Song List +// Songs.LoadSongList; // moved to the UltraStar unit + CatSongs.Refresh; + + if (length(CatSongs.Song) > 0) then + begin + //Set Length of Button Array one Time Instead of one time for every Song + SetButtonLength(Length(CatSongs.Song)); + + I := 0; + CreateSongButtons: + + try + for Pet := I to High(CatSongs.Song) do begin // creating all buttons + // new + Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 + + if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' + + if CatSongs.Song[Pet].Cover = '' then + AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) + else begin + // cache texture if there is a need to this + if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + begin + Texture.CreateCacheMipmap := true; + Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap + Texture.CreateCacheMipmap := false; + + // puts this texture to the cache file + Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + + // unload full size texture + Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); + + // we should also add mipmap texture by calling createtexture and use mipmap cache as data source + end; + + // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) + AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + end; + Texture.Limit := 1024*1024; + I := -1; + end; + except + //When Error is reported the First time for this Song + if (I <> Pet) then + begin + //Some Error reporting: + Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); + + //Change Cover to NoCover and Continue Loading + CatSongs.Song[Pet].Cover := ''; + I := Pet; + end + else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song + begin + Log.LogError('NoCover Cover is damaged!'); + try + AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); + except + {$IFDEF win32} + Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); + {$ELSE} + // TODO : JB_linux - better handle this message and display to user.. + writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'); + Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' ); + {$ENDIF} + Halt; + end; + I := Pet + 1; + end; + end; + + if (I <> -1) then + GoTo CreateSongButtons; + + end; + + // Randomize Patch + Randomize; + //Equalizer + SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); + //ClearArray + For I := low(EqualizerBands) to high(EqualizerBands) do + EqualizerBands[I] := 3; + + if (Length(CatSongs.Song) > 0) then + Interaction := 0; +end; + +procedure TScreenSong.SetScroll; +var + VS, B: Integer; +begin + VS := CatSongs.VisibleSongs; + if VS > 0 then + begin + //Set Positions + Case Theme.Song.Cover.Style of + 3: SetScroll3; + 5:begin + if VS > 5 then + SetScroll5 + else + SetScroll4; + end; + 6: SetScroll6; + else SetScroll4; + end; + //Set Visibility of Video Icon + Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> ''); + + //Set Texts: + Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; + Text[TextTitle].Text := CatSongs.Song[Interaction].Title; + if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then + begin + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); + Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; + end + else if (CatSongs.CatNumShow = -2) then + Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) + else if (CatSongs.CatNumShow = -3) then + Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) + else if (Ini.Tabs_at_startup = 1) then + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) + else + Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); + end + else + begin + Text[TextNumber].Text := '0/0'; + Text[TextArtist].Text := ''; + Text[TextTitle].Text := ''; + for B := 0 to High(Button) do + Button[B].Visible := False; + + end; +end; + +procedure TScreenSong.SetScroll1; +var + B: integer; // button + BMin: integer; // button min + BMax: integer; // button max + Src: integer; +// Dst: integer; + Count: integer; // Dst is not used. Count is used. + Ready: boolean; + + VisCount: integer; // count of visible (or selectable) buttons + VisInt: integer; // visible position of interacted button + Typ: integer; // 0 when all songs fits the screen + Placed: integer; // number of placed visible buttons +begin +// Src := 0; +// Dst := -1; + Count := 1; + Typ := 0; + Ready := false; + Placed := 0; + + VisCount := 0; + for B := 0 to High(Button) do + if CatSongs.Song[B].Visible then Inc(VisCount); + + VisInt := 0; + for B := 0 to Interaction-1 do + if CatSongs.Song[B].Visible then Inc(VisInt); + + + if VisCount <= 6 then begin + Typ := 0; + end else begin + if VisInt <= 3 then begin + Typ := 1; + Count := 7; + Ready := true; + end; + + if (VisCount - VisInt) <= 3 then begin + Typ := 2; + Count := 7; + Ready := true; + end; + + if not Ready then begin + Typ := 3; + Src := Interaction; + end; + end; + + + + // hide all buttons + for B := 0 to High(Button) do begin + Button[B].Visible := false; + Button[B].Selectable := CatSongs.Song[B].Visible; + end; + +{ for B := Src to Dst do begin +// Button[B].Visible := true; + Button[B].Visible := CatSongs.Song[B].Visible; + Button[B].Selectable := Button[B].Visible; + Button[B].Y := 140 + (B-Src) * 60; + end;} + + + if Typ = 0 then begin + for B := 0 to High(Button) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (Placed) * 60; + Inc(Placed); + end; + end; + end; + + if Typ = 1 then begin + B := 0; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Inc(B); + end; + end; + + if Typ = 2 then begin + B := High(Button); + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (6-Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Dec(B); + end; + end; + + if Typ = 3 then begin + B := Src; + Count := 4; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (3+Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Inc(B); + end; + + B := Src-1; + Placed := 0; + Count := 3; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (2-Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Dec(B); + end; + + end; + + if Length(Button) > 0 then + Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture +end; + +procedure TScreenSong.SetScroll2; +var + B: integer; + Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu + Wsp2: real; +begin + // liniowe + for B := 0 to High(Button) do + Button[B].X := 300 + (B - Interaction) * 260; + + if Length(Button) >= 3 then begin + if Interaction = 0 then + Button[High(Button)].X := 300 - 260; + + if Interaction = High(Button) then + Button[0].X := 300 + 260; + end; + + // kolowe +{ for B := 0 to High(Button) do begin + Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. + Wsp2 := Wsp / Length(Button); + Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); +// Button[B].Y := 140 + 50 * ; + end;} +end; + +procedure TScreenSong.SetScroll3; // with slide +var + B: integer; + Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu + Wsp2: real; +begin + SongTarget := Interaction; + + // liniowe + for B := 0 to High(Button) do + begin + Button[B].X := 300 + (B - SongCurrent) * 260; + if (Button[B].X < -Button[B].W) OR (Button[B].X > 800) then + Button[B].Visible := False + else + Button[B].Visible := True; + end; + +{ if Length(Button) >= 3 then begin + if Interaction = 0 then + Button[High(Button)].X := 300 - 260; + + if Interaction = High(Button) then + Button[0].X := 300 + 260; + end;} + + // kolowe +{ for B := 0 to High(Button) do begin + Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. + Wsp2 := Wsp / Length(Button); + Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); +// Button[B].Y := 140 + 50 * ; + end;} +end; + +procedure TScreenSong.SetScroll4; // rotate +var + B: integer; + Wsp: real; + Z, Z2: real; + VS: integer; +begin + VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important + + // kolowe + for B := 0 to High(Button) do begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2; + Z2 := (1 + 2*Z) / 3; + + + Button[B].X := Theme.Song.Cover.X + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z / 2 + 0.3; + + Button[B].W := Theme.Song.Cover.H * Z2; + +// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; + Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; + Button[B].H := Button[B].W; + end; + end; +end; + +(* +procedure TScreenSong.SetScroll4; // rotate +var + B: integer; + Wsp: real; + Z: real; + Z2, Z3: real; + VS: integer; + function modreal (const X, Y: real):real; + begin + Result := Frac(x / y) * y; + if Result < -3 then + Result := Result + Y + else if Result > 3 then + Result := Result - Y; + end; +begin + VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important + Z3 := 1; + if VS < 12 then + Z2 := VS + else + Z2 := 12; + + // kolowe + for B := 0 to High(Button) do begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + if ((ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)>-3) AND (ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)<3)) then + begin + if CatSongs.VisibleIndex(B)> SongCurrent then + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2 + else + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2; + + Z3 := 2; + Z := (1 + cos(Wsp)) / 2; + //Z2 := (1 + 2*Z) / 3; + //Z2 := (0.5 + Z/2); + //Z2 := sin(Wsp); + + //Z2 := Power (Z2,Z3); + + Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); + + //Button[B].X := Theme.Song.CoverX + ({Theme.Song.CoverX + Theme.Song.CoverW/2 + Theme.Song.CoverW*0.18 * VS {CatSongs.VisibleSongs {Length(Button) * sin(Wsp) {- Theme.Song.CoverX - Theme.Song.CoverW) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + if (sin(Wsp)<0) then + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W + else //*Theme.Song.CoverW*0.004*Z3 + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; + Button[B].Z := Z-0.00001; + +// Button[B].Y := {50 + 140 + 50 - 50 * Z2; + // Button[B].Y := (Theme.Song.CoverY + 40 + 50 - 50 * Z2); + Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); + Button[B].H := Button[B].W; + Button[B].Visible := True; + end + {else if (((CatSongs.VisibleIndex(B) - SongCurrent)>-3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) OR ((round (CatSongs.VisibleIndex(B) - SongCurrent) mod VS > -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) then + begin + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / 12 ;// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2 -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); + + if (sin(Wsp)<0) then + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W + else + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; + + Button[B].Z := Z; + + Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); + + Button[B].H := Button[B].W; + Button[B].Visible := True; + end + else Button[B].Visible := False; + end; + end; +end; *) + +procedure TScreenSong.SetScroll5; // rotate +var + B: integer; + Angle: real; + Pos: Real; + VS: integer; + diff: real; + X: Real; + helper: real; +begin + VS := CatSongs.VisibleSongs; // cache Visible Songs + {Vars + Theme.Song.CoverW: Radius des Kreises + Theme.Song.CoverX: X Pos Linke Kante des gewählten Covers + Theme.Song.CoverX: Y Pos Obere Kante des gewählten Covers + Theme.Song.CoverH: Höhe der Cover + + (CatSongs.VisibleIndex(B) - SongCurrent)/VS = Abstand zum MIttleren Cover in % + } + + //Change Pos of all Buttons + for B := low(Button) to high(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility + if Button[B].Visible then //Only Change Pos for Visible Buttons + begin + Pos := (CatSongs.VisibleIndex(B) - SongCurrent); + if (Pos < -VS/2) then + Pos := Pos + VS + else if (Pos > VS/2) then + Pos := Pos - VS; + + if (Abs(Pos) < 2.5) then {fixed Positions} + begin + Angle := Pi * (Pos / 5); +// Button[B].Visible := False; + + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); + +// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Z := 0.95 - Abs(Pos) * 0.01; + + Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); + + Button[B].W := Button[B].H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + + X := Sin(Angle*1.3)*0.9; + + Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Diff; + + end + else + begin {Behind the Front Covers} + + // limit-bg-covers hack + if (abs(abs(Pos)-VS/2)>10) then Button[B].Visible:=False; + // end of limit-bg-covers hack + + if Pos < 0 then + Pos := (Pos - VS/2)/VS + else + Pos := (Pos + VS/2)/VS; + + Angle := pi * Pos*2; + if VS > 24 then + begin + if Angle < 0 then helper:=-1 else helper:=1; + Angle:=2*pi-abs(Angle); + Angle:=Angle*(VS/24); + Angle:=(2*pi-Angle)*helper; + end; + + Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); + + Button[B].W := Button[B].H; + + Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; + +// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*((Theme.Song.Cover.H)*sin(Angle/2)*1.52); + + end; + + //Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field +// Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); + + end; + end; +end; + +procedure TScreenSong.SetScroll6; // rotate (slotmachine style) +var + B: integer; + Angle: real; + Pos: Real; + VS: integer; + diff: real; + X: Real; + Wsp: real; + Z, Z2: real; +begin + VS := CatSongs.VisibleSongs; // cache Visible Songs + if VS <=5 then begin + // kolowe + for B := 0 to High(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2; + Z2 := (1 + 2*Z) / 3; + + + Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z / 2 + 0.3; + + Button[B].W := Theme.Song.Cover.H * Z2; + +// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; + Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; + Button[B].H := Button[B].W; + end; + end; + end + else begin + + //Change Pos of all Buttons + for B := low(Button) to high(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility + if Button[B].Visible then //Only Change Pos for Visible Buttons + begin + Pos := (CatSongs.VisibleIndex(B) - SongCurrent); + if (Pos < -VS/2) then + Pos := Pos + VS + else if (Pos > VS/2) then + Pos := Pos - VS; + + if (Abs(Pos) < 2.5) then {fixed Positions} + begin + Angle := Pi * (Pos / 5); +// Button[B].Visible := False; + + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); + + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Z := 0.95 - Abs(Pos) * 0.01; + + Button[B].X := (Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); + + Button[B].W := Button[B].H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + + X := Sin(Angle*1.3)*0.9; + + Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff; + end + else + begin {Behind the Front Covers} + + // limit-bg-covers hack + if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; + if VS > 25 then VS:=25; + // end of limit-bg-covers hack + + if Pos < 0 then + Pos := (Pos - VS/2)/VS + else + Pos := (Pos + VS/2)/VS; + + Angle := pi * Pos*2; + + Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); + + Button[B].W := Button[B].H; + + Button[B].X := Theme.Song.Cover.X - (Button[B].H - Theme.Song.Cover.H)*0.5; + + + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Y := Theme.Song.Cover.Y+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*(Theme.Song.Cover.H*sin(Angle/2)*1.52); + end; + end; + end; + end; +end; + + +procedure TScreenSong.onShow; +begin + Music.Stop; + + if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; + if Ini.Players = 4 then PlayersPlay := 6; + + //Cat Mod etc + if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then + begin + CatSongs.ShowCategoryList; + FixSelected; + //Show Cat in Top Left Mod + HideCatTL; + end; + + + if Length(CatSongs.Song) > 0 then begin + //Load Music only when Song Preview is activated + if (Ini.PreviewVolume <> 0) then + begin + Music.SetLoop(false); + Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + Music.MoveTo(Music.Length / 4); + Music.Play; + + //Set Preview Volume + Music.SetMusicVolume (Ini.PreviewVolume * 10); + {//if Music Fade is activated, Set Volume to 0 % + if (Ini.PreviewFading <> 0) then + Music.SetMusicVolume(0);} + end; + + SetScroll; + UpdateLCD; + end; + + //Playlist Mode + if (Mode = 0) then + begin + //If Playlist Shown -> Select Next automatically + if (CatSongs.CatNumShow = -3) then + begin + SelectNext; + ChangeMusic; + end; + end + //Party Mode + else if (Mode = 1) then + begin + + SelectRandomSong; + //Show Menu directly in PartyMode + //But only if selected in Options + if (Ini.PartyPopup = 1) then + begin + ScreenSongMenu.MenuShow(SM_Party_Main); + end; + + + end; + + SetJoker; + SetStatics; +end; + +procedure TScreenSong.onHide; +begin + //When Music Fading is activated, Turn Music to 100 % + If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then + Music.SetMusicVolume(100); + + //If Preview is deactivated: Load MUsicfile now + If (Ini.PreviewVolume = 0) then + Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + + //When hide then Stop Music (For Party Mode Popup on Exit) + if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then + Music.Stop; +end; + +procedure TScreenSong.DrawExtensions; +begin + //Draw Song Menu + if (ScreenSongMenu.Visible) then + begin + ScreenSongMenu.Draw; + end + else if (ScreenSongJumpto.Visible) then + begin + ScreenSongJumpto.Draw; + end +end; + +function TScreenSong.Draw: boolean; +var + dx: real; + dt: real; + I: Integer; +begin + dx := SongTarget-SongCurrent; + dt := TimeSkip*7; + if dt > 1 then dt := 1; + SongCurrent := SongCurrent + dx*dt; + +{ if SongCurrent > Catsongs.VisibleSongs then begin + SongCurrent := SongCurrent - Catsongs.VisibleSongs; + SongTarget := SongTarget - Catsongs.VisibleSongs; + end;} + +// Log.BenchmarkStart(5); + SetScroll; +// Log.BenchmarkEnd(5); +// Log.LogBenchmark('SetScroll4', 5); + + //Fading Functions, Only if Covertime is under 5 Seconds + If (CoverTime < 5) then + begin + // 0.5.0: cover fade + if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin + // load new texture + Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture.Alpha := 1; + Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture2.Alpha := 1; + end; + + //Song Fade + if (CatSongs.VisibleSongs > 0) AND (Ini.PreviewVolume <> 0) AND (Not CatSongs.Song[Interaction].Main) AND (Ini.PreviewFading <> 0) then + begin + //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling + if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then + Music.Play; + + //Update Song Volume + if (CoverTime < Ini.PreviewFading) then + Music.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) + else + Music.SetMusicVolume(Ini.PreviewVolume * 10); + + end; + + + //Update Fading Time + CoverTime := CoverTime + TimeSkip; + + //Update Fading Texture + Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; + if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; + + end; + + //inherited Draw; + //heres a little Hack, that causes the Statics + //are Drawn after the Buttons because of some Blending Problems. + //This should cause no Problems because all Buttons on this screen + //Has Z Position. + //Draw BG + DrawBG; + + //Instead of Draw FG Procedure: + //We draw Buttons for our own + for I := 0 to Length(Button) - 1 do + Button[I].Draw; + + // Statics + for I := 0 to Length(Static) - 1 do + Static[I].Draw; + + // and texts + for I := 0 to Length(Text) - 1 do + Text[I].Draw; + + + //Draw Equalizer + if Theme.Song.Equalizer.Visible then + DrawEqualizer; + + DrawExtensions; + +end; + +procedure TScreenSong.SelectNext; +var + Skip: integer; + I: integer; + VS: Integer; +begin + VS := CatSongs.VisibleSongs; + + if VS > 0 then + begin + UnLoadDetailedCover; + + Skip := 1; + + // this 1 could be changed by CatSongs.FindNextVisible + while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); + + SongTarget := SongTarget + 1;//Skip; + + Interaction := (Interaction + Skip) mod Length(Interactions); + + // try to keep all at the beginning + if SongTarget > VS-1 then begin + SongTarget := SongTarget - VS; + SongCurrent := SongCurrent - VS; + end; + + end; + // Interaction -> Button, ktorego okladke przeczytamy + // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture +end; + +procedure TScreenSong.SelectPrev; +var + Skip: integer; + I: integer; + VS: Integer; +begin + VS := CatSongs.VisibleSongs; + + if VS > 0 then + begin + UnLoadDetailedCover; + + Skip := 1; + + while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); + SongTarget := SongTarget - 1;//Skip; + + Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); + + // try to keep all at the beginning + if SongTarget < 0 then begin + SongTarget := SongTarget + CatSongs.VisibleSongs; + SongCurrent := SongCurrent + CatSongs.VisibleSongs; + end; + + // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture + end; +end; + +procedure TScreenSong.UpdateLCD; +begin + LCD.HideCursor; + LCD.Clear; + LCD.WriteText(1, Text[TextArtist].Text); + LCD.WriteText(2, Text[TextTitle].Text); +end; + +//Procedure Change current played Preview +procedure TScreenSong.ChangeMusic; +begin + //When Music Preview is avtivated -> then Change Music + if (Ini.PreviewVolume <> 0) then + begin + if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then + begin + Music.Close; + if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + Music.MoveTo(Music.Length / 4); + //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal + if (Ini.PreviewFading = 0) then + Music.Play + else + Music.SetMusicVolume(0); + end; + end + else + Music.Stop; + end; +end; + +procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0 +var + Skip: integer; + I: integer; +begin + UnLoadDetailedCover; + + Interaction := High(CatSongs.Song); + SongTarget := 0; + + for I := 1 to Target+1 do + SelectNext; + + FixSelected2; +end; + +procedure TScreenSong.DrawEqualizer; +var + Data: TFFTData; //Audio Data + I, J: Integer; + Res: byte; + A, B: Integer; + PosX, PosY: Integer; + Pos: Real; + lTmp : double; +begin + +if (not Music.Finished) AND (Theme.Song.Equalizer.Length > 0) then +begin + + + A := GetTickCount div 44; + + if (A <> EqualizerTime) then + begin + EqualizerTime := A; + Data := Music.GetFFTData; + + B:=0; + Pos := 0; + Res := ceil(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band + + //Change Lengths + for I := 0 to (Res * Theme.Song.Equalizer.Bands - 1) do + begin + A := floor(I/Res); + + if (A<>B) then //Band changed + begin + if (Pos <= Theme.Song.Equalizer.Length) then + begin + if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then + EqualizerBands[B] := EqualizerBands[B] - 1 + else + EqualizerBands[B] := floor(Pos); + end + else + EqualizerBands[B] := 1; + + B := A; + Pos := 0; + end; + + if I > 35 then + Data[i] := Data[i] * 8 + else if I > 11 then + Data[i] := Data[i] * 4.5 + else + Data[i] := Data[i] * 1.1; + + if (Data[i] >= 1) then + Data[i] := 0.9999999999999; + + try + if ( assigned( Theme ) ) AND + ( assigned( Theme.Song ) ) AND + ( i < length( Data ) ) THEN + begin + writeln( '!!!!!!!!! - '+ inttostr( i ) + ' - ' + inttostr( Theme.Song.Equalizer.Length ) ); + + if Single(Data[i]) > 0 then + begin + lTmp := Single(Data[i]) * Theme.Song.Equalizer.Length; + if lTmp > Pos then + Pos := lTmp; + end; + end; + except + // TODO: JB_Linux..... why does this happen ! + on E:EInvalidOp do + writeln( 'UScreenSong - DOH !!!!' ); + end + + end; + + //Change Last Band + if (EqualizerBands[B] <= Theme.Song.Equalizer.Length) then + begin + if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then + EqualizerBands[B] := EqualizerBands[B] - 1 + else + EqualizerBands[B] := floor(Pos) + end + else + EqualizerBands[B] := 1; + end; + + //Draw every Channel + glColor4f(Theme.Song.Equalizer.ColR, Theme.Song.Equalizer.ColG, Theme.Song.Equalizer.ColB, Theme.Song.Equalizer.Alpha); //Set Color + glDisable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + + PosY := Theme.Song.Equalizer.Y; + PosX := Theme.Song.Equalizer.X; + + For I := 0 to Theme.Song.Equalizer.Bands-1 do + begin + if Theme.Song.Equalizer.Direction then + PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length + else + PosX := Theme.Song.Equalizer.X; + //Draw for every visible quad + for J := 1 to EqualizerBands[I] do + begin + glBegin(GL_QUADS); + glVertex3f(PosX, PosY, Theme.Song.Equalizer.Z); + glVertex3f(PosX, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); + glVertex3f(PosX+Theme.Song.Equalizer.W, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); + glVertex3f(PosX+Theme.Song.Equalizer.W, PosY, Theme.Song.Equalizer.Z); + glEnd; + + if Theme.Song.Equalizer.Direction then //Vertically + PosY := PosY - Theme.Song.Equalizer.H - Theme.Song.Equalizer.Space + else //Horizontally + PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space; + end; + if Theme.Song.Equalizer.Direction then //Horizontally + PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space + else //Vertically + PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space; + end; +end; +end; + +Procedure TScreenSong.SelectRandomSong; +var + I, I2: Integer; +begin + Case PlaylistMan.Mode of + 0: //All Songs Just Select Random Song + begin + //When Tabs are activated then use Tab Method + if (Ini.Tabs_at_startup = 1) then + begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; + + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + //I is the CatNum, I2 is the No of the Song within this Cat + + //Choose Cat + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Choose Song + SkipTo(I2-I); + end + //When Tabs are deactivated use easy Method + else + SkipTo(Random(CatSongs.VisibleSongs)); + end; + 1: //One Category Select Category and Select Random Song + begin + CatSongs.ShowCategoryList; + CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); + ShowCatTL(PlaylistMan.CurPlayList); + + SelectNext; + FixSelected2; + + SkipTo(Random(CatSongs.VisibleSongs)); + end; + 2: //Playlist: Select Playlist and Select Random Song + begin + PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); + + SkipTo(Random(CatSongs.VisibleSongs)); + FixSelected2; + end; + end; + + Music.PlayChange; + ChangeMusic; + SetScroll; + UpdateLCD; +end; + +procedure TScreenSong.SetJoker; +begin + //If Party Mode + if Mode = 1 then //Show Joker that are available + begin + if (PartySession.Teams.NumTeams >= 1) then + begin + Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1); + Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2); + Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3); + Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4); + Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5); + end + else + begin + Static[StaticTeam1Joker1].Visible := False; + Static[StaticTeam1Joker2].Visible := False; + Static[StaticTeam1Joker3].Visible := False; + Static[StaticTeam1Joker4].Visible := False; + Static[StaticTeam1Joker5].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 2) then + begin + Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1); + Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2); + Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3); + Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4); + Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5); + end + else + begin + Static[StaticTeam2Joker1].Visible := False; + Static[StaticTeam2Joker2].Visible := False; + Static[StaticTeam2Joker3].Visible := False; + Static[StaticTeam2Joker4].Visible := False; + Static[StaticTeam2Joker5].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 3) then + begin + Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1); + Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2); + Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3); + Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4); + Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5); + end + else + begin + Static[StaticTeam3Joker1].Visible := False; + Static[StaticTeam3Joker2].Visible := False; + Static[StaticTeam3Joker3].Visible := False; + Static[StaticTeam3Joker4].Visible := False; + Static[StaticTeam3Joker5].Visible := False; + end; + end + else + begin //Hide all + Static[StaticTeam1Joker1].Visible := False; + Static[StaticTeam1Joker2].Visible := False; + Static[StaticTeam1Joker3].Visible := False; + Static[StaticTeam1Joker4].Visible := False; + Static[StaticTeam1Joker5].Visible := False; + + Static[StaticTeam2Joker1].Visible := False; + Static[StaticTeam2Joker2].Visible := False; + Static[StaticTeam2Joker3].Visible := False; + Static[StaticTeam2Joker4].Visible := False; + Static[StaticTeam2Joker5].Visible := False; + + Static[StaticTeam3Joker1].Visible := False; + Static[StaticTeam3Joker2].Visible := False; + Static[StaticTeam3Joker3].Visible := False; + Static[StaticTeam3Joker4].Visible := False; + Static[StaticTeam3Joker5].Visible := False; + end; +end; + +procedure TScreenSong.SetStatics; +var + I: Integer; + Visible: Boolean; +begin + //Set Visibility of Party Statics and Text + Visible := (Mode = 1); + + For I := 0 to high(StaticParty) do + Static[StaticParty[I]].Visible := Visible; + + For I := 0 to high(TextParty) do + Text[TextParty[I]].Visible := Visible; + + //Set Visibility of Non Party Statics and Text + Visible := not Visible; + + For I := 0 to high(StaticNonParty) do + Static[StaticNonParty[I]].Visible := Visible; + + For I := 0 to high(TextNonParty) do + Text[TextNonParty[I]].Visible := Visible; +end; + +//Procedures for Menu + +procedure TScreenSong.StartSong; +begin + CatSongs.Selected := Interaction; + Music.Stop; + //Party Mode + if (Mode = 1) then + begin + FadeTo(@ScreenSingModi); + end + else + begin + FadeTo(@ScreenSing); + end; +end; + +procedure TScreenSong.SelectPlayers; +begin + CatSongs.Selected := Interaction; + Music.Stop; + + ScreenName.Goto_SingScreen := True; + FadeTo(@ScreenName); +end; + +procedure TScreenSong.OpenEditor; +begin + if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin + Music.Stop; + Music.PlayStart; + ScreenEditSub.Path := CatSongs.Song[Interaction].Path; + ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName; + FadeTo(@ScreenEditSub); + end; +end; + +//Team No of Team (0-5) +procedure TScreenSong.DoJoker (Team: Byte); +begin + if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[Team].Joker); + SelectRandomSong; + SetJoker; + end; +end; + +//Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song +procedure TScreenSong.UnLoadDetailedCover; +begin + CoverTime := 0; + + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture + Button[Interaction].Texture2.Alpha := 0; + + if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then + Texture.UnloadTexture(Button[Interaction].Texture.Name, false); +end; + +procedure TScreenSong.Refresh; +begin { +CatSongs.Refresh; +CatSongs.ShowCategoryList; +Interaction := 0; +SelectNext; +FixSelected; } + +end; + +end. -- cgit v1.2.3 From d123263213fba448d5695df35660f7de4cbed433 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 11 Oct 2007 08:11:47 +0000 Subject: modified UTime to utilise SDL timer... this allows for reliable cross platform timers. Tested working on linux. Modified UVideo and screens to get Video playback working on linux currently only video stream... no audio.. but I Will be working towards this, for all audio playback ( at least for linux ) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@501 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 2615 +++++++++++++++++++------------------ Game/Code/Screens/UScreenSong.pas | 37 +- 2 files changed, 1335 insertions(+), 1317 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 391fdccf..9e43f31f 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1,1300 +1,1315 @@ -unit UScreenSing; - -interface - -{$I switches.inc} - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - - -uses UMenu, - UMusic, - SDL, - SysUtils, - UFiles, - UTime, - USongs, - UIni, - ULog, - UTexture, - ULyrics, - TextGL, - OpenGL12, - {$IFDEF useBASS} - bass, - {$ENDIF} - UThemes, - ULCD, - UGraphicClasses, - UVideo, - USingScores; - -type - TScreenSing = class(TMenu) - protected - paused: boolean; //Pause Mod - PauseTime: Real; - NumEmptySentences: integer; - public - //TextTime: integer; - - //TimeBar mod - StaticTimeProgress: integer; - TextTimeText: integer; - //eoa TimeBar mod - - StaticP1: integer; - TextP1: integer; - {StaticP1ScoreBG: integer; - TextP1Score: integer;} - - {//moveable singbar mod - StaticP1SingBar: integer; - StaticP1ThreePSingBar: integer; - StaticP1TwoPSingBar: integer; - StaticP2RSingBar: integer; - StaticP2MSingBar: integer; - StaticP3SingBar: integer; - //eoa moveable singbar } - - //Added for ps3 skin - //shown when game is in 2/4 player modus - StaticP1TwoP: integer; - TextP1TwoP: integer; - - {StaticP1TwoPScoreBG: integer; - TextP1TwoPScore: integer;} - //shown when game is in 3/6 player modus - StaticP1ThreeP: integer; - TextP1ThreeP: integer; - - {TextP1ThreePScore: integer; - StaticP1ThreePScoreBG: integer; } - //eoa - - StaticP2R: integer; - TextP2R: integer; - - {StaticP2RScoreBG: integer; - TextP2RScore: integer;} - - StaticP2M: integer; - TextP2M: integer; - - {StaticP2MScoreBG: integer; - TextP2MScore: integer; } - - StaticP3R: integer; - TextP3R: integer; - - {StaticP3RScoreBG: integer; - TextP3RScore: integer;} - - Tex_Background: TTexture; - FadeOut: boolean; -// LyricMain: TLyric; -// LyricSub: TLyric; - Lyrics: TLyricEngine; - - //Score Manager: - Scores: TSingScores; - - constructor Create; override; - procedure onShow; override; - procedure onShowFinish; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure Finish; virtual; - procedure UpdateLCD; - procedure Pause; //Pause Mod(Toggles Pause) - - //OnSentenceEnd for LineBonus + Singbar - procedure onSentenceEnd(S: Cardinal); - //OnSentenceChange (for Golden Notes) - procedure onSentenceChange(S: Cardinal); - end; - -implementation -uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math; - -// Method for input parsing. If False is returned, GetNextWindow -// should be checked to know the next window to load; -function TScreenSing.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then - begin // Key Down - case PressedKey of - SDLK_Q: - begin - //When not ask before Exit then Finish now - if (Ini.AskbeforeDel <> 1) then - Finish - //else just Pause and let the Popup make the Work - else if not paused then - Pause; - - Result := false; - end; - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - //Record Sound Hack: - //Sound[0].BufferLong - - Finish; - Music.PlayBack; - FadeTo(@ScreenScore); - end; - - SDLK_P://Pause Mod - begin - Pause; - end; - - SDLK_RETURN: - begin - 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 : - begin - end; - SDLK_UP : - begin - end; - end; - end; -end; - -//Pause Mod -procedure TScreenSing.Pause; -begin - if not paused then //Pause einschalten - begin - // pause Time - PauseTime := Czas.Teraz; - Paused := true; - - // pause Music - Music.Pause; - - // pause Video - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then - FFmpegTogglePause; - end - else //Pause ausschalten - begin - Czas.Teraz := PauseTime; //Position of Notes - - // Position of Music - Music.MoveTo (PauseTime); - // Play Music - Music.Play; - - // Video - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then - FFmpegTogglePause; - //SkipSmpeg(PauseTime); - - Paused := false; - end; -end; -//Pause Mod End - -constructor TScreenSing.Create; -var - I: integer; - P: integer; -begin - inherited Create; - - //Create Score Class - Scores := TSingScores.Create; - Scores.LoadfromTheme; - - LoadFromTheme(Theme.Sing); - - //TimeBar - StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); - TextTimeText := AddText(Theme.Sing.TextTimeText); - -// 1 player | P1 - StaticP1 := AddStatic(Theme.Sing.StaticP1); - TextP1 := AddText(Theme.Sing.TextP1); - - {StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); - TextP1Score := AddText(Theme.Sing.TextP1Score); - StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar);} - -// 2 or 4 players | P1 - StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); - TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); - - {StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG); - TextP1TwoPScore := AddText(Theme.Sing.TextP1TwoPScore); - StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar);} - - // | P2 - StaticP2R := AddStatic(Theme.Sing.StaticP2R); - TextP2R := AddText(Theme.Sing.TextP2R); - - {StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); - TextP2RScore := AddText(Theme.Sing.TextP2RScore); - StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); } - -// 3 or 6 players | P1 - StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); - TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); - - {StaticP1ThreePScoreBG := AddStatic(Theme.Sing.StaticP1ThreePScoreBG); - TextP1ThreePScore := AddText(Theme.Sing.TextP1ThreePScore); - StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar);} - - // | P2 - StaticP2M := AddStatic(Theme.Sing.StaticP2M); - TextP2M := AddText(Theme.Sing.TextP2M); - - {StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG); - TextP2MScore := AddText(Theme.Sing.TextP2MScore); - StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar);} - - // | P3 - StaticP3R := AddStatic(Theme.Sing.StaticP3R); - TextP3R := AddText(Theme.Sing.TextP3R); - - {StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG); - TextP3RScore := AddText(Theme.Sing.TextP3RScore); - StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar);} - - if ScreenAct = 2 then begin - // katze und affe - - end; - - Lyrics := TLyricEngine.Create(80,Skin_LyricsT,640,12,80,Skin_LyricsT+36,640,12); - - UVideo.Init; -end; - -procedure TScreenSing.onShow; -var - P: integer; - V1: boolean; - V1TwoP: boolean; //added for ps3 skin - V1ThreeP: boolean; //added for ps3 skin - V2R: boolean; - V2M: boolean; - V3R: boolean; - NR: TRecR; //Line Bonus Mod - - Color: TRGB; -begin - Log.LogStatus('Begin', 'onShow'); - FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented - - //SetUp Score Manager - Scores.ClearPlayers; //Clear Old Player Values - Color.R := 0; Color.G := 0; Color.B := 0; //Dummy atm - For P := 0 to PlayersPlay -1 do //Add new Ones - begin - Scores.AddPlayer(Tex_ScoreBG[P], Color); - end; - - Scores.Init; //Get Positions for Players - - - - // prepare players - SetLength(Player, PlayersPlay); -// Player[0].ScoreTotalI := 0; - - case PlayersPlay of - 1: begin - V1 := true; - V1TwoP := false; - V1ThreeP := false; - V2R := false; - V2M := false; - V3R := false; - end; - 2: begin - V1 := false; - V1TwoP := true; - V1ThreeP := false; - V2R := true; - V2M := false; - V3R := false; - end; - 3: begin - V1 := false; - V1TwoP := false; - V1ThreeP := true; - V2R := false; - V2M := true; - V3R := true; - end; - 4: begin // double screen - V1 := false; - V1TwoP := true; - V1ThreeP := false; - V2R := true; - V2M := false; - V3R := false; - end; - 6: begin // double screen - V1 := false; - V1TwoP := false; - V1ThreeP := true; - V2R := false; - V2M := true; - V3R := true; - end; - - end; - - //This one is shown in 1P mode - Static[StaticP1].Visible := V1; - Text[TextP1].Visible := V1; - - {Static[StaticP1ScoreBG].Visible := V1; - Text[TextP1Score].Visible := V1;} - - - //This one is shown in 2/4P mode - Static[StaticP1TwoP].Visible := V1TwoP; - Text[TextP1TwoP].Visible := V1TwoP; - - {Static[StaticP1TwoPScoreBG].Visible := V1TwoP; - Text[TextP1TwoPScore].Visible := V1TwoP;} - - Static[StaticP2R].Visible := V2R; - Text[TextP2R].Visible := V2R; - - {Static[StaticP2RScoreBG].Visible := V2R; - Text[TextP2RScore].Visible := V2R; } - - - //This one is shown in 3/6P mode - Static[StaticP1ThreeP].Visible := V1ThreeP; - Text[TextP1ThreeP].Visible := V1ThreeP; - - {Static[StaticP1ThreePScoreBG].Visible := V1ThreeP; - Text[TextP1ThreePScore].Visible := V1ThreeP; } - - Static[StaticP2M].Visible := V2M; - Text[TextP2M].Visible := V2M; - - {Static[StaticP2MScoreBG].Visible := V2M; - Text[TextP2MScore].Visible := V2M; } - - Static[StaticP3R].Visible := V3R; - Text[TextP3R].Visible := V3R; - - {Static[StaticP3RScoreBG].Visible := V3R; - Text[TextP3RScore].Visible := V3R; } - - // load notes - ResetSingTemp; -// Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); - AktSong := CatSongs.Song[CatSongs.Selected]; - try - if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName) then - begin - //Error Loading Song -> Go back to Song Screen and Show some Error Message - FadeTo(@ScreenSong); - //Select New Song in Party Mode - if ScreenSong.Mode = 1 then - ScreenSong.SelectRandomSong; - ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); - Exit; - end; - except - //Error Loading Song -> Go back to Song Screen and Show some Error Message - FadeTo(@ScreenSong); - //Select New Song in Party Mode - if ScreenSong.Mode = 1 then - ScreenSong.SelectRandomSong; - ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); - Exit; - end; - AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; -// AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed - - // set movie - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin -(* OpenSmpeg(AktSong.Path + AktSong.Video); - SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*) - - // todo: VideoGap and Start time verwursten - FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); - FFmpegSkip(AktSong.VideoGAP + AktSong.Start); - AktSong.VideoLoaded := true; - end; - - // set background - if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then - try - Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background); - except - log.LogError('Background could not be loaded: ' + AktSong.Path + AktSong.Background); - Tex_Background.TexNum := -1; - end - else - Tex_Background.TexNum := -1; - - - - // play music (I) - Music.CaptureStart; - Music.MoveTo(AktSong.Start); -// Music.Play; - - // prepare timer (I) -// CountSkipTimeSet; - Czas.Teraz := AktSong.Start; - Czas.Razem := Music.Length; - if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000; - Czas.OldBeat := -1; - for P := 0 to High(Player) do - ClearScores(P); - - // main text - Lyrics.Clear (AktSong.BPM[0].BPM, AktSong.Resolution); - - // set custom options - case Ini.LyricsFont of - 0: - begin - Lyrics.UpperLineSize := 14; - Lyrics.LowerLineSize := 14; - Lyrics.FontStyle := 0; - - Lyrics.LineColor_en.R := Skin_FontR; - Lyrics.LineColor_en.G := Skin_FontG; - Lyrics.LineColor_en.B := Skin_FontB; - Lyrics.LineColor_en.A := 1; - - Lyrics.LineColor_dis.R := 0.4; - Lyrics.LineColor_dis.G := 0.4; - Lyrics.LineColor_dis.B := 0.4; - Lyrics.LineColor_dis.A := 1; - - Lyrics.LineColor_akt.R := 5/256; - Lyrics.LineColor_akt.G := 163/256; - Lyrics.LineColor_akt.B := 210/256; - Lyrics.LineColor_akt.A := 1; - -{ LyricSub.FontStyle := 0; - LyricMain.Size := 14; // 13 - LyricSub.Size := 14; // 13 - LyricMain.ColR := Skin_FontR; - LyricMain.ColG := Skin_FontG; - LyricMain.ColB := Skin_FontB; //Change für Crazy Joker - {LyricMain.ColSR := Skin_FontHighlightR; - LyricMain.ColSG := Skin_FontHighlightG; - LyricMain.ColSB := Skin_FontHighlightB;1aa5dc}{ - LyricMain.ColSR := 5/255; //26 - LyricMain.ColSG := 163/255; //165 - LyricMain.ColSB := 210/255; //220 - - LyricSub.ColR := 0.4; //0.6 - LyricSub.ColG := 0.4; //0.6 - LyricSub.ColB := 0.4; //0.6 } - end; - 1: - begin - { LyricMain.FontStyle := 2; - LyricSub.FontStyle := 2; - LyricMain.Size := 14; - LyricSub.Size := 14; - LyricMain.ColR := 0.75; - LyricMain.ColG := 0.75; - LyricMain.ColB := 1; - LyricMain.ColSR := 0.5; - LyricMain.ColSG := 0.5; - LyricMain.ColSB := 1; - LyricSub.ColR := 0.8; - LyricSub.ColG := 0.8; - LyricSub.ColB := 0.8; } - - Lyrics.UpperLineSize := 14; - Lyrics.LowerLineSize := 14; - Lyrics.FontStyle := 2; - - Lyrics.LineColor_en.R := 0.75; - Lyrics.LineColor_en.G := 0.75; - Lyrics.LineColor_en.B := 1; - Lyrics.LineColor_en.A := 1; - - Lyrics.LineColor_dis.R := 0.8; - Lyrics.LineColor_dis.G := 0.8; - Lyrics.LineColor_dis.B := 0.8; - Lyrics.LineColor_dis.A := 1; - - Lyrics.LineColor_akt.R := 0.5; - Lyrics.LineColor_akt.G := 0.5; - Lyrics.LineColor_akt.B := 1; - Lyrics.LineColor_akt.A := 1; - end; - 2: - begin - Lyrics.UpperLineSize := 12; - Lyrics.LowerLineSize := 12; - Lyrics.FontStyle := 3; - - Lyrics.LineColor_en.R := 0.75; - Lyrics.LineColor_en.G := 0.75; - Lyrics.LineColor_en.B := 1; - Lyrics.LineColor_en.A := 1; - - Lyrics.LineColor_dis.R := 0.8; - Lyrics.LineColor_dis.G := 0.8; - Lyrics.LineColor_dis.B := 0.8; - Lyrics.LineColor_dis.A := 1; - - Lyrics.LineColor_akt.R := 0.5; - Lyrics.LineColor_akt.G := 0.5; - Lyrics.LineColor_akt.B := 1; - Lyrics.LineColor_akt.A := 1; -{ LyricSub.FontStyle := 3; - LyricMain.Size := 12; - LyricSub.Size := 12; - LyricMain.ColR := 0.75; - LyricMain.ColG := 0.75; - LyricMain.ColB := 1; - LyricMain.ColSR := 0.5; - LyricMain.ColSG := 0.5; - LyricMain.ColSB := 1; - LyricSub.ColR := 0.8; - LyricSub.ColG := 0.8; - LyricSub.ColB := 0.8;} - end; - end; // case - - case Ini.LyricsEffect of - 0: Lyrics.HoverEffekt := 1; // 0 - one selected, 1 - selected all to the current - 1: Lyrics.HoverEffekt := 2; - 2: Lyrics.HoverEffekt := 3; - 3: Lyrics.HoverEffekt := 4; - end; // case - - // Add Lines to Lyrics - While (not Lyrics.LineinQueue) AND (Lyrics.LineCounter <= High(Czesci[0].Czesc)) do - Lyrics.AddLine(@Czesci[0].Czesc[Lyrics.LineCounter]); - - UpdateLCD; - - //Deactivate Pause - Paused := False; - - //Kill all Stars not Killed yet - //GoldenStarsTwinkle Mod - GoldenRec.SentenceChange; - //GoldenStarsTwinkle Mod End - - {//Set Position of Line Bonus - PhrasenBonus - if (Ini.LineBonus = 1) then //Show Line Bonus at Scores - begin - Case PlayersPlay of - 1: begin - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; - end; - - 2: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.X; - Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.X; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.X; - Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - end; - - 3: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - end; - - 4: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; - - //P4 - Player[3].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; - Player[3].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; - Player[3].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; - Player[3].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; - end; - - 6: begin - //P1 - Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; - Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; - - //P2 - Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P3 - Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - - //P4 - Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[3].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; - Player[3].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; - Player[3].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; - - //P5 - Player[4].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; - Player[4].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; - Player[4].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; - Player[4].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; - - //P6 - Player[5].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; - Player[5].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; - Player[5].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; - Player[5].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; - end; - end; - end - else if (Ini.LineBonus = 2) then //Show Line Bonus at Notes - begin - - // positions - if Ini.SingWindow = 0 then begin - NR.Left := 120; - end else begin - NR.Left := 20; - end; - NR.Right := 780; - - NR.Width := NR.Right - NR.Left; - NR.WMid := NR.Width / 2; - NR.Mid := NR.Left + NR.WMid; - - Case PlayersPlay of - 1: begin - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := Skin_P2_NotesB - 105; - end; - - 2: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - end; - - 3: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := 120 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := 120 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := 245 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := 245 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_TargetY := 370 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_StartY := 370 + 28; - end; - - 4: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; - - //P4 - Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; - Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; - end; - - 6: begin - //P1 - Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_TargetY := 120 - 65 + 28; - Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[0].LineBonus_StartY := 120 + 28; - - //P2 - Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_TargetY := 245 - 65 + 28; - Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[1].LineBonus_StartY := 245 + 28; - - //P3 - Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_TargetY := 370 - 65 + 28; - Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[2].LineBonus_StartY := 370 + 28; - - //P4 - Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_TargetY := 120 - 65 + 28; - Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[3].LineBonus_StartY := 120 + 28; - - //P5 - Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[4].LineBonus_TargetY := 245 - 65 + 28; - Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[4].LineBonus_StartY := 245 + 28; - - //P6 - Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); - Player[5].LineBonus_TargetY := 370 - 65 + 28; - Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); - Player[5].LineBonus_StartY := 370 + 28; - end; - end; - end; } - - //Set Position of Line Bonus - PhrasenBonus End - //Set Num of Empty Sentences for Phrasen Bonus - NumEmptySentences := 0; - for P := low(Czesci[0].Czesc) to high(Czesci[0].Czesc) do - if Czesci[0].Czesc[P].TotalNotes = 0 then Inc(NumEmptySentences); - - Log.LogStatus('End', 'onShow'); -end; - -procedure TScreenSing.onShowFinish; -begin - // play movie (II) - - if AktSong.VideoLoaded then - begin - try - FFmpegGetFrame(Czas.Teraz); - FFmpegDrawGL(ScreenAct); -// PlaySmpeg; - except - //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video - AktSong.VideoLoaded := False; - Log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); - Log.LogError('Corrupted File: ' + AktSong.Video); - try -// CloseSmpeg; - FFmpegClose; - except - - end; - end; - end; - - // play music (II) - Music.Play; - - // prepare timer (II) - CountSkipTimeSet; -end; - -function TScreenSing.Draw: boolean; -var - Min: integer; - Sec: integer; - Tekst: string; - Flash: real; - S: integer; - T: integer; -begin - - - - //ScoreBG Mod | den wirren Scheiss hier brauch mer nimmer, wir haben colorized png's - no need for wirrness also - // set player colors - macht nichts weiter als die farben des statics zu wechseln, was zu unschönen effekten bei colorized png führt -{ if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - end; - if ScreenAct = 2 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P4Dark'); - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P3Dark'); - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); - end; - if ScreenAct = 2 then begin - - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P6Dark'); - - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); - end; - end; - } - - // set player names (for 2 screens and only Singstar skin) - if ScreenAct = 1 then begin - Text[TextP1].Text := 'P1'; - Text[TextP1TwoP].Text := 'P1'; - Text[TextP1ThreeP].Text := 'P1'; - Text[TextP2R].Text := 'P2'; - Text[TextP2M].Text := 'P2'; - Text[TextP3R].Text := 'P3'; - end; - - if ScreenAct = 2 then begin - case PlayersPlay of -{ 1: begin - Text[TextP1].Text := 'P2'; - end; - 2: begin - Text[TextP1].Text := 'P3'; - Text[TextP2R].Text := 'P4'; - end; - 3: begin - Text[TextP1].Text := 'P4'; - Text[TextP2M].Text := 'P5'; - Text[TextP3R].Text := 'P6'; - end;} - - 4: begin - Text[TextP1TwoP].Text := 'P3'; - Text[TextP2R].Text := 'P4'; - end; - 6: begin - Text[TextP1ThreeP].Text := 'P4'; - Text[TextP2M].Text := 'P5'; - Text[TextP3R].Text := 'P6'; - end; - end; // case - end; // if - - // stereo - -// weird stuff, maybe this is for "dual screen?", but where is player three then? | okay, i commented the stuff out the other day - nothing was missing on screen w/ 6 players - so do we even need this stuff? -// okay this stuff appears again some lines beneath this one, I commented it out for testing what it does - seems like it's doing nothing -// but I might be wrong, so what is this stuff here doing? O.o - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; - - Text[TextP1].X := Text[TextP1].X + 10*ScreenX; - - {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} - - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; - - Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; - - {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} -// end of weird stuff - - for S := 1 to 1 do //wtf? - Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X + 10*ScreenX; - - // update static menu with time ... - Min := Round(Czas.Teraz) div 60; - Sec := Round(Czas.Teraz) mod 60; - Text[TextTimeText].Text := ''; - if Min < 10 then Text[TextTimeText].Text := '0'; - Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':'; - if Sec < 10 then Text[TextTimeText].Text := Text[TextTimeText].Text + '0'; - Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec); - - {// .. and scores - if PlayersPlay = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; - end; - - if PlayersPlay = 2 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - - if PlayersPlay = 3 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[4].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[5].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - end; } - - // draw static menu (BG) - DrawBG; - //Draw Background - SingDrawBackground; - // update and draw movie - if ShowFinish and AktSong.VideoLoaded then begin - try -// UpdateSmpeg; // this only draws - // todo: find a way to determine, when a new frame is needed - // toto: same for the need to skip frames - FFmpegGetFrame(Czas.Teraz); - FFmpegDrawGL(ScreenAct); - except - //If an Error occurs drawing: prevent Video from being Drawn again and Close Video - AktSong.VideoLoaded := False; - log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); - Log.LogError('Corrupted File: ' + AktSong.Video); - try -// CloseSmpeg; - FFmpegClose; - except - - end; - end; - end; - - // draw static menu (FG) - DrawFG; - - // check for music finish -// Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(AktSong.Finish)); - if ShowFinish then begin - if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin - //Pause Mod: - if not Paused then - Sing(Self); // analyze song - end else begin -// Log.LogError('End'); - if not FadeOut then begin -// Log.LogError('End2'); - Finish; - FadeOut := true; - FadeTo(@ScreenScore); - end; - end; - end; - - // draw custom items - SingDraw; // always draw - -//GoldenNoteStarsTwinkle Mod - GoldenRec.SpawnRec; -//GoldenNoteStarsTwinkle Mod - - //Draw Scores - Scores.Draw; - - // back stereo - -// weird stuff, maybe this is for "dual screen?", but where is player three then? -// okay this stuff appears again some lines above this one, I commented it out for testing what it does - seems like it's doing nothing -// but I might be wrong, so what is this stuff here doing? O.o - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; - Text[TextP1].X := Text[TextP1].X - 10*ScreenX; - - {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX;} - - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; - Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; - - {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX;} -//weird end - - for S := 1 to 1 do // wtf? - Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X - 10*ScreenX; - -end; - -procedure TScreenSing.Finish; -begin - Music.CaptureStop; - Music.Stop; - - if Ini.SavePlayback = 1 then begin - Log.BenchmarkStart(0); - Log.LogVoice(0); - Log.LogVoice(1); - Log.LogVoice(2); - Log.BenchmarkEnd(0); - Log.LogBenchmark('Creating files', 0); - end; - - if AktSong.VideoLoaded then begin -// CloseSmpeg; - FFmpegClose; - AktSong.VideoLoaded := false; // to prevent drawing closed video - end; - - SetFontItalic (False); -end; - -procedure TScreenSing.UpdateLCD; -var - T: string; -begin - //Todo: Lyrics -{ LCD.HideCursor; - LCD.Clear; - - T := LyricMain.Text; - if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; - LCD.AddTextBR(T); - - T := LyricSub.Text; - if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; - LCD.AddTextBR(T);} -end; - -procedure TScreenSing.onSentenceEnd(S: Cardinal); -var -I: Integer; -A: Real; -B: integer; //Max Points for Notes -begin - - //Check for Empty Sentence - if (Czesci[0].Czesc[S].TotalNotes<=0) then - exit; - - //Set Max Note Points - if (Ini.LineBonus > 0) then - B := 9000 - else - B := 10000; - - for I := 0 to High(Player) do begin - A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2; - - - //PhrasenBonus - Line Bonus Mod - - //Generate Steps 0 to 8 - A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); - - If (Ini.LineBonus > 0) then - begin - //PhrasenBonus give Points - Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8); - Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10; - //Update Total Score - Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; - - //Spawn PopUp - If (A >= 8) then - A := 8 - else IF A < 0 then - A := 0; - - Scores.SpawnPopUp(I, Floor(A), Player[I].ScoreTotalI); - end; - //PhrasenBonus - Line Bonus Mod End// } - - //PerfectLineTwinkle Mod (effect) Pt.1 - If (Ini.EffectSing=1) then - begin - if A >= 8 then Player[I].LastSentencePerfect := True - else Player[I].LastSentencePerfect := False; - end; - //PerfectLineTwinkle Mod end - - //Refresh LastScore - Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; - - end; - - //PerfectLineTwinkle Mod (effect) Pt.2 - if Ini.EffectSing=1 then - GoldenRec.SpawnPerfectLineTwinkle; - //PerfectLineTwinkle Mod end -end; - -//Called on Sentence Change S= New Current Sentence -procedure TScreenSing.onSentenceChange(S: Cardinal); -begin - //GoldenStarsTwinkle Mod - GoldenRec.SentenceChange; - if (Lyrics.LineCounter <= High(Czesci[0].Czesc)) then - Lyrics.AddLine(@Czesci[0].Czesc[Lyrics.LineCounter]); - //GoldenStarsTwinkle Mod End -end; - -end. +unit UScreenSing; + +interface + +{$I switches.inc} + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + +uses UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + UIni, + ULog, + UTexture, + ULyrics, + TextGL, + OpenGL12, + {$IFDEF useBASS} + bass, + {$ENDIF} + UThemes, + ULCD, + UGraphicClasses, + UVideo, + USingScores; + +type + TScreenSing = class(TMenu) + protected + paused: boolean; //Pause Mod + PauseTime: Real; + NumEmptySentences: integer; + public + //TextTime: integer; + + //TimeBar mod + StaticTimeProgress: integer; + TextTimeText: integer; + //eoa TimeBar mod + + StaticP1: integer; + TextP1: integer; + {StaticP1ScoreBG: integer; + TextP1Score: integer;} + + {//moveable singbar mod + StaticP1SingBar: integer; + StaticP1ThreePSingBar: integer; + StaticP1TwoPSingBar: integer; + StaticP2RSingBar: integer; + StaticP2MSingBar: integer; + StaticP3SingBar: integer; + //eoa moveable singbar } + + //Added for ps3 skin + //shown when game is in 2/4 player modus + StaticP1TwoP: integer; + TextP1TwoP: integer; + + {StaticP1TwoPScoreBG: integer; + TextP1TwoPScore: integer;} + //shown when game is in 3/6 player modus + StaticP1ThreeP: integer; + TextP1ThreeP: integer; + + {TextP1ThreePScore: integer; + StaticP1ThreePScoreBG: integer; } + //eoa + + StaticP2R: integer; + TextP2R: integer; + + {StaticP2RScoreBG: integer; + TextP2RScore: integer;} + + StaticP2M: integer; + TextP2M: integer; + + {StaticP2MScoreBG: integer; + TextP2MScore: integer; } + + StaticP3R: integer; + TextP3R: integer; + + {StaticP3RScoreBG: integer; + TextP3RScore: integer;} + + Tex_Background: TTexture; + FadeOut: boolean; +// LyricMain: TLyric; +// LyricSub: TLyric; + Lyrics: TLyricEngine; + + //Score Manager: + Scores: TSingScores; + + constructor Create; override; + procedure onShow; override; + procedure onShowFinish; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure Finish; virtual; + procedure UpdateLCD; + procedure Pause; //Pause Mod(Toggles Pause) + + //OnSentenceEnd for LineBonus + Singbar + procedure onSentenceEnd(S: Cardinal); + //OnSentenceChange (for Golden Notes) + procedure onSentenceChange(S: Cardinal); + end; + +implementation +uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math; + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenSing.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + SDLK_Q: + begin + //When not ask before Exit then Finish now + if (Ini.AskbeforeDel <> 1) then + Finish + //else just Pause and let the Popup make the Work + else if not paused then + Pause; + + Result := false; + end; + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + //Record Sound Hack: + //Sound[0].BufferLong + + Finish; + Music.PlayBack; + FadeTo(@ScreenScore); + end; + + SDLK_P://Pause Mod + begin + Pause; + end; + + SDLK_RETURN: + begin + 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 : + begin + end; + SDLK_UP : + begin + end; + end; + end; +end; + +//Pause Mod +procedure TScreenSing.Pause; +begin + if not paused then //Pause einschalten + begin + // pause Time + PauseTime := Czas.Teraz; + Paused := true; + + // pause Music + Music.Pause; + + // pause Video + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + FFmpegTogglePause; + end + else //Pause ausschalten + begin + Czas.Teraz := PauseTime; //Position of Notes + + // Position of Music + Music.MoveTo (PauseTime); + // Play Music + Music.Play; + + // Video + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + FFmpegTogglePause; + //SkipSmpeg(PauseTime); + + Paused := false; + end; +end; +//Pause Mod End + +constructor TScreenSing.Create; +var + I: integer; + P: integer; +begin + inherited Create; + + //Create Score Class + Scores := TSingScores.Create; + Scores.LoadfromTheme; + + LoadFromTheme(Theme.Sing); + + //TimeBar + StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); + TextTimeText := AddText(Theme.Sing.TextTimeText); + +// 1 player | P1 + StaticP1 := AddStatic(Theme.Sing.StaticP1); + TextP1 := AddText(Theme.Sing.TextP1); + + {StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG); + TextP1Score := AddText(Theme.Sing.TextP1Score); + StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar);} + +// 2 or 4 players | P1 + StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); + TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); + + {StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG); + TextP1TwoPScore := AddText(Theme.Sing.TextP1TwoPScore); + StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar);} + + // | P2 + StaticP2R := AddStatic(Theme.Sing.StaticP2R); + TextP2R := AddText(Theme.Sing.TextP2R); + + {StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG); + TextP2RScore := AddText(Theme.Sing.TextP2RScore); + StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar); } + +// 3 or 6 players | P1 + StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); + TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); + + {StaticP1ThreePScoreBG := AddStatic(Theme.Sing.StaticP1ThreePScoreBG); + TextP1ThreePScore := AddText(Theme.Sing.TextP1ThreePScore); + StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar);} + + // | P2 + StaticP2M := AddStatic(Theme.Sing.StaticP2M); + TextP2M := AddText(Theme.Sing.TextP2M); + + {StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG); + TextP2MScore := AddText(Theme.Sing.TextP2MScore); + StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar);} + + // | P3 + StaticP3R := AddStatic(Theme.Sing.StaticP3R); + TextP3R := AddText(Theme.Sing.TextP3R); + + {StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG); + TextP3RScore := AddText(Theme.Sing.TextP3RScore); + StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar);} + + if ScreenAct = 2 then begin + // katze und affe + + end; + + Lyrics := TLyricEngine.Create(80,Skin_LyricsT,640,12,80,Skin_LyricsT+36,640,12); + + UVideo.Init; +end; + +procedure TScreenSing.onShow; +var + P: integer; + V1: boolean; + V1TwoP: boolean; //added for ps3 skin + V1ThreeP: boolean; //added for ps3 skin + V2R: boolean; + V2M: boolean; + V3R: boolean; + NR: TRecR; //Line Bonus Mod + + Color: TRGB; +begin + Log.LogStatus('Begin', 'onShow'); + FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented + + //SetUp Score Manager + Scores.ClearPlayers; //Clear Old Player Values + Color.R := 0; Color.G := 0; Color.B := 0; //Dummy atm + For P := 0 to PlayersPlay -1 do //Add new Ones + begin + Scores.AddPlayer(Tex_ScoreBG[P], Color); + end; + + Scores.Init; //Get Positions for Players + + + + // prepare players + SetLength(Player, PlayersPlay); +// Player[0].ScoreTotalI := 0; + + case PlayersPlay of + 1: begin + V1 := true; + V1TwoP := false; + V1ThreeP := false; + V2R := false; + V2M := false; + V3R := false; + end; + 2: begin + V1 := false; + V1TwoP := true; + V1ThreeP := false; + V2R := true; + V2M := false; + V3R := false; + end; + 3: begin + V1 := false; + V1TwoP := false; + V1ThreeP := true; + V2R := false; + V2M := true; + V3R := true; + end; + 4: begin // double screen + V1 := false; + V1TwoP := true; + V1ThreeP := false; + V2R := true; + V2M := false; + V3R := false; + end; + 6: begin // double screen + V1 := false; + V1TwoP := false; + V1ThreeP := true; + V2R := false; + V2M := true; + V3R := true; + end; + + end; + + //This one is shown in 1P mode + Static[StaticP1].Visible := V1; + Text[TextP1].Visible := V1; + + {Static[StaticP1ScoreBG].Visible := V1; + Text[TextP1Score].Visible := V1;} + + + //This one is shown in 2/4P mode + Static[StaticP1TwoP].Visible := V1TwoP; + Text[TextP1TwoP].Visible := V1TwoP; + + {Static[StaticP1TwoPScoreBG].Visible := V1TwoP; + Text[TextP1TwoPScore].Visible := V1TwoP;} + + Static[StaticP2R].Visible := V2R; + Text[TextP2R].Visible := V2R; + + {Static[StaticP2RScoreBG].Visible := V2R; + Text[TextP2RScore].Visible := V2R; } + + + //This one is shown in 3/6P mode + Static[StaticP1ThreeP].Visible := V1ThreeP; + Text[TextP1ThreeP].Visible := V1ThreeP; + + {Static[StaticP1ThreePScoreBG].Visible := V1ThreeP; + Text[TextP1ThreePScore].Visible := V1ThreeP; } + + Static[StaticP2M].Visible := V2M; + Text[TextP2M].Visible := V2M; + + {Static[StaticP2MScoreBG].Visible := V2M; + Text[TextP2MScore].Visible := V2M; } + + Static[StaticP3R].Visible := V3R; + Text[TextP3R].Visible := V3R; + + {Static[StaticP3RScoreBG].Visible := V3R; + Text[TextP3RScore].Visible := V3R; } + + // load notes + ResetSingTemp; +// Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); + AktSong := CatSongs.Song[CatSongs.Selected]; + try + if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName) then + begin + //Error Loading Song -> Go back to Song Screen and Show some Error Message + FadeTo(@ScreenSong); + //Select New Song in Party Mode + if ScreenSong.Mode = 1 then + ScreenSong.SelectRandomSong; + ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); + Exit; + end; + except + //Error Loading Song -> Go back to Song Screen and Show some Error Message + FadeTo(@ScreenSong); + //Select New Song in Party Mode + if ScreenSong.Mode = 1 then + ScreenSong.SelectRandomSong; + ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); + Exit; + end; + AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; +// AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed + + // set movie + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin +(* OpenSmpeg(AktSong.Path + AktSong.Video); + SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*) + + // todo: VideoGap and Start time verwursten + FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); + FFmpegSkip(AktSong.VideoGAP + AktSong.Start); + AktSong.VideoLoaded := true; + end; + + // set background + if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then + try + Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background); + except + log.LogError('Background could not be loaded: ' + AktSong.Path + AktSong.Background); + Tex_Background.TexNum := -1; + end + else + Tex_Background.TexNum := -1; + + + + // play music (I) + Music.CaptureStart; + Music.MoveTo(AktSong.Start); +// Music.Play; + + // prepare timer (I) +// CountSkipTimeSet; + Czas.Teraz := AktSong.Start; + Czas.Razem := Music.Length; + if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000; + Czas.OldBeat := -1; + for P := 0 to High(Player) do + ClearScores(P); + + // main text + Lyrics.Clear (AktSong.BPM[0].BPM, AktSong.Resolution); + + // set custom options + case Ini.LyricsFont of + 0: + begin + Lyrics.UpperLineSize := 14; + Lyrics.LowerLineSize := 14; + Lyrics.FontStyle := 0; + + Lyrics.LineColor_en.R := Skin_FontR; + Lyrics.LineColor_en.G := Skin_FontG; + Lyrics.LineColor_en.B := Skin_FontB; + Lyrics.LineColor_en.A := 1; + + Lyrics.LineColor_dis.R := 0.4; + Lyrics.LineColor_dis.G := 0.4; + Lyrics.LineColor_dis.B := 0.4; + Lyrics.LineColor_dis.A := 1; + + Lyrics.LineColor_akt.R := 5/256; + Lyrics.LineColor_akt.G := 163/256; + Lyrics.LineColor_akt.B := 210/256; + Lyrics.LineColor_akt.A := 1; + +{ LyricSub.FontStyle := 0; + LyricMain.Size := 14; // 13 + LyricSub.Size := 14; // 13 + LyricMain.ColR := Skin_FontR; + LyricMain.ColG := Skin_FontG; + LyricMain.ColB := Skin_FontB; //Change für Crazy Joker + {LyricMain.ColSR := Skin_FontHighlightR; + LyricMain.ColSG := Skin_FontHighlightG; + LyricMain.ColSB := Skin_FontHighlightB;1aa5dc}{ + LyricMain.ColSR := 5/255; //26 + LyricMain.ColSG := 163/255; //165 + LyricMain.ColSB := 210/255; //220 + + LyricSub.ColR := 0.4; //0.6 + LyricSub.ColG := 0.4; //0.6 + LyricSub.ColB := 0.4; //0.6 } + end; + 1: + begin + { LyricMain.FontStyle := 2; + LyricSub.FontStyle := 2; + LyricMain.Size := 14; + LyricSub.Size := 14; + LyricMain.ColR := 0.75; + LyricMain.ColG := 0.75; + LyricMain.ColB := 1; + LyricMain.ColSR := 0.5; + LyricMain.ColSG := 0.5; + LyricMain.ColSB := 1; + LyricSub.ColR := 0.8; + LyricSub.ColG := 0.8; + LyricSub.ColB := 0.8; } + + Lyrics.UpperLineSize := 14; + Lyrics.LowerLineSize := 14; + Lyrics.FontStyle := 2; + + Lyrics.LineColor_en.R := 0.75; + Lyrics.LineColor_en.G := 0.75; + Lyrics.LineColor_en.B := 1; + Lyrics.LineColor_en.A := 1; + + Lyrics.LineColor_dis.R := 0.8; + Lyrics.LineColor_dis.G := 0.8; + Lyrics.LineColor_dis.B := 0.8; + Lyrics.LineColor_dis.A := 1; + + Lyrics.LineColor_akt.R := 0.5; + Lyrics.LineColor_akt.G := 0.5; + Lyrics.LineColor_akt.B := 1; + Lyrics.LineColor_akt.A := 1; + end; + 2: + begin + Lyrics.UpperLineSize := 12; + Lyrics.LowerLineSize := 12; + Lyrics.FontStyle := 3; + + Lyrics.LineColor_en.R := 0.75; + Lyrics.LineColor_en.G := 0.75; + Lyrics.LineColor_en.B := 1; + Lyrics.LineColor_en.A := 1; + + Lyrics.LineColor_dis.R := 0.8; + Lyrics.LineColor_dis.G := 0.8; + Lyrics.LineColor_dis.B := 0.8; + Lyrics.LineColor_dis.A := 1; + + Lyrics.LineColor_akt.R := 0.5; + Lyrics.LineColor_akt.G := 0.5; + Lyrics.LineColor_akt.B := 1; + Lyrics.LineColor_akt.A := 1; +{ LyricSub.FontStyle := 3; + LyricMain.Size := 12; + LyricSub.Size := 12; + LyricMain.ColR := 0.75; + LyricMain.ColG := 0.75; + LyricMain.ColB := 1; + LyricMain.ColSR := 0.5; + LyricMain.ColSG := 0.5; + LyricMain.ColSB := 1; + LyricSub.ColR := 0.8; + LyricSub.ColG := 0.8; + LyricSub.ColB := 0.8;} + end; + end; // case + + case Ini.LyricsEffect of + 0: Lyrics.HoverEffekt := 1; // 0 - one selected, 1 - selected all to the current + 1: Lyrics.HoverEffekt := 2; + 2: Lyrics.HoverEffekt := 3; + 3: Lyrics.HoverEffekt := 4; + end; // case + + // Add Lines to Lyrics + While (not Lyrics.LineinQueue) AND (Lyrics.LineCounter <= High(Czesci[0].Czesc)) do + Lyrics.AddLine(@Czesci[0].Czesc[Lyrics.LineCounter]); + + UpdateLCD; + + //Deactivate Pause + Paused := False; + + //Kill all Stars not Killed yet + //GoldenStarsTwinkle Mod + GoldenRec.SentenceChange; + //GoldenStarsTwinkle Mod End + + {//Set Position of Line Bonus - PhrasenBonus + if (Ini.LineBonus = 1) then //Show Line Bonus at Scores + begin + Case PlayersPlay of + 1: begin + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65; + end; + + 2: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.X; + Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.X; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.X; + Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + end; + + 3: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + end; + + 4: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65; + + //P4 + Player[3].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x; + Player[3].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y; + Player[3].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x; + Player[3].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65; + end; + + 6: begin + //P1 + Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; + + //P2 + Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P3 + Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + + //P4 + Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[3].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y; + Player[3].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x; + Player[3].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65; + + //P5 + Player[4].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x; + Player[4].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y; + Player[4].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x; + Player[4].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65; + + //P6 + Player[5].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x; + Player[5].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y; + Player[5].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x; + Player[5].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65; + end; + end; + end + else if (Ini.LineBonus = 2) then //Show Line Bonus at Notes + begin + + // positions + if Ini.SingWindow = 0 then begin + NR.Left := 120; + end else begin + NR.Left := 20; + end; + NR.Right := 780; + + NR.Width := NR.Right - NR.Left; + NR.WMid := NR.Width / 2; + NR.Mid := NR.Left + NR.WMid; + + Case PlayersPlay of + 1: begin + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := Skin_P2_NotesB - 105; + end; + + 2: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + end; + + 3: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := 120 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := 120 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := 245 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := 245 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_TargetY := 370 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_StartY := 370 + 28; + end; + + 4: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_StartY := Skin_P1_NotesB - 105 + 28; + + //P4 + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28; + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_StartY := Skin_P2_NotesB - 105 + 28; + end; + + 6: begin + //P1 + Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_TargetY := 120 - 65 + 28; + Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[0].LineBonus_StartY := 120 + 28; + + //P2 + Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_TargetY := 245 - 65 + 28; + Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[1].LineBonus_StartY := 245 + 28; + + //P3 + Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_TargetY := 370 - 65 + 28; + Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[2].LineBonus_StartY := 370 + 28; + + //P4 + Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_TargetY := 120 - 65 + 28; + Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[3].LineBonus_StartY := 120 + 28; + + //P5 + Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[4].LineBonus_TargetY := 245 - 65 + 28; + Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[4].LineBonus_StartY := 245 + 28; + + //P6 + Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100); + Player[5].LineBonus_TargetY := 370 - 65 + 28; + Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100); + Player[5].LineBonus_StartY := 370 + 28; + end; + end; + end; } + + //Set Position of Line Bonus - PhrasenBonus End + //Set Num of Empty Sentences for Phrasen Bonus + NumEmptySentences := 0; + for P := low(Czesci[0].Czesc) to high(Czesci[0].Czesc) do + if Czesci[0].Czesc[P].TotalNotes = 0 then Inc(NumEmptySentences); + + Log.LogStatus('End', 'onShow'); +end; + +procedure TScreenSing.onShowFinish; +begin + // play movie (II) + + if AktSong.VideoLoaded then + begin + try + FFmpegGetFrame(Czas.Teraz); + FFmpegDrawGL(ScreenAct); +// PlaySmpeg; + except + + on E : Exception do + begin + //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video + AktSong.VideoLoaded := False; + Log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); + Log.LogError('Error Message : '+ E.message ); + Log.LogError(' In : '+ E.ClassName +' (TScreenSing.onShowFinish)' ); + Log.LogError('Corrupted File: ' + AktSong.Video); + try +// CloseSmpeg; + FFmpegClose; + except + + end; + end; + end; + end; + + // play music (II) + Music.Play; + + // prepare timer (II) + CountSkipTimeSet; +end; + +function TScreenSing.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + Flash: real; + S: integer; + T: integer; +begin + + + + //ScoreBG Mod | den wirren Scheiss hier brauch mer nimmer, wir haben colorized png's - no need for wirrness also + // set player colors - macht nichts weiter als die farben des statics zu wechseln, was zu unschönen effekten bei colorized png führt +{ if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P4Dark'); + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P3Dark'); + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); + end; + if ScreenAct = 2 then begin + + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P6Dark'); + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); + end; + end; + } + + // set player names (for 2 screens and only Singstar skin) + if ScreenAct = 1 then begin + Text[TextP1].Text := 'P1'; + Text[TextP1TwoP].Text := 'P1'; + Text[TextP1ThreeP].Text := 'P1'; + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; + end; + + if ScreenAct = 2 then begin + case PlayersPlay of +{ 1: begin + Text[TextP1].Text := 'P2'; + end; + 2: begin + Text[TextP1].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 3: begin + Text[TextP1].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end;} + + 4: begin + Text[TextP1TwoP].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 6: begin + Text[TextP1ThreeP].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end; + end; // case + end; // if + + // stereo + +// weird stuff, maybe this is for "dual screen?", but where is player three then? | okay, i commented the stuff out the other day - nothing was missing on screen w/ 6 players - so do we even need this stuff? +// okay this stuff appears again some lines beneath this one, I commented it out for testing what it does - seems like it's doing nothing +// but I might be wrong, so what is this stuff here doing? O.o + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; + + Text[TextP1].X := Text[TextP1].X + 10*ScreenX; + + {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} + + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; + + Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; + + {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} +// end of weird stuff + + for S := 1 to 1 do //wtf? + Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X + 10*ScreenX; + + // update static menu with time ... + Min := Round(Czas.Teraz) div 60; + Sec := Round(Czas.Teraz) mod 60; + Text[TextTimeText].Text := ''; + if Min < 10 then Text[TextTimeText].Text := '0'; + Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':'; + if Sec < 10 then Text[TextTimeText].Text := Text[TextTimeText].Text + '0'; + Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec); + + {// .. and scores + if PlayersPlay = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + end; + + if PlayersPlay = 2 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + + if PlayersPlay = 3 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[4].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[5].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + end; } + + // draw static menu (BG) + DrawBG; + //Draw Background + SingDrawBackground; + // update and draw movie + + if ShowFinish and AktSong.VideoLoaded then begin + try +// UpdateSmpeg; // this only draws + // todo: find a way to determine, when a new frame is needed + // toto: same for the need to skip frames + + FFmpegGetFrame(Czas.Teraz); + FFmpegDrawGL(ScreenAct); + except + on E : Exception do + begin + + //If an Error occurs drawing: prevent Video from being Drawn again and Close Video + AktSong.VideoLoaded := False; + log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); + Log.LogError('Error Message : '+ E.message ); + Log.LogError(' In : '+ E.ClassName +' (TScreenSing.Draw)' ); + + Log.LogError('Corrupted File: ' + AktSong.Video); + try +// CloseSmpeg; + FFmpegClose; + except + + end; + end; + end; + end; + + // draw static menu (FG) + DrawFG; + + // check for music finish +// Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(AktSong.Finish)); + if ShowFinish then begin + if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + //Pause Mod: + if not Paused then + Sing(Self); // analyze song + end else begin +// Log.LogError('End'); + if not FadeOut then begin +// Log.LogError('End2'); + Finish; + FadeOut := true; + FadeTo(@ScreenScore); + end; + end; + end; + + // draw custom items + SingDraw; // always draw + +//GoldenNoteStarsTwinkle Mod + GoldenRec.SpawnRec; +//GoldenNoteStarsTwinkle Mod + + //Draw Scores + Scores.Draw; + + // back stereo + +// weird stuff, maybe this is for "dual screen?", but where is player three then? +// okay this stuff appears again some lines above this one, I commented it out for testing what it does - seems like it's doing nothing +// but I might be wrong, so what is this stuff here doing? O.o + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; + Text[TextP1].X := Text[TextP1].X - 10*ScreenX; + + {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX;} + + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; + Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; + + {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX;} +//weird end + + for S := 1 to 1 do // wtf? + Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X - 10*ScreenX; + +end; + +procedure TScreenSing.Finish; +begin + Music.CaptureStop; + Music.Stop; + + if Ini.SavePlayback = 1 then begin + Log.BenchmarkStart(0); + Log.LogVoice(0); + Log.LogVoice(1); + Log.LogVoice(2); + Log.BenchmarkEnd(0); + Log.LogBenchmark('Creating files', 0); + end; + + if AktSong.VideoLoaded then begin +// CloseSmpeg; + FFmpegClose; + AktSong.VideoLoaded := false; // to prevent drawing closed video + end; + + SetFontItalic (False); +end; + +procedure TScreenSing.UpdateLCD; +var + T: string; +begin + //Todo: Lyrics +{ LCD.HideCursor; + LCD.Clear; + + T := LyricMain.Text; + if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; + LCD.AddTextBR(T); + + T := LyricSub.Text; + if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; + LCD.AddTextBR(T);} +end; + +procedure TScreenSing.onSentenceEnd(S: Cardinal); +var +I: Integer; +A: Real; +B: integer; //Max Points for Notes +begin + + //Check for Empty Sentence + if (Czesci[0].Czesc[S].TotalNotes<=0) then + exit; + + //Set Max Note Points + if (Ini.LineBonus > 0) then + B := 9000 + else + B := 10000; + + for I := 0 to High(Player) do begin + A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2; + + + //PhrasenBonus - Line Bonus Mod + + //Generate Steps 0 to 8 + A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8); + + If (Ini.LineBonus > 0) then + begin + //PhrasenBonus give Points + Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8); + Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10; + //Update Total Score + Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI; + + //Spawn PopUp + If (A >= 8) then + A := 8 + else IF A < 0 then + A := 0; + + Scores.SpawnPopUp(I, Floor(A), Player[I].ScoreTotalI); + end; + //PhrasenBonus - Line Bonus Mod End// } + + //PerfectLineTwinkle Mod (effect) Pt.1 + If (Ini.EffectSing=1) then + begin + if A >= 8 then Player[I].LastSentencePerfect := True + else Player[I].LastSentencePerfect := False; + end; + //PerfectLineTwinkle Mod end + + //Refresh LastScore + Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden; + + end; + + //PerfectLineTwinkle Mod (effect) Pt.2 + if Ini.EffectSing=1 then + GoldenRec.SpawnPerfectLineTwinkle; + //PerfectLineTwinkle Mod end +end; + +//Called on Sentence Change S= New Current Sentence +procedure TScreenSing.onSentenceChange(S: Cardinal); +begin + //GoldenStarsTwinkle Mod + GoldenRec.SentenceChange; + if (Lyrics.LineCounter <= High(Czesci[0].Czesc)) then + Lyrics.AddLine(@Czesci[0].Czesc[Lyrics.LineCounter]); + //GoldenStarsTwinkle Mod End +end; + +end. diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 859d5026..b5a34f46 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1509,8 +1509,13 @@ var I: Integer; begin dx := SongTarget-SongCurrent; - dt := TimeSkip*7; - if dt > 1 then dt := 1; + dt := TimeSkip * 7; + +// writeln( 'TScreenSong.Draw '+ inttostr(trunc(TimeSkip)) ); + + if dt > 1 then + dt := 1; + SongCurrent := SongCurrent + dx*dt; { if SongCurrent > Catsongs.VisibleSongs then begin @@ -1527,7 +1532,8 @@ begin If (CoverTime < 5) then begin // 0.5.0: cover fade - if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin + if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then + begin // load new texture Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); Button[Interaction].Texture.Alpha := 1; @@ -1756,27 +1762,24 @@ begin Data[i] := 0.9999999999999; try - if ( assigned( Theme ) ) AND - ( assigned( Theme.Song ) ) AND - ( i < length( Data ) ) THEN - begin - writeln( '!!!!!!!!! - '+ inttostr( i ) + ' - ' + inttostr( Theme.Song.Equalizer.Length ) ); - - if Single(Data[i]) > 0 then + if ( assigned( Theme ) ) AND + ( assigned( Theme.Song ) ) AND + ( i < length( Data ) ) THEN begin - lTmp := Single(Data[i]) * Theme.Song.Equalizer.Length; - if lTmp > Pos then - Pos := lTmp; + if single( Data[i] ) > single( 1 ) then + begin + lTmp := Single(Data[i]) * Theme.Song.Equalizer.Length; + if lTmp > Pos then + Pos := lTmp; + end; end; - end; except - // TODO: JB_Linux..... why does this happen ! on E:EInvalidOp do - writeln( 'UScreenSong - DOH !!!!' ); + writeln( 'UScreenSong - DOH !!!! ('+inttostr(i)+' '+ inttostr( integer( single( Data[i] ) ) )+' * '+ ')' ); end end; - + //Change Last Band if (EqualizerBands[B] <= Theme.Song.Equalizer.Length) then begin -- cgit v1.2.3 From 0d997f8433e982584a0ab67a6d630d12f4314759 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 11 Oct 2007 10:50:01 +0000 Subject: fixes so codebase builds in delphi now, after major FFMpeg changse for linux. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@503 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index b5a34f46..0bf411c1 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1766,7 +1766,7 @@ begin ( assigned( Theme.Song ) ) AND ( i < length( Data ) ) THEN begin - if single( Data[i] ) > single( 1 ) then + if single( Data[i] ) > 1 then begin lTmp := Single(Data[i]) * Theme.Song.Equalizer.Length; if lTmp > Pos then @@ -1774,8 +1774,10 @@ begin end; end; except + {$IFDEF FPC} on E:EInvalidOp do - writeln( 'UScreenSong - DOH !!!! ('+inttostr(i)+' '+ inttostr( integer( single( Data[i] ) ) )+' * '+ ')' ); + writeln( 'UScreenSong - DOH !!!! ('+inttostr(i)+' '+ inttostr( integer( Data[i] ) )+' * '+ ')' ); + {$ENDIF} end end; -- cgit v1.2.3 From 44554c7908f7e2405a249331f00a35703f5939c2 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 11 Oct 2007 12:02:20 +0000 Subject: Added IAudioPlayback Interface and implementation for BASS. Created "AudioPlayback" Global Singleton, which removed the need for the "Music" Global variable. This was done because global singleton objects are a recognized better "design pattern" achieving the same thing as global variables, but in a nicer way. I will be working to a) separate IAudioPlayback in to separate "Playback" and "Input" Interfaces b) build a FFMpeg class that implements IAudioPlayback git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@504 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 22 ++++---- Game/Code/Screens/UScreenEdit.pas | 12 ++-- Game/Code/Screens/UScreenEditConvert.pas | 10 ++-- Game/Code/Screens/UScreenEditSub.pas | 38 +++++++------ Game/Code/Screens/UScreenLevel.pas | 4 +- Game/Code/Screens/UScreenMain.pas | 30 +++++----- Game/Code/Screens/UScreenName.pas | 4 +- Game/Code/Screens/UScreenOpen.pas | 6 +- Game/Code/Screens/UScreenOptions.pas | 42 ++++++++------ Game/Code/Screens/UScreenOptionsAdvanced.pas | 8 +-- Game/Code/Screens/UScreenOptionsGame.pas | 14 +++-- Game/Code/Screens/UScreenOptionsGraphics.pas | 8 +-- Game/Code/Screens/UScreenOptionsLyrics.pas | 8 +-- Game/Code/Screens/UScreenOptionsRecord.pas | 8 +-- Game/Code/Screens/UScreenOptionsSound.pas | 8 +-- Game/Code/Screens/UScreenOptionsThemes.pas | 8 +-- Game/Code/Screens/UScreenPartyNewRound.pas | 4 +- Game/Code/Screens/UScreenPartyOptions.pas | 8 +-- Game/Code/Screens/UScreenPartyPlayer.pas | 4 +- Game/Code/Screens/UScreenPartyScore.pas | 4 +- Game/Code/Screens/UScreenPartyWin.pas | 4 +- Game/Code/Screens/UScreenSing.pas | 22 ++++---- Game/Code/Screens/UScreenSingModi.pas | 10 ++-- Game/Code/Screens/UScreenSong.pas | 82 ++++++++++++++-------------- Game/Code/Screens/UScreenSongJumpto.pas | 2 +- Game/Code/Screens/UScreenSongMenu.pas | 2 +- Game/Code/Screens/UScreenStatDetail.pas | 4 +- Game/Code/Screens/UScreenStatMain.pas | 9 +-- 28 files changed, 204 insertions(+), 181 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 2bd0156a..b7d6d3e7 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -172,7 +172,7 @@ begin SDLK_BACKSPACE : begin FadeTo(@ScreenMain); - Music.PlayBack; + AudioPlayback.PlayBack; end; { SDLK_SPACE: begin @@ -288,7 +288,7 @@ begin deluxe_slidein := 0; Credits_Alpha := 0; //Music.SetLoop(true); Loop looped ned, so ne scheisse - Music.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! + AudioPlayback.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! // Music.Play; CTime:=0; // setlength(CTime_hold,0); @@ -344,7 +344,7 @@ end; procedure TScreenCredits.onHide; begin - Music.Stop; + AudioPlayback.Stop; end; Procedure TScreenCredits.Draw_FunkyText; @@ -445,7 +445,7 @@ const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),( begin //dis does teh muiwk y0r - Data := Music.GetFFTData; + Data := AudioPlayback.GetFFTData; Log.LogStatus('',' JB-1'); @@ -465,7 +465,7 @@ begin CRDTS_Stage:=Intro; CTime:=0; - Music.Play; + AudioPlayback.Play; end; if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then @@ -1311,14 +1311,14 @@ Log.LogStatus('',' JB-4'); begin if CTime=Timings[20] then begin CTime_hold:=0; - Music.Stop; - Music.Open(soundpath + 'credits-outro-tune.mp3'); - Music.Play; - Music.SetVolume(20); - Music.SetLoop(True); + AudioPlayback.Stop; + AudioPlayback.Open(soundpath + 'credits-outro-tune.mp3'); + AudioPlayback.Play; + AudioPlayback.SetVolume(20); + AudioPlayback.SetLoop(True); end; if CTime_hold > 231 then begin - Music.Play; + AudioPlayback.Play; Ctime_hold:=0; end; glClearColor(0,0,0,0); diff --git a/Game/Code/Screens/UScreenEdit.pas b/Game/Code/Screens/UScreenEdit.pas index 93c2a5b4..a58756e6 100644 --- a/Game/Code/Screens/UScreenEdit.pas +++ b/Game/Code/Screens/UScreenEdit.pas @@ -36,14 +36,15 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenMain); // Result := false; end; SDLK_RETURN: begin - if Interaction = 0 then begin - Music.PlayStart; + if Interaction = 0 then + begin + AudioPlayback.PlayStart; FadeTo(@ScreenEditConvert); end; // if Interaction = 1 then begin @@ -51,8 +52,9 @@ begin // FadeTo(@ScreenEditHeader); // end; - if Interaction = 1 then begin - Music.PlayBack; + if Interaction = 1 then + begin + AudioPlayback.PlayBack; FadeTo(@ScreenMain); end; end; diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index 762f84c2..1878337b 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -120,19 +120,21 @@ begin {$IFDEF UseMIDIPort} MidiFile.StopPlaying; {$ENDIF} - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenEdit); end; SDLK_RETURN: begin - if Interaction = 0 then begin - Music.PlayStart; + if Interaction = 0 then + begin + AudioPlayback.PlayStart; ScreenOpen.BackScreen := @ScreenEditConvert; FadeTo(@ScreenOpen); end; - if Interaction = 1 then begin + if Interaction = 1 then + begin Selected := false; {$IFDEF UseMIDIPort} MidiFile.OnMidiEvent := MidiFile1MidiEvent; diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 22420b26..1dd3fb24 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -320,13 +320,13 @@ begin if SDL_ModState = 0 then begin // Play Sentence Click := true; - Music.Stop; + AudioPlayback.Stop; R := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote); - if R <= Music.Length then begin - Music.MoveTo(R); + if R <= AudioPlayback.Length then begin + AudioPlayback.MoveTo(R); PlayStopTime := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec); PlaySentence := true; - Music.Play; + AudioPlayback.Play; LastClick := -100; end; end; @@ -349,10 +349,10 @@ begin PlaySentence := true; Click := true; - Music.Stop; - Music.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote)+0{-0.10}); + 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; - Music.Play; + AudioPlayback.Play; LastClick := -100; end; end; @@ -363,12 +363,12 @@ begin PlaySentenceMidi := false; // stop midi PlaySentence := true; Click := false; - Music.Stop; - Music.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start)); + 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)); - Music.Play; + AudioPlayback.Play; LastClick := -100; end; @@ -510,7 +510,7 @@ begin Lyric.AddCzesc(Czesci[0].Akt); Lyric.Selected := 0; - Music.Stop; + AudioPlayback.Stop; PlaySentence := false; end; @@ -538,7 +538,7 @@ begin Lyric.AddCzesc(Czesci[0].Akt); Lyric.Selected := 0; - Music.Stop; + AudioPlayback.Stop; PlaySentence := false; end; @@ -1188,7 +1188,7 @@ begin AktNuta := 0; Czesci[0].Czesc[0].Nuta[0].Color := 1; - Music.Open(Path + AktSong.Mp3); + AudioPlayback.Open(Path + AktSong.Mp3); //Set Down Music Volume for Better hearability of Midi Sounds //Music.SetVolume(40); @@ -1262,20 +1262,22 @@ begin // mp3 music if PlaySentence then begin // stop the music - if (Music.Position > PlayStopTime) then begin - Music.Stop; + 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(Music.Position - AktSong.GAP / 1000)); + 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 - Music.PlayClick; + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then + begin + AudioPlayback.PlayClick; LastClick := AktBeat; end; end; diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas index 34fc87af..df23d340 100644 --- a/Game/Code/Screens/UScreenLevel.pas +++ b/Game/Code/Screens/UScreenLevel.pas @@ -32,7 +32,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenName); end; @@ -40,7 +40,7 @@ begin begin Ini.Difficulty := Interaction; Ini.SaveLevel; - Music.PlayStart; + AudioPlayback.PlayStart; //Set Standard Mode ScreenSong.Mode := 0; FadeTo(@ScreenSong); diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index aecc40bb..cb7390cc 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -92,7 +92,7 @@ begin //Credits_Y := 600; //Credits_Alpha := 0; //Credits_Visible := True; - Music.PlayStart; + AudioPlayback.PlayStart; FadeTo(@ScreenCredits); end; end; @@ -100,20 +100,20 @@ begin begin if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then begin - Music.PlayStart; + AudioPlayback.PlayStart; FadeTo(@ScreenPartyOptions); end; end; SDLK_S: begin - Music.PlayStart; + AudioPlayback.PlayStart; FadeTo(@ScreenStatMain); end; SDLK_E: begin - Music.PlayStart; + AudioPlayback.PlayStart; FadeTo(@ScreenEdit); end; @@ -124,7 +124,7 @@ begin begin if (Length(Songs.Song) >= 1) then begin - Music.PlayStart; + AudioPlayback.PlayStart; if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1; if (Ini.Players = 4) then PlayersPlay := 6; @@ -141,7 +141,7 @@ begin begin if (Length(DLLMan.Plugins)>=1) then begin - Music.PlayStart; + AudioPlayback.PlayStart; FadeTo(@ScreenPartyOptions); end else //show error message, No Plugins Loaded @@ -152,25 +152,29 @@ begin end; //Stats - if Interaction = 2 then begin - Music.PlayStart; + if Interaction = 2 then + begin + AudioPlayback.PlayStart; FadeTo(@ScreenStatMain); end; //Editor - if Interaction = 3 then begin - Music.PlayStart; + if Interaction = 3 then + begin + AudioPlayback.PlayStart; FadeTo(@ScreenEdit); end; //Options - if Interaction = 4 then begin - Music.PlayStart; + if Interaction = 4 then + begin + AudioPlayback.PlayStart; FadeTo(@ScreenOptions); end; //Exit - if Interaction = 5 then begin + if Interaction = 5 then + begin Result := false; end; end; diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index 0d98e944..5363d2a2 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -156,7 +156,7 @@ begin SDLK_ESCAPE : begin Ini.SaveNames; - Music.PlayBack; + AudioPlayback.PlayBack; if GoTo_SingScreen then FadeTo(@ScreenSong) else @@ -168,7 +168,7 @@ begin for I := 1 to 6 do Ini.Name[I-1] := Button[I-1].Text[0].Text; Ini.SaveNames; - Music.PlayStart; + AudioPlayback.PlayStart; if GoTo_SingScreen then FadeTo(@ScreenSing) diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index c27ee762..edf684db 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -57,7 +57,7 @@ begin begin //Empty Filename and go to last Screen FileName := ''; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(BackScreen); end; @@ -66,14 +66,14 @@ begin if (Interaction = 2) then begin //Update Filename and go to last Screen FileName := Text[TextN].Text; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(BackScreen); end else if (Interaction = 1) then begin //Empty Filename and go to last Screen FileName := ''; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(BackScreen); end; end; diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas index a1f64659..1867d03b 100644 --- a/Game/Code/Screens/UScreenOptions.pas +++ b/Game/Code/Screens/UScreenOptions.pas @@ -36,49 +36,57 @@ begin SDLK_BACKSPACE : begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenMain); end; SDLK_RETURN: begin - if SelInteraction = 0 then begin - Music.PlayStart; + if SelInteraction = 0 then + begin + AudioPlayback.PlayStart; FadeTo(@ScreenOptionsGame); end; - if SelInteraction = 1 then begin - Music.PlayStart; + if SelInteraction = 1 then + begin + AudioPlayback.PlayStart; FadeTo(@ScreenOptionsGraphics); end; - if SelInteraction = 2 then begin - Music.PlayStart; + if SelInteraction = 2 then + begin + AudioPlayback.PlayStart; FadeTo(@ScreenOptionsSound); end; - if SelInteraction = 3 then begin - Music.PlayStart; + if SelInteraction = 3 then + begin + AudioPlayback.PlayStart; FadeTo(@ScreenOptionsLyrics); end; - if SelInteraction = 4 then begin - Music.PlayStart; + if SelInteraction = 4 then + begin + AudioPlayback.PlayStart; FadeTo(@ScreenOptionsThemes); end; - if SelInteraction = 5 then begin - Music.PlayStart; + if SelInteraction = 5 then + begin + AudioPlayback.PlayStart; FadeTo(@ScreenOptionsRecord); end; - if SelInteraction = 6 then begin - Music.PlayStart; + if SelInteraction = 6 then + begin + AudioPlayback.PlayStart; FadeTo(@ScreenOptionsAdvanced); end; - if SelInteraction = 7 then begin + if SelInteraction = 7 then + begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenMain); end; end; diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index 63c3aa7a..271ff972 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -32,7 +32,7 @@ begin SDLK_BACKSPACE : begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; SDLK_RETURN: @@ -41,7 +41,7 @@ begin //if SelInteraction = 7 then begin if SelInteraction = 6 then begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; end; @@ -54,7 +54,7 @@ begin //SelectLoadAnimation Hidden because it is useless atm //if (SelInteraction >= 0) and (SelInteraction <= 6) then begin if (SelInteraction >= 0) and (SelInteraction <= 5) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractInc; end; end; @@ -63,7 +63,7 @@ begin //SelectLoadAnimation Hidden because it is useless atm //if (SelInteraction >= 0) and (SelInteraction <= 6) then begin if (SelInteraction >= 0) and (SelInteraction <= 5) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index 0f69f326..1d94ffa6 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -33,14 +33,14 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - Music.PlayBack; + AudioPlayback.PlayBack; RefreshSongs; FadeTo(@ScreenOptions); end; SDLK_RETURN: begin if SelInteraction = 6 then begin - Music.PlayBack; + AudioPlayback.PlayBack; RefreshSongs; FadeTo(@ScreenOptions); end; @@ -51,15 +51,17 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin - Music.PlayOption; + if (SelInteraction >= 0) and (SelInteraction <= 5) then + begin + AudioPlayback.PlayOption; InteractInc; end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin - Music.PlayOption; + if (SelInteraction >= 0) and (SelInteraction <= 5) then + begin + AudioPlayback.PlayOption; InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index d4be6974..c0ea90ff 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -32,7 +32,7 @@ begin SDLK_BACKSPACE : begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; SDLK_RETURN: @@ -42,7 +42,7 @@ begin end;} if SelInteraction = 5 then begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; end; @@ -53,14 +53,14 @@ begin SDLK_RIGHT: begin if (SelInteraction >= 0) and (SelInteraction <= 4) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractInc; end; end; SDLK_LEFT: begin if (SelInteraction >= 0) and (SelInteraction <= 4) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas index 5cadc5b9..7ef7c207 100644 --- a/Game/Code/Screens/UScreenOptionsLyrics.pas +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -32,14 +32,14 @@ begin SDLK_BACKSPACE : begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; SDLK_RETURN: begin if SelInteraction = 3 then begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; end; @@ -50,14 +50,14 @@ begin SDLK_RIGHT: begin if (SelInteraction >= 0) and (SelInteraction <= 2) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractInc; end; end; SDLK_LEFT: begin if (SelInteraction >= 0) and (SelInteraction <= 2) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index ef8b31d1..d497c637 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -36,14 +36,14 @@ begin SDLK_BACKSPACE: begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; SDLK_RETURN: begin if SelInteraction = 4 then begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; end; @@ -54,7 +54,7 @@ begin SDLK_RIGHT: begin if (SelInteraction >= 0) and (SelInteraction <= 3) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractInc; end; if SelInteraction = 0 then UpdateCard; @@ -62,7 +62,7 @@ begin SDLK_LEFT: begin if (SelInteraction >= 0) and (SelInteraction <= 3) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractDec; end; if SelInteraction = 0 then UpdateCard; diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index 3c3e28e4..1777228b 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -32,14 +32,14 @@ begin SDLK_BACKSPACE : begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; SDLK_RETURN: begin if SelInteraction = 6 then begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; end; @@ -50,14 +50,14 @@ begin SDLK_RIGHT: begin if (SelInteraction >= 0) and (SelInteraction <= 5) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractInc; end; end; SDLK_LEFT: begin if (SelInteraction >= 0) and (SelInteraction <= 5) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index 5b5f8877..cf89ac3f 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -35,14 +35,14 @@ begin SDLK_BACKSPACE : begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; SDLK_RETURN: begin if SelInteraction = 3 then begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; end; @@ -53,14 +53,14 @@ begin SDLK_RIGHT: begin if (SelInteraction >= 0) and (SelInteraction <= 2) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractInc; end; end; SDLK_LEFT: begin if (SelInteraction >= 0) and (SelInteraction <= 2) then begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 30a1f8f0..ee534781 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -92,13 +92,13 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - Music.PlayBack; + AudioPlayback.PlayBack; CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); end; SDLK_RETURN: begin - Music.PlayStart; + AudioPlayback.PlayStart; if DLLMan.Selected.LoadSong then begin //Select PartyMode ScreenSong diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index ab6bd733..714e0d99 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -63,7 +63,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenMain); end; @@ -113,7 +113,7 @@ begin //Start Party PartySession.StartNewParty(Rounds + 2); - Music.PlayStart; + AudioPlayback.PlayStart; //Go to Player Screen FadeTo(@ScreenPartyPlayer); end; @@ -125,7 +125,7 @@ begin SDLK_UP: InteractPrev; SDLK_RIGHT: begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractInc; //Change Playlist2 if Playlist is Changed @@ -140,7 +140,7 @@ begin end; SDLK_LEFT: begin - Music.PlayOption; + AudioPlayback.PlayOption; InteractDec; //Change Playlist2 if Playlist is Changed diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index e6830ee6..24534599 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -184,7 +184,7 @@ begin SDLK_ESCAPE: begin Ini.SaveNames; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenPartyOptions); end; @@ -202,7 +202,7 @@ begin end; end; - Music.PlayStart; + AudioPlayback.PlayStart; FadeTo(@ScreenPartyNewRound); end; diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index 6333896c..6af835f2 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -57,7 +57,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - Music.PlayStart; + AudioPlayback.PlayStart; if (PartySession.CurRound < High(PartySession.Rounds)) then FadeTo(@ScreenPartyNewRound) else @@ -69,7 +69,7 @@ begin SDLK_RETURN: begin - Music.PlayStart; + AudioPlayback.PlayStart; if (PartySession.CurRound < High(PartySession.Rounds)) then FadeTo(@ScreenPartyNewRound) else diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas index fecca3d1..3c7ad921 100644 --- a/Game/Code/Screens/UScreenPartyWin.pas +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -50,13 +50,13 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - Music.PlayStart; + AudioPlayback.PlayStart; FadeTo(@ScreenMain); end; SDLK_RETURN: begin - Music.PlayStart; + AudioPlayback.PlayStart; FadeTo(@ScreenMain); end; end; diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 9e43f31f..e0c80297 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -146,7 +146,7 @@ begin //Sound[0].BufferLong Finish; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenScore); end; @@ -182,7 +182,7 @@ begin Paused := true; // pause Music - Music.Pause; + AudioPlayback.Pause; // pause Video if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then @@ -193,9 +193,9 @@ begin Czas.Teraz := PauseTime; //Position of Notes // Position of Music - Music.MoveTo (PauseTime); + AudioPlayback.MoveTo (PauseTime); // Play Music - Music.Play; + AudioPlayback.Play; // Video if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then @@ -451,14 +451,14 @@ begin // play music (I) - Music.CaptureStart; - Music.MoveTo(AktSong.Start); + AudioPlayback.CaptureStart; + AudioPlayback.MoveTo(AktSong.Start); // Music.Play; // prepare timer (I) // CountSkipTimeSet; Czas.Teraz := AktSong.Start; - Czas.Razem := Music.Length; + Czas.Razem := AudioPlayback.Length; if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000; Czas.OldBeat := -1; for P := 0 to High(Player) do @@ -871,7 +871,7 @@ begin end; // play music (II) - Music.Play; + AudioPlayback.Play; // prepare timer (II) CountSkipTimeSet; @@ -1147,7 +1147,7 @@ begin // check for music finish // Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(AktSong.Finish)); if ShowFinish then begin - if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + if (not AudioPlayback.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin //Pause Mod: if not Paused then Sing(Self); // analyze song @@ -1201,8 +1201,8 @@ end; procedure TScreenSing.Finish; begin - Music.CaptureStop; - Music.Stop; + AudioPlayback.CaptureStop; + AudioPlayback.Stop; if Ini.SavePlayback = 1 then begin Log.BenchmarkStart(0); diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index d18dd5bc..a05c6d4b 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -102,7 +102,7 @@ begin SDLK_BACKSPACE : begin Finish; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenPartyScore); end; @@ -170,7 +170,7 @@ begin end else //Start Without Song begin - Music.CaptureStart; + AudioPlayback.CaptureStart; end; //Set Playerinfo @@ -531,7 +531,7 @@ end; if ShowFinish then begin if DllMan.Selected.LoadSong then begin - if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + if (not AudioPlayback.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin //Pause Mod: if not Paused then Sing(Self); // analyze song @@ -658,12 +658,12 @@ end; function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound begin - Result := Music.LoadCustomSound(String(Name)); + Result := AudioPlayback.LoadCustomSound(String(Name)); end; procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound begin - Music.PlayCustomSound(Index); + AudioPlayback.PlayCustomSound(Index); end; end. diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 0bf411c1..df4ec87a 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -265,7 +265,7 @@ begin begin SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - Music.PlayChange; + AudioPlayback.PlayChange; ChangeMusic; SetScroll4; @@ -284,7 +284,7 @@ begin begin SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - Music.PlayChange; + AudioPlayback.PlayChange; ChangeMusic; SetScroll4; @@ -326,7 +326,7 @@ begin Interaction := I - 1; //Stop Music - Music.Stop; + AudioPlayback.Stop; CatSongs.ShowCategoryList; @@ -361,8 +361,8 @@ begin end else begin - Music.Stop; - Music.PlayBack; + AudioPlayback.Stop; + AudioPlayback.PlayBack; FadeTo(@ScreenMain); end; @@ -372,7 +372,7 @@ begin //When in party Mode then Ask before Close else if (Mode = 1) then begin - Music.PlayBack; + AudioPlayback.PlayBack; CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); end; end; @@ -495,7 +495,7 @@ begin FixSelected; //Play Music: - Music.PlayChange; + AudioPlayback.PlayChange; ChangeMusic; end; @@ -538,7 +538,7 @@ begin FixSelected; //Play Music: - Music.PlayChange; + AudioPlayback.PlayChange; ChangeMusic; end; end; @@ -548,8 +548,9 @@ begin SDLK_RIGHT: begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin - Music.PlayChange; + if (Length(Songs.Song) > 0) AND (Mode = 0) then + begin + AudioPlayback.PlayChange; SelectNext; // InteractNext; // SongTarget := Interaction; @@ -563,7 +564,7 @@ begin SDLK_LEFT: begin if (Length(Songs.Song) > 0)AND (Mode = 0) then begin - Music.PlayChange; + AudioPlayback.PlayChange; SelectPrev; ChangeMusic; SetScroll4; @@ -643,9 +644,9 @@ begin end else //Random in one Category begin - SkipTo(Random(CatSongs.VisibleSongs)); + SkipTo(Random(CatSongs.VisibleSongs)); end; - Music.PlayChange; + AudioPlayback.PlayChange; ChangeMusic; SetScroll4; @@ -1410,7 +1411,7 @@ end; procedure TScreenSong.onShow; begin - Music.Stop; + AudioPlayback.Stop; if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; if Ini.Players = 4 then PlayersPlay := 6; @@ -1429,13 +1430,13 @@ begin //Load Music only when Song Preview is activated if (Ini.PreviewVolume <> 0) then begin - Music.SetLoop(false); - Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); - Music.MoveTo(Music.Length / 4); - Music.Play; + AudioPlayback.SetLoop(false); + AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + AudioPlayback.MoveTo(AudioPlayback.Length / 4); + AudioPlayback.Play; //Set Preview Volume - Music.SetMusicVolume (Ini.PreviewVolume * 10); + AudioPlayback.SetMusicVolume (Ini.PreviewVolume * 10); {//if Music Fade is activated, Set Volume to 0 % if (Ini.PreviewFading <> 0) then Music.SetMusicVolume(0);} @@ -1478,15 +1479,15 @@ procedure TScreenSong.onHide; begin //When Music Fading is activated, Turn Music to 100 % If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then - Music.SetMusicVolume(100); + AudioPlayback.SetMusicVolume(100); //If Preview is deactivated: Load MUsicfile now If (Ini.PreviewVolume = 0) then - Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); //When hide then Stop Music (For Party Mode Popup on Exit) - if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then - Music.Stop; + if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (AudioPlayback <> nil) then + AudioPlayback.Stop; end; procedure TScreenSong.DrawExtensions; @@ -1546,13 +1547,13 @@ begin begin //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then - Music.Play; + AudioPlayback.Play; //Update Song Volume if (CoverTime < Ini.PreviewFading) then - Music.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) + AudioPlayback.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) else - Music.SetMusicVolume(Ini.PreviewVolume * 10); + AudioPlayback.SetMusicVolume(Ini.PreviewVolume * 10); end; @@ -1673,18 +1674,18 @@ begin begin if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then begin - Music.Close; - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - Music.MoveTo(Music.Length / 4); + AudioPlayback.Close; + if AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + AudioPlayback.MoveTo(AudioPlayback.Length / 4); //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal if (Ini.PreviewFading = 0) then - Music.Play + AudioPlayback.Play else - Music.SetMusicVolume(0); + AudioPlayback.SetMusicVolume(0); end; end else - Music.Stop; + AudioPlayback.Stop; end; end; @@ -1715,7 +1716,7 @@ var lTmp : double; begin -if (not Music.Finished) AND (Theme.Song.Equalizer.Length > 0) then +if (not AudioPlayback.Finished) AND (Theme.Song.Equalizer.Length > 0) then begin @@ -1724,7 +1725,7 @@ begin if (A <> EqualizerTime) then begin EqualizerTime := A; - Data := Music.GetFFTData; + Data := AudioPlayback.GetFFTData; B:=0; Pos := 0; @@ -1890,7 +1891,7 @@ begin end; end; - Music.PlayChange; + AudioPlayback.PlayChange; ChangeMusic; SetScroll; UpdateLCD; @@ -2003,7 +2004,7 @@ end; procedure TScreenSong.StartSong; begin CatSongs.Selected := Interaction; - Music.Stop; + AudioPlayback.Stop; //Party Mode if (Mode = 1) then begin @@ -2018,7 +2019,7 @@ end; procedure TScreenSong.SelectPlayers; begin CatSongs.Selected := Interaction; - Music.Stop; + AudioPlayback.Stop; ScreenName.Goto_SingScreen := True; FadeTo(@ScreenName); @@ -2026,9 +2027,10 @@ end; procedure TScreenSong.OpenEditor; begin - if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin - Music.Stop; - Music.PlayStart; + if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then + begin + AudioPlayback.Stop; + AudioPlayback.PlayStart; ScreenEditSub.Path := CatSongs.Song[Interaction].Path; ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName; FadeTo(@ScreenEditSub); diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 48d23468..de78665e 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -65,7 +65,7 @@ begin SDLK_ESCAPE: begin Visible := False; - Music.PlayBack; + AudioPlayback.PlayBack; if (VisSongs = 0) AND (Length(Button[0].Text[0].Text) > 0) then begin ScreenSong.UnLoadDetailedCover; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index ce331e2f..c6e16f60 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -94,7 +94,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - Music.PlayBack; + AudioPlayback.PlayBack; Visible := False; end; diff --git a/Game/Code/Screens/UScreenStatDetail.pas b/Game/Code/Screens/UScreenStatDetail.pas index 9dc6c525..1310b127 100644 --- a/Game/Code/Screens/UScreenStatDetail.pas +++ b/Game/Code/Screens/UScreenStatDetail.pas @@ -51,7 +51,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenStatMain); end; SDLK_RETURN: @@ -74,7 +74,7 @@ begin end; if Interaction = 3 then begin - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenStatMain); end; end; diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index 223ad2b2..4f46bec2 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -60,19 +60,20 @@ begin SDLK_BACKSPACE : begin Ini.Save; - Music.PlayBack; + AudioPlayback.PlayBack; FadeTo(@ScreenMain); end; SDLK_RETURN: begin //Exit Button Pressed - if Interaction = 4 then begin - Music.PlayBack; + if Interaction = 4 then + begin + AudioPlayback.PlayBack; FadeTo(@ScreenMain); end else //One of the Stats Buttons Pressed begin - Music.PlayBack; + AudioPlayback.PlayBack; ScreenStatDetail.Typ := Interaction; FadeTo(@ScreenStatDetail); end; -- cgit v1.2.3 From 6292440f6da3c11e85bb9fc3a741a26540e429be Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 11 Oct 2007 12:12:37 +0000 Subject: separated IAudioPlayback in to separate "Playback" and "Input" Interfaces ( both interfaces provided by same TMusic_Bass class... git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@505 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 2 +- Game/Code/Screens/UScreenSing.pas | 4 ++-- Game/Code/Screens/UScreenSingModi.pas | 2 +- Game/Code/Screens/UScreenSong.pas | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index b7d6d3e7..a24997d4 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -445,7 +445,7 @@ const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),( begin //dis does teh muiwk y0r - Data := AudioPlayback.GetFFTData; + Data := AudioInput.GetFFTData; Log.LogStatus('',' JB-1'); diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index e0c80297..abb2726e 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -451,7 +451,7 @@ begin // play music (I) - AudioPlayback.CaptureStart; + AudioInput.CaptureStart; AudioPlayback.MoveTo(AktSong.Start); // Music.Play; @@ -1201,7 +1201,7 @@ end; procedure TScreenSing.Finish; begin - AudioPlayback.CaptureStop; + AudioInput.CaptureStop; AudioPlayback.Stop; if Ini.SavePlayback = 1 then begin diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index a05c6d4b..b6989c76 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -170,7 +170,7 @@ begin end else //Start Without Song begin - AudioPlayback.CaptureStart; + AudioInput.CaptureStart; end; //Set Playerinfo diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index df4ec87a..ea1dd8a5 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1725,7 +1725,7 @@ begin if (A <> EqualizerTime) then begin EqualizerTime := A; - Data := AudioPlayback.GetFFTData; + Data := AudioInput.GetFFTData; B:=0; Pos := 0; -- cgit v1.2.3 From 8c923b5b76bb17e00132a0b2b2b96de34265fc63 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 16 Oct 2007 11:27:23 +0000 Subject: modified ffmpeg usage, to use interface same as bass... still needs some tidy up, but its working. :) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@515 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 43 +++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index abb2726e..c32b29e0 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -22,13 +22,15 @@ uses UMenu, ULyrics, TextGL, OpenGL12, +(* {$IFDEF useBASS} bass, {$ENDIF} +*) UThemes, ULCD, UGraphicClasses, - UVideo, +// UVideo, USingScores; type @@ -186,7 +188,8 @@ begin // pause Video if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then - FFmpegTogglePause; + VideoPlayback.Pause; +// FFmpegTogglePause; end else //Pause ausschalten begin @@ -199,7 +202,8 @@ begin // Video if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then - FFmpegTogglePause; + VideoPlayback.Pause; +// FFmpegTogglePause; //SkipSmpeg(PauseTime); Paused := false; @@ -279,7 +283,7 @@ begin Lyrics := TLyricEngine.Create(80,Skin_LyricsT,640,12,80,Skin_LyricsT+36,640,12); - UVideo.Init; + VideoPlayback.Init(); end; procedure TScreenSing.onShow; @@ -432,8 +436,12 @@ begin SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*) // todo: VideoGap and Start time verwursten - FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); - FFmpegSkip(AktSong.VideoGAP + AktSong.Start); +// FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); + VideoPlayback.Open( AktSong.Path + AktSong.Video ); + +// FFmpegSkip(AktSong.VideoGAP + AktSong.Start); + VideoPlayback.position := AktSong.VideoGAP + AktSong.Start; + AktSong.VideoLoaded := true; end; @@ -847,8 +855,11 @@ begin if AktSong.VideoLoaded then begin try - FFmpegGetFrame(Czas.Teraz); - FFmpegDrawGL(ScreenAct); + writeln( 'VideoPlayback.FFmpegGetFrame' ); + VideoPlayback.FFmpegGetFrame(Czas.Teraz); + + writeln( 'VideoPlayback.FFmpegDrawGL' ); + VideoPlayback.FFmpegDrawGL(ScreenAct); // PlaySmpeg; except @@ -862,7 +873,7 @@ begin Log.LogError('Corrupted File: ' + AktSong.Video); try // CloseSmpeg; - FFmpegClose; + VideoPlayback.Close; except end; @@ -1112,14 +1123,15 @@ begin SingDrawBackground; // update and draw movie - if ShowFinish and AktSong.VideoLoaded then begin + if ShowFinish and AktSong.VideoLoaded then + begin try // UpdateSmpeg; // this only draws // todo: find a way to determine, when a new frame is needed // toto: same for the need to skip frames - FFmpegGetFrame(Czas.Teraz); - FFmpegDrawGL(ScreenAct); + VideoPlayback.FFmpegGetFrame(Czas.Teraz); + VideoPlayback.FFmpegDrawGL(ScreenAct); except on E : Exception do begin @@ -1133,7 +1145,7 @@ begin Log.LogError('Corrupted File: ' + AktSong.Video); try // CloseSmpeg; - FFmpegClose; + VideoPlayback.Close; except end; @@ -1213,9 +1225,10 @@ begin Log.LogBenchmark('Creating files', 0); end; - if AktSong.VideoLoaded then begin + if AktSong.VideoLoaded then + begin // CloseSmpeg; - FFmpegClose; + VideoPlayback.Close; AktSong.VideoLoaded := false; // to prevent drawing closed video end; -- cgit v1.2.3 From 659f88b3328ab25380777d2f04124ff5e5c444ba Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 16 Oct 2007 11:36:18 +0000 Subject: tidy up un-needed uses clauses.. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@516 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 6 ------ Game/Code/Screens/UScreenSingModi.pas | 4 +--- 2 files changed, 1 insertion(+), 9 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index c32b29e0..542326d2 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -22,15 +22,9 @@ uses UMenu, ULyrics, TextGL, OpenGL12, -(* - {$IFDEF useBASS} - bass, - {$ENDIF} -*) UThemes, ULCD, UGraphicClasses, -// UVideo, USingScores; type diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index b6989c76..e2d53f0a 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -21,9 +21,7 @@ uses UMenu, ULyrics, TextGL, OpenGL12, - {$IFDEF useBASS} - bass, - {$ENDIF} + UThemes, ULCD, UScreenSing, -- cgit v1.2.3 From 9a144f3cc3b9fbed5b07ffc3a05c5449d638d3ae Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 25 Oct 2007 06:59:28 +0000 Subject: minor changes and fixes for USDX on linux. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@526 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenScore.pas | 8 +++++++- Game/Code/Screens/UScreenSing.pas | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index c53e8b32..97d31541 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -521,6 +521,7 @@ var BarStartPosX : Single; R,G,B : real; + lTmp : real; begin MaxHeight := Static[StaticBackLevel[PlayerNumber + 1]].Texture.H; @@ -544,7 +545,12 @@ begin // quadratic easing out - decelerating to zero velocity // -end_position * current_time * ( current_time - 2 ) + start_postion - NewHeight := (-Height2Reach * RaiseStep * (RaiseStep - 20) + BarStartPosY) / RaiseSmoothness; + lTmp := (-Height2Reach * RaiseStep * (RaiseStep - 20) + BarStartPosY); + if ( RaiseSmoothness > 0 ) AND + ( lTmp > 0 ) then + begin + NewHeight := lTmp / RaiseSmoothness; + end; end else begin diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 542326d2..8cba8f36 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -425,7 +425,8 @@ begin // AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed // set movie - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin + if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + begin (* OpenSmpeg(AktSong.Path + AktSong.Video); SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*) -- cgit v1.2.3 From 8cca9e3e6f591c35d35d132a9d3f93ffc7cdfee8 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sat, 27 Oct 2007 06:31:04 +0000 Subject: made some major progress with ffmpeg audio playback !!! YAY !!! still a little choppy, so I suspect incorrect buffer sizes or something like that. also made some mods to support Unicode song file iteration on windows, this is no worse than what we had before, but is not complete.. oh this code only supports win 2000 and up .. no Win 98... git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@533 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index ea1dd8a5..4d146283 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -261,7 +261,9 @@ begin begin For I := 1 to high(CatSongs.Song) do begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND + (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND + (widechar(UpperCase(CatSongs.Song[(I + Interaction) mod I2].Title)[1]) = widechar(Letter)) then begin SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); @@ -280,7 +282,9 @@ begin begin For I := 1 to high(CatSongs.Song) do begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Artist[1]) = Letter) then + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND + (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND + (widechar(uppercase(CatSongs.Song[(I + Interaction) mod I2].Artist)[1]) = widechar(Letter)) then begin SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); -- cgit v1.2.3 From 391d30716d48dc709f6444b19c008e82311623b9 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Thu, 1 Nov 2007 19:34:40 +0000 Subject: Mac OS X version compiles and links. I hope I didn't break too many files on windows/linux. Added switches.inc to all files. Changed many IFDEFs. For Windows-only code please use MSWINDOWS instead of WIN32 now. WIN32 is also used by the Mac port. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@546 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 4 - Game/Code/Screens/UScreenEdit.pas | 2 + Game/Code/Screens/UScreenEditConvert.pas | 4 - Game/Code/Screens/UScreenEditHeader.pas | 2 + Game/Code/Screens/UScreenEditSub.pas | 4 - Game/Code/Screens/UScreenLevel.pas | 2 + Game/Code/Screens/UScreenLoading.pas | 4 - Game/Code/Screens/UScreenMain.pas | 4 +- Game/Code/Screens/UScreenName.pas | 2 + Game/Code/Screens/UScreenOpen.pas | 2 + Game/Code/Screens/UScreenOptions.pas | 2 + Game/Code/Screens/UScreenOptionsAdvanced.pas | 2 + Game/Code/Screens/UScreenOptionsGame.pas | 2 + Game/Code/Screens/UScreenOptionsGraphics.pas | 2 + Game/Code/Screens/UScreenOptionsLyrics.pas | 2 + Game/Code/Screens/UScreenOptionsRecord.pas | 2 + Game/Code/Screens/UScreenOptionsSound.pas | 2 + Game/Code/Screens/UScreenOptionsThemes.pas | 2 + Game/Code/Screens/UScreenPartyNewRound.pas | 5 +- Game/Code/Screens/UScreenPartyOptions.pas | 4 +- Game/Code/Screens/UScreenPartyPlayer.pas | 2 + Game/Code/Screens/UScreenPartyScore.pas | 2 + Game/Code/Screens/UScreenPartyWin.pas | 2 + Game/Code/Screens/UScreenPopup.pas | 2 + Game/Code/Screens/UScreenScore.pas | 4 +- Game/Code/Screens/UScreenSing.pas | 4 - Game/Code/Screens/UScreenSingModi.pas | 907 +++++++++++++-------------- Game/Code/Screens/UScreenSong.pas | 8 +- Game/Code/Screens/UScreenSongJumpto.pas | 2 + Game/Code/Screens/UScreenSongMenu.pas | 4 +- Game/Code/Screens/UScreenStatDetail.pas | 2 + Game/Code/Screens/UScreenStatMain.pas | 9 +- Game/Code/Screens/UScreenTop5.pas | 5 +- Game/Code/Screens/UScreenWelcome.pas | 2 + 34 files changed, 503 insertions(+), 507 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index a24997d4..e60b9fb9 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -2,10 +2,6 @@ unit UScreenCredits; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - {$I switches.inc} diff --git a/Game/Code/Screens/UScreenEdit.pas b/Game/Code/Screens/UScreenEdit.pas index a58756e6..49adb994 100644 --- a/Game/Code/Screens/UScreenEdit.pas +++ b/Game/Code/Screens/UScreenEdit.pas @@ -2,6 +2,8 @@ unit UScreenEdit; interface +{$I switches.inc} + uses UMenu, SDL, UThemes; type diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index 1878337b..0c8244ab 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -2,10 +2,6 @@ unit UScreenEditConvert; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - {$I switches.inc} uses UMenu, diff --git a/Game/Code/Screens/UScreenEditHeader.pas b/Game/Code/Screens/UScreenEditHeader.pas index a7105b0e..7c8b2d56 100644 --- a/Game/Code/Screens/UScreenEditHeader.pas +++ b/Game/Code/Screens/UScreenEditHeader.pas @@ -2,6 +2,8 @@ unit UScreenEditHeader; interface +{$I switches.inc} + uses UMenu, SDL, USongs, UThemes; type diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 1dd3fb24..d24fdede 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -2,10 +2,6 @@ unit UScreenEditSub; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - {$I switches.inc} uses diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas index df23d340..d4b528b5 100644 --- a/Game/Code/Screens/UScreenLevel.pas +++ b/Game/Code/Screens/UScreenLevel.pas @@ -2,6 +2,8 @@ unit UScreenLevel; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; diff --git a/Game/Code/Screens/UScreenLoading.pas b/Game/Code/Screens/UScreenLoading.pas index 2ccc5c79..989461f2 100644 --- a/Game/Code/Screens/UScreenLoading.pas +++ b/Game/Code/Screens/UScreenLoading.pas @@ -4,10 +4,6 @@ interface {$I switches.inc} -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - uses UMenu, SDL, diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index cb7390cc..38f58bf1 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -2,9 +2,7 @@ unit UScreenMain; interface -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} +{$I switches.inc} uses UMenu, diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index 5363d2a2..76e79a3b 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -2,6 +2,8 @@ unit UScreenName; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index edf684db..30404d6e 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -2,6 +2,8 @@ unit UScreenOpen; interface +{$I switches.inc} + uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, UMenuText, ULyrics, Math, OpenGL12, UThemes; diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas index 1867d03b..bcd781cc 100644 --- a/Game/Code/Screens/UScreenOptions.pas +++ b/Game/Code/Screens/UScreenOptions.pas @@ -2,6 +2,8 @@ unit UScreenOptions; interface +{$I switches.inc} + uses UMenu, SDL, SysUtils, UDisplay, UMusic, UFiles, UIni, UThemes; diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index 271ff972..0d40b7ec 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -2,6 +2,8 @@ unit UScreenOptionsAdvanced; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index 1d94ffa6..6cd0a20c 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -2,6 +2,8 @@ unit UScreenOptionsGame; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes, USongs; diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index c0ea90ff..947d506b 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -2,6 +2,8 @@ unit UScreenOptionsGraphics; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas index 7ef7c207..8d70eec9 100644 --- a/Game/Code/Screens/UScreenOptionsLyrics.pas +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -2,6 +2,8 @@ unit UScreenOptionsLyrics; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index d497c637..4be16e70 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -2,6 +2,8 @@ unit UScreenOptionsRecord; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index 1777228b..867a10b6 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -2,6 +2,8 @@ unit UScreenOptionsSound; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index cf89ac3f..750e8859 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -2,6 +2,8 @@ unit UScreenOptionsThemes; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index ee534781..17f3b2b5 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -2,10 +2,7 @@ unit UScreenPartyNewRound; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - +{$I switches.inc} uses UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 714e0d99..7be4d1c0 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -2,9 +2,7 @@ unit UScreenPartyOptions; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} +{$I switches.inc} uses UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index 24534599..4aaa5a3e 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -2,6 +2,8 @@ unit UScreenPartyPlayer; Interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index 6af835f2..ea9b944b 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -2,6 +2,8 @@ unit UScreenPartyScore; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, SysUtils, UThemes; diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas index 3c7ad921..9806159a 100644 --- a/Game/Code/Screens/UScreenPartyWin.pas +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -2,6 +2,8 @@ unit UScreenPartyWin; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, SysUtils, UThemes; diff --git a/Game/Code/Screens/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas index cc1b4492..402857a9 100644 --- a/Game/Code/Screens/UScreenPopup.pas +++ b/Game/Code/Screens/UScreenPopup.pas @@ -2,6 +2,8 @@ unit UScreenPopup; interface +{$I switches.inc} + uses UMenu, SDL, UMusic, UFiles, SysUtils, UThemes; diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 97d31541..36e3b43b 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -2,9 +2,7 @@ unit UScreenScore; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} +{$I switches.inc} uses UMenu, diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 8cba8f36..60cab0a4 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -4,10 +4,6 @@ interface {$I switches.inc} -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - uses UMenu, UMusic, diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index e2d53f0a..7f692af5 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -1,12 +1,9 @@ -unit UScreenSingModi; +unit UScreenSingModi; interface {$I switches.inc} -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} uses UMenu, UMusic, @@ -156,456 +153,456 @@ begin end; procedure TScreenSingModi.onShow; -var - I: Integer; -begin - - PlayersPlay := TeamInfo.NumTeams; - - if DLLMan.Selected.LoadSong then //Start with Song - begin - inherited; - end - else //Start Without Song - begin - AudioInput.CaptureStart; - end; - -//Set Playerinfo - PlayerInfo.NumPlayers := PlayersPlay; - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); - PlayerInfo.Playerinfo[I].Score := 0; - PlayerInfo.Playerinfo[I].Bar := 50; - PlayerInfo.Playerinfo[I].Enabled := True; - end; - - for I := PlayerInfo.NumPlayers to high(PlayerInfo.Playerinfo) do - begin - PlayerInfo.Playerinfo[I].Score:= 0; - PlayerInfo.Playerinfo[I].Bar := 0; - PlayerInfo.Playerinfo[I].Enabled := False; - end; - - {Case PlayersPlay of - 1: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; - end; - 2,4: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1TwoPScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; - PlayerInfo.Playerinfo[2].PosX := Static[StaticP1TwoPScoreBG].Texture.X; - PlayerInfo.Playerinfo[2].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; - PlayerInfo.Playerinfo[1].PosX := Static[StaticP2RScoreBG].Texture.X; - PlayerInfo.Playerinfo[1].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; - PlayerInfo.Playerinfo[3].PosX := Static[StaticP2RScoreBG].Texture.X; - PlayerInfo.Playerinfo[3].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; - end; - 3,6: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ThreePScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; - PlayerInfo.Playerinfo[3].PosX := Static[StaticP1ThreePScoreBG].Texture.X; - PlayerInfo.Playerinfo[3].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; - PlayerInfo.Playerinfo[1].PosX := Static[StaticP2MScoreBG].Texture.X; - PlayerInfo.Playerinfo[1].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; - PlayerInfo.Playerinfo[4].PosX := Static[StaticP2MScoreBG].Texture.X; - PlayerInfo.Playerinfo[4].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; - PlayerInfo.Playerinfo[2].PosX := Static[StaticP3RScoreBG].Texture.X; - PlayerInfo.Playerinfo[2].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; - PlayerInfo.Playerinfo[5].PosX := Static[StaticP3RScoreBG].Texture.X; - PlayerInfo.Playerinfo[5].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; - end; - end; } - - // play music (I) - //Music.CaptureStart; - //Music.MoveTo(AktSong.Start); - - //Init Plugin - if not DLLMan.PluginInit(TeamInfo, PlayerInfo, ToSentences(Czesci[0]), LoadTex, Print, LoadSound, PlaySound) then - begin - //Fehler - Log.LogError('Could not Init Plugin'); - Halt; - end; - - // Set Background (Little Workaround, maybe change sometime) - if (DLLMan.Selected.LoadBack) AND (DLLMan.Selected.LoadSong) then - ScreenSing.Tex_Background := Tex_Background; - - Winner := 0; - - //Set Score Visibility - {if PlayersPlay = 1 then begin - Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; - Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; - end; - - if (PlayersPlay = 2) OR (PlayersPlay = 4) then begin - Text[TextP1TwoPScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP1TwoPScoreBG].Visible := DLLMan.Selected.ShowScore; - - Text[TextP2RScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP2RScoreBG].Visible := DLLMan.Selected.ShowScore; - end; - - if (PlayersPlay = 3) OR (PlayersPlay = 6) then begin - Text[TextP1ThreePScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP1ThreePScoreBG].Visible := DLLMan.Selected.ShowScore; - - Text[TextP2MScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP2MScoreBG].Visible := DLLMan.Selected.ShowScore; - - Text[TextP3RScore].Visible := DLLMan.Selected.ShowScore; - Static[StaticP3RScoreBG].Visible := DLLMan.Selected.ShowScore; - end; } -end; - -function TScreenSingModi.Draw: boolean; -var - Min: integer; - Sec: integer; - Tekst: string; - S, I: integer; - T: integer; -begin -//Set Playerinfo - PlayerInfo.NumPlayers := PlayersPlay; - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - PlayerInfo.Playerinfo[I].Name := PChar(Player[I].Name); - if PlayerInfo.Playerinfo[I].Enabled then - begin - if (Player[I].ScoreTotalI<=10000) then - PlayerInfo.Playerinfo[I].Score:= Player[I].ScoreTotalI; - PlayerInfo.Playerinfo[I].Bar := Round(Scores.Players[I].RBPos * 100); - end; - end; - -//Show Score -if DLLMan.Selected.ShowScore then -begin - {//ScoreBG Mod - // set player colors - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - - - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - - - - end; - if ScreenAct = 2 then begin - LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, - Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P4Dark'); - - - - LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, - Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); - LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); - - - - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P3Dark'); - - - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); - - - - end; - if ScreenAct = 2 then begin - LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, - Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, - Static[StaticP2R].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, - Static[StaticP3R].Texture.ColB, 'P6Dark'); - - - - - LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, - Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); - LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, - Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); - LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, - Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); - - - - - end; - end; - //end ScoreBG Mod } - -// set player names (for 2 screens and only Singstar skin) - if ScreenAct = 1 then begin - Text[TextP1].Text := 'P1'; - Text[TextP1TwoP].Text := 'P1'; // added for ps3 skin - Text[TextP1ThreeP].Text := 'P1'; // added for ps3 skin - Text[TextP2R].Text := 'P2'; - Text[TextP2M].Text := 'P2'; - Text[TextP3R].Text := 'P3'; - end; - - if ScreenAct = 2 then begin - case PlayersPlay of - 4: begin - Text[TextP1TwoP].Text := 'P3'; - Text[TextP2R].Text := 'P4'; - end; - 6: begin - Text[TextP1ThreeP].Text := 'P4'; - Text[TextP2M].Text := 'P5'; - Text[TextP3R].Text := 'P6'; - end; - end; // case - end; // if - - - // stereo <- and where iss P2M? or P3? - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; - Text[TextP1].X := Text[TextP1].X + 10*ScreenX; - - {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; - Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; - - {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} - - // .. and scores - {if PlayersPlay = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; - end; - - if PlayersPlay = 2 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - - if PlayersPlay = 3 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; - - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - if ScreenAct = 2 then begin - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; - - Tekst := IntToStr(Player[4].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; - - Tekst := IntToStr(Player[5].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; - end; - end; } - -end; //ShowScore - - for S := 1 to 1 do - Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X + 10*ScreenX; - -if DLLMan.Selected.LoadSong then -begin - // update static menu with time ... - Min := Round(Czas.Teraz) div 60; - Sec := Round(Czas.Teraz) mod 60; - Text[TextTimeText].Text := ''; - if Min < 10 then Text[TextTimeText].Text := '0'; - Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':'; - if Sec < 10 then Text[TextTimeText].Text := Text[TextTimeText].Text + '0'; - Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec); -end; - - // draw static menu (BG) - DrawBG; - - //Draw Background - if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) then - SingDrawBackground; - - // comment by blindy: wo zum henker wird denn in diesem screen ein video abgespielt? - // update and draw movie - // wie wo wadd? also in der selben funktion in der uscreensing kommt des video in der zeile 995, oder was wollteste wissen? :X -{ if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin - UpdateSmpeg; // this only draws - end;} - - // draw static menu (FG) - DrawFG; - - if ShowFinish then begin - if DllMan.Selected.LoadSong then - begin - if (not AudioPlayback.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin - //Pause Mod: - if not Paused then - Sing(Self); // analyze song - end else begin - if not FadeOut then begin - Finish; - FadeOut := true; - FadeTo(@ScreenPartyScore); - end; - end; - end; - end; - - // draw custom items - SingModiDraw(PlayerInfo); // always draw - - //GoldenNoteStarsTwinkle Mod - GoldenRec.SpawnRec; - //GoldenNoteStarsTwinkle Mod - - //Update PlayerInfo - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - if PlayerInfo.Playerinfo[I].Enabled then - begin - //PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; - PlayerInfo.Playerinfo[I].Score := Player[I].ScoreTotalI; - end; - end; - - if ((ShowFinish) AND (NOT Paused)) then - begin - if not DLLMan.PluginDraw(Playerinfo, Czesci[0].Akt) then - begin - if not FadeOut then begin - Finish; - FadeOut := true; - FadeTo(@ScreenPartyScore); - end; - end; - end; - - //Change PlayerInfo/Changeables - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - if (Player[I].ScoreTotalI <> PlayerInfo.Playerinfo[I].Score) then - begin - //Player[I].ScoreTotal := Player[I].ScoreTotal + (PlayerInfo.Playerinfo[I].Score - Player[I].ScoreTotalI); - Player[I].ScoreTotalI := PlayerInfo.Playerinfo[I].Score; - end; - {if (PlayerInfo.Playerinfo[I].Bar <> Player[I].ScorePercent) then - Player[I].ScorePercentTarget := PlayerInfo.Playerinfo[I].Bar; } - end; - - // back stereo - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; - Text[TextP1].X := Text[TextP1].X - 10*ScreenX; - - {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX;} - - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; - Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; - - {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX;} - - - for S := 1 to 1 do - Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X - 10*ScreenX; - - +var + I: Integer; +begin + + PlayersPlay := TeamInfo.NumTeams; + + if DLLMan.Selected.LoadSong then //Start with Song + begin + inherited; + end + else //Start Without Song + begin + AudioInput.CaptureStart; + end; + +//Set Playerinfo + PlayerInfo.NumPlayers := PlayersPlay; + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); + PlayerInfo.Playerinfo[I].Score := 0; + PlayerInfo.Playerinfo[I].Bar := 50; + PlayerInfo.Playerinfo[I].Enabled := True; + end; + + for I := PlayerInfo.NumPlayers to high(PlayerInfo.Playerinfo) do + begin + PlayerInfo.Playerinfo[I].Score:= 0; + PlayerInfo.Playerinfo[I].Bar := 0; + PlayerInfo.Playerinfo[I].Enabled := False; + end; + + {Case PlayersPlay of + 1: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; + end; + 2,4: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1TwoPScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; + PlayerInfo.Playerinfo[2].PosX := Static[StaticP1TwoPScoreBG].Texture.X; + PlayerInfo.Playerinfo[2].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; + PlayerInfo.Playerinfo[1].PosX := Static[StaticP2RScoreBG].Texture.X; + PlayerInfo.Playerinfo[1].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; + PlayerInfo.Playerinfo[3].PosX := Static[StaticP2RScoreBG].Texture.X; + PlayerInfo.Playerinfo[3].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; + end; + 3,6: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ThreePScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; + PlayerInfo.Playerinfo[3].PosX := Static[StaticP1ThreePScoreBG].Texture.X; + PlayerInfo.Playerinfo[3].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; + PlayerInfo.Playerinfo[1].PosX := Static[StaticP2MScoreBG].Texture.X; + PlayerInfo.Playerinfo[1].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; + PlayerInfo.Playerinfo[4].PosX := Static[StaticP2MScoreBG].Texture.X; + PlayerInfo.Playerinfo[4].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; + PlayerInfo.Playerinfo[2].PosX := Static[StaticP3RScoreBG].Texture.X; + PlayerInfo.Playerinfo[2].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; + PlayerInfo.Playerinfo[5].PosX := Static[StaticP3RScoreBG].Texture.X; + PlayerInfo.Playerinfo[5].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; + end; + end; } + + // play music (I) + //Music.CaptureStart; + //Music.MoveTo(AktSong.Start); + + //Init Plugin + if not DLLMan.PluginInit(TeamInfo, PlayerInfo, ToSentences(Czesci[0]), LoadTex, Print, LoadSound, PlaySound) then + begin + //Fehler + Log.LogError('Could not Init Plugin'); + Halt; + end; + + // Set Background (Little Workaround, maybe change sometime) + if (DLLMan.Selected.LoadBack) AND (DLLMan.Selected.LoadSong) then + ScreenSing.Tex_Background := Tex_Background; + + Winner := 0; + + //Set Score Visibility + {if PlayersPlay = 1 then begin + Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; + end; + + if (PlayersPlay = 2) OR (PlayersPlay = 4) then begin + Text[TextP1TwoPScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1TwoPScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP2RScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP2RScoreBG].Visible := DLLMan.Selected.ShowScore; + end; + + if (PlayersPlay = 3) OR (PlayersPlay = 6) then begin + Text[TextP1ThreePScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP1ThreePScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP2MScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP2MScoreBG].Visible := DLLMan.Selected.ShowScore; + + Text[TextP3RScore].Visible := DLLMan.Selected.ShowScore; + Static[StaticP3RScoreBG].Visible := DLLMan.Selected.ShowScore; + end; } +end; + +function TScreenSingModi.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + S, I: integer; + T: integer; +begin +//Set Playerinfo + PlayerInfo.NumPlayers := PlayersPlay; + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + PlayerInfo.Playerinfo[I].Name := PChar(Player[I].Name); + if PlayerInfo.Playerinfo[I].Enabled then + begin + if (Player[I].ScoreTotalI<=10000) then + PlayerInfo.Playerinfo[I].Score:= Player[I].ScoreTotalI; + PlayerInfo.Playerinfo[I].Bar := Round(Scores.Players[I].RBPos * 100); + end; + end; + +//Show Score +if DLLMan.Selected.ShowScore then +begin + {//ScoreBG Mod + // set player colors + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + + + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P4Dark'); + + + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); + + + + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P3Dark'); + + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P6Dark'); + + + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); + + + + + end; + end; + //end ScoreBG Mod } + +// set player names (for 2 screens and only Singstar skin) + if ScreenAct = 1 then begin + Text[TextP1].Text := 'P1'; + Text[TextP1TwoP].Text := 'P1'; // added for ps3 skin + Text[TextP1ThreeP].Text := 'P1'; // added for ps3 skin + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; + end; + + if ScreenAct = 2 then begin + case PlayersPlay of + 4: begin + Text[TextP1TwoP].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 6: begin + Text[TextP1ThreeP].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end; + end; // case + end; // if + + + // stereo <- and where iss P2M? or P3? + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; + Text[TextP1].X := Text[TextP1].X + 10*ScreenX; + + {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; + Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; + + {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} + + // .. and scores + {if PlayersPlay = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + end; + + if PlayersPlay = 2 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + + if PlayersPlay = 3 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[4].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[5].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + end; } + +end; //ShowScore + + for S := 1 to 1 do + Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X + 10*ScreenX; + +if DLLMan.Selected.LoadSong then +begin + // update static menu with time ... + Min := Round(Czas.Teraz) div 60; + Sec := Round(Czas.Teraz) mod 60; + Text[TextTimeText].Text := ''; + if Min < 10 then Text[TextTimeText].Text := '0'; + Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':'; + if Sec < 10 then Text[TextTimeText].Text := Text[TextTimeText].Text + '0'; + Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec); +end; + + // draw static menu (BG) + DrawBG; + + //Draw Background + if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) then + SingDrawBackground; + + // comment by blindy: wo zum henker wird denn in diesem screen ein video abgespielt? + // update and draw movie + // wie wo wadd? also in der selben funktion in der uscreensing kommt des video in der zeile 995, oder was wollteste wissen? :X +{ if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin + UpdateSmpeg; // this only draws + end;} + + // draw static menu (FG) + DrawFG; + + if ShowFinish then begin + if DllMan.Selected.LoadSong then + begin + if (not AudioPlayback.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + //Pause Mod: + if not Paused then + Sing(Self); // analyze song + end else begin + if not FadeOut then begin + Finish; + FadeOut := true; + FadeTo(@ScreenPartyScore); + end; + end; + end; + end; + + // draw custom items + SingModiDraw(PlayerInfo); // always draw + + //GoldenNoteStarsTwinkle Mod + GoldenRec.SpawnRec; + //GoldenNoteStarsTwinkle Mod + + //Update PlayerInfo + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + if PlayerInfo.Playerinfo[I].Enabled then + begin + //PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; + PlayerInfo.Playerinfo[I].Score := Player[I].ScoreTotalI; + end; + end; + + if ((ShowFinish) AND (NOT Paused)) then + begin + if not DLLMan.PluginDraw(Playerinfo, Czesci[0].Akt) then + begin + if not FadeOut then begin + Finish; + FadeOut := true; + FadeTo(@ScreenPartyScore); + end; + end; + end; + + //Change PlayerInfo/Changeables + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + if (Player[I].ScoreTotalI <> PlayerInfo.Playerinfo[I].Score) then + begin + //Player[I].ScoreTotal := Player[I].ScoreTotal + (PlayerInfo.Playerinfo[I].Score - Player[I].ScoreTotalI); + Player[I].ScoreTotalI := PlayerInfo.Playerinfo[I].Score; + end; + {if (PlayerInfo.Playerinfo[I].Bar <> Player[I].ScorePercent) then + Player[I].ScorePercentTarget := PlayerInfo.Playerinfo[I].Bar; } + end; + + // back stereo + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; + Text[TextP1].X := Text[TextP1].X - 10*ScreenX; + + {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX;} + + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; + Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; + + {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX;} + + + for S := 1 to 1 do + Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X - 10*ScreenX; + + end; procedure TScreenSingModi.Finish; @@ -665,4 +662,4 @@ begin end; end. ->>>>>>> .r429 +>>>>>>> .r429 diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 4d146283..3f2f5d58 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1,12 +1,8 @@ unit UScreenSong; interface -{$I switches.inc} - -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} +{$I switches.inc} uses @@ -813,7 +809,7 @@ begin try AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); except - {$IFDEF win32} + {$IFDEF MSWINDOWS} Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); {$ELSE} // TODO : JB_linux - better handle this message and display to user.. diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index de78665e..14228964 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -2,6 +2,8 @@ unit UScreenSongJumpto; interface +{$I switches.inc} + uses UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index c6e16f60..6f9b0c53 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -2,9 +2,7 @@ unit UScreenSongMenu; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} +{$I switches.inc} uses UMenu, diff --git a/Game/Code/Screens/UScreenStatDetail.pas b/Game/Code/Screens/UScreenStatDetail.pas index 1310b127..414055f9 100644 --- a/Game/Code/Screens/UScreenStatDetail.pas +++ b/Game/Code/Screens/UScreenStatDetail.pas @@ -2,6 +2,8 @@ unit UScreenStatDetail; interface +{$I switches.inc} + uses UMenu, SDL, SysUtils, UDisplay, UMusic, UIni, UThemes; diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index 4f46bec2..02209dd7 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -2,10 +2,7 @@ unit UScreenStatMain; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - +{$I switches.inc} uses UMenu, @@ -164,7 +161,7 @@ var Result1, Result2: AStatResult; ResetTime: TSystemTime; - {$IFDEF win32} + {$IFDEF MSWINDOWS} function GetFileCreation(Filename: String): TSystemTime; var FindData: TWin32FindData; @@ -207,7 +204,7 @@ begin ResetTime := GetFileCreation(Database.Filename); - {$IFDEF win32} + {$IFDEF MSWINDOWS} A1 := ResetTime.wDay; A2 := ResetTime.wMonth; A3 := ResetTime.wYear; diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas index d0fe15c8..83ba2bb0 100644 --- a/Game/Code/Screens/UScreenTop5.pas +++ b/Game/Code/Screens/UScreenTop5.pas @@ -2,10 +2,7 @@ unit UScreenTop5; interface -{$IFDEF FPC} - {$MODE DELPHI} -{$ENDIF} - +{$I switches.inc} uses UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes, ULCD; diff --git a/Game/Code/Screens/UScreenWelcome.pas b/Game/Code/Screens/UScreenWelcome.pas index 35e159f8..fc088458 100644 --- a/Game/Code/Screens/UScreenWelcome.pas +++ b/Game/Code/Screens/UScreenWelcome.pas @@ -2,6 +2,8 @@ unit UScreenWelcome; interface +{$I switches.inc} + uses UMenu, SDL, SysUtils, UThemes; -- cgit v1.2.3 From 99955c78f63d1cb0d8bec666bc33953590a74c8a Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 1 Nov 2007 23:22:01 +0000 Subject: fixed failed builds build:USDX-LAZLIN-75 build:USDX-LAZLIN-76 for some reason we can not use {$MODE Delphi} in an included file. ( Probably because of the way the compier scopes this switch to each pas file ) ive had to revert this part of eddies changes. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@548 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 4 + Game/Code/Screens/UScreenEditConvert.pas | 1158 ++++++------ Game/Code/Screens/UScreenEditSub.pas | 2749 ++++++++++++++-------------- Game/Code/Screens/UScreenLoading.pas | 110 +- Game/Code/Screens/UScreenMain.pas | 572 +++--- Game/Code/Screens/UScreenPartyNewRound.pas | 842 ++++----- Game/Code/Screens/UScreenPartyOptions.pas | 522 +++--- Game/Code/Screens/UScreenScore.pas | 4 + Game/Code/Screens/UScreenSing.pas | 4 + Game/Code/Screens/UScreenSingModi.pas | 4 + Game/Code/Screens/UScreenSong.pas | 7 +- Game/Code/Screens/UScreenSongMenu.pas | 4 + Game/Code/Screens/UScreenStatMain.pas | 4 + Game/Code/Screens/UScreenTop5.pas | 4 + 14 files changed, 3022 insertions(+), 2966 deletions(-) (limited to 'Game/Code/Screens') 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 -- cgit v1.2.3 From 35b7a40253bd38d1e1df8469d4151e99f9978850 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Fri, 2 Nov 2007 11:14:33 +0000 Subject: Runtime theme changing - jira#USDX-156 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@552 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenOptionsThemes.pas | 51 ++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 3 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index 750e8859..5b7e4d43 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -37,13 +37,28 @@ begin SDLK_BACKSPACE : begin Ini.Save; + + // Reload all screens, after Theme changed + // Todo : JB - Check if theme was actually changed + UGraphic.UnLoadScreens(); + UGraphic.LoadScreens(); + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; SDLK_RETURN: begin - if SelInteraction = 3 then begin + if SelInteraction = 3 then + begin Ini.Save; + + // Reload all screens, after Theme changed + // Todo : JB - Check if theme was actually changed + UGraphic.UnLoadScreens(); + UGraphic.LoadScreens(); + + UGraphic.LoadScreens(); + AudioPlayback.PlayBack; FadeTo(@ScreenOptions); end; @@ -54,14 +69,16 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 2) then begin + if (SelInteraction >= 0) and (SelInteraction <= 2) then + begin AudioPlayback.PlayOption; InteractInc; end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 2) then begin + if (SelInteraction >= 0) and (SelInteraction <= 2) then + begin AudioPlayback.PlayOption; InteractDec; end; @@ -78,6 +95,20 @@ begin begin Skin.OnThemeChange; UpdateSelectSlideOptions (Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); + + Theme.LoadTheme('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + + ScreenOptionsThemes := TScreenOptionsThemes.create(); + ScreenOptionsThemes.onshow; + Display.ActualScreen := @ScreenOptionsThemes; + ScreenOptionsThemes.Draw; + + + Display.Draw; + SwapBuffers; + + freeandnil( self ); + end; end; @@ -89,6 +120,20 @@ begin begin Skin.OnThemeChange; UpdateSelectSlideOptions (Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); + + Theme.LoadTheme('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + + ScreenOptionsThemes := TScreenOptionsThemes.create(); + ScreenOptionsThemes.onshow; + Display.ActualScreen := @ScreenOptionsThemes; + ScreenOptionsThemes.Draw; + + + Display.Draw; + SwapBuffers; + + freeandnil( self ); + end; end; -- cgit v1.2.3 From ae057627ff135d55891e9f04f399608fbc47e9ee Mon Sep 17 00:00:00 2001 From: jaybinks Date: Fri, 2 Nov 2007 12:16:50 +0000 Subject: Runtime Song Addition jira:USDX-157 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@553 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 95 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 91 insertions(+), 4 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 85c38c26..bd9e5e67 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -92,6 +92,7 @@ type procedure SetScroll6; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; function Draw: boolean; override; + procedure GenerateThumbnails(); procedure onShow; override; procedure onHide; override; procedure SelectNext; @@ -696,9 +697,9 @@ end; constructor TScreenSong.Create; var - Pet: integer; +// Pet: integer; I: integer; -Label CreateSongButtons; +//Label CreateSongButtons; begin inherited Create; @@ -755,6 +756,8 @@ begin // Songs.LoadSongList; // moved to the UltraStar unit CatSongs.Refresh; + GenerateThumbnails(); +(* if (length(CatSongs.Song) > 0) then begin //Set Length of Button Array one Time Instead of one time for every Song @@ -830,6 +833,7 @@ begin GoTo CreateSongButtons; end; +*) // Randomize Patch Randomize; @@ -843,6 +847,89 @@ begin Interaction := 0; end; +procedure TScreenSong.GenerateThumbnails(); +var + I : Integer; + Pet: integer; +Label CreateSongButtons; +begin + if (length(CatSongs.Song) > 0) then + begin + //Set Length of Button Array one Time Instead of one time for every Song + SetButtonLength(Length(CatSongs.Song)); + + I := 0; + CreateSongButtons: + + try + for Pet := I to High(CatSongs.Song) do begin // creating all buttons + // new + Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 + + if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' + + if CatSongs.Song[Pet].Cover = '' then + AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) + else begin + // cache texture if there is a need to this + if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + begin + Texture.CreateCacheMipmap := true; + Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap + Texture.CreateCacheMipmap := false; + + // puts this texture to the cache file + Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + + // unload full size texture + Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); + + // we should also add mipmap texture by calling createtexture and use mipmap cache as data source + end; + + // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) + AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + end; + Texture.Limit := 1024*1024; + I := -1; + end; + except + //When Error is reported the First time for this Song + if (I <> Pet) then + begin + //Some Error reporting: + Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); + + //Change Cover to NoCover and Continue Loading + CatSongs.Song[Pet].Cover := ''; + I := Pet; + end + else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song + begin + Log.LogError('NoCover Cover is damaged!'); + try + AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); + except + {$IFDEF MSWINDOWS} + Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); + {$ELSE} + // TODO : JB_linux - better handle this message and display to user.. + writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'); + Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' ); + {$ENDIF} + Halt; + end; + I := Pet + 1; + end; + end; + + if (I <> -1) then + GoTo CreateSongButtons; + + end; +end; + procedure TScreenSong.SetScroll; var VS, B: Integer; @@ -1418,7 +1505,7 @@ begin AudioPlayback.Stop; if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; - if Ini.Players = 4 then PlayersPlay := 6; + if Ini.Players = 4 then PlayersPlay := 6; //Cat Mod etc if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then @@ -1701,7 +1788,7 @@ begin UnLoadDetailedCover; Interaction := High(CatSongs.Song); - SongTarget := 0; + SongTarget := 0; for I := 1 to Target+1 do SelectNext; -- cgit v1.2.3 From 5e733f7e9cb2118651df90171db1892c9155e089 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 4 Nov 2007 21:00:20 +0000 Subject: Partymodule finished. All PartyScreens and SingScreen needs some adapting. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@583 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenPartyNewRound.pas | 46 ++++++++++++++++-------------- Game/Code/Screens/UScreenPartyOptions.pas | 7 +++-- Game/Code/Screens/UScreenPartyPlayer.pas | 8 +++--- Game/Code/Screens/UScreenPartyScore.pas | 19 ++++++------ Game/Code/Screens/UScreenPartyWin.pas | 14 ++++----- Game/Code/Screens/UScreenSong.pas | 23 ++++++++------- Game/Code/Screens/UScreenSongMenu.pas | 10 +++---- 7 files changed, 66 insertions(+), 61 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 33543211..6f039080 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -181,23 +181,25 @@ var var Players: Array of String; J: Byte; - begin - if (Num-1 >= PartySession.Teams.NumTeams) then + begin // to-do : Party + if (Num-1 >= {PartySession.Teams.NumTeams}0) then exit; - //Create Players Array + {//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); + Players[J] := String(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name);} //Implode and Return Result := Language.Implode(Players); end; begin - PartySession.StartRound; + // to-do : Party + //PartySession.StartRound; //Set Visibility of Round Infos - I := Length(PartySession.Rounds); + // to-do : Party + I := {Length(PartySession.Rounds)}0; if (I >= 1) then begin Static[StaticRound1].Visible := True; @@ -205,8 +207,8 @@ begin Text[TextWinner1].Visible := True; //Texts: - Text[TextRound1].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[0].Plugin].Name); - Text[TextWinner1].Text := PartySession.GetWinnerString(0); + //Text[TextRound1].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[0].Plugin].Name); + //Text[TextWinner1].Text := PartySession.GetWinnerString(0); end else begin @@ -222,8 +224,8 @@ begin Text[TextWinner2].Visible := True; //Texts: - Text[TextRound2].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[1].Plugin].Name); - Text[TextWinner2].Text := PartySession.GetWinnerString(1); + //Text[TextRound2].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[1].Plugin].Name); + //Text[TextWinner2].Text := PartySession.GetWinnerString(1); end else begin @@ -239,8 +241,8 @@ begin Text[TextWinner3].Visible := True; //Texts: - Text[TextRound3].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[2].Plugin].Name); - Text[TextWinner3].Text := PartySession.GetWinnerString(2); + //Text[TextRound3].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[2].Plugin].Name); + //Text[TextWinner3].Text := PartySession.GetWinnerString(2); end else begin @@ -256,8 +258,8 @@ begin Text[TextWinner4].Visible := True; //Texts: - Text[TextRound4].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[3].Plugin].Name); - Text[TextWinner4].Text := PartySession.GetWinnerString(3); + //Text[TextRound4].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[3].Plugin].Name); + //Text[TextWinner4].Text := PartySession.GetWinnerString(3); end else begin @@ -273,8 +275,8 @@ begin Text[TextWinner5].Visible := True; //Texts: - Text[TextRound5].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[4].Plugin].Name); - Text[TextWinner5].Text := PartySession.GetWinnerString(4); + //Text[TextRound5].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[4].Plugin].Name); + //Text[TextWinner5].Text := PartySession.GetWinnerString(4); end else begin @@ -290,8 +292,8 @@ begin Text[TextWinner6].Visible := True; //Texts: - Text[TextRound6].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[5].Plugin].Name); - Text[TextWinner6].Text := PartySession.GetWinnerString(5); + //Text[TextRound6].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[5].Plugin].Name); + //Text[TextWinner6].Text := PartySession.GetWinnerString(5); end else begin @@ -307,8 +309,8 @@ begin Text[TextWinner7].Visible := True; //Texts: - Text[TextRound7].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[6].Plugin].Name); - Text[TextWinner7].Text := PartySession.GetWinnerString(6); + //Text[TextRound7].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[6].Plugin].Name); + //Text[TextWinner7].Text := PartySession.GetWinnerString(6); end else begin @@ -318,7 +320,7 @@ begin end; //Display Scores - if (PartySession.Teams.NumTeams >= 1) then + {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); @@ -406,7 +408,7 @@ begin Text[TextNextPlayer3].Visible := True; end else - Text[TextNextPlayer3].Visible := False; + Text[TextNextPlayer3].Visible := False; } // LCD.WriteText(1, ' Choose mode: '); diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 1c5e8461..85ee65bc 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -81,10 +81,10 @@ begin //Save Num Teams: - PartySession.Teams.NumTeams := NumTeams + 2; + {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; + PartySession.Teams.Teaminfo[2].NumPlayers := NumPlayer3+1;} //Save Playlist PlaylistMan.Mode := Playlist; @@ -113,7 +113,8 @@ begin PlaylistMan.CurPlayList := Playlist2; //Start Party - PartySession.StartNewParty(Rounds + 2); + // to-do : Party + //PartySession.StartNewParty(Rounds + 2); AudioPlayback.PlayStart; //Go to Player Screen diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index 4aaa5a3e..3bd33a5c 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -193,7 +193,7 @@ begin SDLK_RETURN: begin - //Save PlayerNames + {//Save PlayerNames for I := 0 to PartySession.Teams.NumTeams-1 do begin PartySession.Teams.Teaminfo[I].Name := PChar(Button[I*5].Text[0].Text); @@ -205,7 +205,7 @@ begin end; AudioPlayback.PlayStart; - FadeTo(@ScreenPartyNewRound); + FadeTo(@ScreenPartyNewRound);} end; // Up and Down could be done at the same time, @@ -267,7 +267,7 @@ begin Button[10].Text[0].Text := Ini.NameTeam[2]; // Templates for Names Mod end - If (PartySession.Teams.NumTeams>=1) then + {If (PartySession.Teams.NumTeams>=1) then begin Button[0].Visible := True; Button[1].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=1); @@ -316,7 +316,7 @@ begin Button[12].Visible := False; Button[13].Visible := False; Button[14].Visible := False; - end; + end; } end; diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index ea9b944b..6215e65a 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -60,21 +60,22 @@ begin SDLK_BACKSPACE : begin AudioPlayback.PlayStart; - if (PartySession.CurRound < High(PartySession.Rounds)) then + {if (PartySession.CurRound < High(PartySession.Rounds)) then FadeTo(@ScreenPartyNewRound) - else + else // to-do : Party begin - PartySession.EndRound; + PartySession.EndRound; } FadeTo(@ScreenPartyWin); - end; + //end; end; SDLK_RETURN: begin AudioPlayback.PlayStart; - if (PartySession.CurRound < High(PartySession.Rounds)) then + // to-do : Party + {if (PartySession.CurRound < High(PartySession.Rounds)) then FadeTo(@ScreenPartyNewRound) - else + else } FadeTo(@ScreenPartyWin); end; end; @@ -182,11 +183,11 @@ begin if Static[StaticTeam2].Texture.ScaleW > 99 then Static[StaticTeam2].Texture.ScaleW := 99; if Static[StaticTeam3].Texture.ScaleW > 99 then Static[StaticTeam3].Texture.ScaleW := 99; - //End Last Round - PartySession.EndRound; + //End Last Round // to-do : Party + //PartySession.EndRound; //Set Winnertext - Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.GetWinnerString(PartySession.CurRound)]); + //Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.GetWinnerString(PartySession.CurRound)]); if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then begin diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas index 9806159a..d8a3bd71 100644 --- a/Game/Code/Screens/UScreenPartyWin.pas +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -96,7 +96,7 @@ end; procedure TScreenPartyWin.onShow; var I: Integer; - Placing: TeamOrderArray; + Placing: Integer; Function GetTeamColor(Team: Byte): Cardinal; var NameString: String; @@ -106,13 +106,13 @@ var Result := ColorExists(NameString); end; begin + // to-do : Party //Get Team Placing - Placing := PartySession.GetTeamOrder; - - //Set Winnertext - Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.Teams.Teaminfo[Placing[0]].Name]); + //Placing := PartySession.GetTeamOrder; - if (PartySession.Teams.NumTeams >= 1) then + //Set Winnertext + //Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.Teams.Teaminfo[Placing[0]].Name]); + {if (PartySession.Teams.NumTeams >= 1) then begin Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[0]].Score); Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[Placing[0]].Name); @@ -239,7 +239,7 @@ begin Static[StaticTeam3].Visible := False; Static[StaticTeam3BG].Visible := False; Static[StaticTeam3Deco].Visible := False; - end; + end; } // LCD.WriteText(1, ' Choose mode: '); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index bd9e5e67..8123ef03 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -660,36 +660,36 @@ begin end; SDLK_1: - begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then + begin //Jocker // to-do : Party + {if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then begin //Joker spielen Dec(PartySession.Teams.Teaminfo[0].Joker); SelectRandomSong; SetJoker; - end; + end; } end; SDLK_2: begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then + {if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then begin //Joker spielen Dec(PartySession.Teams.Teaminfo[1].Joker); SelectRandomSong; SetJoker; - end; + end; } end; SDLK_3: begin //Jocker - if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then + {if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then begin //Joker spielen Dec(PartySession.Teams.Teaminfo[2].Joker); SelectRandomSong; SetJoker; - end; + end; } end; end; end; @@ -1991,7 +1991,8 @@ end; procedure TScreenSong.SetJoker; begin - //If Party Mode + {//If Party Mode + // to-do : Party if Mode = 1 then //Show Joker that are available begin if (PartySession.Teams.NumTeams >= 1) then @@ -2064,7 +2065,7 @@ begin Static[StaticTeam3Joker3].Visible := False; Static[StaticTeam3Joker4].Visible := False; Static[StaticTeam3Joker5].Visible := False; - end; + end; } end; procedure TScreenSong.SetStatics; @@ -2132,13 +2133,13 @@ end; //Team No of Team (0-5) procedure TScreenSong.DoJoker (Team: Byte); begin - if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then + {if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then begin //Joker spielen Dec(PartySession.Teams.Teaminfo[Team].Joker); SelectRandomSong; SetJoker; - end; + end; } end; //Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 90e56a54..88b0de32 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -373,16 +373,16 @@ begin begin CurMenu := sMenu; Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_JOKER'); - - Button[0].Visible := (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0); + // to-do : Party + {Button[0].Visible := (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0); Button[1].Visible := (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0); - Button[2].Visible := (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0); + Button[2].Visible := (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0);} Button[3].Visible := True; SelectsS[0].Visible := False; - Button[0].Text[0].Text := String(PartySession.Teams.Teaminfo[0].Name); + {Button[0].Text[0].Text := String(PartySession.Teams.Teaminfo[0].Name); Button[1].Text[0].Text := String(PartySession.Teams.Teaminfo[1].Name); - Button[2].Text[0].Text := String(PartySession.Teams.Teaminfo[2].Name); + Button[2].Text[0].Text := String(PartySession.Teams.Teaminfo[2].Name);} Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); //Set right Interaction -- cgit v1.2.3 From 318b273351e334c61ebf114508044043ee96cb35 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 19 Nov 2007 00:29:54 +0000 Subject: fixed bug in UIni ( on linux at least ) todo with SDL Initialization. Modifed Theme selection screen, so ALL theme options are runtime changable. ( Without restart ) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@610 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenOptionsThemes.pas | 330 +++++++++++++++-------------- 1 file changed, 166 insertions(+), 164 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index 5b7e4d43..06444dfe 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -1,164 +1,166 @@ -unit UScreenOptionsThemes; - -interface - -{$I switches.inc} - -uses - UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; - -type - TScreenOptionsThemes = class(TMenu) - public - SkinSelect: Integer; - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - procedure onShow; override; - procedure InteractInc; override; - procedure InteractDec; override; - end; - -implementation - -uses UGraphic, USkins; - -function TScreenOptionsThemes.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 - Ini.Save; - - // Reload all screens, after Theme changed - // Todo : JB - Check if theme was actually changed - UGraphic.UnLoadScreens(); - UGraphic.LoadScreens(); - - AudioPlayback.PlayBack; - FadeTo(@ScreenOptions); - end; - SDLK_RETURN: - begin - if SelInteraction = 3 then - begin - Ini.Save; - - // Reload all screens, after Theme changed - // Todo : JB - Check if theme was actually changed - UGraphic.UnLoadScreens(); - UGraphic.LoadScreens(); - - UGraphic.LoadScreens(); - - AudioPlayback.PlayBack; - FadeTo(@ScreenOptions); - end; - end; - SDLK_DOWN: - InteractNext; - SDLK_UP : - InteractPrev; - SDLK_RIGHT: - begin - if (SelInteraction >= 0) and (SelInteraction <= 2) then - begin - AudioPlayback.PlayOption; - InteractInc; - end; - end; - SDLK_LEFT: - begin - if (SelInteraction >= 0) and (SelInteraction <= 2) then - begin - AudioPlayback.PlayOption; - InteractDec; - end; - end; - end; - end; -end; - -procedure TScreenOptionsThemes.InteractInc; -begin - inherited InteractInc; - //Update Skins - if (SelInteraction = 0) then - begin - Skin.OnThemeChange; - UpdateSelectSlideOptions (Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); - - Theme.LoadTheme('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); - - ScreenOptionsThemes := TScreenOptionsThemes.create(); - ScreenOptionsThemes.onshow; - Display.ActualScreen := @ScreenOptionsThemes; - ScreenOptionsThemes.Draw; - - - Display.Draw; - SwapBuffers; - - freeandnil( self ); - - end; -end; - -procedure TScreenOptionsThemes.InteractDec; -begin - inherited InteractDec; - //Update Skins - if (SelInteraction = 0) then - begin - Skin.OnThemeChange; - UpdateSelectSlideOptions (Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); - - Theme.LoadTheme('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); - - ScreenOptionsThemes := TScreenOptionsThemes.create(); - ScreenOptionsThemes.onshow; - Display.ActualScreen := @ScreenOptionsThemes; - ScreenOptionsThemes.Draw; - - - Display.Draw; - SwapBuffers; - - freeandnil( self ); - - end; -end; - -constructor TScreenOptionsThemes.Create; -var - I: integer; -begin - inherited Create; - - LoadFromTheme(Theme.OptionsThemes); - - AddSelectSlide(Theme.OptionsThemes.SelectTheme, Ini.Theme, ITheme); - - SkinSelect := AddSelectSlide(Theme.OptionsThemes.SelectSkin, Ini.SkinNo, ISkin); - - AddSelectSlide(Theme.OptionsThemes.SelectColor, Ini.Color, IColor); - - AddButton(Theme.OptionsThemes.ButtonExit); - if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[7]); -end; - -procedure TScreenOptionsThemes.onShow; -begin - Interaction := 0; -end; - -end. +unit UScreenOptionsThemes; + +interface + +{$I switches.inc} + +uses + SDL, + UMenu, + UDisplay, + UMusic, + UFiles, + UIni, + UThemes; + +type + TScreenOptionsThemes = class(TMenu) + private + procedure ReloadTheme; + public + SkinSelect: Integer; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure InteractInc; override; + procedure InteractDec; override; + end; + +implementation + +uses UGraphic, USkins; + +function TScreenOptionsThemes.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 + Ini.Save; + + // Reload all screens, after Theme changed + // Todo : JB - Check if theme was actually changed + UGraphic.UnLoadScreens(); + UGraphic.LoadScreens(); + + AudioPlayback.PlayBack; + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 3 then + begin + Ini.Save; + + // Reload all screens, after Theme changed + // Todo : JB - Check if theme was actually changed + UGraphic.UnLoadScreens(); + UGraphic.LoadScreens(); + + AudioPlayback.PlayBack; + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 2) then + begin + AudioPlayback.PlayOption; + InteractInc; + end; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 2) then + begin + AudioPlayback.PlayOption; + InteractDec; + end; + end; + end; + end; +end; + +procedure TScreenOptionsThemes.InteractInc; +begin + inherited InteractInc; + + //Update Skins + if (SelInteraction = 0) then + begin + Skin.OnThemeChange; + UpdateSelectSlideOptions (Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); + end; + + ReloadTheme(); +end; + +procedure TScreenOptionsThemes.InteractDec; +begin + inherited InteractDec; + + //Update Skins + if (SelInteraction = 0 ) then + begin + Skin.OnThemeChange; + UpdateSelectSlideOptions (Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); + end; + + ReloadTheme(); +end; + +constructor TScreenOptionsThemes.Create; +var + I: integer; +begin + inherited Create; + + LoadFromTheme(Theme.OptionsThemes); + + AddSelectSlide(Theme.OptionsThemes.SelectTheme, Ini.Theme, ITheme); + + SkinSelect := AddSelectSlide(Theme.OptionsThemes.SelectSkin, Ini.SkinNo, ISkin); + + AddSelectSlide(Theme.OptionsThemes.SelectColor, Ini.Color, IColor); + + AddButton(Theme.OptionsThemes.ButtonExit); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[7]); +end; + +procedure TScreenOptionsThemes.onShow; +begin + Interaction := 0; +end; + +procedure TScreenOptionsThemes.ReloadTheme; +begin + Theme.LoadTheme('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + + ScreenOptionsThemes := TScreenOptionsThemes.create(); + ScreenOptionsThemes.onshow; + Display.ActualScreen := @ScreenOptionsThemes; + + ScreenOptionsThemes.Interaction := self.Interaction; + ScreenOptionsThemes.Draw; + + + Display.Draw; + SwapBuffers; + + freeandnil( self ); +end; + +end. -- cgit v1.2.3 From 96bad07609c8f0036dc482a74797deabeac46d33 Mon Sep 17 00:00:00 2001 From: jekatt Date: Fri, 23 Nov 2007 14:30:13 +0000 Subject: Fixed: PartyModus: SinglePlayer Teams but only Multiplayer Plugins available git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@633 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenPartyOptions.pas | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 85ee65bc..46a075ce 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -51,6 +51,7 @@ uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UDLLManager, UPlaylist, function TScreenPartyOptions.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; var I, J: Integer; + OnlyMultiPlayer: boolean; begin Result := true; If (PressedDown) Then @@ -74,7 +75,15 @@ begin //Don'T start when Playlist is Selected and there are no Playlists If (Playlist = 2) and (Length(PlaylistMan.Playlists) = 0) then Exit; - + // Don't start when SinglePlayer Teams but only Multiplayer Plugins available + OnlyMultiPlayer:=true; + for I := 0 to High(DLLMan.Plugins) do begin + OnlyMultiPlayer := (OnlyMultiPlayer AND DLLMan.Plugins[I].TeamModeOnly); + end; + if (OnlyMultiPlayer) AND ((NumPlayer1 = 0) OR (NumPlayer2 = 0) OR ((NumPlayer3 = 0) AND (NumTeams = 1))) then begin + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS')); + Exit; + end; //Save Difficulty Ini.Difficulty := SelectsS[SelectLevel].SelectedOption; Ini.SaveLevel; -- cgit v1.2.3 From 2a3e98281141c47b08eb3876d7ed52fdfe4daa81 Mon Sep 17 00:00:00 2001 From: eddie-0815 Date: Fri, 23 Nov 2007 19:53:21 +0000 Subject: Now it should build again... git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@644 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSingModi.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 5e9d94ec..5d87ffdd 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -133,7 +133,7 @@ begin begin Result.Sentence[I].Start := Czeski.Czesc[I].Start; Result.Sentence[I].StartNote := Czeski.Czesc[I].StartNote; - Result.Sentence[I].Lyric := Czeski.Czesc[I].Lyric; + Result.Sentence[I].Lyric := Czeski.Czesc[I].Lyric; Result.Sentence[I].LyricWidth := Czeski.Czesc[I].LyricWidth; Result.Sentence[I].Koniec := Czeski.Czesc[I].Koniec; Result.Sentence[I].BaseNote := Czeski.Czesc[I].BaseNote; -- cgit v1.2.3 From 0723a3058fd34826251f2dbd8169131863b69df5 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 5 Dec 2007 21:56:25 +0000 Subject: GetFFTData() is an output- and not an input-interface's function git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@671 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 2 +- Game/Code/Screens/UScreenSong.pas | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 7147be2e..d5c9bebc 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -445,7 +445,7 @@ const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),( begin //dis does teh muiwk y0r - Data := AudioInput.GetFFTData; + Data := AudioPlayback.GetFFTData; Log.LogStatus('',' JB-1'); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 8123ef03..0def87ab 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1816,7 +1816,7 @@ begin if (A <> EqualizerTime) then begin EqualizerTime := A; - Data := AudioInput.GetFFTData; + Data := AudioPlayback.GetFFTData; B:=0; Pos := 0; -- cgit v1.2.3 From 5bda51a14091c942b93753cb622400451a13031d Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 5 Dec 2007 22:05:36 +0000 Subject: Changed this so that us-dx doesn't crash anymore if no soundcard is available git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@673 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenOptionsRecord.pas | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index 4be16e70..80259802 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -86,25 +86,17 @@ begin SetLength(ICard, Length(Recording.SoundCard)); for SC := 0 to High(Recording.SoundCard) do ICard[SC] := Recording.SoundCard[SC].Description; -// end; -// if Length(Recording.SoundCard[Ini.Card].Input) > 0 then begin - - {$IFDEF win32} - // TODO : JB_Linux .... Audio Input ... had to remove to get it to run ??? - + if (Length(Recording.SoundCard) > 0) then begin SetLength(IInput, Length(Recording.SoundCard[Ini.Card].Input)); for SCI := 0 to High(Recording.SoundCard[Ini.Card].Input) do IInput[SCI] := Recording.SoundCard[Ini.Card].Input[SCI].Name; -// end; - - AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, Ini.Card, ICard); - SelectSlideInput := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, Ini.CardList[0].Input, IInput); - SelectSlideChannelL := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelL, Ini.CardList[0].ChannelL, IChannel); - SelectSlideChannelR := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelR, Ini.CardList[0].ChannelR, IChannel); - - {$ENDIF} + AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, Ini.Card, ICard); + SelectSlideInput := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, Ini.CardList[0].Input, IInput); + SelectSlideChannelL := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelL, Ini.CardList[0].ChannelL, IChannel); + SelectSlideChannelR := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelR, Ini.CardList[0].ChannelR, IChannel); + end; AddButton(Theme.OptionsRecord.ButtonExit); if (Length(Button[0].Text)=0) then -- cgit v1.2.3 From 486ad8796acc5883ef83f3a78cd615f6711d77f0 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 6 Dec 2007 09:39:49 +0000 Subject: conformed projectM to IVideoPlayback still needs a little work. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@678 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index dd11ee07..c3bb78d2 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -851,10 +851,10 @@ begin begin try writeln( 'VideoPlayback.FFmpegGetFrame' ); - VideoPlayback.FFmpegGetFrame(Czas.Teraz); + VideoPlayback.GetFrame(Czas.Teraz); writeln( 'VideoPlayback.FFmpegDrawGL' ); - VideoPlayback.FFmpegDrawGL(ScreenAct); + VideoPlayback.DrawGL(ScreenAct); // PlaySmpeg; except @@ -1125,8 +1125,8 @@ begin // todo: find a way to determine, when a new frame is needed // toto: same for the need to skip frames - VideoPlayback.FFmpegGetFrame(Czas.Teraz); - VideoPlayback.FFmpegDrawGL(ScreenAct); + VideoPlayback.GetFrame(Czas.Teraz); + VideoPlayback.DrawGL(ScreenAct); except on E : Exception do begin -- cgit v1.2.3 From 553ee1ad981964a3689e6510d5813dbff0f2119c Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 6 Dec 2007 10:46:53 +0000 Subject: added "V" key to sing screen to start Visualization... git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@681 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index c3bb78d2..b3b92446 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -150,6 +150,13 @@ begin begin Pause; end; + + SDLK_V: //Show Visualization + begin + AktSong.VideoLoaded := not AktSong.VideoLoaded; + VideoPlayback.play; + + end; SDLK_RETURN: begin @@ -183,7 +190,7 @@ begin // pause Video if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then VideoPlayback.Pause; -// FFmpegTogglePause; + end else //Pause ausschalten begin @@ -197,8 +204,6 @@ begin // Video if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then VideoPlayback.Pause; -// FFmpegTogglePause; - //SkipSmpeg(PauseTime); Paused := false; end; @@ -427,14 +432,9 @@ begin // set movie if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin -(* OpenSmpeg(AktSong.Path + AktSong.Video); - SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*) - // todo: VideoGap and Start time verwursten -// FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); VideoPlayback.Open( AktSong.Path + AktSong.Video ); -// FFmpegSkip(AktSong.VideoGAP + AktSong.Start); VideoPlayback.position := AktSong.VideoGAP + AktSong.Start; AktSong.VideoLoaded := true; @@ -1119,6 +1119,7 @@ begin // update and draw movie if ShowFinish and AktSong.VideoLoaded then +// if ShowFinish then begin try // UpdateSmpeg; // this only draws -- cgit v1.2.3 From 886b7205df1355054eda3cb72b65c77ec8a40d73 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 6 Dec 2007 11:19:36 +0000 Subject: added [tab] to change visualization preset git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@682 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index b3b92446..e62b9339 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -157,6 +157,12 @@ begin VideoPlayback.play; end; + + SDLK_TAB: //Change Visualization Preset + begin + if AktSong.VideoLoaded then + VideoPlayback.MoveTo( now ); // move to a random position + end; SDLK_RETURN: begin -- cgit v1.2.3 From be68ff31e2d10d5f29894c6ec4ed877c70c142a3 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 6 Dec 2007 12:26:05 +0000 Subject: gave priority to videos over Visualization... so now video plays back... and "V" will switch between Video ( or jpg ) background and visualization. this needs to be pressed on every song, as the state should be forgotten. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@687 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 51 ++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 17 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index e62b9339..75246d09 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -97,6 +97,9 @@ type //Score Manager: Scores: TSingScores; + fShowVisualization : boolean; + fCurrentVideoPlaybackEngine : IVideoPlayback; + constructor Create; override; procedure onShow; override; procedure onShowFinish; override; @@ -153,15 +156,22 @@ begin SDLK_V: //Show Visualization begin - AktSong.VideoLoaded := not AktSong.VideoLoaded; - VideoPlayback.play; + fShowVisualization := not fShowVisualization; + + if fShowVisualization then + fCurrentVideoPlaybackEngine := Visualization + else + fCurrentVideoPlaybackEngine := VideoPlayback; + + if fShowVisualization then + fCurrentVideoPlaybackEngine.play; end; SDLK_TAB: //Change Visualization Preset begin - if AktSong.VideoLoaded then - VideoPlayback.MoveTo( now ); // move to a random position + if fShowVisualization then + fCurrentVideoPlaybackEngine.MoveTo( now ); // move to a random position end; SDLK_RETURN: @@ -195,7 +205,7 @@ begin // pause Video if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then - VideoPlayback.Pause; + fCurrentVideoPlaybackEngine.Pause; end else //Pause ausschalten @@ -209,7 +219,7 @@ begin // Video if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then - VideoPlayback.Pause; + fCurrentVideoPlaybackEngine.Pause; Paused := false; end; @@ -223,6 +233,10 @@ var begin inherited Create; + fShowVisualization := false; + fCurrentVideoPlaybackEngine := VideoPlayback; + + //Create Score Class Scores := TSingScores.Create; Scores.LoadfromTheme; @@ -288,7 +302,7 @@ begin Lyrics := TLyricEngine.Create(80,Skin_LyricsT,640,12,80,Skin_LyricsT+36,640,12); - VideoPlayback.Init(); + fCurrentVideoPlaybackEngine.Init(); end; procedure TScreenSing.onShow; @@ -307,6 +321,9 @@ begin Log.LogStatus('Begin', 'onShow'); FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented + // reset video playback engine, to play Video Clip... + fCurrentVideoPlaybackEngine := VideoPlayback; + //SetUp Score Manager Scores.ClearPlayers; //Clear Old Player Values Color.R := 0; Color.G := 0; Color.B := 0; //Dummy atm @@ -439,9 +456,9 @@ begin if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin // todo: VideoGap and Start time verwursten - VideoPlayback.Open( AktSong.Path + AktSong.Video ); + fCurrentVideoPlaybackEngine.Open( AktSong.Path + AktSong.Video ); - VideoPlayback.position := AktSong.VideoGAP + AktSong.Start; + fCurrentVideoPlaybackEngine.position := AktSong.VideoGAP + AktSong.Start; AktSong.VideoLoaded := true; end; @@ -857,10 +874,10 @@ begin begin try writeln( 'VideoPlayback.FFmpegGetFrame' ); - VideoPlayback.GetFrame(Czas.Teraz); + fCurrentVideoPlaybackEngine.GetFrame(Czas.Teraz); writeln( 'VideoPlayback.FFmpegDrawGL' ); - VideoPlayback.DrawGL(ScreenAct); + fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); // PlaySmpeg; except @@ -874,7 +891,7 @@ begin Log.LogError('Corrupted File: ' + AktSong.Video); try // CloseSmpeg; - VideoPlayback.Close; + fCurrentVideoPlaybackEngine.Close; except end; @@ -1124,7 +1141,7 @@ begin SingDrawBackground; // update and draw movie - if ShowFinish and AktSong.VideoLoaded then + if ShowFinish and ( AktSong.VideoLoaded or fShowVisualization ) then // if ShowFinish then begin try @@ -1132,8 +1149,8 @@ begin // todo: find a way to determine, when a new frame is needed // toto: same for the need to skip frames - VideoPlayback.GetFrame(Czas.Teraz); - VideoPlayback.DrawGL(ScreenAct); + fCurrentVideoPlaybackEngine.GetFrame(Czas.Teraz); + fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); except on E : Exception do begin @@ -1147,7 +1164,7 @@ begin Log.LogError('Corrupted File: ' + AktSong.Video); try // CloseSmpeg; - VideoPlayback.Close; + fCurrentVideoPlaybackEngine.Close; except end; @@ -1230,7 +1247,7 @@ begin if AktSong.VideoLoaded then begin // CloseSmpeg; - VideoPlayback.Close; + fCurrentVideoPlaybackEngine.Close; AktSong.VideoLoaded := false; // to prevent drawing closed video end; -- cgit v1.2.3 From 5ec90c178c0c04b42ed80918d0497bb24ee774ed Mon Sep 17 00:00:00 2001 From: mogguh Date: Thu, 6 Dec 2007 15:01:07 +0000 Subject: Fixed array issues, moving through the several arrays is ugly - but at least it works git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@689 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenScore.pas | 355 ++++++++++++++++++------------------- 1 file changed, 171 insertions(+), 184 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 3537a26d..0ed04b89 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -61,17 +61,17 @@ type Animation: real; Fadeout: boolean; - BarScore_ActualHeight : array[1..6] of real; - BarPhrase_ActualHeight : array[1..6] of real; - BarGolden_ActualHeight : array[1..6] of real; + BarScore_ActualHeight : array[0..5] of real; + BarPhrase_ActualHeight : array[0..5] of real; + BarGolden_ActualHeight : array[0..5] of real; BarScore_EaseOut_Step : real; BarPhrase_EaseOut_Step : real; BarGolden_EaseOut_Step : real; - TextScore_ActualValue : array[1..6] of integer; - TextPhrase_ActualValue : array[1..6] of integer; - TextGolden_ActualValue : array[1..6] of integer; + TextScore_ActualValue : array[0..5] of integer; + TextPhrase_ActualValue : array[0..5] of integer; + TextGolden_ActualValue : array[0..5] of integer; EaseOut_MaxSteps : real; @@ -150,44 +150,41 @@ begin LoadFromTheme(Theme.Score); TextArtist := AddText(Theme.Score.TextArtist); - TextTitle := AddText(Theme.Score.TextTitle); + TextTitle := AddText(Theme.Score.TextTitle); TextArtistTitle := AddText(Theme.Score.TextArtistTitle); - for P := 1 to 6 do begin - TextName[P] := AddText(Theme.Score.TextName[P]); - TextScore[P] := AddText(Theme.Score.TextScore[P]); - - TextNotes[P] := AddText(Theme.Score.TextNotes[P]); - TextNotesScore[P] := AddText(Theme.Score.TextNotesScore[P]); - TextLineBonus[P] := AddText(Theme.Score.TextLineBonus[P]); - TextLineBonusScore[P] := AddText(Theme.Score.TextLineBonusScore[P]); - TextGoldenNotes[P] := AddText(Theme.Score.TextGoldenNotes[P]); - TextGoldenNotesScore[P] := AddText(Theme.Score.TextGoldenNotesScore[P]); - TextTotal[P] := AddText(Theme.Score.TextTotal[P]); - TextTotalScore[P] := AddText(Theme.Score.TextTotalScore[P]); - - SetLength(PlayerStatic[P], Length(Theme.Score.PlayerStatic[P])); - - SetLength(PlayerTexts[P], Length(Theme.Score.PlayerTexts[P])); + for P := 1 to 6 do + begin + SetLength(PlayerStatic[P], Length(Theme.Score.PlayerStatic[P])); + SetLength(PlayerTexts[P], Length(Theme.Score.PlayerTexts[P])); for I := 0 to High(Theme.Score.PlayerStatic[P]) do - PlayerStatic[P, I] := AddStatic(Theme.Score.PlayerStatic[P, I]); + PlayerStatic[P, I] := AddStatic(Theme.Score.PlayerStatic[P, I]); - - //added by mog for C := 0 to High(Theme.Score.PlayerTexts[P]) do - PlayerTexts[P, C] := AddText(Theme.Score.PlayerTexts[P, C]); - // more skinable now - - StaticBoxLightest[P] := AddStatic(Theme.Score.StaticBoxLightest[P]); - StaticBoxLight[P] := AddStatic(Theme.Score.StaticBoxLight[P]); - StaticBoxDark[P] := AddStatic(Theme.Score.StaticBoxDark[P]); - - StaticBackLevel[P] := AddStatic(Theme.Score.StaticBackLevel[P]); - StaticBackLevelRound[P] := AddStatic(Theme.Score.StaticBackLevelRound[P]); - StaticLevel[P] := AddStatic(Theme.Score.StaticLevel[P]); - StaticLevelRound[P] := AddStatic(Theme.Score.StaticLevelRound[P]); + PlayerTexts[P, C] := AddText(Theme.Score.PlayerTexts[P, C]); + + TextName[P] := AddText(Theme.Score.TextName[P]); + TextScore[P] := AddText(Theme.Score.TextScore[P]); + + TextNotes[P] := AddText(Theme.Score.TextNotes[P]); + TextNotesScore[P] := AddText(Theme.Score.TextNotesScore[P]); + TextLineBonus[P] := AddText(Theme.Score.TextLineBonus[P]); + TextLineBonusScore[P] := AddText(Theme.Score.TextLineBonusScore[P]); + TextGoldenNotes[P] := AddText(Theme.Score.TextGoldenNotes[P]); + TextGoldenNotesScore[P] := AddText(Theme.Score.TextGoldenNotesScore[P]); + TextTotal[P] := AddText(Theme.Score.TextTotal[P]); + TextTotalScore[P] := AddText(Theme.Score.TextTotalScore[P]); + + StaticBoxLightest[P] := AddStatic(Theme.Score.StaticBoxLightest[P]); + StaticBoxLight[P] := AddStatic(Theme.Score.StaticBoxLight[P]); + StaticBoxDark[P] := AddStatic(Theme.Score.StaticBoxDark[P]); + + StaticBackLevel[P] := AddStatic(Theme.Score.StaticBackLevel[P]); + StaticBackLevelRound[P] := AddStatic(Theme.Score.StaticBackLevelRound[P]); + StaticLevel[P] := AddStatic(Theme.Score.StaticLevel[P]); + StaticLevelRound[P] := AddStatic(Theme.Score.StaticLevelRound[P]); end; end; @@ -203,124 +200,91 @@ var MaxH: real; // maximum height of score bar Wsp: real; begin -{* - CountSkipTimeSet; - - Animation := 0; - Fadeout := false; - - Text[1].Text := AktSong.Artist + ' - ' + AktSong.Title; - Text[2].Text := ' ' + IntToStr((Round(Gracz[0].Punkty) div 10) * 10) + ' points'; - - Static[0].Texture.X := -2000; - Static[1].Texture.X := -2000; - Static[2].Texture.X := -2000; - Static[3].Texture.X := -2000; - Static[4].Texture.X := -2000; - Static[5].Texture.X := -2000; - Static[6].Texture.X := -2000; - Static[7].Texture.X := -2000; - - Text[0].X := -2000; - Text[1].X := -2000; - Text[2].X := -2000; - Text[3].X := -2000; - - - case (Round(Gracz[0].Punkty) div 10) * 10 of - 0..1000: Text[3].Text := ' Tone Deaf'; - 2010..4000: Text[3].Text := ' Amateur'; - 4010..6000: Text[3].Text := ' Rising Star'; - 6010..8000: Text[3].Text := ' Lead Singer'; - 8010..9000: Text[3].Text := ' Hit Artist'; - 9010..10000: Text[3].Text := ' Superstar'; - end; - - Music.PlayShuffle; -*} // Singstar Fadeout := false; - Text[TextArtist].Text := AktSong.Artist; - Text[TextTitle].Text := AktSong.Title; + Text[TextArtist].Text := AktSong.Artist; + Text[TextTitle].Text := AktSong.Title; Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; // set visibility - case PlayersPlay of - 1: begin - V[1] := true; - V[2] := false; - V[3] := false; - V[4] := false; - V[5] := false; - V[6] := false; - end; - 2, 4: begin - V[1] := false; - V[2] := true; - V[3] := true; - V[4] := false; - V[5] := false; - V[6] := false; - end; - 3, 6: begin - V[1] := false; - V[2] := false; - V[3] := false; - V[4] := true; - V[5] := true; - V[6] := true; - end; - end; - - for P := 1 to 6 do begin - Text[TextName[P]].Visible := V[P]; - Text[TextScore[P]].Visible := V[P]; - - // We set alpha to 0 , so we can nicely blend them in when we need them - Text[TextScore[P]].Alpha := 0; - Text[TextNotesScore[P]].Alpha := 0; - Text[TextNotes[P]].Alpha := 0; - Text[TextLineBonus[P]].Alpha := 0; - Text[TextLineBonusScore[P]].Alpha := 0; - Text[TextGoldenNotes[P]].Alpha := 0; - Text[TextGoldenNotesScore[P]].Alpha := 0; - Text[TextTotal[P]].Alpha := 0; - Text[TextTotalScore[P]].Alpha := 0; - - Text[TextNotes[P]].Visible := V[P]; - Text[TextNotesScore[P]].Visible := V[P]; - Text[TextLineBonus[P]].Visible := V[P]; - Text[TextLineBonusScore[P]].Visible := V[P]; - Text[TextGoldenNotes[P]].Visible := V[P]; - Text[TextGoldenNotesScore[P]].Visible := V[P]; - Text[TextTotal[P]].Visible := V[P]; - Text[TextTotalScore[P]].Visible := V[P]; - - for I := 0 to high(PlayerStatic[P]) do - Static[PlayerStatic[P, I]].Visible := V[P]; - - for I := 0 to high(PlayerTexts[P]) do - Text[PlayerTexts[P, I]].Visible := V[P]; - - Static[StaticBoxLightest[P]].Visible := V[P]; - Static[StaticBoxLight[P]].Visible := V[P]; - Static[StaticBoxDark[P]].Visible := V[P]; - - Static[StaticBackLevel[P]].Visible := false; //V[P]; - Static[StaticBackLevelRound[P]].Visible := false; //V[P]; - Static[StaticLevel[P]].Visible := false; //V[P]; - Static[StaticLevelRound[P]].Visible := false; //V[P]; + case PlayersPlay of + 1: begin + V[1] := true; + V[2] := false; + V[3] := false; + V[4] := false; + V[5] := false; + V[6] := false; + end; + 2, 4: begin + V[1] := false; + V[2] := true; + V[3] := true; + V[4] := false; + V[5] := false; + V[6] := false; + end; + 3, 6: begin + V[1] := false; + V[2] := false; + V[3] := false; + V[4] := true; + V[5] := true; + V[6] := true; + end; end; + for P := 1 to 6 do + begin + Text[TextName[P]].Visible := V[P]; + Text[TextScore[P]].Visible := V[P]; + + // We set alpha to 0 , so we can nicely blend them in when we need them + Text[TextScore[P]].Alpha := 0; + Text[TextNotesScore[P]].Alpha := 0; + Text[TextNotes[P]].Alpha := 0; + Text[TextLineBonus[P]].Alpha := 0; + Text[TextLineBonusScore[P]].Alpha := 0; + Text[TextGoldenNotes[P]].Alpha := 0; + Text[TextGoldenNotesScore[P]].Alpha := 0; + Text[TextTotal[P]].Alpha := 0; + Text[TextTotalScore[P]].Alpha := 0; + + + Text[TextNotes[P]].Visible := V[P]; + Text[TextNotesScore[P]].Visible := V[P]; + Text[TextLineBonus[P]].Visible := V[P]; + Text[TextLineBonusScore[P]].Visible := V[P]; + Text[TextGoldenNotes[P]].Visible := V[P]; + Text[TextGoldenNotesScore[P]].Visible := V[P]; + Text[TextTotal[P]].Visible := V[P]; + Text[TextTotalScore[P]].Visible := V[P]; + + for I := 0 to high(PlayerStatic[P]) do + Static[PlayerStatic[P, I]].Visible := V[P]; + + for I := 0 to high(PlayerTexts[P]) do + Text[PlayerTexts[P, I]].Visible := V[P]; + + Static[StaticBoxLightest[P]].Visible := V[P]; + Static[StaticBoxLight[P]].Visible := V[P]; + Static[StaticBoxDark[P]].Visible := V[P]; + +// + Static[StaticBackLevel[P]].Visible := false; + Static[StaticBackLevelRound[P]].Visible := false; + Static[StaticLevel[P]].Visible := false; + Static[StaticLevelRound[P]].Visible := false; + end; end; procedure TScreenScore.onShowFinish; var index : integer; begin -for index := 1 to 2 do +for index := 0 to (PlayersPlay-1) do begin BarScore_ActualHeight[index] := 0; BarPhrase_ActualHeight[index] := 0; @@ -331,7 +295,6 @@ for index := 1 to 2 do TextGolden_ActualValue[index] := 0; end; - BarScore_EaseOut_Step := 1; BarPhrase_EaseOut_Step := 1; BarGolden_EaseOut_Step := 1; @@ -354,6 +317,7 @@ var C: integer; katze : integer; + ArrayStartModifier : integer; begin // 0.5.0: try also use 4 players screen with nicks @@ -395,22 +359,45 @@ begin end; inherited Draw; -{ - player[1].ScoreI := 7000; - player[1].ScoreLineI := 2000; - player[1].ScoreGoldenI := 1000; - - player[2].ScoreI := 2500; - player[2].ScoreLineI := 1100; - player[2].ScoreGoldenI := 900; - } + + //player[1].ScoreI := 7000; + //player[1].ScoreLineI := 2000; + //player[1].ScoreGoldenI := 1000; + + //player[2].ScoreI := 2500; + //player[2].ScoreLineI := 1100; + //player[2].ScoreGoldenI := 900; + // Let's arise the bars ActualTime := GetTickCount div 33; if ((ActualTime <> OldTime) and ShowFinish )then begin OldTime := ActualTime; - For katze:= 0 to 5 do +// okay i hate that as much as you might do too, but there's no way around that yet (imho) +// all statics / texts are loaded at start - so that we have them all even if we change the amount of players +// array overview: + +// 1 Player -> Player[0].Score (The score for one player starts at 0) +// -> Statics[1] (The statics for the one player screen start at 0) +// 2 Player -> Player[0..1].Score +// -> Statics[2..3] +// 3 Player -> Player[0..5].Score +// -> Statics[4..6] + + case PlayersPlay of + 1: begin + ArrayStartModifier := 1; + end; + 2, 4: begin + ArrayStartModifier := 2; + end; + 3, 6: begin + ArrayStartModifier := 4; + end; + end; + + For katze:= 0 to (PlayersPlay-1) do begin // We actually araise them in the right order, but we have to draw them in reverse order (golden -> phrase -> mainscore) @@ -436,72 +423,72 @@ begin // Draw golden score bar # //######################## - BarGolden_ActualHeight[katze] := RaiseBar(katze, - Static[StaticBackLevel[katze+1]].Texture.y - BarScore_ActualHeight[katze] - BarPhrase_ActualHeight[katze], + BarGolden_ActualHeight[katze] := RaiseBar(katze + ArrayStartModifier, + Static[StaticBackLevel[katze + ArrayStartModifier]].Texture.y - BarScore_ActualHeight[katze] - BarPhrase_ActualHeight[katze], BarGolden_ActualHeight[katze], - player[katze+1].ScoreGoldenI, + player[katze].ScoreGoldenI, 'Lightest', BarGolden_EaseOut_Step); // Increment and show total score and plain score TextGolden_ActualValue[katze] := IncrementScore(katze, TextGolden_ActualValue[katze], - Player[katze+1].ScoreGoldenI, + Player[katze].ScoreGoldenI, BarGolden_EaseOut_Step); - Text[TextGoldenNotesScore[katze+1]].Text := IntToStr(TextGolden_ActualValue[katze]); + Text[TextGoldenNotesScore[katze + ArrayStartModifier]].Text := IntToStr(TextGolden_ActualValue[katze]); // Blend in - Text[TextGoldenNotesScore[katze+1]].Alpha := (BarGolden_EaseOut_Step / 100); - Text[TextGoldenNotes[katze+1]].Alpha := (BarGolden_EaseOut_Step / 100); + Text[TextGoldenNotesScore[katze + ArrayStartModifier]].Alpha := (BarGolden_EaseOut_Step / 100); + Text[TextGoldenNotes[katze + ArrayStartModifier]].Alpha := (BarGolden_EaseOut_Step / 100); end; //######################## // Draw phrase score bar # //######################## - BarPhrase_ActualHeight[katze] := RaiseBar(katze, - Static[StaticBackLevel[katze+1]].Texture.y - BarScore_ActualHeight[katze], + BarPhrase_ActualHeight[katze] := RaiseBar(katze + ArrayStartModifier, + Static[StaticBackLevel[katze + ArrayStartModifier]].Texture.y - BarScore_ActualHeight[katze], BarPhrase_ActualHeight[katze], - Player[katze+1].ScoreLineI, + Player[katze].ScoreLineI, 'Light', BarPhrase_EaseOut_Step); // Increment and show total score and plain score TextPhrase_ActualValue[katze] := IncrementScore(katze, TextPhrase_ActualValue[katze], - Player[katze+1].ScoreLineI, + Player[katze].ScoreLineI, BarPhrase_EaseOut_Step); - Text[TextLineBonusScore[katze+1]].Text := IntToStr(TextPhrase_ActualValue[katze]); + Text[TextLineBonusScore[katze + ArrayStartModifier]].Text := IntToStr(TextPhrase_ActualValue[katze]); //Blend in - Text[TextLineBonusScore[katze+1]].Alpha := (BarPhrase_EaseOut_Step / 100); - Text[TextLineBonus[katze+1]].Alpha := (BarPhrase_EaseOut_Step / 100); + Text[TextLineBonusScore[katze + ArrayStartModifier]].Alpha := (BarPhrase_EaseOut_Step / 100); + Text[TextLineBonus[katze + ArrayStartModifier]].Alpha := (BarPhrase_EaseOut_Step / 100); end; //####################### // Draw plain score bar # //####################### - BarScore_ActualHeight[katze] := RaiseBar(katze, - Static[StaticBackLevel[katze+1]].Texture.y, + BarScore_ActualHeight[katze] := RaiseBar(katze + ArrayStartModifier, + Static[StaticBackLevel[katze + ArrayStartModifier]].Texture.y, BarScore_ActualHeight[katze], - Player[katze+1].ScoreI, + Player[katze].ScoreI, 'Dark', BarScore_EaseOut_Step); // Increment and show total score and plain score TextScore_ActualValue[katze] := IncrementScore(katze, TextScore_ActualValue[katze], - Player[katze+1].ScoreI, + Player[katze].ScoreI, BarScore_EaseOut_Step); - Text[TextNotesScore[katze+1]].Text := IntToStr(TextScore_ActualValue[katze]); + Text[TextNotesScore[katze + ArrayStartModifier]].Text := IntToStr(TextScore_ActualValue[katze]); - Text[TextTotalScore[katze+1]].Text := IntToStr(TextScore_ActualValue[katze] + TextPhrase_ActualValue[katze] + TextGolden_ActualValue[katze]); + Text[TextTotalScore[katze + ArrayStartModifier]].Text := IntToStr(TextScore_ActualValue[katze] + TextPhrase_ActualValue[katze] + TextGolden_ActualValue[katze]); //Blend em in - Text[TextTotalScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextTotal[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextNotesScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextNotes[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextTotalScore[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextTotal[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextNotesScore[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextNotes[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextScore[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); end; // me loop end; @@ -526,10 +513,10 @@ var lTmp : real; begin - MaxHeight := Static[StaticBackLevel[PlayerNumber + 1]].Texture.H; - Width := Static[StaticBackLevel[PlayerNumber + 1]].Texture.W; + MaxHeight := Static[StaticBackLevel[PlayerNumber]].Texture.H; + Width := Static[StaticBackLevel[PlayerNumber]].Texture.W; - BarStartPosX := Static[StaticBackLevel[PlayerNumber + 1]].Texture.X; + BarStartPosX := Static[StaticBackLevel[PlayerNumber]].Texture.X; BarStartPosY := BarStartPosY + MaxHeight; // The texture starts in the upper left corner, so let's subtract the height - so we can arise it @@ -559,11 +546,11 @@ begin NewHeight := Height2Reach; end; //+1 - LoadColor(R, G, B, 'P' + inttostr(PlayerNumber+1) + ColorBrightness); //dark, light, lightest + LoadColor(R, G, B, 'P' + inttostr(PlayerNumber) + ColorBrightness); //dark, light, lightest glColor4f(R, G, B, 1); //the actual bar - glBindTexture(GL_TEXTURE_2D, Static[StaticLevel[PlayerNumber + 1]].Texture.TexNum); + glBindTexture(GL_TEXTURE_2D, Static[StaticLevel[PlayerNumber]].Texture.TexNum); glEnable(GL_TEXTURE_2D); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -577,15 +564,15 @@ begin glEnd; //the round thing on top - glBindTexture(GL_TEXTURE_2D, Static[StaticLevelRound[PlayerNumber + 1]].Texture.TexNum); + glBindTexture(GL_TEXTURE_2D, Static[StaticLevelRound[PlayerNumber]].Texture.TexNum); glEnable(GL_TEXTURE_2D); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(BarStartPosX, (BarStartPosY - Static[StaticLevelRound[PlayerNumber + 1]].Texture.h) - NewHeight); - glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, (BarStartPosY - Static[StaticLevelRound[PlayerNumber + 1]].Texture.h) - NewHeight); + glTexCoord2f(0, 0); glVertex2f(BarStartPosX, (BarStartPosY - Static[StaticLevelRound[PlayerNumber]].Texture.h) - NewHeight); + glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, (BarStartPosY - Static[StaticLevelRound[PlayerNumber]].Texture.h) - NewHeight); glTexCoord2f(1, 1); glVertex2f(BarStartPosX + Width, BarStartPosY - NewHeight); glTexCoord2f(0, 1); glVertex2f(BarStartPosX, BarStartPosY - NewHeight); glEnd; -- cgit v1.2.3 From 425ff834dbc3933475ee8f783eea6167e92ec174 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Fri, 7 Dec 2007 04:32:38 +0000 Subject: little bit of tidy up.. added command line switch, to see what media interfaces are being used. moved RandomPCM Data generation to Visualizer class. added Visualization preset change, on new line ( may be a little to much... maybe we should do ever 4 or 16 bars or something ?) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@697 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 75246d09..31e9f511 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -165,14 +165,14 @@ begin if fShowVisualization then fCurrentVideoPlaybackEngine.play; - + end; SDLK_TAB: //Change Visualization Preset begin - if fShowVisualization then - fCurrentVideoPlaybackEngine.MoveTo( now ); // move to a random position - end; + if fShowVisualization then + fCurrentVideoPlaybackEngine.MoveTo( now ); // move to a random position + end; SDLK_RETURN: begin @@ -1144,13 +1144,18 @@ begin if ShowFinish and ( AktSong.VideoLoaded or fShowVisualization ) then // if ShowFinish then begin - try +// try // UpdateSmpeg; // this only draws // todo: find a way to determine, when a new frame is needed // toto: same for the need to skip frames - fCurrentVideoPlaybackEngine.GetFrame(Czas.Teraz); - fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); + if assigned( fCurrentVideoPlaybackEngine ) then + begin + fCurrentVideoPlaybackEngine.GetFrame(Czas.Teraz); + fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); + end; + +(* except on E : Exception do begin @@ -1170,6 +1175,8 @@ begin end; end; end; +*) + end; // draw static menu (FG) @@ -1332,6 +1339,12 @@ begin if Ini.EffectSing=1 then GoldenRec.SpawnPerfectLineTwinkle; //PerfectLineTwinkle Mod end + + + // if we are shoing a visualization... change to a new preset after each sentence.. + // Maybe we should make this less often or something... just a + if fShowVisualization then + fCurrentVideoPlaybackEngine.MoveTo( now ); // move to a random position end; //Called on Sentence Change S= New Current Sentence -- cgit v1.2.3 From 5404b0734c15320423bc4848fbc0880ed092e5e7 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 15 Dec 2007 17:12:20 +0000 Subject: again some progress with the lyrics... git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@703 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 31e9f511..d3019ac6 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -511,10 +511,10 @@ begin Lyrics.LineColor_dis.B := 0.4; Lyrics.LineColor_dis.A := 1; - Lyrics.LineColor_akt.R := 5/256; - Lyrics.LineColor_akt.G := 163/256; - Lyrics.LineColor_akt.B := 210/256; - Lyrics.LineColor_akt.A := 1; + Lyrics.LineColor_act.R := 5/256; + Lyrics.LineColor_act.G := 163/256; + Lyrics.LineColor_act.B := 210/256; + Lyrics.LineColor_act.A := 1; { LyricSub.FontStyle := 0; LyricMain.Size := 14; // 13 @@ -563,10 +563,10 @@ begin Lyrics.LineColor_dis.B := 0.8; Lyrics.LineColor_dis.A := 1; - Lyrics.LineColor_akt.R := 0.5; - Lyrics.LineColor_akt.G := 0.5; - Lyrics.LineColor_akt.B := 1; - Lyrics.LineColor_akt.A := 1; + Lyrics.LineColor_act.R := 0.5; + Lyrics.LineColor_act.G := 0.5; + Lyrics.LineColor_act.B := 1; + Lyrics.LineColor_act.A := 1; end; 2: begin @@ -584,10 +584,10 @@ begin Lyrics.LineColor_dis.B := 0.8; Lyrics.LineColor_dis.A := 1; - Lyrics.LineColor_akt.R := 0.5; - Lyrics.LineColor_akt.G := 0.5; - Lyrics.LineColor_akt.B := 1; - Lyrics.LineColor_akt.A := 1; + Lyrics.LineColor_act.R := 0.5; + Lyrics.LineColor_act.G := 0.5; + Lyrics.LineColor_act.B := 1; + Lyrics.LineColor_act.A := 1; { LyricSub.FontStyle := 3; LyricMain.Size := 12; LyricSub.Size := 12; -- cgit v1.2.3 From 9f4eaeef7d2100486af9ecbdd1e94e3bd10df3f8 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sun, 16 Dec 2007 11:10:20 +0000 Subject: elimitated sentence change flicker bug git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@704 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index d3019ac6..309af301 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1353,7 +1353,18 @@ begin //GoldenStarsTwinkle Mod GoldenRec.SentenceChange; if (Lyrics.LineCounter <= High(Czesci[0].Czesc)) then + begin Lyrics.AddLine(@Czesci[0].Czesc[Lyrics.LineCounter]); + // addline uses display memory + // calling draw makes sure, there's the singscreen in it, when the next + // swap between onscreen and offscreen buffers is done + // (this eliminates the onSentenceChange flickering) + // note: maybe it would be better to make sure, a display redraw is done + // right after the sentence change (before buffer swap) or make sure + // onsentencechange is only called right before calling Display.Draw + // (or whatever it was called) + Draw; + end; //GoldenStarsTwinkle Mod End end; -- cgit v1.2.3 From c7e01792aaf8f16bb17d7254d93157d617271391 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 18 Dec 2007 03:51:24 +0000 Subject: fixed crash on song play, if the AudioInterface reports the song as 0 length. fixed ffmpeg bug with song length. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@722 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 0def87ab..03ef793b 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1519,7 +1519,8 @@ begin if Length(CatSongs.Song) > 0 then begin //Load Music only when Song Preview is activated - if (Ini.PreviewVolume <> 0) then + if ( Ini.PreviewVolume <> 0 ) AND + ( AudioPlayback.Length > 1 ) then begin AudioPlayback.SetLoop(false); AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); -- cgit v1.2.3 From 0d5fbd096cddf37bfc3a5f642644179c81bde582 Mon Sep 17 00:00:00 2001 From: mogguh Date: Thu, 20 Dec 2007 00:21:32 +0000 Subject: Minor refinings in score screen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@732 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenScore.pas | 701 ++++++++++++++++++++++++++++--------- 1 file changed, 534 insertions(+), 167 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 0ed04b89..35296233 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -19,20 +19,69 @@ uses OpenGL12, {$ifdef win32} Windows, + dialogs, {$endif} math, - ULCD; - + ULCD, + UTexture; // OpenGL; +const + ZBars : real = 0.8; // Z value for the bars + ZRatingPic : real = 0.8; // Z value for the rating pictures + + EaseOut_MaxSteps : real = 40; // that's the speed of the bars (10 is fast | 100 is slower) + type + TPlayerScoreScreenTexture = record // holds all colorized textures for up to 6 players + //Bar textures + Score_NoteBarLevel_Dark : TTexture; // Note + Score_NoteBarRound_Dark : TTexture; // that's the round thing on top + + Score_NoteBarLevel_Light : TTexture; // LineBonus | Phrasebonus + Score_NoteBarRound_Light : TTexture; + + Score_NoteBarLevel_Lightest : TTexture; // GoldenNotes + Score_NoteBarRound_Lightest : TTexture; + end; + + TPlayerScoreScreenData = record // holds the positions and other data + Bar_X :Real; + Bar_Y :Real; + Bar_Height :Real; // this is the max height of the bar, who knows if there ever will be a theme with different heights :D + Bar_Width :Real; // another rather senseless setting, but you never know what our cool users do with the them :) + + Bar_Actual_Height : Real; // this one holds the actual height of the bar, while we animate it + BarScore_ActualHeight : Real; + BarLine_ActualHeight : Real; + BarGolden_ActualHeight : Real; + end; + + TPlayerScoreRatingPics = record // a fine array of the rating pictures + RatePic_X :Real; + RatePic_Y :Real; + RatePic_Height :Real; + RatePic_Width :Real; + + RateEaseStep : Integer; + RateEaseValue: Real; + end; + TScreenScore = class(TMenu) public + aPlayerScoreScreenTextures : array[1..6] of TPlayerScoreScreenTexture; + aPlayerScoreScreenDatas : array[1..6] of TPlayerScoreScreenData; + aPlayerScoreScreenRatings : array[1..6] of TPlayerScoreRatingPics; + + BarScore_EaseOut_Step : real; + BarPhrase_EaseOut_Step : real; + BarGolden_EaseOut_Step : real; + TextArtist: integer; TextTitle: integer; TextArtistTitle : integer; - + TextName: array[1..6] of integer; TextScore: array[1..6] of integer; @@ -61,19 +110,11 @@ type Animation: real; Fadeout: boolean; - BarScore_ActualHeight : array[0..5] of real; - BarPhrase_ActualHeight : array[0..5] of real; - BarGolden_ActualHeight : array[0..5] of real; - - BarScore_EaseOut_Step : real; - BarPhrase_EaseOut_Step : real; - BarGolden_EaseOut_Step : real; + TextScore_ActualValue : array[1..6] of integer; + TextPhrase_ActualValue : array[1..6] of integer; + TextGolden_ActualValue : array[1..6] of integer; - TextScore_ActualValue : array[0..5] of integer; - TextPhrase_ActualValue : array[0..5] of integer; - TextGolden_ActualValue : array[0..5] of integer; - EaseOut_MaxSteps : real; constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; @@ -82,8 +123,13 @@ type function Draw: boolean; override; procedure FillPlayer(Item, P: integer); - function RaiseBar(PlayerNumber: integer; BarStartPosY: Single; ActualHeight: real; Score: integer; ColorBrightness : String; EaseOut_Step: Real) : real; - function IncrementScore(PlayerNumber: integer; ActualScoreValue: Integer; ScoreReached: integer; EaseOut_Step: Real) : integer; + function EaseBarIn(PlayerNumber : Integer; BarType: String) : real; + function EaseScoreIn(PlayerNumber : Integer; ScoreType: String) : real; + + procedure FillPlayerItems(PlayerNumber : Integer; ScoreType: String); + procedure ShowRating(PlayerNumber: integer); + + function elastique(PlayerNumber : Integer): real; end; implementation @@ -142,18 +188,35 @@ end; constructor TScreenScore.Create; var - P: integer; - I, C: integer; + P : integer; + I, C : integer; + ArrayStartModifier : Byte; + begin inherited Create; LoadFromTheme(Theme.Score); - TextArtist := AddText(Theme.Score.TextArtist); - TextTitle := AddText(Theme.Score.TextTitle); - + TextArtist := AddText(Theme.Score.TextArtist); + TextTitle := AddText(Theme.Score.TextTitle); TextArtistTitle := AddText(Theme.Score.TextArtistTitle); + for P := 1 to 6 do + begin + //textures + aPlayerScoreScreenTextures[P].Score_NoteBarLevel_Dark := Tex_Score_NoteBarLevel_Dark[P]; + aPlayerScoreScreenTextures[P].Score_NoteBarRound_Dark := Tex_Score_NoteBarRound_Dark[P]; + + aPlayerScoreScreenTextures[P].Score_NoteBarLevel_Light := Tex_Score_NoteBarLevel_Light[P]; + aPlayerScoreScreenTextures[P].Score_NoteBarRound_Light := Tex_Score_NoteBarRound_Light[P]; + + aPlayerScoreScreenTextures[P].Score_NoteBarLevel_Lightest := Tex_Score_NoteBarLevel_Lightest[P]; + aPlayerScoreScreenTextures[P].Score_NoteBarRound_Lightest := Tex_Score_NoteBarRound_Lightest[P]; + end; + + +//old stuff + for P := 1 to 6 do begin SetLength(PlayerStatic[P], Length(Theme.Score.PlayerStatic[P])); @@ -186,6 +249,7 @@ begin StaticLevel[P] := AddStatic(Theme.Score.StaticLevel[P]); StaticLevelRound[P] := AddStatic(Theme.Score.StaticLevelRound[P]); end; + end; procedure TScreenScore.onShow; @@ -199,8 +263,44 @@ var V: array[1..6] of boolean; // visibility array MaxH: real; // maximum height of score bar Wsp: real; + ArrayStartModifier :integer; begin + case PlayersPlay of + 1: begin + ArrayStartModifier := 0; + end; + 2, 4: begin + ArrayStartModifier := 1; + end; + 3, 6: begin + ArrayStartModifier := 3; + end; + end; + + for P := 1 to PlayersPlay do + begin + // data + aPlayerScoreScreenDatas[P].Bar_X := Theme.Score.StaticBackLevel[P + ArrayStartModifier].X; + aPlayerScoreScreenDatas[P].Bar_Y := Theme.Score.StaticBackLevel[P + ArrayStartModifier].Y; + aPlayerScoreScreenDatas[P].Bar_Height := Theme.Score.StaticBackLevel[P + ArrayStartModifier].H; + aPlayerScoreScreenDatas[P].Bar_Width := Theme.Score.StaticBackLevel[P + ArrayStartModifier].W; + + aPlayerScoreScreenDatas[P].Bar_Actual_Height := 0; + aPlayerScoreScreenDatas[P].BarScore_ActualHeight := 0; + aPlayerScoreScreenDatas[P].BarLine_ActualHeight := 0; + aPlayerScoreScreenDatas[P].BarGolden_ActualHeight := 0; + + // ratings + aPlayerScoreScreenRatings[P].RatePic_X := Theme.Score.StaticRatings[P + ArrayStartModifier].X; + aPlayerScoreScreenRatings[P].RatePic_Y := Theme.Score.StaticRatings[P + ArrayStartModifier].Y; + aPlayerScoreScreenRatings[P].RatePic_Height := Theme.Score.StaticRatings[P + ArrayStartModifier].H; + aPlayerScoreScreenRatings[P].RatePic_Width := Theme.Score.StaticRatings[P + ArrayStartModifier].W; + aPlayerScoreScreenRatings[P].RateEaseStep := 1; + aPlayerScoreScreenRatings[P].RateEaseValue := 20; + end; + + // Singstar Fadeout := false; @@ -242,15 +342,18 @@ begin Text[TextScore[P]].Visible := V[P]; // We set alpha to 0 , so we can nicely blend them in when we need them - Text[TextScore[P]].Alpha := 0; - Text[TextNotesScore[P]].Alpha := 0; - Text[TextNotes[P]].Alpha := 0; - Text[TextLineBonus[P]].Alpha := 0; - Text[TextLineBonusScore[P]].Alpha := 0; - Text[TextGoldenNotes[P]].Alpha := 0; - Text[TextGoldenNotesScore[P]].Alpha := 0; - Text[TextTotal[P]].Alpha := 0; - Text[TextTotalScore[P]].Alpha := 0; + Text[TextScore[P]].Alpha := 0; + Text[TextNotesScore[P]].Alpha := 0; + Text[TextNotes[P]].Alpha := 0; + Text[TextLineBonus[P]].Alpha := 0; + Text[TextLineBonusScore[P]].Alpha := 0; + Text[TextGoldenNotes[P]].Alpha := 0; + Text[TextGoldenNotesScore[P]].Alpha := 0; + Text[TextTotal[P]].Alpha := 0; + Text[TextTotalScore[P]].Alpha := 0; + Static[StaticBoxLightest[P]].Texture.Alpha := 0; + Static[StaticBoxLight[P]].Texture.Alpha := 0; + Static[StaticBoxDark[P]].Texture.Alpha := 0; Text[TextNotes[P]].Visible := V[P]; @@ -272,7 +375,7 @@ begin Static[StaticBoxLight[P]].Visible := V[P]; Static[StaticBoxDark[P]].Visible := V[P]; -// +// we draw that on our own Static[StaticBackLevel[P]].Visible := false; Static[StaticBackLevelRound[P]].Visible := false; Static[StaticLevel[P]].Visible := false; @@ -284,11 +387,8 @@ procedure TScreenScore.onShowFinish; var index : integer; begin -for index := 0 to (PlayersPlay-1) do +for index := 1 to (PlayersPlay) do begin - BarScore_ActualHeight[index] := 0; - BarPhrase_ActualHeight[index] := 0; - BarGolden_ActualHeight[index] := 0; TextScore_ActualValue[index] := 0; TextPhrase_ActualValue[index] := 0; @@ -298,8 +398,6 @@ for index := 0 to (PlayersPlay-1) do BarScore_EaseOut_Step := 1; BarPhrase_EaseOut_Step := 1; BarGolden_EaseOut_Step := 1; - - EaseOut_MaxSteps := 100; end; function TScreenScore.Draw: boolean; @@ -314,11 +412,14 @@ var Item: integer; P: integer; - C: integer; + C, I: integer; + + CurTime: Cardinal; + + PlayerCounter : integer; - katze : integer; - ArrayStartModifier : integer; begin +{ // 0.5.0: try also use 4 players screen with nicks if PlayersPlay = 4 then begin @@ -339,7 +440,7 @@ begin FillPlayer(Item, P); -{ if ScreenAct = 1 then begin + if ScreenAct = 1 then begin LoadColor( Static[StaticBoxLightest[Item]].Texture.ColR, Static[StaticBoxLightest[Item]].Texture.ColG, @@ -353,57 +454,39 @@ begin Static[StaticBoxLightest[Item]].Texture.ColG, Static[StaticBoxLightest[Item]].Texture.ColB, 'P4Dark'); - end;} + end; end; + + end; +} +inherited Draw; - inherited Draw; + player[0].ScoreI := 7000; + player[0].ScoreLineI := 2000; + player[0].ScoreGoldenI := 1000; + player[0].ScoreTotalI := 10000; - //player[1].ScoreI := 7000; - //player[1].ScoreLineI := 2000; - //player[1].ScoreGoldenI := 1000; + player[1].ScoreI := 2500; + player[1].ScoreLineI := 1100; + player[1].ScoreGoldenI := 900; + player[1].ScoreTotalI := 4500; - //player[2].ScoreI := 2500; - //player[2].ScoreLineI := 1100; - //player[2].ScoreGoldenI := 900; // Let's arise the bars + ActualTime := GetTickCount div 33; if ((ActualTime <> OldTime) and ShowFinish )then begin OldTime := ActualTime; -// okay i hate that as much as you might do too, but there's no way around that yet (imho) -// all statics / texts are loaded at start - so that we have them all even if we change the amount of players -// array overview: - -// 1 Player -> Player[0].Score (The score for one player starts at 0) -// -> Statics[1] (The statics for the one player screen start at 0) -// 2 Player -> Player[0..1].Score -// -> Statics[2..3] -// 3 Player -> Player[0..5].Score -// -> Statics[4..6] - - case PlayersPlay of - 1: begin - ArrayStartModifier := 1; - end; - 2, 4: begin - ArrayStartModifier := 2; - end; - 3, 6: begin - ArrayStartModifier := 4; - end; - end; - - For katze:= 0 to (PlayersPlay-1) do + For PlayerCounter := 1 to PlayersPlay do begin // We actually araise them in the right order, but we have to draw them in reverse order (golden -> phrase -> mainscore) - Case BarScore_EaseOut_Step < EaseOut_MaxSteps * 10 of - true : BarScore_EaseOut_Step := BarScore_EaseOut_Step + 1; - end; + if (BarScore_EaseOut_Step < EaseOut_MaxSteps * 10) + then BarScore_EaseOut_Step := BarScore_EaseOut_Step + 1; // PhrasenBonus if (BarScore_EaseOut_Step >= (EaseOut_MaxSteps * 10)) then @@ -423,79 +506,250 @@ begin // Draw golden score bar # //######################## - BarGolden_ActualHeight[katze] := RaiseBar(katze + ArrayStartModifier, - Static[StaticBackLevel[katze + ArrayStartModifier]].Texture.y - BarScore_ActualHeight[katze] - BarPhrase_ActualHeight[katze], - BarGolden_ActualHeight[katze], - player[katze].ScoreGoldenI, - 'Lightest', - BarGolden_EaseOut_Step); - - // Increment and show total score and plain score - TextGolden_ActualValue[katze] := IncrementScore(katze, - TextGolden_ActualValue[katze], - Player[katze].ScoreGoldenI, - BarGolden_EaseOut_Step); - Text[TextGoldenNotesScore[katze + ArrayStartModifier]].Text := IntToStr(TextGolden_ActualValue[katze]); - - // Blend in - Text[TextGoldenNotesScore[katze + ArrayStartModifier]].Alpha := (BarGolden_EaseOut_Step / 100); - Text[TextGoldenNotes[katze + ArrayStartModifier]].Alpha := (BarGolden_EaseOut_Step / 100); + EaseBarIn(PlayerCounter, 'Golden'); // ease bar for golden notes in + EaseScoreIn(PlayerCounter,'Golden'); end; //######################## // Draw phrase score bar # //######################## - BarPhrase_ActualHeight[katze] := RaiseBar(katze + ArrayStartModifier, - Static[StaticBackLevel[katze + ArrayStartModifier]].Texture.y - BarScore_ActualHeight[katze], - BarPhrase_ActualHeight[katze], - Player[katze].ScoreLineI, - 'Light', - BarPhrase_EaseOut_Step); - - // Increment and show total score and plain score - TextPhrase_ActualValue[katze] := IncrementScore(katze, - TextPhrase_ActualValue[katze], - Player[katze].ScoreLineI, - BarPhrase_EaseOut_Step); - Text[TextLineBonusScore[katze + ArrayStartModifier]].Text := IntToStr(TextPhrase_ActualValue[katze]); - //Blend in - Text[TextLineBonusScore[katze + ArrayStartModifier]].Alpha := (BarPhrase_EaseOut_Step / 100); - Text[TextLineBonus[katze + ArrayStartModifier]].Alpha := (BarPhrase_EaseOut_Step / 100); + EaseBarIn(PlayerCounter, 'Line'); // ease bar for line bonus / phrasenbonus notes in + EaseScoreIn(PlayerCounter,'Line'); end; //####################### // Draw plain score bar # //####################### - BarScore_ActualHeight[katze] := RaiseBar(katze + ArrayStartModifier, - Static[StaticBackLevel[katze + ArrayStartModifier]].Texture.y, - BarScore_ActualHeight[katze], - Player[katze].ScoreI, - 'Dark', - BarScore_EaseOut_Step); - // Increment and show total score and plain score - TextScore_ActualValue[katze] := IncrementScore(katze, - TextScore_ActualValue[katze], - Player[katze].ScoreI, - BarScore_EaseOut_Step); - Text[TextNotesScore[katze + ArrayStartModifier]].Text := IntToStr(TextScore_ActualValue[katze]); - - Text[TextTotalScore[katze + ArrayStartModifier]].Text := IntToStr(TextScore_ActualValue[katze] + TextPhrase_ActualValue[katze] + TextGolden_ActualValue[katze]); - - //Blend em in - Text[TextTotalScore[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextTotal[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextNotesScore[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextNotes[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextScore[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); - - end; // me loop + + + EaseBarIn(PlayerCounter, 'Note'); // ease bar for all other notes in + EaseScoreIn(PlayerCounter,'Note'); + + + FillPlayerItems(PlayerCounter,'Funky'); + + end; + end; +//todo: i need a clever method to draw statics with their z value + for I := 0 to Length(Static) - 1 do + Static[I].Draw; + for I := 0 to Length(Text) - 1 do + Text[I].Draw; +end; + +procedure TscreenScore.FillPlayerItems(PlayerNumber : Integer; ScoreType: String); +var + ArrayStartModifier : integer; +begin +// okay i hate that as much as you might do too, but there's no way around that yet (imho) +// all statics / texts are loaded at start - so that we have them all even if we change the amount of players +// array overview: + +// 1 Player -> Player[0].Score (The score for one player starts at 0) +// -> Statics[1] (The statics for the one player screen start at 0) +// 2 Player -> Player[0..1].Score +// -> Statics[2..3] +// 3 Player -> Player[0..5].Score +// -> Statics[4..6] + + case PlayersPlay of + 1: begin + ArrayStartModifier := 0; + end; + 2, 4: begin + ArrayStartModifier := 1; + end; + 3, 6: begin + ArrayStartModifier := 3; + end; + end; + +// todo: take the name from player[PlayerNumber].Name instead of the ini when this is done (mog) + Text[TextName[PlayerNumber + ArrayStartModifier]].Text := Ini.Name[PlayerNumber - 1]; +// end todo + + +//golden + Text[TextGoldenNotesScore[PlayerNumber + ArrayStartModifier]].Text := IntToStr(TextGolden_ActualValue[PlayerNumber]); + Text[TextGoldenNotesScore[PlayerNumber + ArrayStartModifier]].Alpha := (BarGolden_EaseOut_Step / 100); + + Static[StaticBoxLightest[PlayerNumber + ArrayStartModifier]].Texture.Alpha := (BarGolden_EaseOut_Step / 100); + Text[TextGoldenNotes[PlayerNumber + ArrayStartModifier]].Alpha := (BarGolden_EaseOut_Step / 100); + + // line bonus + Text[TextLineBonusScore[PlayerNumber + ArrayStartModifier]].Text := IntToStr(TextPhrase_ActualValue[PlayerNumber]); + Text[TextLineBonusScore[PlayerNumber + ArrayStartModifier]].Alpha := (BarPhrase_EaseOut_Step / 100); + + Static[StaticBoxLight[PlayerNumber + ArrayStartModifier]].Texture.Alpha := (BarPhrase_EaseOut_Step / 100); + Text[TextLineBonus[PlayerNumber + ArrayStartModifier]].Alpha := (BarPhrase_EaseOut_Step / 100); + +// plain score + Text[TextNotesScore[PlayerNumber + ArrayStartModifier]].Text := IntToStr(TextScore_ActualValue[PlayerNumber]); + Text[TextNotes[PlayerNumber + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); + + Static[StaticBoxDark[PlayerNumber + ArrayStartModifier]].Texture.Alpha := (BarScore_EaseOut_Step / 100); + Text[TextNotesScore[PlayerNumber + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); + +// total score + Text[TextTotalScore[PlayerNumber + ArrayStartModifier]].Text := IntToStr(TextScore_ActualValue[PlayerNumber] + TextPhrase_ActualValue[PlayerNumber] + TextGolden_ActualValue[PlayerNumber]); + Text[TextTotalScore[PlayerNumber + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); + + Text[TextTotal[PlayerNumber + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); + + Text[TextTotal[PlayerNumber + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100); + + if(BarGolden_EaseOut_Step > 100) then + begin + ShowRating(PlayerNumber); end; + end; + + +procedure TScreenScore.ShowRating(PlayerNumber: integer); +var + ArrayStartModifier : integer; + Rating : integer; + fu : integer; + + Posx : real; + Posy : real; + width : array[1..3] of real; +begin + case PlayersPlay of + 1: begin + ArrayStartModifier := 0; + end; + 2, 4: begin + ArrayStartModifier := 1; + end; + 3, 6: begin + ArrayStartModifier := 3; + end; + end; + + fu := PlayerNumber + ArrayStartModifier; + +//todo: this could break if the width is not given, for instance when there's a skin with no picture for ratings + Text[TextScore[PlayerNumber + ArrayStartModifier]].Alpha := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue / aPlayerScoreScreenRatings[PlayerNumber].RatePic_Width; +// end todo + {{$IFDEF TRANSLATE} + case (Player[PlayerNumber-1].ScoreTotalI) of + 0..2000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_TONE_DEAF'); + Rating := 0; + end; + 2010..4000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_AMATEUR'); + Rating := 1; + end; + 4010..6000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_RISING_STAR'); + Rating := 2; + end; + 6010..8000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_LEAD_SINGER'); + Rating := 3; + end; + 8010..9000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_HIT_ARTIST'); + Rating := 4; + end; + 9010..9800: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_SUPERSTAR'); + Rating := 5; + end; + 9810..10000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_ULTRASTAR'); + Rating := 6; + end; + end; + {{$ELSE}{ + case (Player[P].ScoreTotalI-1) of + 0..2000: Text[TextScore[fu]].Text := 'Tone Deaf'; + 2010..4000: Text[TextScore[fu]].Text := 'Amateur'; + 4010..6000: Text[TextScore[fu]].Text := 'Rising Star'; + 6010..8000: Text[TextScore[fu]].Text := 'Lead Singer'; + 8010..9000: Text[TextScore[fu]].Text := 'Hit Artist'; + 9010..9800: Text[TextScore[fu]].Text := 'Superstar'; + 9810..10000: Text[TextScore[fu]].Text := 'Ultrastar'; + end; + {$ENDIF} + +// Bounce the rating picture in + PosX := aPlayerScoreScreenRatings[PlayerNumber].RatePic_X + (aPlayerScoreScreenRatings[PlayerNumber].RatePic_Width / 2); + PosY := aPlayerScoreScreenRatings[PlayerNumber].RatePic_Y + (aPlayerScoreScreenRatings[PlayerNumber].RatePic_Height / 2); ; + + elastique(PlayerNumber); + + width[PlayerNumber] := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue/2; + + glBindTexture(GL_TEXTURE_2D, Tex_Score_Ratings[Rating].TexNum); + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(PosX - width[PlayerNumber], PosY - width[PlayerNumber]); + glTexCoord2f(Tex_Score_Ratings[Rating].TexW, 0); glVertex2f(PosX + width[PlayerNumber], PosY - width[PlayerNumber]); + glTexCoord2f(Tex_Score_Ratings[Rating].TexW, Tex_Score_Ratings[Rating].TexH); glVertex2f(PosX + width[PlayerNumber], PosY + width[PlayerNumber]); + glTexCoord2f(0, Tex_Score_Ratings[Rating].TexH); glVertex2f(PosX - width[PlayerNumber], PosY + width[PlayerNumber]); + glEnd; + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2d); end; -function TscreenScore.RaiseBar(PlayerNumber: integer; BarStartPosY: Single; ActualHeight: real; Score: integer; ColorBrightness : String; EaseOut_Step: Real) : real; +function TscreenScore.elastique(PlayerNumber : Integer): real; +var + ReturnValue : real; + p, s : real; + + RaiseStep, Actual_Value, MaxVal : real; + EaseOut_Step : integer; +begin + + EaseOut_Step := aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep; + Actual_Value := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue; + MaxVal := aPlayerScoreScreenRatings[PlayerNumber].RatePic_Width; + + RaiseStep := EaseOut_Step; + + if (RaiseStep = 0) + then ReturnValue := MaxVal; + + RaiseStep := RaiseStep / MaxVal; + + if (RaiseStep = 1) + then + begin + ReturnValue := MaxVal; + end + else + begin + p := MaxVal * 0.4; + + s := p/(2*PI) * arcsin (1); + ReturnValue := MaxVal * power(2,-5 * RaiseStep) * sin( (RaiseStep * MaxVal - s) * (2 * PI) / p) + MaxVal; + + inc(aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep); + aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue := ReturnValue; + end; + Result := ReturnValue; +end; + + +function TscreenScore.EaseBarIn(PlayerNumber : Integer; BarType: String) : real; const RaiseSmoothness : integer = 100; var @@ -508,25 +762,52 @@ var RaiseStep : real; BarStartPosX : Single; + BarStartPosY : Single; - R,G,B : real; lTmp : real; + Score : integer; + + //textures + TextureBar : integer; + TextureRound : integer; begin - MaxHeight := Static[StaticBackLevel[PlayerNumber]].Texture.H; - Width := Static[StaticBackLevel[PlayerNumber]].Texture.W; + MaxHeight := aPlayerScoreScreenDatas[PlayerNumber].Bar_Height; + Width := aPlayerScoreScreenDatas[PlayerNumber].Bar_Width; - BarStartPosX := Static[StaticBackLevel[PlayerNumber]].Texture.X; + BarStartPosX := aPlayerScoreScreenDatas[PlayerNumber].Bar_X; - BarStartPosY := BarStartPosY + MaxHeight; // The texture starts in the upper left corner, so let's subtract the height - so we can arise it + // The texture starts in the upper left corner, so let's subtract the height - so we can arise it + + // let's get the points according to the bar we draw + // score array starts at 0, which means the score for player 1 is in score[0] + // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps + if (BarType = 'Note') + then + begin + Score := Player[PlayerNumber - 1].ScoreI; + RaiseStep := BarScore_EaseOut_Step; + BarStartPosY := aPlayerScoreScreenDatas[PlayerNumber].Bar_Y + MaxHeight; + end; + if (BarType = 'Line') + then + begin + Score := Player[PlayerNumber - 1].ScoreLineI; + RaiseStep := BarPhrase_EaseOut_Step; + BarStartPosY := aPlayerScoreScreenDatas[PlayerNumber].Bar_Y - aPlayerScoreScreenDatas[PlayerNumber].BarScore_ActualHeight + MaxHeight; + end; + if (BarType = 'Golden') + then + begin + Score := Player[PlayerNumber - 1].ScoreGoldenI; + RaiseStep := BarGolden_EaseOut_Step; + BarStartPosY := aPlayerScoreScreenDatas[PlayerNumber].Bar_Y - aPlayerScoreScreenDatas[PlayerNumber].BarScore_ActualHeight - aPlayerScoreScreenDatas[PlayerNumber].BarLine_ActualHeight + MaxHeight; + end; // the height dependend of the score Height2Reach := (Score / 10000) * MaxHeight; - // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps - RaiseStep := EaseOut_Step; - - if (ActualHeight < Height2Reach) then + if (aPlayerScoreScreenDatas[PlayerNumber].Bar_Actual_Height < Height2Reach) then begin // Check http://proto.layer51.com/d.aspx?f=400 for more info on easing functions // Calculate the actual step according to the maxsteps @@ -535,58 +816,117 @@ begin // quadratic easing out - decelerating to zero velocity // -end_position * current_time * ( current_time - 2 ) + start_postion lTmp := (-Height2Reach * RaiseStep * (RaiseStep - 20) + BarStartPosY); - if ( RaiseSmoothness > 0 ) AND - ( lTmp > 0 ) then - begin - NewHeight := lTmp / RaiseSmoothness; - end; + + if ( RaiseSmoothness > 0 ) AND ( lTmp > 0 ) + then + begin + NewHeight := lTmp / RaiseSmoothness; + end; end else begin NewHeight := Height2Reach; end; - //+1 - LoadColor(R, G, B, 'P' + inttostr(PlayerNumber) + ColorBrightness); //dark, light, lightest - glColor4f(R, G, B, 1); - //the actual bar - glBindTexture(GL_TEXTURE_2D, Static[StaticLevel[PlayerNumber]].Texture.TexNum); + glColor4f(1, 1, 1, 1); + +// set the texture for the bar + if (BarType = 'Note') + then + begin + glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarLevel_Dark.TexNum); + end; + if (BarType = 'Line') + then + begin + glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarLevel_Light.TexNum); + end; + if (BarType = 'Golden') + then + begin + glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarLevel_Lightest.TexNum); + end; + //draw it glEnable(GL_TEXTURE_2D); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(BarStartPosX, BarStartPosY - NewHeight); - glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, BarStartPosY - NewHeight); - glTexCoord2f(1, 1); glVertex2f(BarStartPosX + Width, BarStartPosY); - glTexCoord2f(0, 1); glVertex2f(BarStartPosX, BarStartPosY); + glTexCoord2f(0, 0); glVertex3f(BarStartPosX, BarStartPosY - NewHeight, ZBars); + glTexCoord2f(1, 0); glVertex3f(BarStartPosX + Width, BarStartPosY - NewHeight, ZBars); + glTexCoord2f(1, 1); glVertex3f(BarStartPosX + Width, BarStartPosY, ZBars); + glTexCoord2f(0, 1); glVertex3f(BarStartPosX, BarStartPosY, ZBars); glEnd; - //the round thing on top - glBindTexture(GL_TEXTURE_2D, Static[StaticLevelRound[PlayerNumber]].Texture.TexNum); + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2d); + + //the round thing on top + if (BarType = 'Note') then + glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarRound_Dark.TexNum); + if (BarType = 'Line') then + glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarRound_Light.TexNum); + if (BarType = 'Golden') then + glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarRound_Lightest.TexNum); glEnable(GL_TEXTURE_2D); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2f(BarStartPosX, (BarStartPosY - Static[StaticLevelRound[PlayerNumber]].Texture.h) - NewHeight); - glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, (BarStartPosY - Static[StaticLevelRound[PlayerNumber]].Texture.h) - NewHeight); - glTexCoord2f(1, 1); glVertex2f(BarStartPosX + Width, BarStartPosY - NewHeight); - glTexCoord2f(0, 1); glVertex2f(BarStartPosX, BarStartPosY - NewHeight); + glTexCoord2f(0, 0); glVertex3f(BarStartPosX, (BarStartPosY - Static[StaticLevelRound[PlayerNumber]].Texture.h) - NewHeight, ZBars); + glTexCoord2f(1, 0); glVertex3f(BarStartPosX + Width, (BarStartPosY - Static[StaticLevelRound[PlayerNumber]].Texture.h) - NewHeight, ZBars); + glTexCoord2f(1, 1); glVertex3f(BarStartPosX + Width, BarStartPosY - NewHeight, ZBars); + glTexCoord2f(0, 1); glVertex3f(BarStartPosX, BarStartPosY - NewHeight, ZBars); glEnd; - Result := NewHeight; + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2d); + + if (BarType = 'Note') + then + aPlayerScoreScreenDatas[PlayerNumber].BarScore_ActualHeight := NewHeight; + if (BarType = 'Line') + then + aPlayerScoreScreenDatas[PlayerNumber].BarLine_ActualHeight := NewHeight; + if (BarType = 'Golden') + then + aPlayerScoreScreenDatas[PlayerNumber].BarGolden_ActualHeight := NewHeight; end; -function TScreenScore.IncrementScore(PlayerNumber: integer; ActualScoreValue: Integer; ScoreReached: integer; EaseOut_Step: Real) : integer; + +function TScreenScore.EaseScoreIn(PlayerNumber: integer; ScoreType : String) : real; const RaiseSmoothness : integer = 100; var RaiseStep : Real; lTmpA : Real; + ScoreReached :Integer; + EaseOut_Step :Real; + ActualScoreValue:integer; begin + + + if (ScoreType = 'Note') then + begin + EaseOut_Step := BarScore_EaseOut_Step; + ActualScoreValue := TextScore_ActualValue[PlayerNumber]; + ScoreReached := Player[PlayerNumber-1].ScoreI; + end; + if (ScoreType = 'Line') then + begin + EaseOut_Step := BarPhrase_EaseOut_Step; + ActualScoreValue := TextPhrase_ActualValue[PlayerNumber]; + ScoreReached := Player[PlayerNumber-1].ScoreLineI; + end; + if (ScoreType = 'Golden') then + begin + EaseOut_Step := BarGolden_EaseOut_Step; + ActualScoreValue := TextGolden_ActualValue[PlayerNumber]; + ScoreReached := Player[PlayerNumber-1].ScoreGoldenI; + end; + // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps RaiseStep := EaseOut_Step; @@ -601,12 +941,38 @@ begin if ( lTmpA > 0 ) AND ( RaiseSmoothness > 0 ) THEN begin - Result := floor( lTmpA / RaiseSmoothness); + + if (ScoreType = 'Note') then + begin + TextScore_ActualValue[PlayerNumber] := floor( lTmpA / RaiseSmoothness); + end; + if (ScoreType = 'Line') then + begin + TextPhrase_ActualValue[PlayerNumber] := floor( lTmpA / RaiseSmoothness); + end; + if (ScoreType = 'Golden') then + begin + TextGolden_ActualValue[PlayerNumber] := floor( lTmpA / RaiseSmoothness); + end; + end; end else begin - Result := ScoreReached; + + if (ScoreType = 'Note') then + begin + TextScore_ActualValue[PlayerNumber] := ScoreReached; + end; + if (ScoreType = 'Line') then + begin + TextPhrase_ActualValue[PlayerNumber] := ScoreReached; + end; + if (ScoreType = 'Golden') then + begin + TextGolden_ActualValue[PlayerNumber] := ScoreReached; + end; + end; end; @@ -644,7 +1010,7 @@ begin Text[TextName[Item]].ColG, Text[TextName[Item]].ColB, 'P' + IntToStr(P+1) + 'Dark'); - + { LoadColor( Static[StaticBoxLightest[Item]].Texture.ColR, Static[StaticBoxLightest[Item]].Texture.ColG, @@ -662,6 +1028,7 @@ begin Static[StaticBoxDark[Item]].Texture.ColG, Static[StaticBoxDark[Item]].Texture.ColB, 'P' + IntToStr(P+1) + 'Dark'); + } end; end. -- cgit v1.2.3 From 0fc1609b13b256acef7fe9ab456225b68a806730 Mon Sep 17 00:00:00 2001 From: mogguh Date: Thu, 20 Dec 2007 00:38:12 +0000 Subject: Some more minor refining in the score screen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@733 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenScore.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 35296233..7273a06c 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -462,7 +462,7 @@ begin end; } inherited Draw; - + {* player[0].ScoreI := 7000; player[0].ScoreLineI := 2000; player[0].ScoreGoldenI := 1000; @@ -472,7 +472,7 @@ inherited Draw; player[1].ScoreLineI := 1100; player[1].ScoreGoldenI := 900; player[1].ScoreTotalI := 4500; - + *} // Let's arise the bars -- cgit v1.2.3 From cdfdd0ea3fa2eb92893db46c158cf61b7a9411d7 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Dec 2007 01:33:30 +0000 Subject: fixed divide by 0 bugs in score screen. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@734 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenScore.pas | 331 +++++++++++++++++++------------------ 1 file changed, 170 insertions(+), 161 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 7273a06c..84fd4e15 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -267,15 +267,15 @@ var begin case PlayersPlay of - 1: begin - ArrayStartModifier := 0; - end; - 2, 4: begin - ArrayStartModifier := 1; - end; - 3, 6: begin - ArrayStartModifier := 3; - end; + 1: begin + ArrayStartModifier := 0; + end; + 2, 4: begin + ArrayStartModifier := 1; + end; + 3, 6: begin + ArrayStartModifier := 3; + end; end; for P := 1 to PlayersPlay do @@ -309,36 +309,36 @@ begin Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; // set visibility - case PlayersPlay of - 1: begin - V[1] := true; - V[2] := false; - V[3] := false; - V[4] := false; - V[5] := false; - V[6] := false; - end; - 2, 4: begin - V[1] := false; - V[2] := true; - V[3] := true; - V[4] := false; - V[5] := false; - V[6] := false; - end; - 3, 6: begin - V[1] := false; - V[2] := false; - V[3] := false; - V[4] := true; - V[5] := true; - V[6] := true; - end; + case PlayersPlay of + 1: begin + V[1] := true; + V[2] := false; + V[3] := false; + V[4] := false; + V[5] := false; + V[6] := false; + end; + 2, 4: begin + V[1] := false; + V[2] := true; + V[3] := true; + V[4] := false; + V[5] := false; + V[6] := false; + end; + 3, 6: begin + V[1] := false; + V[2] := false; + V[3] := false; + V[4] := true; + V[5] := true; + V[6] := true; + end; end; for P := 1 to 6 do begin - Text[TextName[P]].Visible := V[P]; + Text[TextName[P]].Visible := V[P]; Text[TextScore[P]].Visible := V[P]; // We set alpha to 0 , so we can nicely blend them in when we need them @@ -352,27 +352,27 @@ begin Text[TextTotal[P]].Alpha := 0; Text[TextTotalScore[P]].Alpha := 0; Static[StaticBoxLightest[P]].Texture.Alpha := 0; - Static[StaticBoxLight[P]].Texture.Alpha := 0; + Static[StaticBoxLight[P]].Texture.Alpha := 0; Static[StaticBoxDark[P]].Texture.Alpha := 0; Text[TextNotes[P]].Visible := V[P]; - Text[TextNotesScore[P]].Visible := V[P]; - Text[TextLineBonus[P]].Visible := V[P]; - Text[TextLineBonusScore[P]].Visible := V[P]; - Text[TextGoldenNotes[P]].Visible := V[P]; - Text[TextGoldenNotesScore[P]].Visible := V[P]; - Text[TextTotal[P]].Visible := V[P]; - Text[TextTotalScore[P]].Visible := V[P]; - - for I := 0 to high(PlayerStatic[P]) do - Static[PlayerStatic[P, I]].Visible := V[P]; - - for I := 0 to high(PlayerTexts[P]) do - Text[PlayerTexts[P, I]].Visible := V[P]; - - Static[StaticBoxLightest[P]].Visible := V[P]; - Static[StaticBoxLight[P]].Visible := V[P]; + Text[TextNotesScore[P]].Visible := V[P]; + Text[TextLineBonus[P]].Visible := V[P]; + Text[TextLineBonusScore[P]].Visible := V[P]; + Text[TextGoldenNotes[P]].Visible := V[P]; + Text[TextGoldenNotesScore[P]].Visible := V[P]; + Text[TextTotal[P]].Visible := V[P]; + Text[TextTotalScore[P]].Visible := V[P]; + + for I := 0 to high(PlayerStatic[P]) do + Static[PlayerStatic[P, I]].Visible := V[P]; + + for I := 0 to high(PlayerTexts[P]) do + Text[PlayerTexts[P, I]].Visible := V[P]; + + Static[StaticBoxLightest[P]].Visible := V[P]; + Static[StaticBoxLight[P]].Visible := V[P]; Static[StaticBoxDark[P]].Visible := V[P]; // we draw that on our own @@ -555,19 +555,19 @@ begin // -> Statics[4..6] case PlayersPlay of - 1: begin - ArrayStartModifier := 0; - end; - 2, 4: begin - ArrayStartModifier := 1; - end; - 3, 6: begin - ArrayStartModifier := 3; - end; + 1: begin + ArrayStartModifier := 0; + end; + 2, 4: begin + ArrayStartModifier := 1; + end; + 3, 6: begin + ArrayStartModifier := 3; + end; end; // todo: take the name from player[PlayerNumber].Name instead of the ini when this is done (mog) - Text[TextName[PlayerNumber + ArrayStartModifier]].Text := Ini.Name[PlayerNumber - 1]; + Text[TextName[PlayerNumber + ArrayStartModifier]].Text := Ini.Name[PlayerNumber - 1]; // end todo @@ -618,70 +618,75 @@ var width : array[1..3] of real; begin case PlayersPlay of - 1: begin - ArrayStartModifier := 0; - end; - 2, 4: begin - ArrayStartModifier := 1; - end; - 3, 6: begin - ArrayStartModifier := 3; - end; + 1: begin + ArrayStartModifier := 0; + end; + 2, 4: begin + ArrayStartModifier := 1; + end; + 3, 6: begin + ArrayStartModifier := 3; + end; end; - fu := PlayerNumber + ArrayStartModifier; - -//todo: this could break if the width is not given, for instance when there's a skin with no picture for ratings - Text[TextScore[PlayerNumber + ArrayStartModifier]].Alpha := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue / aPlayerScoreScreenRatings[PlayerNumber].RatePic_Width; -// end todo - {{$IFDEF TRANSLATE} - case (Player[PlayerNumber-1].ScoreTotalI) of - 0..2000: - begin - Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_TONE_DEAF'); - Rating := 0; - end; - 2010..4000: - begin - Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_AMATEUR'); - Rating := 1; - end; - 4010..6000: - begin - Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_RISING_STAR'); - Rating := 2; - end; - 6010..8000: - begin - Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_LEAD_SINGER'); - Rating := 3; - end; - 8010..9000: - begin - Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_HIT_ARTIST'); - Rating := 4; - end; - 9010..9800: - begin - Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_SUPERSTAR'); - Rating := 5; - end; - 9810..10000: - begin - Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_ULTRASTAR'); - Rating := 6; - end; - end; - {{$ELSE}{ - case (Player[P].ScoreTotalI-1) of - 0..2000: Text[TextScore[fu]].Text := 'Tone Deaf'; - 2010..4000: Text[TextScore[fu]].Text := 'Amateur'; - 4010..6000: Text[TextScore[fu]].Text := 'Rising Star'; - 6010..8000: Text[TextScore[fu]].Text := 'Lead Singer'; - 8010..9000: Text[TextScore[fu]].Text := 'Hit Artist'; - 9010..9800: Text[TextScore[fu]].Text := 'Superstar'; - 9810..10000: Text[TextScore[fu]].Text := 'Ultrastar'; - end; + fu := PlayerNumber + ArrayStartModifier; + +//todo: this could break if the width is not given, for instance when there's a skin with no picture for ratings + if ( aPlayerScoreScreenRatings[PlayerNumber].RatePic_Width > 0 ) AND // JB :) + ( aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue > 0 ) then + begin + Text[TextScore[PlayerNumber + ArrayStartModifier]].Alpha := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue / aPlayerScoreScreenRatings[PlayerNumber].RatePic_Width; + end; + +// end todo + {{$IFDEF TRANSLATE} + case (Player[PlayerNumber-1].ScoreTotalI) of + 0..2000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_TONE_DEAF'); + Rating := 0; + end; + 2010..4000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_AMATEUR'); + Rating := 1; + end; + 4010..6000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_RISING_STAR'); + Rating := 2; + end; + 6010..8000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_LEAD_SINGER'); + Rating := 3; + end; + 8010..9000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_HIT_ARTIST'); + Rating := 4; + end; + 9010..9800: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_SUPERSTAR'); + Rating := 5; + end; + 9810..10000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_ULTRASTAR'); + Rating := 6; + end; + end; + {{$ELSE}{ + case (Player[P].ScoreTotalI-1) of + 0..2000: Text[TextScore[fu]].Text := 'Tone Deaf'; + 2010..4000: Text[TextScore[fu]].Text := 'Amateur'; + 4010..6000: Text[TextScore[fu]].Text := 'Rising Star'; + 6010..8000: Text[TextScore[fu]].Text := 'Lead Singer'; + 8010..9000: Text[TextScore[fu]].Text := 'Hit Artist'; + 9010..9800: Text[TextScore[fu]].Text := 'Superstar'; + 9810..10000: Text[TextScore[fu]].Text := 'Ultrastar'; + end; {$ENDIF} // Bounce the rating picture in @@ -710,43 +715,47 @@ begin end; -function TscreenScore.elastique(PlayerNumber : Integer): real; -var - ReturnValue : real; - p, s : real; - - RaiseStep, Actual_Value, MaxVal : real; - EaseOut_Step : integer; -begin - - EaseOut_Step := aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep; - Actual_Value := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue; - MaxVal := aPlayerScoreScreenRatings[PlayerNumber].RatePic_Width; - - RaiseStep := EaseOut_Step; - - if (RaiseStep = 0) - then ReturnValue := MaxVal; - - RaiseStep := RaiseStep / MaxVal; - - if (RaiseStep = 1) - then - begin - ReturnValue := MaxVal; - end - else - begin - p := MaxVal * 0.4; - - s := p/(2*PI) * arcsin (1); - ReturnValue := MaxVal * power(2,-5 * RaiseStep) * sin( (RaiseStep * MaxVal - s) * (2 * PI) / p) + MaxVal; - - inc(aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep); - aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue := ReturnValue; - end; - Result := ReturnValue; -end; +function TscreenScore.elastique(PlayerNumber : Integer): real; +var + ReturnValue : real; + p, s : real; + + RaiseStep, Actual_Value, MaxVal : real; + EaseOut_Step : integer; +begin + + EaseOut_Step := aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep; + Actual_Value := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue; + MaxVal := aPlayerScoreScreenRatings[PlayerNumber].RatePic_Width; + + RaiseStep := EaseOut_Step; + + if (RaiseStep = 0) + then ReturnValue := MaxVal; + + if ( MaxVal > 0 ) AND // JB :) + ( RaiseStep > 0 ) then + begin + RaiseStep := RaiseStep / MaxVal; + end; + + if (RaiseStep = 1) + then + begin + ReturnValue := MaxVal; + end + else + begin + p := MaxVal * 0.4; + + s := p/(2*PI) * arcsin (1); + ReturnValue := MaxVal * power(2,-5 * RaiseStep) * sin( (RaiseStep * MaxVal - s) * (2 * PI) / p) + MaxVal; + + inc(aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep); + aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue := ReturnValue; + end; + Result := ReturnValue; +end; function TscreenScore.EaseBarIn(PlayerNumber : Integer; BarType: String) : real; -- cgit v1.2.3 From 7d61a98f807803a337fd12342c29eb0f5f69fc76 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Dec 2007 03:33:14 +0000 Subject: made USDX function when file paths differ from previous expectations.. ( most of the software was still using hard coded paths ) also added ability to have multiple song directories. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@735 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenOptionsThemes.pas | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index 06444dfe..114a5e45 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -28,7 +28,9 @@ type implementation -uses UGraphic, USkins; +uses UMain, + UGraphic, + USkins; function TScreenOptionsThemes.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -147,7 +149,7 @@ end; procedure TScreenOptionsThemes.ReloadTheme; begin - Theme.LoadTheme('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); + Theme.LoadTheme(ThemePath + ITheme[Ini.Theme] + '.ini', Ini.Color); ScreenOptionsThemes := TScreenOptionsThemes.create(); ScreenOptionsThemes.onshow; -- cgit v1.2.3 From bc01e7c70cf07c9758e09b07af5f788a45297eee Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 11 Jan 2008 12:41:51 +0000 Subject: Cleanup: Use the property Position in favor of MoveTo() (MoveTo() will be SetPosition() soon) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@784 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditSub.pas | 6 +++--- Game/Code/Screens/UScreenSing.pas | 8 ++++---- Game/Code/Screens/UScreenSong.pas | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 6dcb1f5f..725dd4e9 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -322,7 +322,7 @@ begin AudioPlayback.Stop; R := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote); if R <= AudioPlayback.Length then begin - AudioPlayback.MoveTo(R); + AudioPlayback.Position := R; PlayStopTime := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Koniec); PlaySentence := true; AudioPlayback.Play; @@ -349,7 +349,7 @@ begin PlaySentence := true; Click := true; AudioPlayback.Stop; - AudioPlayback.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote)+0{-0.10}); + AudioPlayback.Position := 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; @@ -363,7 +363,7 @@ begin PlaySentence := true; Click := false; AudioPlayback.Stop; - AudioPlayback.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start)); + AudioPlayback.Position := 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)); diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 309af301..5a9ecae7 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -171,7 +171,7 @@ begin SDLK_TAB: //Change Visualization Preset begin if fShowVisualization then - fCurrentVideoPlaybackEngine.MoveTo( now ); // move to a random position + fCurrentVideoPlaybackEngine.Position := now; // move to a random position end; SDLK_RETURN: @@ -213,7 +213,7 @@ begin Czas.Teraz := PauseTime; //Position of Notes // Position of Music - AudioPlayback.MoveTo (PauseTime); + AudioPlayback.Position := PauseTime; // Play Music AudioPlayback.Play; @@ -478,7 +478,7 @@ begin // play music (I) AudioInput.CaptureStart; - AudioPlayback.MoveTo(AktSong.Start); + AudioPlayback.Position := AktSong.Start; // Music.Play; // prepare timer (I) @@ -1344,7 +1344,7 @@ begin // if we are shoing a visualization... change to a new preset after each sentence.. // Maybe we should make this less often or something... just a if fShowVisualization then - fCurrentVideoPlaybackEngine.MoveTo( now ); // move to a random position + fCurrentVideoPlaybackEngine.Position := now; // move to a random position end; //Called on Sentence Change S= New Current Sentence diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 03ef793b..4f90e2ca 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1524,7 +1524,7 @@ begin begin AudioPlayback.SetLoop(false); AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); - AudioPlayback.MoveTo(AudioPlayback.Length / 4); + AudioPlayback.Position := AudioPlayback.Length / 4; AudioPlayback.Play; //Set Preview Volume @@ -1768,7 +1768,7 @@ begin begin AudioPlayback.Close; if AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - AudioPlayback.MoveTo(AudioPlayback.Length / 4); + AudioPlayback.Position := AudioPlayback.Length / 4; //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal if (Ini.PreviewFading = 0) then AudioPlayback.Play -- cgit v1.2.3 From e74bd57c12f470257111c1c0530fb38f0fd34414 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sat, 12 Jan 2008 12:31:43 +0000 Subject: bunch of smaller changes... some changes to song loading... Record global changed to singleton object started implementing mic volume display in Settings-Record hope this dosnt break anything.. :P git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@789 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditConvert.pas | 1 + Game/Code/Screens/UScreenEditHeader.pas | 6 +- Game/Code/Screens/UScreenEditSub.pas | 51 +++++------ Game/Code/Screens/UScreenMain.pas | 7 +- Game/Code/Screens/UScreenOptionsRecord.pas | 132 +++++++++++++++++++++++------ Game/Code/Screens/UScreenOptionsSound.pas | 9 +- Game/Code/Screens/UScreenScore.pas | 6 +- Game/Code/Screens/UScreenSing.pas | 91 +++++++++++--------- Game/Code/Screens/UScreenSingModi.pas | 4 +- Game/Code/Screens/UScreenSong.pas | 18 ++-- Game/Code/Screens/UScreenStatMain.pas | 7 +- Game/Code/Screens/UScreenTop5.pas | 18 ++-- 12 files changed, 223 insertions(+), 127 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index e370ad67..a523afd2 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -16,6 +16,7 @@ uses UMenu, {$ENDIF} ULog, USongs, + USong, UMusic, UThemes; diff --git a/Game/Code/Screens/UScreenEditHeader.pas b/Game/Code/Screens/UScreenEditHeader.pas index 7c8b2d56..60466a27 100644 --- a/Game/Code/Screens/UScreenEditHeader.pas +++ b/Game/Code/Screens/UScreenEditHeader.pas @@ -4,7 +4,11 @@ interface {$I switches.inc} -uses UMenu, SDL, USongs, UThemes; +uses UMenu, + SDL, + USongs, + USong, + UThemes; type TScreenEditHeader = class(TMenu) diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 725dd4e9..57d6777e 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -15,6 +15,7 @@ uses UFiles, UTime, USongs, + USong, UIni, ULog, UTexture, @@ -143,40 +144,40 @@ begin begin // Increase BPM if SDL_ModState = 0 then - AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 5) + 1) / 5; // (1/20) + CurrentSong.BPM[0].BPM := Round((CurrentSong.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) + CurrentSong.BPM[0].BPM := CurrentSong.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) + CurrentSong.BPM[0].BPM := Round((CurrentSong.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; + CurrentSong.BPM[0].BPM := Round((CurrentSong.BPM[0].BPM * 5) - 1) / 5; if SDL_ModState = KMOD_LSHIFT then - AktSong.BPM[0].BPM := AktSong.BPM[0].BPM - 4; + CurrentSong.BPM[0].BPM := CurrentSong.BPM[0].BPM - 4; if SDL_ModState = KMOD_LCTRL then - AktSong.BPM[0].BPM := Round((AktSong.BPM[0].BPM * 25) - 1) / 25; + CurrentSong.BPM[0].BPM := Round((CurrentSong.BPM[0].BPM * 25) - 1) / 25; end; SDLK_0: begin // Increase GAP if SDL_ModState = 0 then - AktSong.GAP := AktSong.GAP + 10; + CurrentSong.GAP := CurrentSong.GAP + 10; if SDL_ModState = KMOD_LSHIFT then - AktSong.GAP := AktSong.GAP + 1000; + CurrentSong.GAP := CurrentSong.GAP + 1000; end; SDLK_9: begin // Decrease GAP if SDL_ModState = 0 then - AktSong.GAP := AktSong.GAP - 10; + CurrentSong.GAP := CurrentSong.GAP - 10; if SDL_ModState = KMOD_LSHIFT then - AktSong.GAP := AktSong.GAP - 1000; + CurrentSong.GAP := CurrentSong.GAP - 1000; end; SDLK_KP_PLUS: @@ -222,13 +223,13 @@ begin begin // Save Song if SDL_ModState = KMOD_LSHIFT then - SaveSong(AktSong, Czesci[0], Path + FileName, true) + SaveSong(CurrentSong, Czesci[0], Path + FileName, true) else - SaveSong(AktSong, Czesci[0], Path + FileName, false); + SaveSong(CurrentSong, 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);} + SaveSongDebug(CurrentSong, Czesci[0], 'C:\song.asm', false);} end; @@ -656,7 +657,7 @@ var C: integer; N: integer; begin - AktSong.BPM[0].BPM := AktSong.BPM[0].BPM / 2; + CurrentSong.BPM[0].BPM := CurrentSong.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; @@ -673,7 +674,7 @@ var C: integer; N: integer; begin - AktSong.BPM[0].BPM := AktSong.BPM[0].BPM * 2; + CurrentSong.BPM[0].BPM := CurrentSong.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; @@ -1160,7 +1161,7 @@ begin try ResetSingTemp; - Error := not LoadSong(Path + FileName); +// Error := not LoadSong(Path + FileName); // todo - JB come back to this except Error := True; end; @@ -1179,15 +1180,15 @@ begin 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; + Text[TextTitle].Text := CurrentSong.Title; + Text[TextArtist].Text := CurrentSong.Artist; + Text[TextMp3].Text := CurrentSong.Mp3; Czesci[0].Akt := 0; AktNuta := 0; Czesci[0].Czesc[0].Nuta[0].Color := 1; - AudioPlayback.Open(Path + AktSong.Mp3); + AudioPlayback.Open(Path + CurrentSong.Mp3); //Set Down Music Volume for Better hearability of Midi Sounds //Music.SetVolume(40); @@ -1238,7 +1239,7 @@ begin {$ENDIF} // click - AktBeat := Floor(GetMidBeat(MidiPos - AktSong.GAP / 1000)); + AktBeat := Floor(GetMidBeat(MidiPos - CurrentSong.GAP / 1000)); Text[TextDebug].Text := IntToStr(AktBeat); if AktBeat <> LastClick then begin @@ -1269,8 +1270,8 @@ begin // 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)); +// AktBeat := Floor(CurrentSong.BPM[0].BPM * (Music.Position - CurrentSong.GAP / 1000) / 60); + AktBeat := Floor(GetMidBeat(AudioPlayback.Position - CurrentSong.GAP / 1000)); Text[TextDebug].Text := IntToStr(AktBeat); if AktBeat <> LastClick then begin for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do @@ -1288,8 +1289,8 @@ begin 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); + Text[TextBPM].Text := FloatToStr(CurrentSong.BPM[0].BPM / 4); + Text[TextGAP].Text := FloatToStr(CurrentSong.GAP); //Error reading Variables when no Song is loaded if not Error then diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 5f7a0461..a4dc5f0d 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -124,7 +124,7 @@ begin //Solo if (Interaction = 0) then begin - if (Length(Songs.Song) >= 1) then + if (Songs.SongList.Count >= 1) then begin AudioPlayback.PlayStart; if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1; @@ -138,8 +138,9 @@ begin end; //Multi - if Interaction = 1 then begin - if (Length(Songs.Song) >= 1) then + if Interaction = 1 then + begin + if (Songs.SongList.Count >= 1) then begin if (Length(DLLMan.Plugins)>=1) then begin diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index 80259802..42776717 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -15,14 +15,21 @@ type SelectSlideChannelR: integer; public constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - procedure onShow; override; - procedure UpdateCard; + function Draw: boolean; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure UpdateCard; end; implementation -uses SysUtils, UGraphic, URecord, ULog; +uses SysUtils, + UGraphic, + URecord, + UDraw, + UMain, + ULog; function TScreenOptionsRecord.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -43,7 +50,7 @@ begin end; SDLK_RETURN: begin - if SelInteraction = 4 then begin + if SelInteraction = 5 then begin Ini.Save; AudioPlayback.PlayBack; FadeTo(@ScreenOptions); @@ -55,19 +62,21 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + if (SelInteraction >= 0) and (SelInteraction <= 4) then begin AudioPlayback.PlayOption; InteractInc; end; - if SelInteraction = 0 then UpdateCard; +// if SelInteraction = 0 then UpdateCard; + UpdateCard; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + if (SelInteraction >= 0) and (SelInteraction <= 4) then begin AudioPlayback.PlayOption; InteractDec; end; - if SelInteraction = 0 then UpdateCard; + UpdateCard; +// if SelInteraction = 0 then UpdateCard; end; end; end; @@ -80,22 +89,27 @@ var SCI: integer; begin inherited Create; - + LoadFromTheme(Theme.OptionsRecord); - SetLength(ICard, Length(Recording.SoundCard)); - for SC := 0 to High(Recording.SoundCard) do - ICard[SC] := Recording.SoundCard[SC].Description; + SetLength(ICard, Length(AudioInputProcessor.SoundCard)); + for SC := 0 to High(AudioInputProcessor.SoundCard) do + ICard[SC] := AudioInputProcessor.SoundCard[SC].Description; + + if (Length(AudioInputProcessor.SoundCard) > 0) then + begin + SetLength(IInput, Length(AudioInputProcessor.SoundCard[Ini.Card].Input)); + for SCI := 0 to High(AudioInputProcessor.SoundCard[Ini.Card].Input) do + IInput[SCI] := AudioInputProcessor.SoundCard[Ini.Card].Input[SCI].Name; - if (Length(Recording.SoundCard) > 0) then begin - SetLength(IInput, Length(Recording.SoundCard[Ini.Card].Input)); - for SCI := 0 to High(Recording.SoundCard[Ini.Card].Input) do - IInput[SCI] := Recording.SoundCard[Ini.Card].Input[SCI].Name; AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, Ini.Card, ICard); + SelectSlideInput := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, Ini.CardList[0].Input, IInput); SelectSlideChannelL := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelL, Ini.CardList[0].ChannelL, IChannel); SelectSlideChannelR := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelR, Ini.CardList[0].ChannelR, IChannel); + + AddSelect(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost); end; AddButton(Theme.OptionsRecord.ButtonExit); @@ -108,6 +122,16 @@ end; procedure TScreenOptionsRecord.onShow; begin Interaction := 0; + writeln( 'AudioInput.CaptureStart') ; + + PlayersPlay := 2; // TODO : This needs fixing + AudioInput.CaptureStart; + +end; + +procedure TScreenOptionsRecord.onHide; +begin + AudioInput.CaptureStop; end; procedure TScreenOptionsRecord.UpdateCard; @@ -115,18 +139,74 @@ var SC: integer; SCI: integer; begin - SC := Ini.Card; -// if SC = 1 then beep; + writeln( 'Update Card') ; + AudioInput.CaptureStop; + try + SC := Ini.Card; + // if SC = 1 then beep; + + SetLength(IInput, Length(AudioInputProcessor.SoundCard[SC].Input)); + for SCI := 0 to High(AudioInputProcessor.SoundCard[SC].Input) do begin + IInput[SCI] := AudioInputProcessor.SoundCard[SC].Input[SCI].Name; + // Log.LogError(IInput[SCI]); + end; - SetLength(IInput, Length(Recording.SoundCard[SC].Input)); - for SCI := 0 to High(Recording.SoundCard[SC].Input) do begin - IInput[SCI] := Recording.SoundCard[SC].Input[SCI].Name; -// Log.LogError(IInput[SCI]); + + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideInput, SelectSlideInput, IInput, Ini.CardList[SC].Input); + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelL, SelectSlideChannelL, IChannel, Ini.CardList[SC].ChannelL); + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelR, SelectSlideChannelR, IChannel, Ini.CardList[SC].ChannelR); + + finally + AudioInput.CaptureStart; end; +end; - UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideInput, SelectSlideInput, IInput, Ini.CardList[SC].Input); - UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelL, SelectSlideChannelL, IChannel, Ini.CardList[SC].ChannelL); - UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelR, SelectSlideChannelR, IChannel, Ini.CardList[SC].ChannelR); +function TScreenOptionsRecord.Draw: boolean; +begin + DrawBG; + DrawFG; + + // TODO : this needs to be positioned correctly + if PlayersPlay = 1 then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + + if PlayersPlay = 2 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + if ScreenAct = 2 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 2); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 3); + end; + end; + + if PlayersPlay = 3 then begin + SingDrawOscilloscope(75 + 10*ScreenX, 95, 100, 20, 0); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 0); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + if ScreenAct = 2 then begin + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 3); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 4); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 5); + end; + end; + + Result := True; end; + end. diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index 867a10b6..64a0413f 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -51,14 +51,14 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + if (SelInteraction >= 0) and (SelInteraction <= 6) then begin AudioPlayback.PlayOption; InteractInc; end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + if (SelInteraction >= 0) and (SelInteraction <= 6) then begin AudioPlayback.PlayOption; InteractDec; end; @@ -75,15 +75,14 @@ begin LoadFromTheme(Theme.OptionsSound); - AddSelect(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost); + AddSelect(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost); // TODO - This need moving to ScreenOptionsRecord AddSelect(Theme.OptionsSound.SelectClickAssist, Ini.ClickAssist, IClickAssist); AddSelect(Theme.OptionsSound.SelectBeatClick, Ini.BeatClick, IBeatClick); AddSelect(Theme.OptionsSound.SelectThreshold, Ini.Threshold, IThreshold); //Song Preview AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewVolume, Ini.PreviewVolume, IPreviewVolume); - AddSelectSlide - (Theme.OptionsSound.SelectSlidePreviewFading, Ini.PreviewFading, IPreviewFading); + AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewFading, Ini.PreviewFading, IPreviewFading); AddButton(Theme.OptionsSound.ButtonExit); if (Length(Button[0].Text)=0) then diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 84fd4e15..c53844f5 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -304,9 +304,9 @@ begin // Singstar Fadeout := false; - Text[TextArtist].Text := AktSong.Artist; - Text[TextTitle].Text := AktSong.Title; - Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; + Text[TextArtist].Text := CurrentSong.Artist; + Text[TextTitle].Text := CurrentSong.Title; + Text[TextArtistTitle].Text := CurrentSong.Artist + ' - ' + CurrentSong.Title; // set visibility case PlayersPlay of diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 5a9ecae7..adfc4d2c 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -101,22 +101,29 @@ type fCurrentVideoPlaybackEngine : IVideoPlayback; constructor Create; override; - procedure onShow; override; - procedure onShowFinish; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure Finish; virtual; - procedure UpdateLCD; - procedure Pause; //Pause Mod(Toggles Pause) - - //OnSentenceEnd for LineBonus + Singbar - procedure onSentenceEnd(S: Cardinal); - //OnSentenceChange (for Golden Notes) - procedure onSentenceChange(S: Cardinal); + procedure onShow; override; + procedure onShowFinish; override; + + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + + procedure Finish; virtual; + procedure UpdateLCD; + procedure Pause; //Pause Mod(Toggles Pause) + + procedure onSentenceEnd(S: Cardinal); //OnSentenceEnd for LineBonus + Singbar + procedure onSentenceChange(S: Cardinal); //OnSentenceChange (for Golden Notes) end; implementation -uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math; + +uses UGraphic, + UDraw, + UMain, + Classes, + URecord, + ULanguage, + math; // Method for input parsing. If False is returned, GetNextWindow // should be checked to know the next window to load; @@ -204,7 +211,7 @@ begin AudioPlayback.Pause; // pause Video - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then fCurrentVideoPlaybackEngine.Pause; end @@ -218,7 +225,7 @@ begin AudioPlayback.Play; // Video - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then fCurrentVideoPlaybackEngine.Pause; Paused := false; @@ -425,12 +432,13 @@ begin {Static[StaticP3RScoreBG].Visible := V3R; Text[TextP3RScore].Visible := V3R; } - // load notes ResetSingTemp; // Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); - AktSong := CatSongs.Song[CatSongs.Selected]; + CurrentSong := CatSongs.Song[CatSongs.Selected]; + try - if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName) then + if not CurrentSong.LoadSong then +// if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName) then begin //Error Loading Song -> Go back to Song Screen and Show some Error Message FadeTo(@ScreenSong); @@ -449,26 +457,26 @@ begin ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); Exit; end; - AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; -// AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed + CurrentSong.Path := CatSongs.Song[CatSongs.Selected].Path; +// CurrentSong.GAP := CurrentSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / CurrentSong.BPM[0].BPM / 2; // temporary until UMain will be fixed // set movie - if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then begin // todo: VideoGap and Start time verwursten - fCurrentVideoPlaybackEngine.Open( AktSong.Path + AktSong.Video ); + fCurrentVideoPlaybackEngine.Open( CurrentSong.Path + CurrentSong.Video ); - fCurrentVideoPlaybackEngine.position := AktSong.VideoGAP + AktSong.Start; + fCurrentVideoPlaybackEngine.position := CurrentSong.VideoGAP + CurrentSong.Start; - AktSong.VideoLoaded := true; + CurrentSong.VideoLoaded := true; end; // set background - if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then + if (CurrentSong.Background <> '') and (CurrentSong.VideoLoaded = false) then try - Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background); + Tex_Background := Texture.LoadTexture(CurrentSong.Path + CurrentSong.Background); except - log.LogError('Background could not be loaded: ' + AktSong.Path + AktSong.Background); + log.LogError('Background could not be loaded: ' + CurrentSong.Path + CurrentSong.Background); Tex_Background.TexNum := -1; end else @@ -478,20 +486,20 @@ begin // play music (I) AudioInput.CaptureStart; - AudioPlayback.Position := AktSong.Start; + AudioPlayback.Position := CurrentSong.Start; // Music.Play; // prepare timer (I) // CountSkipTimeSet; - Czas.Teraz := AktSong.Start; + Czas.Teraz := CurrentSong.Start; Czas.Razem := AudioPlayback.Length; - if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000; + if (CurrentSong.Finish > 0) then Czas.Razem := CurrentSong.Finish / 1000; Czas.OldBeat := -1; for P := 0 to High(Player) do ClearScores(P); // main text - Lyrics.Clear (AktSong.BPM[0].BPM, AktSong.Resolution); + Lyrics.Clear (CurrentSong.BPM[0].BPM, CurrentSong.Resolution); // set custom options case Ini.LyricsFont of @@ -870,7 +878,7 @@ procedure TScreenSing.onShowFinish; begin // play movie (II) - if AktSong.VideoLoaded then + if CurrentSong.VideoLoaded then begin try writeln( 'VideoPlayback.FFmpegGetFrame' ); @@ -884,11 +892,11 @@ begin on E : Exception do begin //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video - AktSong.VideoLoaded := False; + CurrentSong.VideoLoaded := False; Log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); Log.LogError('Error Message : '+ E.message ); Log.LogError(' In : '+ E.ClassName +' (TScreenSing.onShowFinish)' ); - Log.LogError('Corrupted File: ' + AktSong.Video); + Log.LogError('Corrupted File: ' + CurrentSong.Video); try // CloseSmpeg; fCurrentVideoPlaybackEngine.Close; @@ -1141,7 +1149,8 @@ begin SingDrawBackground; // update and draw movie - if ShowFinish and ( AktSong.VideoLoaded or fShowVisualization ) then + if ShowFinish and + ( CurrentSong.VideoLoaded or fShowVisualization ) then // if ShowFinish then begin // try @@ -1161,12 +1170,12 @@ begin begin //If an Error occurs drawing: prevent Video from being Drawn again and Close Video - AktSong.VideoLoaded := False; + CurrentSong.VideoLoaded := False; log.LogError('Error drawing Video, Video has been disabled for this Song/Session.'); Log.LogError('Error Message : '+ E.message ); Log.LogError(' In : '+ E.ClassName +' (TScreenSing.Draw)' ); - Log.LogError('Corrupted File: ' + AktSong.Video); + Log.LogError('Corrupted File: ' + CurrentSong.Video); try // CloseSmpeg; fCurrentVideoPlaybackEngine.Close; @@ -1183,9 +1192,9 @@ begin DrawFG; // check for music finish -// Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(AktSong.Finish)); +// Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(CurrentSong.Finish)); if ShowFinish then begin - if (not AudioPlayback.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + if (not AudioPlayback.Finished) and ((CurrentSong.Finish = 0) or (Czas.Teraz*1000 <= CurrentSong.Finish)) then begin //Pause Mod: if not Paused then Sing(Self); // analyze song @@ -1251,11 +1260,11 @@ begin Log.LogBenchmark('Creating files', 0); end; - if AktSong.VideoLoaded then + if CurrentSong.VideoLoaded then begin // CloseSmpeg; fCurrentVideoPlaybackEngine.Close; - AktSong.VideoLoaded := false; // to prevent drawing closed video + CurrentSong.VideoLoaded := false; // to prevent drawing closed video end; SetFontItalic (False); diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 5d87ffdd..7d2eba07 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -520,7 +520,7 @@ end; // comment by blindy: wo zum henker wird denn in diesem screen ein video abgespielt? // update and draw movie // wie wo wadd? also in der selben funktion in der uscreensing kommt des video in der zeile 995, oder was wollteste wissen? :X -{ if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin +{ if ShowFinish and CurrentSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin UpdateSmpeg; // this only draws end;} @@ -530,7 +530,7 @@ end; if ShowFinish then begin if DllMan.Selected.LoadSong then begin - if (not AudioPlayback.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin + if (not AudioPlayback.Finished) and ((CurrentSong.Finish = 0) or (Czas.Teraz*1000 <= CurrentSong.Finish)) then begin //Pause Mod: if not Paused then Sing(Self); // analyze song diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 4f90e2ca..4b42288a 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -383,7 +383,7 @@ begin end; SDLK_RETURN: begin - if Length(Songs.Song) > 0 then + if Songs.SongList.Count > 0 then begin {$IFDEF UseSerialPort} // PortWriteB($378, 0); @@ -438,7 +438,7 @@ begin SDLK_M: //Show SongMenu begin - if (Length(Songs.Song) > 0) then begin + if (Songs.SongList.Count > 0) then begin if (Mode = 0) then begin if not CatSongs.Song[Interaction].Main then begin // clicked on Song if CatSongs.CatNumShow = -3 then @@ -457,14 +457,14 @@ begin SDLK_P: //Show Playlist Menu begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + if (Songs.SongList.Count > 0) AND (Mode = 0) then begin ScreenSongMenu.MenuShow(SM_Playlist_Load); end; end; SDLK_J: //Show Jumpto Menu begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then + if (Songs.SongList.Count > 0) AND (Mode = 0) then begin ScreenSongJumpto.Visible := True; end; @@ -553,7 +553,7 @@ begin SDLK_RIGHT: begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then + if (Songs.SongList.Count > 0) AND (Mode = 0) then begin AudioPlayback.PlayChange; SelectNext; @@ -568,7 +568,7 @@ begin SDLK_LEFT: begin - if (Length(Songs.Song) > 0)AND (Mode = 0) then begin + if (Songs.SongList.Count > 0)AND (Mode = 0) then begin AudioPlayback.PlayChange; SelectPrev; ChangeMusic; @@ -585,7 +585,7 @@ begin SDLK_R: begin - if (Length(Songs.Song) > 0) AND (Mode = 0) then begin + if (Songs.SongList.Count > 0) AND (Mode = 0) then begin if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category begin @@ -1819,7 +1819,7 @@ begin EqualizerTime := A; Data := AudioPlayback.GetFFTData; - B:=0; + B := 0; Pos := 0; Res := ceil(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band @@ -2121,7 +2121,7 @@ end; procedure TScreenSong.OpenEditor; begin - if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then + if (Songs.SongList.Count > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin AudioPlayback.Stop; AudioPlayback.PlayStart; diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index 7e5c7d91..f7257201 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -37,6 +37,7 @@ implementation uses UGraphic, UDataBase, USongs, + USong, ULanguage, UCommon, {$IFDEF win32} @@ -133,8 +134,8 @@ begin //Set Songs with Vid SongswithVid := 0; - For I := 0 to high(Songs.Song) do - if (Songs.Song[I].Video <> '') then + For I := 0 to Songs.SongList.Count -1 do + if (TSong(Songs.SongList[I]).Video <> '') then Inc(SongswithVid); end; @@ -233,7 +234,7 @@ begin %2:d Count of UnSung Songs %3:d Count of Songs with Video (A3) %4:s Name of the most popular Song} - A1 := Length(Songs.Song); + A1 := Songs.SongList.Count; A2 := Database.GetTotalEntrys(2); A3 := SongswithVid; diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas index bf19fed2..207f6ee6 100644 --- a/Game/Code/Screens/UScreenTop5.pas +++ b/Game/Code/Screens/UScreenTop5.pas @@ -92,29 +92,29 @@ var begin Fadeout := false; - //ReadScore(AktSong); + //ReadScore(CurrentSong); PMax := Ini.Players; if Ini.Players = 4 then Ini.Players := 5; for I := 0 to PMax do - DataBase.AddScore(AktSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalI)); + DataBase.AddScore(CurrentSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalI)); - DataBase.WriteScore(AktSong); - DataBase.ReadScore(AktSong); + DataBase.WriteScore(CurrentSong); + DataBase.ReadScore(CurrentSong); - Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; + Text[TextArtistTitle].Text := CurrentSong.Artist + ' - ' + CurrentSong.Title; - for I := 1 to Length(AktSong.Score[Ini.Difficulty]) do begin + for I := 1 to Length(CurrentSong.Score[Ini.Difficulty]) do begin Static[StaticNumber[I]].Visible := true; Text[TextNumber[I]].Visible := true; Text[TextName[I]].Visible := true; Text[TextScore[I]].Visible := true; - Text[TextName[I]].Text := AktSong.Score[Ini.Difficulty, I-1].Name; - Text[TextScore[I]].Text := IntToStr(AktSong.Score[Ini.Difficulty, I-1].Score); + Text[TextName[I]].Text := CurrentSong.Score[Ini.Difficulty, I-1].Name; + Text[TextScore[I]].Text := IntToStr(CurrentSong.Score[Ini.Difficulty, I-1].Score); end; - for I := Length(AktSong.Score[Ini.Difficulty])+1 to 5 do begin + for I := Length(CurrentSong.Score[Ini.Difficulty])+1 to 5 do begin Static[StaticNumber[I]].Visible := false; Text[TextNumber[I]].Visible := false; Text[TextName[I]].Visible := false; -- cgit v1.2.3 From f153a656e343f043673f97203ca680797196335e Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 14 Jan 2008 00:31:20 +0000 Subject: Bugfix: when entering the song-screen the preview on the first song was never played. Reason: Length of audio-file was checked _before_ it was opened. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@793 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 4b42288a..a54bda9f 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1519,19 +1519,20 @@ begin if Length(CatSongs.Song) > 0 then begin //Load Music only when Song Preview is activated - if ( Ini.PreviewVolume <> 0 ) AND - ( AudioPlayback.Length > 1 ) then + if ( Ini.PreviewVolume <> 0 ) then begin - AudioPlayback.SetLoop(false); - AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); - AudioPlayback.Position := AudioPlayback.Length / 4; - AudioPlayback.Play; - - //Set Preview Volume - AudioPlayback.SetMusicVolume (Ini.PreviewVolume * 10); - {//if Music Fade is activated, Set Volume to 0 % - if (Ini.PreviewFading <> 0) then - Music.SetMusicVolume(0);} + if(AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3)) then + begin + AudioPlayback.SetLoop(false); + AudioPlayback.Position := AudioPlayback.Length / 4; + AudioPlayback.Play; + + //Set Preview Volume + AudioPlayback.SetMusicVolume (Ini.PreviewVolume * 10); + {//if Music Fade is activated, Set Volume to 0 % + if (Ini.PreviewFading <> 0) then + Music.SetMusicVolume(0);} + end; end; SetScroll; -- cgit v1.2.3 From 1b458d8b1f4723ce82bb74f2157982980274e79c Mon Sep 17 00:00:00 2001 From: jaybinks Date: Mon, 14 Jan 2008 12:27:38 +0000 Subject: tidy up sing mode, to be an enum now. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@794 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenLevel.pas | 8 +++- Game/Code/Screens/UScreenOptionsRecord.pas | 2 +- Game/Code/Screens/UScreenPartyNewRound.pas | 12 +++++- Game/Code/Screens/UScreenPartyOptions.pas | 4 +- Game/Code/Screens/UScreenSing.pas | 5 ++- Game/Code/Screens/UScreenSong.pas | 60 ++++++++++++++++-------------- 6 files changed, 54 insertions(+), 37 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas index d4b528b5..e5deb6ba 100644 --- a/Game/Code/Screens/UScreenLevel.pas +++ b/Game/Code/Screens/UScreenLevel.pas @@ -18,7 +18,11 @@ type implementation -uses UGraphic, UMain, UIni, UTexture; +uses UGraphic, + UMain, + UIni, + USong, + UTexture; function TScreenLevel.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -44,7 +48,7 @@ begin Ini.SaveLevel; AudioPlayback.PlayStart; //Set Standard Mode - ScreenSong.Mode := 0; + ScreenSong.Mode := smNormal; FadeTo(@ScreenSong); end; diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index 42776717..65d016c7 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -124,7 +124,7 @@ begin Interaction := 0; writeln( 'AudioInput.CaptureStart') ; - PlayersPlay := 2; // TODO : This needs fixing + PlayersPlay := 2; // TODO : This needs fixing AudioInput.CaptureStart; end; diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 6f039080..2f07dcb0 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -76,7 +76,15 @@ type implementation -uses UGraphic, UMain, UIni, UTexture, UParty, UDLLManager, ULanguage, ULog; +uses UGraphic, + UMain, + UIni, + UTexture, + UParty, + UDLLManager, + ULanguage, + USong, + ULog; function TScreenPartyNewRound.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -103,7 +111,7 @@ begin if DLLMan.Selected.LoadSong then begin //Select PartyMode ScreenSong - ScreenSong.Mode := 1; + ScreenSong.Mode := smPartyMode; FadeTo(@ScreenSong); end else diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 46a075ce..c8cb2bb5 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -46,7 +46,7 @@ const implementation -uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UDLLManager, UPlaylist, USongs; +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, USong, UDLLManager, UPlaylist, USongs; function TScreenPartyOptions.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; var @@ -96,7 +96,7 @@ begin PartySession.Teams.Teaminfo[2].NumPlayers := NumPlayer3+1;} //Save Playlist - PlaylistMan.Mode := Playlist; + PlaylistMan.Mode := TSingMode( Playlist ); PlaylistMan.CurPlayList := High(Cardinal); //If Category Selected Search Category ID if Playlist = 1 then diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index adfc4d2c..5216477d 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -120,6 +120,7 @@ implementation uses UGraphic, UDraw, UMain, + USong, Classes, URecord, ULanguage, @@ -443,7 +444,7 @@ begin //Error Loading Song -> Go back to Song Screen and Show some Error Message FadeTo(@ScreenSong); //Select New Song in Party Mode - if ScreenSong.Mode = 1 then + if ScreenSong.Mode = smPartyMode then ScreenSong.SelectRandomSong; ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); Exit; @@ -452,7 +453,7 @@ begin //Error Loading Song -> Go back to Song Screen and Show some Error Message FadeTo(@ScreenSong); //Select New Song in Party Mode - if ScreenSong.Mode = 1 then + if ScreenSong.Mode = smPartyMode then ScreenSong.SelectRandomSong; ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); Exit; diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index a54bda9f..4773cdac 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -24,6 +24,7 @@ uses ULanguage, ULCD, ULight, + USong, UIni; type @@ -56,7 +57,8 @@ type EqualizerTime2: Byte; //Party Mod - Mode: Byte; //0 = Standard, 1= Go to PartyMode after Selection + Change to Random Song at Show + Mode: TSingMode; + //party Statics (Joker) StaticTeam1Joker1: Cardinal; StaticTeam1Joker2: Cardinal; @@ -252,7 +254,7 @@ begin + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); //Jump to Artist/Titel - if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then + if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = smNormal) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then begin Letter := UpCase(Chr(ScanCode)); I2 := Length(CatSongs.Song); @@ -312,7 +314,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - if (Mode = 0) then + if (Mode = smNormal) then begin //On Escape goto Cat-List Hack if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then @@ -375,7 +377,7 @@ begin end; end //When in party Mode then Ask before Close - else if (Mode = 1) then + else if (Mode = smPartyMode) then begin AudioPlayback.PlayBack; CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); @@ -410,8 +412,10 @@ begin //Play Music: ChangeMusic; - end else begin // clicked on song - if (Mode = 0) then //Normal Mode -> Start Song + end + else + begin // clicked on song + if (Mode = smNormal) then //Normal Mode -> Start Song begin //Do the Action that is specified in Ini case Ini.OnSongClick of @@ -425,7 +429,7 @@ begin end; end; end - else if (Mode = 1) then //PartyMode -> Show Menu + else if (Mode = smPartyMode) then //PartyMode -> Show Menu begin if (Ini.PartyPopup = 1) then ScreenSongMenu.MenuShow(SM_Party_Main) @@ -439,7 +443,7 @@ begin SDLK_M: //Show SongMenu begin if (Songs.SongList.Count > 0) then begin - if (Mode = 0) then begin + if (Mode = smNormal) then begin if not CatSongs.Song[Interaction].Main then begin // clicked on Song if CatSongs.CatNumShow = -3 then ScreenSongMenu.MenuShow(SM_Playlist) @@ -457,14 +461,14 @@ begin SDLK_P: //Show Playlist Menu begin - if (Songs.SongList.Count > 0) AND (Mode = 0) then begin + if (Songs.SongList.Count > 0) AND (Mode = smNormal) then begin ScreenSongMenu.MenuShow(SM_Playlist_Load); end; end; SDLK_J: //Show Jumpto Menu begin - if (Songs.SongList.Count > 0) AND (Mode = 0) then + if (Songs.SongList.Count > 0) AND (Mode = smNormal) then begin ScreenSongJumpto.Visible := True; end; @@ -472,7 +476,7 @@ begin SDLK_DOWN: begin - if (Mode = 0) then + if (Mode = smNormal) then begin //Only Change Cat when not in Playlist or Search Mode if (CatSongs.CatNumShow > -2) then @@ -512,7 +516,7 @@ begin end; SDLK_UP: begin - if (Mode = 0) then + if (Mode = smNormal) then begin //Only Change Cat when not in Playlist or Search Mode if (CatSongs.CatNumShow > -2) then @@ -553,7 +557,7 @@ begin SDLK_RIGHT: begin - if (Songs.SongList.Count > 0) AND (Mode = 0) then + if (Songs.SongList.Count > 0) AND (Mode = smNormal) then begin AudioPlayback.PlayChange; SelectNext; @@ -568,7 +572,7 @@ begin SDLK_LEFT: begin - if (Songs.SongList.Count > 0)AND (Mode = 0) then begin + if (Songs.SongList.Count > 0)AND (Mode = smNormal) then begin AudioPlayback.PlayChange; SelectPrev; ChangeMusic; @@ -585,7 +589,7 @@ begin SDLK_R: begin - if (Songs.SongList.Count > 0) AND (Mode = 0) then begin + if (Songs.SongList.Count > 0) AND (Mode = smNormal) then begin if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category begin @@ -661,7 +665,7 @@ begin SDLK_1: begin //Jocker // to-do : Party - {if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then + {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then begin //Joker spielen Dec(PartySession.Teams.Teaminfo[0].Joker); @@ -672,7 +676,7 @@ begin SDLK_2: begin //Jocker - {if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then + {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then begin //Joker spielen Dec(PartySession.Teams.Teaminfo[1].Joker); @@ -683,7 +687,7 @@ begin SDLK_3: begin //Jocker - {if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then + {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then begin //Joker spielen Dec(PartySession.Teams.Teaminfo[2].Joker); @@ -1540,7 +1544,7 @@ begin end; //Playlist Mode - if (Mode = 0) then + if (Mode = smNormal) then begin //If Playlist Shown -> Select Next automatically if (CatSongs.CatNumShow = -3) then @@ -1550,7 +1554,7 @@ begin end; end //Party Mode - else if (Mode = 1) then + else if (Mode = smPartyMode) then begin SelectRandomSong; @@ -1931,7 +1935,7 @@ var I, I2: Integer; begin Case PlaylistMan.Mode of - 0: //All Songs Just Select Random Song + smNormal: //All Songs Just Select Random Song begin //When Tabs are activated then use Tab Method if (Ini.Tabs_at_startup = 1) then @@ -1965,7 +1969,7 @@ begin else SkipTo(Random(CatSongs.VisibleSongs)); end; - 1: //One Category Select Category and Select Random Song + smPartyMode: //One Category Select Category and Select Random Song begin CatSongs.ShowCategoryList; CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); @@ -1976,7 +1980,7 @@ begin SkipTo(Random(CatSongs.VisibleSongs)); end; - 2: //Playlist: Select Playlist and Select Random Song + smPlaylistRandom: //Playlist: Select Playlist and Select Random Song begin PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); @@ -1995,7 +1999,7 @@ procedure TScreenSong.SetJoker; begin {//If Party Mode // to-do : Party - if Mode = 1 then //Show Joker that are available + if Mode = smPartyMode then //Show Joker that are available begin if (PartySession.Teams.NumTeams >= 1) then begin @@ -2076,7 +2080,7 @@ var Visible: Boolean; begin //Set Visibility of Party Statics and Text - Visible := (Mode = 1); + Visible := (Mode = smPartyMode); For I := 0 to high(StaticParty) do Static[StaticParty[I]].Visible := Visible; @@ -2101,7 +2105,7 @@ begin CatSongs.Selected := Interaction; AudioPlayback.Stop; //Party Mode - if (Mode = 1) then + if (Mode = smPartyMode) then begin FadeTo(@ScreenSingModi); end @@ -2122,7 +2126,7 @@ end; procedure TScreenSong.OpenEditor; begin - if (Songs.SongList.Count > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then + if (Songs.SongList.Count > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = smNormal) then begin AudioPlayback.Stop; AudioPlayback.PlayStart; @@ -2135,7 +2139,7 @@ end; //Team No of Team (0-5) procedure TScreenSong.DoJoker (Team: Byte); begin - {if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then + {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then begin //Joker spielen Dec(PartySession.Teams.Teaminfo[Team].Joker); -- cgit v1.2.3 From dee94f5dae9e6b5ae6c7b54a12a567745abc8dc3 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 20:36:19 +0000 Subject: General: - cleanup and adaption of SingDrawOscilloscope Portaudio/SDL audio output: - stuttering in portaudio output has been fixed (SDL_MixBuffers cannot be used without initializing the SDL audio stuff first, so it is not usable with portaudio. Now SDL is used for audio-output instead of portaudio (although the file-name is UAudioPlayback_Portaudio.pas at the moment). - cleaner file closing - volume adjustment UMusic: - cleanup of the audio-interfaces - introduced TNoteType = (ntFreestyle, ntNormal, ntGolden) - some bug-fixes - introduced TSoundLibrary. This is library for all in-game sounds used by USDX. Instead of calling AudioPlayer.PlaySwoosh you should call AudioPlayer.PlaySound(SoundLib.Swoosh) now. You might call SoundLib.Swoosh.Play too, but this is not recommended at the moment because SoundLib.Swoosh could be nil if the file was not found. The SoundLibrary approach is much cleaner than the previous one. The AudioPlayer does not have to specify a Play... and Stop... method for every available sound anymore. In addition it is not an AudioPlayers responsibility to init the in-game sounds. URecord: - polish to english translation of some variables - CaptureSoundLeft/Right is CaptureChannel[0/1] now - TSoundCardInput -> TAudioInputDeviceSource - TGenericSoundCard.Input -> TGenericSoundCard.Source - autocorrelation algorithm more readable now - Clean-up of the audio-input interface - moved cloned code of the input-classes to one base class (TAudioInputBase) - Cleaner finalization - Start-/StopCapture will not crash anymore in the recording-options menu - Fixed several bugs in the autocorrelation stuff (e.g. wrong usage of $10000) - SzczytJest (now ToneValid) was not used correctly. ToneValid is set to true if a valid tone was found (= the sound was louder than the threshold -> no background noise). If i remember correctly the sound was accepted although the tone was invalid. So the old data was used although noone was singing. This resulted in some sort of ghost-singer effect. UIni: - moved TIni.Card to TScreenOptionsRecord.Card because it is not stored in the ini-file and will not be in the future. - TIni.CardList ist now TIni.InputDeviceConfig. The name cardlist was misleading because it just specifies input- but no output-devices. In addition a soundcard can have multiple input-devices (at least in linux). - bugfix on InputDeviceConfig (formerly CardList) usage. USDX expected that the indices of the corresponding elements in TIni.InputDeviceConfig[] and TAudioInputProcessor.Device[] were the same. This is wrong. If device 2 was defined at first place in the ini and device 1 at the second, the indices of the two arrays didn't match (they were swapped) erroneously. To fix this and to support the item listed below the index to TIni.InputDeviceConfig[] is now stored in TAudioInputDevice.CfgIndex. NOTE: InputDeviceConfig[] contains configurations of non-available (unplugged) devices. Iterate over TAudioInputProcessor.Device[] for available devices. - configurations of external devices that are not plugged in will not be deleted anymore. - multiple definitions of one device in the ini-file will not crash USDX anymore - CardList[I].ChannelL/R now are InputDeviceConfig[I].ChannelToPlayerMap[0/1]. I think the new name is more intuitive because it maps a channel to a player number. Now the both vars are joint to one array. Now it is possible to use loops to process them and we might support more than two input channels on one device in the future (if such devices exist) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@827 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 2804 +++++++++++++------------- Game/Code/Screens/UScreenEdit.pas | 6 +- Game/Code/Screens/UScreenEditConvert.pas | 4 +- Game/Code/Screens/UScreenEditSub.pas | 2 +- Game/Code/Screens/UScreenLevel.pas | 4 +- Game/Code/Screens/UScreenMain.pas | 18 +- Game/Code/Screens/UScreenName.pas | 4 +- Game/Code/Screens/UScreenOpen.pas | 6 +- Game/Code/Screens/UScreenOptions.pas | 18 +- Game/Code/Screens/UScreenOptionsAdvanced.pas | 8 +- Game/Code/Screens/UScreenOptionsGame.pas | 8 +- Game/Code/Screens/UScreenOptionsGraphics.pas | 8 +- Game/Code/Screens/UScreenOptionsLyrics.pas | 8 +- Game/Code/Screens/UScreenOptionsRecord.pas | 444 ++-- Game/Code/Screens/UScreenOptionsSound.pas | 8 +- Game/Code/Screens/UScreenOptionsThemes.pas | 8 +- Game/Code/Screens/UScreenPartyNewRound.pas | 4 +- Game/Code/Screens/UScreenPartyOptions.pas | 8 +- Game/Code/Screens/UScreenPartyPlayer.pas | 2 +- Game/Code/Screens/UScreenPartyScore.pas | 4 +- Game/Code/Screens/UScreenPartyWin.pas | 4 +- Game/Code/Screens/UScreenSing.pas | 2 +- Game/Code/Screens/UScreenSingModi.pas | 38 +- Game/Code/Screens/UScreenSong.pas | 52 +- Game/Code/Screens/UScreenSongJumpto.pas | 2 +- Game/Code/Screens/UScreenSongMenu.pas | 2 +- Game/Code/Screens/UScreenStatDetail.pas | 4 +- Game/Code/Screens/UScreenStatMain.pas | 6 +- 28 files changed, 1768 insertions(+), 1718 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index d5c9bebc..925d62cc 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -1,1402 +1,1402 @@ -unit UScreenCredits; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - - -uses - UMenu, - SDL, - SDL_Image, - UDisplay, - UTexture, - OpenGL12, - UMusic, - UFiles, - SysUtils, - UThemes, - ULCD, - ULight, - UGraphicClasses; - -type - TCreditsStages=(InitialDelay,Intro,MainPart,Outro); - - TScreenCredits = class(TMenu) - public - - Credits_X: Real; - Credits_Time: Cardinal; - Credits_Alpha: Cardinal; - CTime: Cardinal; - CTime_hold: Cardinal; - ESC_Alpha: Integer; - - credits_entry_tex: TTexture; - credits_entry_dx_tex: TTexture; - credits_bg_tex: TTexture; - credits_bg_ovl: TTexture; -// credits_bg_logo: TTexture; - credits_bg_scrollbox_left: TTexture; - credits_blindguard: TTexture; - credits_blindy: TTexture; - credits_canni: TTexture; - credits_commandio: TTexture; - credits_lazyjoker: TTexture; - credits_mog: TTexture; - credits_mota: TTexture; - credits_skillmaster: TTexture; - credits_whiteshark: TTexture; - intro_layer01: TTexture; - intro_layer02: TTexture; - intro_layer03: TTexture; - intro_layer04: TTexture; - intro_layer05: TTexture; - intro_layer06: TTexture; - intro_layer07: TTexture; - intro_layer08: TTexture; - intro_layer09: TTexture; - outro_bg: TTexture; - outro_esc: TTexture; - outro_exd: TTexture; - - deluxe_slidein: cardinal; - - CurrentScrollText: String; - NextScrollUpdate: Real; - EndofLastScrollingPart: Cardinal; - CurrentScrollStart, CurrentScrollEnd: Integer; - - CRDTS_Stage: TCreditsStages; - - myTex: glUint; - mysdlimage,myconvertedsdlimage: PSDL_Surface; - - Fadeout: boolean; - constructor Create; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure onShow; override; - procedure onHide; override; - procedure DrawCredits; - procedure Draw_FunkyText; - end; - -const - Funky_Text: AnsiString = - 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+ - 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+ - 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+ - 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..'; - - - Timings: array[0..21] of Cardinal=( - 20, // 0 Delay vor Start - - 149, // 1 Ende erster Intro Zoom - 155, // 2 Start 2. Action im Intro - 170, // 3 Ende Separation im Intro - 271, // 4 Anfang Zoomout im Intro - 0, // 5 unused - 261, // 6 Start fade-to-white im Intro - - 271, // 7 Start Main Part - 280, // 8 Start On-Beat-Sternchen Main Part - - 396, // 9 Start BlindGuard - 666, // 10 Start blindy - 936, // 11 Start Canni - 1206, // 12 Start Commandio - 1476, // 13 Start LazyJoker - 1746, // 14 Start Mog - 2016, // 15 Start Mota - 2286, // 16 Start SkillMaster - 2556, // 17 Start WhiteShark - 2826, // 18 Ende Whiteshark - 3096, // 19 Start FadeOut Mainscreen - 3366, // 20 Ende Credits Tune - 60); // 21 start flare im intro - - - sdl32bpprgba: TSDL_Pixelformat=(palette: nil; - BitsPerPixel: 32; - BytesPerPixel: 4; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 24; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $ff000000; - colorkey: 0; - alpha: 255 ); - - -implementation - -uses {$IFDEF win32} - windows, - {$ELSE} - lclintf, - {$ENDIF} - ULog, - UGraphic, - UMain, - UIni, - USongs, - Textgl, - ULanguage, - UCommon, - Math, - dialogs; - - -function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -begin - Result := true; - If (PressedDown) Then - begin // Key Down - case PressedKey of - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - FadeTo(@ScreenMain); - AudioPlayback.PlayBack; - end; -{ SDLK_SPACE: - begin - setlength(CTime_hold,length(CTime_hold)+1); - CTime_hold[high(CTime_hold)]:=CTime; - end; -} - end;//esac - end; //fi -end; - -constructor TScreenCredits.Create; -begin - inherited Create; - - credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0); - credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0); - - credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', 'PNG', 'Font Black', 0); - credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0); - credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0); - credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', 'PNG', 'Font Black', 0); - credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', 'PNG', 'Font Black', 0); - credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', 'Font Black', 0); - credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', 'PNG', 'Font Black', 0); - credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', 'PNG', 'Font Black', 0); - credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', 'PNG', 'Font Black', 0); - - intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', 'PNG', 'Transparent', 0); - intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', 'PNG', 'Transparent', 0); - intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', 'PNG', 'Transparent', 0); - intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', 'PNG', 'Transparent', 0); - intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', 'PNG', 'Transparent', 0); - intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', 'PNG', 'Transparent', 0); - intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', 'PNG', 'Transparent', 0); - intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', 'PNG', 'Transparent', 0); - intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', 'PNG', 'Transparent', 0); - - outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0); - outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0); - outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Transparent', 0); - - CRDTS_Stage:=InitialDelay; -end; - -function TScreenCredits.Draw: boolean; -begin - DrawCredits; - Draw:=true; -end; - -function pixfmt_eq(fmt1,fmt2: TSDL_Pixelformat): boolean; -begin - if (fmt1.BitsPerPixel = fmt2.BitsPerPixel) and - (fmt1.BytesPerPixel = fmt2.BytesPerPixel) and - (fmt1.Rloss = fmt2.Rloss) and - (fmt1.Gloss = fmt2.Gloss) and - (fmt1.Bloss = fmt2.Bloss) and - (fmt1.Rmask = fmt2.Rmask) and - (fmt1.Gmask = fmt2.Gmask) and - (fmt1.Bmask = fmt2.Bmask) and - (fmt1.Rshift = fmt2.Rshift) and - (fmt1.Gshift = fmt2.Gshift) and - (fmt1.Bshift = fmt2.Bshift) - then - pixfmt_eq:=True - else - pixfmt_eq:=False; -end; - -function inttohexstr(i: cardinal):pchar; -var helper, i2, c:cardinal; - tmpstr: string; -begin - helper:=0; - i2:=i; - tmpstr:=''; - for c:=1 to 8 do - begin - helper:=(helper shl 4) or (i2 and $f); - i2:=i2 shr 4; - end; - for c:=1 to 8 do - begin - i2:=helper and $f; - helper := helper shr 4; - case i2 of - 0: tmpstr:=tmpstr+'0'; - 1: tmpstr:=tmpstr+'1'; - 2: tmpstr:=tmpstr+'2'; - 3: tmpstr:=tmpstr+'3'; - 4: tmpstr:=tmpstr+'4'; - 5: tmpstr:=tmpstr+'5'; - 6: tmpstr:=tmpstr+'6'; - 7: tmpstr:=tmpstr+'7'; - 8: tmpstr:=tmpstr+'8'; - 9: tmpstr:=tmpstr+'9'; - 10: tmpstr:=tmpstr+'a'; - 11: tmpstr:=tmpstr+'b'; - 12: tmpstr:=tmpstr+'c'; - 13: tmpstr:=tmpstr+'d'; - 14: tmpstr:=tmpstr+'e'; - 15: tmpstr:=tmpstr+'f'; - end; - end; - inttohexstr:=pchar(tmpstr); -end; - -procedure TScreenCredits.onShow; -begin - CRDTS_Stage:=InitialDelay; - Credits_X := 580; - deluxe_slidein := 0; - Credits_Alpha := 0; - //Music.SetLoop(true); Loop looped ned, so ne scheisse - AudioPlayback.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! -// Music.Play; - CTime:=0; -// setlength(CTime_hold,0); - - mysdlimage:=IMG_Load('test.png'); - if assigned(mysdlimage) then - begin - {$IFNDEF FPC} - showmessage('opened image via SDL_Image'+#13#10+ - 'Width: '+inttostr(mysdlimage^.w)+#13#10+ - 'Height: '+inttostr(mysdlimage^.h)+#13#10+ - 'BitsPP: '+inttostr(mysdlimage^.format.BitsPerPixel)+#13#10+ - 'BytesPP: '+inttostr(mysdlimage^.format.BytesPerPixel)+#13#10+ - 'Rloss: '+inttostr(mysdlimage^.format.Rloss)+#13#10+ - 'Gloss: '+inttostr(mysdlimage^.format.Gloss)+#13#10+ - 'Bloss: '+inttostr(mysdlimage^.format.Bloss)+#13#10+ - 'Aloss: '+inttostr(mysdlimage^.format.Aloss)+#13#10+ - 'Rshift: '+inttostr(mysdlimage^.format.Rshift)+#13#10+ - 'Gshift: '+inttostr(mysdlimage^.format.Gshift)+#13#10+ - 'Bshift: '+inttostr(mysdlimage^.format.Bshift)+#13#10+ - 'Ashift: '+inttostr(mysdlimage^.format.Ashift)+#13#10+ - 'Rmask: '+inttohexstr(mysdlimage^.format.Rmask)+#13#10+ - 'Gmask: '+inttohexstr(mysdlimage^.format.Gmask)+#13#10+ - 'Bmask: '+inttohexstr(mysdlimage^.format.Bmask)+#13#10+ - 'Amask: '+inttohexstr(mysdlimage^.format.Amask)+#13#10+ - 'ColKey: '+inttostr(mysdlimage^.format.Colorkey)+#13#10+ - 'Alpha: '+inttostr(mysdlimage^.format.Alpha)); - - if pixfmt_eq(mysdlimage^.format^,sdl32bpprgba) then - showmessage('equal pixelformats') - else - showmessage('different pixelformats'); - {$ENDIF} - - myconvertedsdlimage:=SDL_ConvertSurface(mysdlimage,@sdl32bpprgba,SDL_SWSURFACE); - glGenTextures(1,@myTex); - glBindTexture(GL_TEXTURE_2D, myTex); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - glTexImage2D( GL_TEXTURE_2D, 0, 4, myconvertedsdlimage^.w, myconvertedsdlimage^.h, 0, - GL_RGBA, GL_UNSIGNED_BYTE, myconvertedsdlimage^.pixels ); - SDL_FreeSurface(mysdlimage); - SDL_FreeSurface(myconvertedsdlimage); - end - else - {$IFDEF FPC} - writeln( 'could not open file - test.png'); - {$ELSE} - showmessage('could not open file - test.png'); - {$ENDIF} - -end; - -procedure TScreenCredits.onHide; -begin - AudioPlayback.Stop; -end; - -Procedure TScreenCredits.Draw_FunkyText; -var - S: Integer; - X,Y,A: Real; - visibleText: PChar; -begin - SetFontSize(10); - //Init ScrollingText - if (CTime = Timings[7]) then - begin - //Set Position of Text - Credits_X := 600; - CurrentScrollStart:=1; - CurrentScrollEnd:=1; - end; - - if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then - begin - X:=0; - visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); - for S := 0 to length(visibleText)-1 do begin - Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); - SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); - A:=0; - if (Credits_X+X < 15) then A:=0; - if (Credits_X+X >=15) then A:=Credits_X+X-15; - if Credits_X+X > 32 then A:=17; - glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17); - glPrintLetter(visibleText[S]); - X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; - end; - if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin - Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; - inc(CurrentScrollStart); - end; - visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); - if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin - inc(CurrentScrollEnd); - end; - end; -{ // timing hack - X:=5; - SetFontStyle (2); - SetFontItalic(False); - SetFontSize(9); - glColor4f(1, 1, 1, 1); - for S:=0 to high(CTime_hold) do begin - visibleText:=pchar(inttostr(CTime_hold[S])); - SetFontPos (500, X); - glPrint (Addr(visibleText[0])); - X:=X+20; - end;} -end; - -procedure Start3D; -begin - glMatrixMode(GL_PROJECTION); - glPushMatrix; - glLoadIdentity; - glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity; -end; -procedure End3D; -begin - glMatrixMode(GL_PROJECTION); - glPopMatrix; - glMatrixMode(GL_MODELVIEW); -end; - -procedure TScreenCredits.DrawCredits; -var - T,I: Cardinal; - X: Real; - Ver: PChar; - RuntimeStr: AnsiString; - Data: TFFTData; - j,k,l:cardinal; - f,g,h: Real; - STime:cardinal; - Delay:cardinal; - - myPixel: longword; - myColor: Cardinal; - myScale: Real; - myAngle: Real; - - -const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24), - (154,31),(156,58),(168,32),(203,36), - (258,34),(251,50),(274,93),(294,84), - (232,54),(278,62),(319,34),(336,92), - (347,23),(374,32),(377,58),(361,83), - (385,91),(405,91),(429,35),(423,51), - (450,32),(485,34),(444,91),(486,93)); - -begin - //dis does teh muiwk y0r - Data := AudioPlayback.GetFFTData; - - Log.LogStatus('',' JB-1'); - - T := GetTickCount div 33; - if T <> Credits_Time then - begin - Credits_Time := T; - inc(CTime); - inc(CTime_hold); - Credits_X := Credits_X-2; - - Log.LogStatus('',' JB-2'); - if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then - begin -// CTime:=Timings[20]; -// CRDTS_Stage:=Outro; - - CRDTS_Stage:=Intro; - CTime:=0; - AudioPlayback.Play; - - end; - if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then - begin - CRDTS_Stage:=MainPart; - end; - if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then - begin - CRDTS_Stage:=Outro; - end; - end; - - Log.LogStatus('',' JB-3'); - - //draw background - if CRDTS_Stage=InitialDelay then - begin - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - end - else - if CRDTS_Stage=Intro then - begin - Start3D; - glPushMatrix; - - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - if CTime < Timings[1] then begin - myScale:= 0.5+0.5*(Timings[1]-CTime)/(Timings[1]); // slowly move layers together - myAngle:=cos((CTime)*pi/((Timings[1])*2)); // and make logo face towards camera - end else begin // this is the part when the logo stands still - myScale:=0.5; - myAngle:=0; - end; - if CTime > Timings[2] then begin - myScale:= 0.5+0.5*(CTime-Timings[2])/(Timings[3]-Timings[2]); // get some space between layers - myAngle:=0; - end; -// if CTime > Timings[3] then myScale:=1; // keep the space between layers - glTranslatef(0,0,-5+0.5*myScale); - if CTime > Timings[3] then myScale:=1; // keep the space between layers - if CTime > Timings[3] then begin // make logo rotate left and grow -// myScale:=(CTime-Timings[4])/(Timings[7]-Timings[4]); - glRotatef(20*sqr(CTime-Timings[3])/sqr((Timings[7]-Timings[3])/2),0,0,1); - glScalef(1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1); - end; - if CTime < Timings[2] then - glRotatef(30*myAngle,0.5*myScale+myScale,1+myScale,0); -// glScalef(0.5,0.5,0.5); - glScalef(4/3,-1,1); - glColor4f(1, 1, 1, 1); - - glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.4 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.4 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.4 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.4 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.3 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.3 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.3 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.3 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.2 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.2 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.2 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.2 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, -0.1 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, -0.1 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, -0.1 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, -0.1 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.1 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.1 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.1 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.1 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.2 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.2 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.2 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.2 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.3 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.3 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.3 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.3 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex3f(-1, -1, 0.22 * myScale); - glTexCoord2f(0,1);glVertex3f(-1, 1, 0.22 * myScale); - glTexCoord2f(1,1); glVertex3f(1, 1, 0.22 * myScale); - glTexCoord2f(1,0);glVertex3f(1, -1, 0.22 * myScale); - glEnd; - gldisable(gl_texture_2d); - glDisable(GL_BLEND); - - glPopMatrix; - End3D; - - // do some sparkling effects - if (CTime < Timings[1]) and (CTime > Timings[21]) then - begin - for k:=1 to 3 do begin - l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5); - j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301); - GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0); - end; - end; - - // fade to white at end - if Ctime > Timings[6] then - begin - glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6])); - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glVertex2f(0,0); - glVertex2f(0,600); - glVertex2f(800,600); - glVertex2f(800,0); - glEnd; - glDisable(GL_BLEND); - end; - - end; - if (CRDTS_Stage=MainPart) then - // main credits screen background, scroller, logo and girl - begin - - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,600/1024);glVertex2f(0, 600); - glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); - glTexCoord2f(800/1024,0);glVertex2f(800, 0); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - // draw scroller - Draw_FunkyText; - -//######################################################################### -// draw credits names - - -Log.LogStatus('',' JB-4'); - -// BlindGuard (von links oben reindrehen, nach rechts unten rausdrehen) - STime:=Timings[9]-10; - Delay:=Timings[10]-Timings[9]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - - try - for j:=0 to 40 do - begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then - begin - if Data[j] >= Data[k] then - k:=j; - end; - end; - except - end; - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(0,329,0); - if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end; - gltranslatef(223,0,0); - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - gltranslatef(223,0,0); - glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1); - gltranslatef(-223,0,0); - end; - glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Blindy (zoom von 0 auf volle grösse und drehung, zoom auf doppelte grösse und nach rechts oben schieben) - STime:=Timings[10]-10; - Delay:=Timings[11]-Timings[10]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - - try - for j:=0 to 40 do - begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then - begin - if Data[j] >= Data[k] then - k:=j; - end; - end; - except - end; - - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+20) and (CTime<=STime+22) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+20 then begin - j:=CTime-Stime; - glscalef(j*j/400,j*j/400,j*j/400); - glrotatef(j*18.0,0,0,1); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - f:=j*10.0; - gltranslatef(f*3,-f,0); - glscalef(1+j/10,1+j/10,1+j/10); - glrotatef(j*9.0,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Canni (von links reinschieben, nach rechts oben rausschieben) - STime:=Timings[11]-10; - Delay:=Timings[12]-Timings[11]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - - try - for j:=0 to 40 do - begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then - begin - if Data[j] >= Data[k] then - k:=j; - end; - end; - except - end; - - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - gltranslatef(((CTime-STime)*21.0)-210,0,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=(CTime-(STime+Delay-10))*21; - gltranslatef(j,-j/2,0); - end; - glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Commandio (von unten reinklappen, nach rechts oben rausklappen) - STime:=Timings[12]-10; - Delay:=Timings[13]-Timings[12]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - - try - for j:=0 to 40 do - begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then - begin - if Data[j] >= Data[k] then - k:=j; - end; - end; - except - end; - - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=258.0-25.8*(CTime-STime) - else - f:=0; - g:=0; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end; - glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163+g-f*1.5, -129+f*1.5-g/2); - glTexCoord2f(0,1);glVertex2f(-163+g*1.5, 129-(g*1.5*258/326)); - glTexCoord2f(1,1); glVertex2f(163+g, 129+g/4); - glTexCoord2f(1,0);glVertex2f(163+f*1.5+g/4, -129+f*1.5-g/4); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing) - STime:=Timings[13]-35; - Delay:=Timings[14]-Timings[13]+5; - if CTime > STime then - begin - k:=0; - - try - for j:=0 to 40 do - begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then - begin - if Data[j] >= Data[k] then - k:=j; - end; - end; - except - end; - - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20; - ESC_Alpha:=10; - f:=CTime-STime; - if CTime <=STime+40 then j:=CTime-STime else j:=40; - if (CTime >=STime+Delay-40) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j*j/1600); - - glPushMatrix; - gltranslatef(180+(f-70),329,0); - glBindTexture(GL_TEXTURE_2D, credits_lazyjoker.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Mog (von links reinklappen, nach rechts unten rausklappen) - STime:=Timings[14]-10; - Delay:=Timings[15]-Timings[14]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - - - try - for j:=0 to 40 do - begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then - begin - if Data[j] >= Data[k] then - k:=j; - end; - end; - except - end; - - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=326.0-32.6*(CTime-STime) - else - f:=0; - - g:=0; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end; - glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163+g*1.5, -129+g*1.5); - glTexCoord2f(0,1);glVertex2f(-163+g*1.2, 129+g); - glTexCoord2f(1,1); glVertex2f(163-f+g/2, 129+f*1.5+g/4); - glTexCoord2f(1,0);glVertex2f(163-f+g*1.5, -129-f*1.5); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Mota (von rechts oben reindrehen, nach links unten rausschieben und verkleinern und dabei drehen) - STime:=Timings[15]-10; - Delay:=Timings[16]-Timings[15]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - - try - for j:=0 to 40 do - begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then - begin - if Data[j] >= Data[k] then - k:=j; - end; - end; - except - end; - - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - gltranslatef(223,0,0); - glrotatef((10-(CTime-STime))*9,0,0,1); - gltranslatef(-223,0,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - f:=j*10.0; - gltranslatef(-f*2,-f,0); - glscalef(1-j/10,1-j/10,1-j/10); - glrotatef(-j*9.0,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// Skillmaster (von rechts unten reinschieben, nach rechts oben rausdrehen) - STime:=Timings[16]-10; - Delay:=Timings[17]-Timings[16]+5; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - - try - for j:=0 to 40 do - begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then - begin - if Data[j] >= Data[k] then - k:=j; - end; - end; - except - end; - - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then begin - j:=STime+10-CTime; - f:=j*10.0; - gltranslatef(+f*2,+f/2,0); - end; - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - gltranslatef(0,-223,0); - glrotatef(integer(j)*-9,0,0,1); - gltranslatef(0,223,0); - glrotatef(j*9,0,0,1); - end; - glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163, -129); - glTexCoord2f(0,1);glVertex2f(-163, 129); - glTexCoord2f(1,1); glVertex2f(163, 129); - glTexCoord2f(1,0);glVertex2f(163, -129); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - -// WhiteShark (von links unten reinklappen, nach rechts oben rausklappen) - STime:=Timings[17]-10; - Delay:=Timings[18]-Timings[17]; - if CTime > STime then - begin - k:=0; - ESC_Alpha:=20; - - try - for j:=0 to 40 do - begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then - begin - if Data[j] >= Data[k] then - k:=j; - end; - end; - except - end; - - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); - - if (CTime >= STime+10) and (CTime<=STime+12) then begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; - - glPushMatrix; - gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=326.0-32.6*(CTime-STime) - else - f:=0; - - if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; - end else - g:=0; - glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2); - glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4); - glTexCoord2f(1,1); glVertex2f(163-f*1.2+g/4, 129+f/2-g/4); - glTexCoord2f(1,0);glVertex2f(163-f*1.5+g/4, -129+f*1.5+g/4); - glEnd; - gldisable(gl_texture_2d); - gldisable(GL_BLEND); - glPopMatrix; - end; - - - Log.LogStatus('',' JB-103'); - -// #################################################################### -// do some twinkle stuff (kinda on beat) - if (CTime > Timings[8] ) and - (CTime < Timings[19] ) then - begin - k := 0; - - try - for j:=0 to 40 do - begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then - begin - if Data[j] >= Data[k] then - k:=j; - end; - end; - except - end; - - if Data[k]>0.2 then - begin - l := RandomRange(6,16); - j := RandomRange(0,27); - - GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); - end; - end; - -//################################################# -// draw the rest of the main screen (girl and logo - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(800-393, 0); - glTexCoord2f(0,600/1024);glVertex2f(800-393, 600); - glTexCoord2f(393/512,600/1024); glVertex2f(800, 600); - glTexCoord2f(393/512,0);glVertex2f(800, 0); - glEnd; -{ glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,112/128);glVertex2f(0, 112); - glTexCoord2f(497/512,112/128); glVertex2f(497, 112); - glTexCoord2f(497/512,0);glVertex2f(497, 0); - glEnd; -} - gldisable(gl_texture_2d); - glDisable(GL_BLEND); - - // fade out at end of main part - if Ctime > Timings[19] then - begin - glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19])); - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glVertex2f(0,0); - glVertex2f(0,600); - glVertex2f(800,600); - glVertex2f(800,0); - glEnd; - glDisable(GL_BLEND); - end; - end - else - if (CRDTS_Stage=Outro) then - begin - if CTime=Timings[20] then begin - CTime_hold:=0; - AudioPlayback.Stop; - AudioPlayback.Open(soundpath + 'credits-outro-tune.mp3'); - AudioPlayback.Play; - AudioPlayback.SetVolume(20); - AudioPlayback.SetLoop(True); - end; - if CTime_hold > 231 then begin - AudioPlayback.Play; - Ctime_hold:=0; - end; - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - - // do something useful - // outro background - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,600/1024);glVertex2f(0, 600); - glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); - glTexCoord2f(800/1024,0);glVertex2f(800, 0); - glEnd; - - //outro overlays - glColor4f(1, 1, 1, (1+sin(CTime/15))/3+1/3); - glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(0, 0); - glTexCoord2f(0,223/256);glVertex2f(0, 223); - glTexCoord2f(487/512,223/256); glVertex2f(487, 223); - glTexCoord2f(487/512,0);glVertex2f(487, 0); - glEnd; - - ESC_Alpha:=20; - if (RandomRange(0,20) > 18) and (ESC_Alpha=20) then - ESC_Alpha:=0 - else inc(ESC_Alpha); - if ESC_Alpha > 20 then ESC_Alpha:=20; - glColor4f(1, 1, 1, ESC_Alpha/20); - glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(800-310, 600-247); - glTexCoord2f(0,247/256);glVertex2f(800-310, 600); - glTexCoord2f(310/512,247/256); glVertex2f(800, 600); - glTexCoord2f(310/512,0);glVertex2f(800, 600-247); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - // outro scrollers? - // ... - end; - -{ // draw credits runtime counter - SetFontStyle (2); - SetFontItalic(False); - SetFontSize(9); - SetFontPos (5, 5); - glColor4f(1, 1, 1, 1); -// RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10); - RuntimeStr:='CTime: '+inttostr(CTime); - glPrint (Addr(RuntimeStr[1])); -} - - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, myTex); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(100, 100); - glTexCoord2f(0,1);glVertex2f(100, 200); - glTexCoord2f(1,1); glVertex2f(200, 200); - glTexCoord2f(1,0);glVertex2f(200, 100); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - - // make the stars shine - GoldenRec.Draw; -end; - -end. +unit UScreenCredits; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +uses + UMenu, + SDL, + SDL_Image, + UDisplay, + UTexture, + OpenGL12, + UMusic, + UFiles, + SysUtils, + UThemes, + ULCD, + ULight, + UGraphicClasses; + +type + TCreditsStages=(InitialDelay,Intro,MainPart,Outro); + + TScreenCredits = class(TMenu) + public + + Credits_X: Real; + Credits_Time: Cardinal; + Credits_Alpha: Cardinal; + CTime: Cardinal; + CTime_hold: Cardinal; + ESC_Alpha: Integer; + + credits_entry_tex: TTexture; + credits_entry_dx_tex: TTexture; + credits_bg_tex: TTexture; + credits_bg_ovl: TTexture; +// credits_bg_logo: TTexture; + credits_bg_scrollbox_left: TTexture; + credits_blindguard: TTexture; + credits_blindy: TTexture; + credits_canni: TTexture; + credits_commandio: TTexture; + credits_lazyjoker: TTexture; + credits_mog: TTexture; + credits_mota: TTexture; + credits_skillmaster: TTexture; + credits_whiteshark: TTexture; + intro_layer01: TTexture; + intro_layer02: TTexture; + intro_layer03: TTexture; + intro_layer04: TTexture; + intro_layer05: TTexture; + intro_layer06: TTexture; + intro_layer07: TTexture; + intro_layer08: TTexture; + intro_layer09: TTexture; + outro_bg: TTexture; + outro_esc: TTexture; + outro_exd: TTexture; + + deluxe_slidein: cardinal; + + CurrentScrollText: String; + NextScrollUpdate: Real; + EndofLastScrollingPart: Cardinal; + CurrentScrollStart, CurrentScrollEnd: Integer; + + CRDTS_Stage: TCreditsStages; + + myTex: glUint; + mysdlimage,myconvertedsdlimage: PSDL_Surface; + + Fadeout: boolean; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure DrawCredits; + procedure Draw_FunkyText; + end; + +const + Funky_Text: AnsiString = + 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+ + 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+ + 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+ + 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..'; + + + Timings: array[0..21] of Cardinal=( + 20, // 0 Delay vor Start + + 149, // 1 Ende erster Intro Zoom + 155, // 2 Start 2. Action im Intro + 170, // 3 Ende Separation im Intro + 271, // 4 Anfang Zoomout im Intro + 0, // 5 unused + 261, // 6 Start fade-to-white im Intro + + 271, // 7 Start Main Part + 280, // 8 Start On-Beat-Sternchen Main Part + + 396, // 9 Start BlindGuard + 666, // 10 Start blindy + 936, // 11 Start Canni + 1206, // 12 Start Commandio + 1476, // 13 Start LazyJoker + 1746, // 14 Start Mog + 2016, // 15 Start Mota + 2286, // 16 Start SkillMaster + 2556, // 17 Start WhiteShark + 2826, // 18 Ende Whiteshark + 3096, // 19 Start FadeOut Mainscreen + 3366, // 20 Ende Credits Tune + 60); // 21 start flare im intro + + + sdl32bpprgba: TSDL_Pixelformat=(palette: nil; + BitsPerPixel: 32; + BytesPerPixel: 4; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 24; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $ff000000; + colorkey: 0; + alpha: 255 ); + + +implementation + +uses {$IFDEF win32} + windows, + {$ELSE} + lclintf, + {$ENDIF} + ULog, + UGraphic, + UMain, + UIni, + USongs, + Textgl, + ULanguage, + UCommon, + Math, + dialogs; + + +function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + FadeTo(@ScreenMain); + AudioPlayback.PlaySound(SoundLib.Back); + end; +{ SDLK_SPACE: + begin + setlength(CTime_hold,length(CTime_hold)+1); + CTime_hold[high(CTime_hold)]:=CTime; + end; +} + end;//esac + end; //fi +end; + +constructor TScreenCredits.Create; +begin + inherited Create; + + credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0); + credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0); + + credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', 'PNG', 'Font Black', 0); + credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0); + credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0); + credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', 'PNG', 'Font Black', 0); + credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', 'PNG', 'Font Black', 0); + credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', 'Font Black', 0); + credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', 'PNG', 'Font Black', 0); + credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', 'PNG', 'Font Black', 0); + credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', 'PNG', 'Font Black', 0); + + intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', 'PNG', 'Transparent', 0); + intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', 'PNG', 'Transparent', 0); + intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', 'PNG', 'Transparent', 0); + intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', 'PNG', 'Transparent', 0); + intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', 'PNG', 'Transparent', 0); + intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', 'PNG', 'Transparent', 0); + intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', 'PNG', 'Transparent', 0); + intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', 'PNG', 'Transparent', 0); + intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', 'PNG', 'Transparent', 0); + + outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0); + outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0); + outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Transparent', 0); + + CRDTS_Stage:=InitialDelay; +end; + +function TScreenCredits.Draw: boolean; +begin + DrawCredits; + Draw:=true; +end; + +function pixfmt_eq(fmt1,fmt2: TSDL_Pixelformat): boolean; +begin + if (fmt1.BitsPerPixel = fmt2.BitsPerPixel) and + (fmt1.BytesPerPixel = fmt2.BytesPerPixel) and + (fmt1.Rloss = fmt2.Rloss) and + (fmt1.Gloss = fmt2.Gloss) and + (fmt1.Bloss = fmt2.Bloss) and + (fmt1.Rmask = fmt2.Rmask) and + (fmt1.Gmask = fmt2.Gmask) and + (fmt1.Bmask = fmt2.Bmask) and + (fmt1.Rshift = fmt2.Rshift) and + (fmt1.Gshift = fmt2.Gshift) and + (fmt1.Bshift = fmt2.Bshift) + then + pixfmt_eq:=True + else + pixfmt_eq:=False; +end; + +function inttohexstr(i: cardinal):pchar; +var helper, i2, c:cardinal; + tmpstr: string; +begin + helper:=0; + i2:=i; + tmpstr:=''; + for c:=1 to 8 do + begin + helper:=(helper shl 4) or (i2 and $f); + i2:=i2 shr 4; + end; + for c:=1 to 8 do + begin + i2:=helper and $f; + helper := helper shr 4; + case i2 of + 0: tmpstr:=tmpstr+'0'; + 1: tmpstr:=tmpstr+'1'; + 2: tmpstr:=tmpstr+'2'; + 3: tmpstr:=tmpstr+'3'; + 4: tmpstr:=tmpstr+'4'; + 5: tmpstr:=tmpstr+'5'; + 6: tmpstr:=tmpstr+'6'; + 7: tmpstr:=tmpstr+'7'; + 8: tmpstr:=tmpstr+'8'; + 9: tmpstr:=tmpstr+'9'; + 10: tmpstr:=tmpstr+'a'; + 11: tmpstr:=tmpstr+'b'; + 12: tmpstr:=tmpstr+'c'; + 13: tmpstr:=tmpstr+'d'; + 14: tmpstr:=tmpstr+'e'; + 15: tmpstr:=tmpstr+'f'; + end; + end; + inttohexstr:=pchar(tmpstr); +end; + +procedure TScreenCredits.onShow; +begin + CRDTS_Stage:=InitialDelay; + Credits_X := 580; + deluxe_slidein := 0; + Credits_Alpha := 0; + //Music.SetLoop(true); Loop looped ned, so ne scheisse + AudioPlayback.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! +// Music.Play; + CTime:=0; +// setlength(CTime_hold,0); + + mysdlimage:=IMG_Load('test.png'); + if assigned(mysdlimage) then + begin + {$IFNDEF FPC} + showmessage('opened image via SDL_Image'+#13#10+ + 'Width: '+inttostr(mysdlimage^.w)+#13#10+ + 'Height: '+inttostr(mysdlimage^.h)+#13#10+ + 'BitsPP: '+inttostr(mysdlimage^.format.BitsPerPixel)+#13#10+ + 'BytesPP: '+inttostr(mysdlimage^.format.BytesPerPixel)+#13#10+ + 'Rloss: '+inttostr(mysdlimage^.format.Rloss)+#13#10+ + 'Gloss: '+inttostr(mysdlimage^.format.Gloss)+#13#10+ + 'Bloss: '+inttostr(mysdlimage^.format.Bloss)+#13#10+ + 'Aloss: '+inttostr(mysdlimage^.format.Aloss)+#13#10+ + 'Rshift: '+inttostr(mysdlimage^.format.Rshift)+#13#10+ + 'Gshift: '+inttostr(mysdlimage^.format.Gshift)+#13#10+ + 'Bshift: '+inttostr(mysdlimage^.format.Bshift)+#13#10+ + 'Ashift: '+inttostr(mysdlimage^.format.Ashift)+#13#10+ + 'Rmask: '+inttohexstr(mysdlimage^.format.Rmask)+#13#10+ + 'Gmask: '+inttohexstr(mysdlimage^.format.Gmask)+#13#10+ + 'Bmask: '+inttohexstr(mysdlimage^.format.Bmask)+#13#10+ + 'Amask: '+inttohexstr(mysdlimage^.format.Amask)+#13#10+ + 'ColKey: '+inttostr(mysdlimage^.format.Colorkey)+#13#10+ + 'Alpha: '+inttostr(mysdlimage^.format.Alpha)); + + if pixfmt_eq(mysdlimage^.format^,sdl32bpprgba) then + showmessage('equal pixelformats') + else + showmessage('different pixelformats'); + {$ENDIF} + + myconvertedsdlimage:=SDL_ConvertSurface(mysdlimage,@sdl32bpprgba,SDL_SWSURFACE); + glGenTextures(1,@myTex); + glBindTexture(GL_TEXTURE_2D, myTex); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + glTexImage2D( GL_TEXTURE_2D, 0, 4, myconvertedsdlimage^.w, myconvertedsdlimage^.h, 0, + GL_RGBA, GL_UNSIGNED_BYTE, myconvertedsdlimage^.pixels ); + SDL_FreeSurface(mysdlimage); + SDL_FreeSurface(myconvertedsdlimage); + end + else + {$IFDEF FPC} + writeln( 'could not open file - test.png'); + {$ELSE} + showmessage('could not open file - test.png'); + {$ENDIF} + +end; + +procedure TScreenCredits.onHide; +begin + AudioPlayback.Stop; +end; + +Procedure TScreenCredits.Draw_FunkyText; +var + S: Integer; + X,Y,A: Real; + visibleText: PChar; +begin + SetFontSize(10); + //Init ScrollingText + if (CTime = Timings[7]) then + begin + //Set Position of Text + Credits_X := 600; + CurrentScrollStart:=1; + CurrentScrollEnd:=1; + end; + + if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then + begin + X:=0; + visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); + for S := 0 to length(visibleText)-1 do begin + Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); + SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); + A:=0; + if (Credits_X+X < 15) then A:=0; + if (Credits_X+X >=15) then A:=Credits_X+X-15; + if Credits_X+X > 32 then A:=17; + glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17); + glPrintLetter(visibleText[S]); + X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + end; + if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin + Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + inc(CurrentScrollStart); + end; + visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); + if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin + inc(CurrentScrollEnd); + end; + end; +{ // timing hack + X:=5; + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + glColor4f(1, 1, 1, 1); + for S:=0 to high(CTime_hold) do begin + visibleText:=pchar(inttostr(CTime_hold[S])); + SetFontPos (500, X); + glPrint (Addr(visibleText[0])); + X:=X+20; + end;} +end; + +procedure Start3D; +begin + glMatrixMode(GL_PROJECTION); + glPushMatrix; + glLoadIdentity; + glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity; +end; +procedure End3D; +begin + glMatrixMode(GL_PROJECTION); + glPopMatrix; + glMatrixMode(GL_MODELVIEW); +end; + +procedure TScreenCredits.DrawCredits; +var + T,I: Cardinal; + X: Real; + Ver: PChar; + RuntimeStr: AnsiString; + Data: TFFTData; + j,k,l:cardinal; + f,g,h: Real; + STime:cardinal; + Delay:cardinal; + + myPixel: longword; + myColor: Cardinal; + myScale: Real; + myAngle: Real; + + +const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24), + (154,31),(156,58),(168,32),(203,36), + (258,34),(251,50),(274,93),(294,84), + (232,54),(278,62),(319,34),(336,92), + (347,23),(374,32),(377,58),(361,83), + (385,91),(405,91),(429,35),(423,51), + (450,32),(485,34),(444,91),(486,93)); + +begin + //dis does teh muiwk y0r + AudioPlayback.GetFFTData(Data); + + Log.LogStatus('',' JB-1'); + + T := GetTickCount div 33; + if T <> Credits_Time then + begin + Credits_Time := T; + inc(CTime); + inc(CTime_hold); + Credits_X := Credits_X-2; + + Log.LogStatus('',' JB-2'); + if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then + begin +// CTime:=Timings[20]; +// CRDTS_Stage:=Outro; + + CRDTS_Stage:=Intro; + CTime:=0; + AudioPlayback.Play; + + end; + if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then + begin + CRDTS_Stage:=MainPart; + end; + if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then + begin + CRDTS_Stage:=Outro; + end; + end; + + Log.LogStatus('',' JB-3'); + + //draw background + if CRDTS_Stage=InitialDelay then + begin + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end + else + if CRDTS_Stage=Intro then + begin + Start3D; + glPushMatrix; + + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + if CTime < Timings[1] then begin + myScale:= 0.5+0.5*(Timings[1]-CTime)/(Timings[1]); // slowly move layers together + myAngle:=cos((CTime)*pi/((Timings[1])*2)); // and make logo face towards camera + end else begin // this is the part when the logo stands still + myScale:=0.5; + myAngle:=0; + end; + if CTime > Timings[2] then begin + myScale:= 0.5+0.5*(CTime-Timings[2])/(Timings[3]-Timings[2]); // get some space between layers + myAngle:=0; + end; +// if CTime > Timings[3] then myScale:=1; // keep the space between layers + glTranslatef(0,0,-5+0.5*myScale); + if CTime > Timings[3] then myScale:=1; // keep the space between layers + if CTime > Timings[3] then begin // make logo rotate left and grow +// myScale:=(CTime-Timings[4])/(Timings[7]-Timings[4]); + glRotatef(20*sqr(CTime-Timings[3])/sqr((Timings[7]-Timings[3])/2),0,0,1); + glScalef(1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1); + end; + if CTime < Timings[2] then + glRotatef(30*myAngle,0.5*myScale+myScale,1+myScale,0); +// glScalef(0.5,0.5,0.5); + glScalef(4/3,-1,1); + glColor4f(1, 1, 1, 1); + + glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.4 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.4 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.4 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.4 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.22 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.22 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.22 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.22 * myScale); + glEnd; + gldisable(gl_texture_2d); + glDisable(GL_BLEND); + + glPopMatrix; + End3D; + + // do some sparkling effects + if (CTime < Timings[1]) and (CTime > Timings[21]) then + begin + for k:=1 to 3 do begin + l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5); + j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301); + GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0); + end; + end; + + // fade to white at end + if Ctime > Timings[6] then + begin + glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + + end; + if (CRDTS_Stage=MainPart) then + // main credits screen background, scroller, logo and girl + begin + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // draw scroller + Draw_FunkyText; + +//######################################################################### +// draw credits names + + +Log.LogStatus('',' JB-4'); + +// BlindGuard (von links oben reindrehen, nach rechts unten rausdrehen) + STime:=Timings[9]-10; + Delay:=Timings[10]-Timings[9]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(0,329,0); + if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end; + gltranslatef(223,0,0); + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + gltranslatef(223,0,0); + glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1); + gltranslatef(-223,0,0); + end; + glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Blindy (zoom von 0 auf volle grösse und drehung, zoom auf doppelte grösse und nach rechts oben schieben) + STime:=Timings[10]-10; + Delay:=Timings[11]-Timings[10]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+20) and (CTime<=STime+22) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+20 then begin + j:=CTime-Stime; + glscalef(j*j/400,j*j/400,j*j/400); + glrotatef(j*18.0,0,0,1); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(f*3,-f,0); + glscalef(1+j/10,1+j/10,1+j/10); + glrotatef(j*9.0,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Canni (von links reinschieben, nach rechts oben rausschieben) + STime:=Timings[11]-10; + Delay:=Timings[12]-Timings[11]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(((CTime-STime)*21.0)-210,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=(CTime-(STime+Delay-10))*21; + gltranslatef(j,-j/2,0); + end; + glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Commandio (von unten reinklappen, nach rechts oben rausklappen) + STime:=Timings[12]-10; + Delay:=Timings[13]-Timings[12]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=258.0-25.8*(CTime-STime) + else + f:=0; + g:=0; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end; + glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163+g-f*1.5, -129+f*1.5-g/2); + glTexCoord2f(0,1);glVertex2f(-163+g*1.5, 129-(g*1.5*258/326)); + glTexCoord2f(1,1); glVertex2f(163+g, 129+g/4); + glTexCoord2f(1,0);glVertex2f(163+f*1.5+g/4, -129+f*1.5-g/4); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing) + STime:=Timings[13]-35; + Delay:=Timings[14]-Timings[13]+5; + if CTime > STime then + begin + k:=0; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20; + ESC_Alpha:=10; + f:=CTime-STime; + if CTime <=STime+40 then j:=CTime-STime else j:=40; + if (CTime >=STime+Delay-40) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j*j/1600); + + glPushMatrix; + gltranslatef(180+(f-70),329,0); + glBindTexture(GL_TEXTURE_2D, credits_lazyjoker.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Mog (von links reinklappen, nach rechts unten rausklappen) + STime:=Timings[14]-10; + Delay:=Timings[15]-Timings[14]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) + else + f:=0; + + g:=0; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end; + glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163+g*1.5, -129+g*1.5); + glTexCoord2f(0,1);glVertex2f(-163+g*1.2, 129+g); + glTexCoord2f(1,1); glVertex2f(163-f+g/2, 129+f*1.5+g/4); + glTexCoord2f(1,0);glVertex2f(163-f+g*1.5, -129-f*1.5); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Mota (von rechts oben reindrehen, nach links unten rausschieben und verkleinern und dabei drehen) + STime:=Timings[15]-10; + Delay:=Timings[16]-Timings[15]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(223,0,0); + glrotatef((10-(CTime-STime))*9,0,0,1); + gltranslatef(-223,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(-f*2,-f,0); + glscalef(1-j/10,1-j/10,1-j/10); + glrotatef(-j*9.0,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Skillmaster (von rechts unten reinschieben, nach rechts oben rausdrehen) + STime:=Timings[16]-10; + Delay:=Timings[17]-Timings[16]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + j:=STime+10-CTime; + f:=j*10.0; + gltranslatef(+f*2,+f/2,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + gltranslatef(0,-223,0); + glrotatef(integer(j)*-9,0,0,1); + gltranslatef(0,223,0); + glrotatef(j*9,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// WhiteShark (von links unten reinklappen, nach rechts oben rausklappen) + STime:=Timings[17]-10; + Delay:=Timings[18]-Timings[17]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) + else + f:=0; + + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end else + g:=0; + glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2); + glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4); + glTexCoord2f(1,1); glVertex2f(163-f*1.2+g/4, 129+f/2-g/4); + glTexCoord2f(1,0);glVertex2f(163-f*1.5+g/4, -129+f*1.5+g/4); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + + + Log.LogStatus('',' JB-103'); + +// #################################################################### +// do some twinkle stuff (kinda on beat) + if (CTime > Timings[8] ) and + (CTime < Timings[19] ) then + begin + k := 0; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + if Data[k]>0.2 then + begin + l := RandomRange(6,16); + j := RandomRange(0,27); + + GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); + end; + end; + +//################################################# +// draw the rest of the main screen (girl and logo + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(800-393, 0); + glTexCoord2f(0,600/1024);glVertex2f(800-393, 600); + glTexCoord2f(393/512,600/1024); glVertex2f(800, 600); + glTexCoord2f(393/512,0);glVertex2f(800, 0); + glEnd; +{ glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,112/128);glVertex2f(0, 112); + glTexCoord2f(497/512,112/128); glVertex2f(497, 112); + glTexCoord2f(497/512,0);glVertex2f(497, 0); + glEnd; +} + gldisable(gl_texture_2d); + glDisable(GL_BLEND); + + // fade out at end of main part + if Ctime > Timings[19] then + begin + glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + end + else + if (CRDTS_Stage=Outro) then + begin + if CTime=Timings[20] then begin + CTime_hold:=0; + AudioPlayback.Stop; + AudioPlayback.Open(soundpath + 'credits-outro-tune.mp3'); + AudioPlayback.Play; + AudioPlayback.SetVolume(20); + AudioPlayback.SetLoop(True); + end; + if CTime_hold > 231 then begin + AudioPlayback.Play; + Ctime_hold:=0; + end; + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + // do something useful + // outro background + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); + glEnd; + + //outro overlays + glColor4f(1, 1, 1, (1+sin(CTime/15))/3+1/3); + glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,223/256);glVertex2f(0, 223); + glTexCoord2f(487/512,223/256); glVertex2f(487, 223); + glTexCoord2f(487/512,0);glVertex2f(487, 0); + glEnd; + + ESC_Alpha:=20; + if (RandomRange(0,20) > 18) and (ESC_Alpha=20) then + ESC_Alpha:=0 + else inc(ESC_Alpha); + if ESC_Alpha > 20 then ESC_Alpha:=20; + glColor4f(1, 1, 1, ESC_Alpha/20); + glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(800-310, 600-247); + glTexCoord2f(0,247/256);glVertex2f(800-310, 600); + glTexCoord2f(310/512,247/256); glVertex2f(800, 600); + glTexCoord2f(310/512,0);glVertex2f(800, 600-247); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // outro scrollers? + // ... + end; + +{ // draw credits runtime counter + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (5, 5); + glColor4f(1, 1, 1, 1); +// RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10); + RuntimeStr:='CTime: '+inttostr(CTime); + glPrint (Addr(RuntimeStr[1])); +} + + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, myTex); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(100, 100); + glTexCoord2f(0,1);glVertex2f(100, 200); + glTexCoord2f(1,1); glVertex2f(200, 200); + glTexCoord2f(1,0);glVertex2f(200, 100); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + + // make the stars shine + GoldenRec.Draw; +end; + +end. diff --git a/Game/Code/Screens/UScreenEdit.pas b/Game/Code/Screens/UScreenEdit.pas index 49adb994..00feddbf 100644 --- a/Game/Code/Screens/UScreenEdit.pas +++ b/Game/Code/Screens/UScreenEdit.pas @@ -38,7 +38,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenMain); // Result := false; end; @@ -46,7 +46,7 @@ begin begin if Interaction = 0 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenEditConvert); end; // if Interaction = 1 then begin @@ -56,7 +56,7 @@ begin if Interaction = 1 then begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenMain); end; end; diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index a523afd2..304c2259 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -121,7 +121,7 @@ begin {$IFDEF UseMIDIPort} MidiFile.StopPlaying; {$ENDIF} - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenEdit); end; @@ -129,7 +129,7 @@ begin begin if Interaction = 0 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); ScreenOpen.BackScreen := @ScreenEditConvert; FadeTo(@ScreenOpen); end; diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 57d6777e..4d971c63 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -1277,7 +1277,7 @@ 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; + AudioPlayback.PlaySound(SoundLib.Click); LastClick := AktBeat; end; end; diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas index e5deb6ba..16e24027 100644 --- a/Game/Code/Screens/UScreenLevel.pas +++ b/Game/Code/Screens/UScreenLevel.pas @@ -38,7 +38,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenName); end; @@ -46,7 +46,7 @@ begin begin Ini.Difficulty := Interaction; Ini.SaveLevel; - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); //Set Standard Mode ScreenSong.Mode := smNormal; FadeTo(@ScreenSong); diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index a4dc5f0d..5824d9fe 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -94,7 +94,7 @@ begin //Credits_Y := 600; //Credits_Alpha := 0; //Credits_Visible := True; - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenCredits); end; end; @@ -102,20 +102,20 @@ begin begin if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenPartyOptions); end; end; SDLK_S: begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenStatMain); end; SDLK_E: begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenEdit); end; @@ -126,7 +126,7 @@ begin begin if (Songs.SongList.Count >= 1) then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1; if (Ini.Players = 4) then PlayersPlay := 6; @@ -144,7 +144,7 @@ begin begin if (Length(DLLMan.Plugins)>=1) then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenPartyOptions); end else //show error message, No Plugins Loaded @@ -157,21 +157,21 @@ begin //Stats if Interaction = 2 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenStatMain); end; //Editor if Interaction = 3 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenEdit); end; //Options if Interaction = 4 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenOptions); end; diff --git a/Game/Code/Screens/UScreenName.pas b/Game/Code/Screens/UScreenName.pas index 76e79a3b..f33d6409 100644 --- a/Game/Code/Screens/UScreenName.pas +++ b/Game/Code/Screens/UScreenName.pas @@ -158,7 +158,7 @@ begin SDLK_ESCAPE : begin Ini.SaveNames; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); if GoTo_SingScreen then FadeTo(@ScreenSong) else @@ -170,7 +170,7 @@ begin for I := 1 to 6 do Ini.Name[I-1] := Button[I-1].Text[0].Text; Ini.SaveNames; - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); if GoTo_SingScreen then FadeTo(@ScreenSing) diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index 30404d6e..5d78fb31 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -59,7 +59,7 @@ begin begin //Empty Filename and go to last Screen FileName := ''; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(BackScreen); end; @@ -68,14 +68,14 @@ begin if (Interaction = 2) then begin //Update Filename and go to last Screen FileName := Text[TextN].Text; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(BackScreen); end else if (Interaction = 1) then begin //Empty Filename and go to last Screen FileName := ''; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(BackScreen); end; end; diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas index bcd781cc..4e39fe21 100644 --- a/Game/Code/Screens/UScreenOptions.pas +++ b/Game/Code/Screens/UScreenOptions.pas @@ -38,57 +38,57 @@ begin SDLK_BACKSPACE : begin Ini.Save; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenMain); end; SDLK_RETURN: begin if SelInteraction = 0 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenOptionsGame); end; if SelInteraction = 1 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenOptionsGraphics); end; if SelInteraction = 2 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenOptionsSound); end; if SelInteraction = 3 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenOptionsLyrics); end; if SelInteraction = 4 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenOptionsThemes); end; if SelInteraction = 5 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenOptionsRecord); end; if SelInteraction = 6 then begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenOptionsAdvanced); end; if SelInteraction = 7 then begin Ini.Save; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenMain); end; end; diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index 0d40b7ec..e2c30bf1 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -34,7 +34,7 @@ begin SDLK_BACKSPACE : begin Ini.Save; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; SDLK_RETURN: @@ -43,7 +43,7 @@ begin //if SelInteraction = 7 then begin if SelInteraction = 6 then begin Ini.Save; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; end; @@ -56,7 +56,7 @@ begin //SelectLoadAnimation Hidden because it is useless atm //if (SelInteraction >= 0) and (SelInteraction <= 6) then begin if (SelInteraction >= 0) and (SelInteraction <= 5) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractInc; end; end; @@ -65,7 +65,7 @@ begin //SelectLoadAnimation Hidden because it is useless atm //if (SelInteraction >= 0) and (SelInteraction <= 6) then begin if (SelInteraction >= 0) and (SelInteraction <= 5) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index 6cd0a20c..15b538a5 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -35,14 +35,14 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); RefreshSongs; FadeTo(@ScreenOptions); end; SDLK_RETURN: begin if SelInteraction = 6 then begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); RefreshSongs; FadeTo(@ScreenOptions); end; @@ -55,7 +55,7 @@ begin begin if (SelInteraction >= 0) and (SelInteraction <= 5) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractInc; end; end; @@ -63,7 +63,7 @@ begin begin if (SelInteraction >= 0) and (SelInteraction <= 5) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index 947d506b..4ceeeb32 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -34,7 +34,7 @@ begin SDLK_BACKSPACE : begin Ini.Save; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; SDLK_RETURN: @@ -44,7 +44,7 @@ begin end;} if SelInteraction = 5 then begin Ini.Save; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; end; @@ -55,14 +55,14 @@ begin SDLK_RIGHT: begin if (SelInteraction >= 0) and (SelInteraction <= 4) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractInc; end; end; SDLK_LEFT: begin if (SelInteraction >= 0) and (SelInteraction <= 4) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas index 8d70eec9..7275efed 100644 --- a/Game/Code/Screens/UScreenOptionsLyrics.pas +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -34,14 +34,14 @@ begin SDLK_BACKSPACE : begin Ini.Save; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; SDLK_RETURN: begin if SelInteraction = 3 then begin Ini.Save; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; end; @@ -52,14 +52,14 @@ begin SDLK_RIGHT: begin if (SelInteraction >= 0) and (SelInteraction <= 2) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractInc; end; end; SDLK_LEFT: begin if (SelInteraction >= 0) and (SelInteraction <= 2) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index 65d016c7..130c3551 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -1,212 +1,232 @@ -unit UScreenOptionsRecord; - -interface - -{$I switches.inc} - -uses - UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; - -type - TScreenOptionsRecord = class(TMenu) - private - SelectSlideInput: integer; - SelectSlideChannelL: integer; - SelectSlideChannelR: integer; - public - constructor Create; override; - function Draw: boolean; override; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - procedure onShow; override; - procedure onHide; override; - procedure UpdateCard; - end; - -implementation - -uses SysUtils, - UGraphic, - URecord, - UDraw, - UMain, - ULog; - -function TScreenOptionsRecord.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 - Ini.Save; - AudioPlayback.PlayBack; - FadeTo(@ScreenOptions); - end; - SDLK_RETURN: - begin - if SelInteraction = 5 then begin - Ini.Save; - AudioPlayback.PlayBack; - FadeTo(@ScreenOptions); - end; - end; - SDLK_DOWN: - InteractNext; - SDLK_UP : - InteractPrev; - SDLK_RIGHT: - begin - if (SelInteraction >= 0) and (SelInteraction <= 4) then begin - AudioPlayback.PlayOption; - InteractInc; - end; -// if SelInteraction = 0 then UpdateCard; - UpdateCard; - end; - SDLK_LEFT: - begin - if (SelInteraction >= 0) and (SelInteraction <= 4) then begin - AudioPlayback.PlayOption; - InteractDec; - end; - UpdateCard; -// if SelInteraction = 0 then UpdateCard; - end; - end; - end; -end; - -constructor TScreenOptionsRecord.Create; -var - I: integer; - SC: integer; - SCI: integer; -begin - inherited Create; - - LoadFromTheme(Theme.OptionsRecord); - - SetLength(ICard, Length(AudioInputProcessor.SoundCard)); - for SC := 0 to High(AudioInputProcessor.SoundCard) do - ICard[SC] := AudioInputProcessor.SoundCard[SC].Description; - - if (Length(AudioInputProcessor.SoundCard) > 0) then - begin - SetLength(IInput, Length(AudioInputProcessor.SoundCard[Ini.Card].Input)); - for SCI := 0 to High(AudioInputProcessor.SoundCard[Ini.Card].Input) do - IInput[SCI] := AudioInputProcessor.SoundCard[Ini.Card].Input[SCI].Name; - - - AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, Ini.Card, ICard); - - SelectSlideInput := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, Ini.CardList[0].Input, IInput); - SelectSlideChannelL := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelL, Ini.CardList[0].ChannelL, IChannel); - SelectSlideChannelR := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelR, Ini.CardList[0].ChannelR, IChannel); - - AddSelect(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost); - end; - - AddButton(Theme.OptionsRecord.ButtonExit); - if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[7]); - - Interaction := 0; -end; - -procedure TScreenOptionsRecord.onShow; -begin - Interaction := 0; - writeln( 'AudioInput.CaptureStart') ; - - PlayersPlay := 2; // TODO : This needs fixing - AudioInput.CaptureStart; - -end; - -procedure TScreenOptionsRecord.onHide; -begin - AudioInput.CaptureStop; -end; - -procedure TScreenOptionsRecord.UpdateCard; -var - SC: integer; - SCI: integer; -begin - writeln( 'Update Card') ; - AudioInput.CaptureStop; - try - SC := Ini.Card; - // if SC = 1 then beep; - - SetLength(IInput, Length(AudioInputProcessor.SoundCard[SC].Input)); - for SCI := 0 to High(AudioInputProcessor.SoundCard[SC].Input) do begin - IInput[SCI] := AudioInputProcessor.SoundCard[SC].Input[SCI].Name; - // Log.LogError(IInput[SCI]); - end; - - - UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideInput, SelectSlideInput, IInput, Ini.CardList[SC].Input); - UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelL, SelectSlideChannelL, IChannel, Ini.CardList[SC].ChannelL); - UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelR, SelectSlideChannelR, IChannel, Ini.CardList[SC].ChannelR); - - finally - AudioInput.CaptureStart; - end; -end; - -function TScreenOptionsRecord.Draw: boolean; -begin - DrawBG; - DrawFG; - - // TODO : this needs to be positioned correctly - if PlayersPlay = 1 then - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - - if PlayersPlay = 2 then begin - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); - end; - if ScreenAct = 2 then begin - SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 2); - SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 3); - end; - end; - - if PlayersPlay = 3 then begin - SingDrawOscilloscope(75 + 10*ScreenX, 95, 100, 20, 0); - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 0); - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); - end; - if ScreenAct = 2 then begin - SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 3); - SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 4); - SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 5); - end; - end; - - Result := True; -end; - - -end. +unit UScreenOptionsRecord; + +interface + +{$I switches.inc} + +uses + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; + +type + TScreenOptionsRecord = class(TMenu) + private + Card: integer; // current input device + + SelectSlideInput: integer; + SelectSlideChannelL: integer; + SelectSlideChannelR: integer; + public + constructor Create; override; + function Draw: boolean; override; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure UpdateCard; + end; + +implementation + +uses SysUtils, + UGraphic, + URecord, + UDraw, + UMain, + ULog; + +function TScreenOptionsRecord.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 + Ini.Save; + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 5 then begin + Ini.Save; + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 4) then begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractInc; + end; +// if SelInteraction = 0 then UpdateCard; + UpdateCard; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 4) then begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractDec; + end; + UpdateCard; +// if SelInteraction = 0 then UpdateCard; + end; + end; + end; +end; + +constructor TScreenOptionsRecord.Create; +var + SC: integer; + SCI: integer; + InputDevice: TAudioInputDevice; + InputDeviceCfg: PInputDeviceConfig; +begin + inherited Create; + + Card := 0; + + LoadFromTheme(Theme.OptionsRecord); + + SetLength(ICard, Length(AudioInputProcessor.Device)); + for SC := 0 to High(AudioInputProcessor.Device) do + ICard[SC] := AudioInputProcessor.Device[SC].Description; + + if (Card > High(AudioInputProcessor.Device)) then + Card := 0; + + if (Length(AudioInputProcessor.Device) > 0) then + begin + InputDevice := AudioInputProcessor.Device[Card]; + InputDeviceCfg := @Ini.InputDeviceConfig[InputDevice.CfgIndex]; + + SetLength(IInput, Length(InputDevice.Source)); + for SCI := 0 to High(InputDevice.Source) do + IInput[SCI] := InputDevice.Source[SCI].Name; + + AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, Card, ICard); + + SelectSlideInput := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, + InputDeviceCfg^.Input, IInput); + SelectSlideChannelL := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelL, + InputDeviceCfg^.ChannelToPlayerMap[0], IChannel); + SelectSlideChannelR := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelR, + InputDeviceCfg^.ChannelToPlayerMap[1], IChannel); + + AddSelect(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost); + end; + + AddButton(Theme.OptionsRecord.ButtonExit); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[7]); + + Interaction := 0; +end; + +procedure TScreenOptionsRecord.onShow; +begin + Interaction := 0; + writeln( 'AudioInput.CaptureStart') ; + + PlayersPlay := 2; // TODO : This needs fixing + AudioInput.CaptureStart; + +end; + +procedure TScreenOptionsRecord.onHide; +begin + AudioInput.CaptureStop; +end; + +procedure TScreenOptionsRecord.UpdateCard; +var + SourceIndex: integer; + InputDevice: TAudioInputDevice; + InputDeviceCfg: PInputDeviceConfig; +begin + Log.LogStatus('Update input-device', 'TScreenOptionsRecord.UpdateCard') ; + + AudioInput.CaptureStop; + + if (Card > High(AudioInputProcessor.Device)) then + Card := 0; + + if (Length(AudioInputProcessor.Device) > 0) then + begin + InputDevice := AudioInputProcessor.Device[Card]; + InputDeviceCfg := @Ini.InputDeviceConfig[InputDevice.CfgIndex]; + + SetLength(IInput, Length(InputDevice.Source)); + for SourceIndex := 0 to High(InputDevice.Source) do begin + IInput[SourceIndex] := InputDevice.Source[SourceIndex].Name; + end; + + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideInput, SelectSlideInput, IInput, + InputDeviceCfg^.Input); + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelL, SelectSlideChannelL, IChannel, + InputDeviceCfg^.ChannelToPlayerMap[0]); + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelR, SelectSlideChannelR, IChannel, + InputDeviceCfg^.ChannelToPlayerMap[1]); + end; + + AudioInput.CaptureStart; +end; + +function TScreenOptionsRecord.Draw: boolean; +begin + DrawBG; + DrawFG; + + // TODO : this needs to be positioned correctly + if PlayersPlay = 1 then + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + + if PlayersPlay = 2 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 0); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 1); + end; + if ScreenAct = 2 then begin + SingDrawOscilloscope(190 + 10*ScreenX, 55, 180, 40, 2); + SingDrawOscilloscope(425 + 10*ScreenX, 55, 180, 40, 3); + end; + end; + + if PlayersPlay = 3 then begin + SingDrawOscilloscope(75 + 10*ScreenX, 95, 100, 20, 0); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 0); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 1); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 2); + end; + if ScreenAct = 2 then begin + SingDrawOscilloscope( 75 + 10*ScreenX, 95, 100, 20, 3); + SingDrawOscilloscope(370 + 10*ScreenX, 95, 100, 20, 4); + SingDrawOscilloscope(670 + 10*ScreenX, 95, 100, 20, 5); + end; + end; + + Result := True; +end; + + +end. diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index 64a0413f..da5c6e90 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -34,14 +34,14 @@ begin SDLK_BACKSPACE : begin Ini.Save; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; SDLK_RETURN: begin if SelInteraction = 6 then begin Ini.Save; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; end; @@ -52,14 +52,14 @@ begin SDLK_RIGHT: begin if (SelInteraction >= 0) and (SelInteraction <= 6) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractInc; end; end; SDLK_LEFT: begin if (SelInteraction >= 0) and (SelInteraction <= 6) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index 114a5e45..239f98fe 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -53,7 +53,7 @@ begin UGraphic.UnLoadScreens(); UGraphic.LoadScreens(); - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; SDLK_RETURN: @@ -67,7 +67,7 @@ begin UGraphic.UnLoadScreens(); UGraphic.LoadScreens(); - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; end; @@ -79,7 +79,7 @@ begin begin if (SelInteraction >= 0) and (SelInteraction <= 2) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractInc; end; end; @@ -87,7 +87,7 @@ begin begin if (SelInteraction >= 0) and (SelInteraction <= 2) then begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractDec; end; end; diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 2f07dcb0..198708cc 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -101,13 +101,13 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); end; SDLK_RETURN: begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); if DLLMan.Selected.LoadSong then begin //Select PartyMode ScreenSong diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index c8cb2bb5..1b5cf976 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -66,7 +66,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenMain); end; @@ -125,7 +125,7 @@ begin // to-do : Party //PartySession.StartNewParty(Rounds + 2); - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); //Go to Player Screen FadeTo(@ScreenPartyPlayer); end; @@ -137,7 +137,7 @@ begin SDLK_UP: InteractPrev; SDLK_RIGHT: begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractInc; //Change Playlist2 if Playlist is Changed @@ -152,7 +152,7 @@ begin end; SDLK_LEFT: begin - AudioPlayback.PlayOption; + AudioPlayback.PlaySound(SoundLib.Option); InteractDec; //Change Playlist2 if Playlist is Changed diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas index 3bd33a5c..68f76952 100644 --- a/Game/Code/Screens/UScreenPartyPlayer.pas +++ b/Game/Code/Screens/UScreenPartyPlayer.pas @@ -186,7 +186,7 @@ begin SDLK_ESCAPE: begin Ini.SaveNames; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenPartyOptions); end; diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index 6215e65a..6b21323b 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -59,7 +59,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); {if (PartySession.CurRound < High(PartySession.Rounds)) then FadeTo(@ScreenPartyNewRound) else // to-do : Party @@ -71,7 +71,7 @@ begin SDLK_RETURN: begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); // to-do : Party {if (PartySession.CurRound < High(PartySession.Rounds)) then FadeTo(@ScreenPartyNewRound) diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas index d8a3bd71..5960db06 100644 --- a/Game/Code/Screens/UScreenPartyWin.pas +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -52,13 +52,13 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenMain); end; SDLK_RETURN: begin - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenMain); end; end; diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 5216477d..6a5b4e90 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -153,7 +153,7 @@ begin //Sound[0].BufferLong Finish; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenScore); end; diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 7d2eba07..ed827ec8 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -75,6 +75,16 @@ type //procedure Pause; //Pause Mod(Toggles Pause) end; +type + TCustomSoundEntry = record + Filename : String; + Stream : TAudioPlaybackStream; + end; + +var + //Custom Sounds + CustomSounds: array of TCustomSoundEntry; + //Procedured for Plugin function LoadTex (const Name, Typ: PChar): TsmallTexture; stdcall; //function Translate (const Name: PChar): PChar; stdcall; @@ -101,7 +111,7 @@ begin SDLK_BACKSPACE : begin Finish; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenPartyScore); end; @@ -656,14 +666,34 @@ begin end; function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound +var + S: TAudioPlaybackStream; + I: Integer; + F: String; begin - Result := AudioPlayback.LoadCustomSound(String(Name)); + //Search for Sound in already loaded Sounds + F := UpperCase(SoundPath + FileName); + For I := 0 to High(CustomSounds) do + begin + if (UpperCase(CustomSounds[I].Filename) = F) then + begin + Result := I; + Exit; + end; + end; + + S := AudioPlayback.OpenSound(SoundPath + String(Name)); + if (S <> nil) then + Result := High(CustomSounds) + else + Result := 0; end; procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound begin - AudioPlayback.PlayCustomSound(Index); + if (Index <= High(CustomSounds)) then + AudioPlayback.PlaySound(CustomSounds[Index].Stream); end; end. ->>>>>>> .r429 + diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 4773cdac..3be0be84 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -29,6 +29,11 @@ uses type TScreenSong = class(TMenu) + private + EqualizerData: TFFTData; // moved here to avoid stack overflows + EqualizerBands: array of Byte; + EqualizerTime: Cardinal; + EqualizerTime2: Byte; public TextArtist: integer; TextTitle: integer; @@ -52,10 +57,6 @@ type is_jump: boolean; // Jump to Song Mod is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title - EqualizerBands: array of Byte; - EqualizerTime: Cardinal; - EqualizerTime2: Byte; - //Party Mod Mode: TSingMode; @@ -270,7 +271,7 @@ begin begin SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - AudioPlayback.PlayChange; + AudioPlayback.PlaySound(SoundLib.Change); ChangeMusic; SetScroll4; @@ -291,7 +292,7 @@ begin begin SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - AudioPlayback.PlayChange; + AudioPlayback.PlaySound(SoundLib.Change); ChangeMusic; SetScroll4; @@ -369,7 +370,7 @@ begin else begin AudioPlayback.Stop; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenMain); end; @@ -379,7 +380,7 @@ begin //When in party Mode then Ask before Close else if (Mode = smPartyMode) then begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); end; end; @@ -504,7 +505,7 @@ begin FixSelected; //Play Music: - AudioPlayback.PlayChange; + AudioPlayback.PlaySound(SoundLib.Change); ChangeMusic; end; @@ -547,7 +548,7 @@ begin FixSelected; //Play Music: - AudioPlayback.PlayChange; + AudioPlayback.PlaySound(SoundLib.Change); ChangeMusic; end; end; @@ -559,7 +560,7 @@ begin begin if (Songs.SongList.Count > 0) AND (Mode = smNormal) then begin - AudioPlayback.PlayChange; + AudioPlayback.PlaySound(SoundLib.Change); SelectNext; // InteractNext; // SongTarget := Interaction; @@ -573,7 +574,7 @@ begin SDLK_LEFT: begin if (Songs.SongList.Count > 0)AND (Mode = smNormal) then begin - AudioPlayback.PlayChange; + AudioPlayback.PlaySound(SoundLib.Change); SelectPrev; ChangeMusic; SetScroll4; @@ -655,7 +656,7 @@ begin begin SkipTo(Random(CatSongs.VisibleSongs)); end; - AudioPlayback.PlayChange; + AudioPlayback.PlaySound(SoundLib.Change); ChangeMusic; SetScroll4; @@ -1804,7 +1805,6 @@ end; procedure TScreenSong.DrawEqualizer; var - Data: TFFTData; //Audio Data I, J: Integer; Res: byte; A, B: Integer; @@ -1822,7 +1822,7 @@ begin if (A <> EqualizerTime) then begin EqualizerTime := A; - Data := AudioPlayback.GetFFTData; + AudioPlayback.GetFFTData(EqualizerData); B := 0; Pos := 0; @@ -1850,23 +1850,23 @@ begin end; if I > 35 then - Data[i] := Data[i] * 8 + EqualizerData[i] := EqualizerData[i] * 8 else if I > 11 then - Data[i] := Data[i] * 4.5 + EqualizerData[i] := EqualizerData[i] * 4.5 else - Data[i] := Data[i] * 1.1; + EqualizerData[i] := EqualizerData[i] * 1.1; - if (Data[i] >= 1) then - Data[i] := 0.9999999999999; + if (EqualizerData[i] >= 1) then + EqualizerData[i] := 0.9999999999999; try if ( assigned( Theme ) ) AND ( assigned( Theme.Song ) ) AND - ( i < length( Data ) ) THEN + ( i < length( EqualizerData ) ) THEN begin - if single( Data[i] ) > 1 then + if single( EqualizerData[i] ) > 1 then begin - lTmp := Single(Data[i]) * Theme.Song.Equalizer.Length; + lTmp := Single(EqualizerData[i]) * Theme.Song.Equalizer.Length; if lTmp > Pos then Pos := lTmp; end; @@ -1874,7 +1874,7 @@ begin except {$IFDEF FPC} on E:EInvalidOp do - writeln( 'UScreenSong - DOH !!!! ('+inttostr(i)+' '+ inttostr( integer( Data[i] ) )+' * '+ ')' ); + writeln( 'UScreenSong - DOH !!!! ('+inttostr(i)+' '+ inttostr( integer( EqualizerData[i] ) )+' * '+ ')' ); {$ENDIF} end @@ -1989,7 +1989,7 @@ begin end; end; - AudioPlayback.PlayChange; + AudioPlayback.PlaySound(SoundLib.Change); ChangeMusic; SetScroll; UpdateLCD; @@ -2129,7 +2129,7 @@ begin if (Songs.SongList.Count > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = smNormal) then begin AudioPlayback.Stop; - AudioPlayback.PlayStart; + AudioPlayback.PlaySound(SoundLib.Start); ScreenEditSub.Path := CatSongs.Song[Interaction].Path; ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName; FadeTo(@ScreenEditSub); diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index 14228964..dfa90009 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -67,7 +67,7 @@ begin SDLK_ESCAPE: begin Visible := False; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); if (VisSongs = 0) AND (Length(Button[0].Text[0].Text) > 0) then begin ScreenSong.UnLoadDetailedCover; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 88b0de32..ae0bc9ba 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -96,7 +96,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); Visible := False; end; diff --git a/Game/Code/Screens/UScreenStatDetail.pas b/Game/Code/Screens/UScreenStatDetail.pas index 414055f9..d793baf0 100644 --- a/Game/Code/Screens/UScreenStatDetail.pas +++ b/Game/Code/Screens/UScreenStatDetail.pas @@ -53,7 +53,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenStatMain); end; SDLK_RETURN: @@ -76,7 +76,7 @@ begin end; if Interaction = 3 then begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenStatMain); end; end; diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index f7257201..53154d6e 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -62,7 +62,7 @@ begin SDLK_BACKSPACE : begin Ini.Save; - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenMain); end; SDLK_RETURN: @@ -70,12 +70,12 @@ begin //Exit Button Pressed if Interaction = 4 then begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenMain); end else //One of the Stats Buttons Pressed begin - AudioPlayback.PlayBack; + AudioPlayback.PlaySound(SoundLib.Back); ScreenStatDetail.Typ := Interaction; FadeTo(@ScreenStatDetail); end; -- cgit v1.2.3 From d22d5070d1b847611786ca483055ea7348cda132 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 21:33:30 +0000 Subject: cleanup git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@828 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSing.pas | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 6a5b4e90..2342d371 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -325,6 +325,8 @@ var NR: TRecR; //Line Bonus Mod Color: TRGB; + + success: boolean; begin Log.LogStatus('Begin', 'onShow'); FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented @@ -433,34 +435,30 @@ begin {Static[StaticP3RScoreBG].Visible := V3R; Text[TextP3RScore].Visible := V3R; } + // FIXME: sets Path and Filename to '' ResetSingTemp; -// Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!'); + CurrentSong := CatSongs.Song[CatSongs.Selected]; + // FIXME: bad style, put the try-except into LoadSong() and not here try - if not CurrentSong.LoadSong then -// if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName) then - begin - //Error Loading Song -> Go back to Song Screen and Show some Error Message - FadeTo(@ScreenSong); - //Select New Song in Party Mode - if ScreenSong.Mode = smPartyMode then - ScreenSong.SelectRandomSong; - ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); - Exit; - end; + success := CurrentSong.LoadSong(); except + success := false; + end; + if (not success) then + begin //Error Loading Song -> Go back to Song Screen and Show some Error Message FadeTo(@ScreenSong); //Select New Song in Party Mode if ScreenSong.Mode = smPartyMode then - ScreenSong.SelectRandomSong; + ScreenSong.SelectRandomSong(); ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); + // FIXME: do we need this? + CurrentSong.Path := CatSongs.Song[CatSongs.Selected].Path; Exit; end; - CurrentSong.Path := CatSongs.Song[CatSongs.Selected].Path; -// CurrentSong.GAP := CurrentSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / CurrentSong.BPM[0].BPM / 2; // temporary until UMain will be fixed - + // set movie if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then begin -- cgit v1.2.3 From b4371d97f409af8ab9dc942c39f143ae400854da Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 5 Feb 2008 21:43:57 +0000 Subject: bugfix to get the editor working again. Path and FileName have not been set. In addtion LoadSong was not used to actually load the song. Jay or some other dev: please revise the changes. The Lyric var is not set too, so it crashes on Lyric.Clear in TScreenEditSub.onShow. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@829 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditSub.pas | 13 +- Game/Code/Screens/UScreenSong.pas | 4345 +++++++++++++++++----------------- 2 files changed, 2178 insertions(+), 2180 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 4d971c63..60e27245 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -89,8 +89,6 @@ type 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; @@ -223,9 +221,9 @@ begin begin // Save Song if SDL_ModState = KMOD_LSHIFT then - SaveSong(CurrentSong, Czesci[0], Path + FileName, true) + SaveSong(CurrentSong, Czesci[0], CurrentSong.Path + CurrentSong.FileName, true) else - SaveSong(CurrentSong, Czesci[0], Path + FileName, false); + SaveSong(CurrentSong, Czesci[0], CurrentSong.Path + CurrentSong.FileName, false); {if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL + KMOD_LALT then // Save Song @@ -1159,9 +1157,10 @@ procedure TScreenEditSub.onShow; begin Log.LogStatus('Initializing', 'TEditScreen.onShow'); + ResetSingTemp; + try - ResetSingTemp; -// Error := not LoadSong(Path + FileName); // todo - JB come back to this + Error := not CurrentSong.LoadSong(); except Error := True; end; @@ -1188,7 +1187,7 @@ begin AktNuta := 0; Czesci[0].Czesc[0].Nuta[0].Color := 1; - AudioPlayback.Open(Path + CurrentSong.Mp3); + AudioPlayback.Open(CurrentSong.Path + CurrentSong.Mp3); //Set Down Music Volume for Better hearability of Midi Sounds //Music.SetVolume(40); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 3be0be84..b142b4dc 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1,2173 +1,2172 @@ -unit UScreenSong; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - - -uses - UMenu, - SDL, - UMusic, - UFiles, - UTime, - UDisplay, - USongs, - SysUtils, - ULog, - UThemes, - UTexture, - ULanguage, - ULCD, - ULight, - USong, - UIni; - -type - TScreenSong = class(TMenu) - private - EqualizerData: TFFTData; // moved here to avoid stack overflows - EqualizerBands: array of Byte; - EqualizerTime: Cardinal; - EqualizerTime2: Byte; - public - TextArtist: integer; - TextTitle: integer; - TextNumber: integer; - - //Video Icon Mod - VideoIcon: Cardinal; - - TextCat: integer; - StaticCat: integer; - - SongCurrent: real; - SongTarget: real; - - HighSpeed: boolean; - CoverFull: boolean; - CoverTime: real; - CoverX: integer; - CoverY: integer; - CoverW: integer; - is_jump: boolean; // Jump to Song Mod - is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title - - //Party Mod - Mode: TSingMode; - - //party Statics (Joker) - StaticTeam1Joker1: Cardinal; - StaticTeam1Joker2: Cardinal; - StaticTeam1Joker3: Cardinal; - StaticTeam1Joker4: Cardinal; - StaticTeam1Joker5: Cardinal; - - StaticTeam2Joker1: Cardinal; - StaticTeam2Joker2: Cardinal; - StaticTeam2Joker3: Cardinal; - StaticTeam2Joker4: Cardinal; - StaticTeam2Joker5: Cardinal; - - StaticTeam3Joker1: Cardinal; - StaticTeam3Joker2: Cardinal; - StaticTeam3Joker3: Cardinal; - StaticTeam3Joker4: Cardinal; - StaticTeam3Joker5: Cardinal; - - StaticParty: Array of Cardinal; - TextParty: Array of Cardinal; - StaticNonParty: Array of Cardinal; - TextNonParty: Array of Cardinal; - - - constructor Create; override; - procedure SetScroll; - procedure SetScroll1; - procedure SetScroll2; - procedure SetScroll3; - procedure SetScroll4; - procedure SetScroll5; - procedure SetScroll6; - function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; - function Draw: boolean; override; - procedure GenerateThumbnails(); - procedure onShow; override; - procedure onHide; override; - procedure SelectNext; - procedure SelectPrev; - procedure UpdateLCD; - procedure SkipTo(Target: Cardinal); - procedure FixSelected; //Show Wrong Song when Tabs on Fix - procedure FixSelected2; //Show Wrong Song when Tabs on Fix - procedure ShowCatTL(Cat: Integer);// Show Cat in Top left - procedure ShowCatTLCustom(Caption: String);// Show Custom Text in Top left - procedure HideCatTL;// Show Cat in Tob left - procedure Refresh; //Refresh Song Sorting - procedure DrawEqualizer; - procedure ChangeMusic; - //Party Mode - procedure SelectRandomSong; - procedure SetJoker; - procedure SetStatics; - //procedures for Menu - procedure StartSong; - procedure OpenEditor; - procedure DoJoker(Team: Byte); - procedure SelectPlayers; - - procedure UnLoadDetailedCover; - - //Extensions - procedure DrawExtensions; - end; - -implementation -uses UGraphic, - UMain, - UCovers, - math, - OpenGL12, - {$IFDEF win32} - windows, - {$ELSE} - lclintf, - {$ENDIF} - USkins, - UDLLManager, - UParty, - UPlaylist, - UScreenSongMenu; - -// ***** Public methods ****** // - -//Show Wrong Song when Tabs on Fix -procedure TScreenSong.FixSelected; -var I, I2: Integer; - begin - if CatSongs.VisibleSongs > 0 then - begin - I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do - begin - if CatSongs.Song[I].Visible then - inc(I2); - - if I = Interaction - 1 then - break; - end; - - SongCurrent := I2; - SongTarget := I2; - end; - end; - -procedure TScreenSong.FixSelected2; -var I, I2: Integer; - begin - if CatSongs.VisibleSongs > 0 then - begin - I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do - begin - if CatSongs.Song[I].Visible then - inc(I2); - - if I = Interaction - 1 then - break; - end; - - SongTarget := I2; - end; - end; -//Show Wrong Song when Tabs on Fix End - - procedure TScreenSong.ShowCatTLCustom(Caption: String);// Show Custom Text in Top left - begin - Text[TextCat].Text := Caption; - Text[TextCat].Visible := true; - Static[StaticCat].Visible := False; - end; - - //Show Cat in Top Left Mod - procedure TScreenSong.ShowCatTL(Cat: Integer); - begin - //Change - Text[TextCat].Text := CatSongs.Song[Cat].Artist; - //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover); - //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); - - Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); - //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false); - //Button[Cat]. - //Cover - - - //Show - Text[TextCat].Visible := true; - Static[StaticCat].Visible := True; - end; - - procedure TScreenSong.HideCatTL; - begin - //Hide - //Text[TextCat].Visible := false; - Static[StaticCat].Visible := false; - //New -> Show Text specified in Theme - Text[TextCat].Visible := True; - Text[TextCat].Text := Theme.Song.TextCat.Text; - end; - //Show Cat in Top Left Mod End - - -// Method for input parsing. If False is returned, GetNextWindow -// should be checked to know the next window to load; -function TScreenSong.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -var - I: integer; - I2: integer; - HS: integer; - SDL_ModState: Word; - Letter: Char; -begin - Result := true; - - //Song Screen Extensions (Jumpto + Menu) - if (ScreenSongMenu.Visible) then - begin - Result := ScreenSongMenu.ParseInput(PressedKey, ScanCode, PressedDown); - Exit; - end - else if (ScreenSongJumpto.Visible) then - begin - Result := ScreenSongJumpto.ParseInput(PressedKey, ScanCode, PressedDown); - Exit; - end; - - If (PressedDown) Then - begin // Key Down - - SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT - + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); - - //Jump to Artist/Titel - if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = smNormal) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then - begin - Letter := UpCase(Chr(ScanCode)); - I2 := Length(CatSongs.Song); - - //Jump To Titel - if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then - begin - For I := 1 to high(CatSongs.Song) do - begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND - (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND - (widechar(UpperCase(CatSongs.Song[(I + Interaction) mod I2].Title)[1]) = widechar(Letter)) then - begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - - AudioPlayback.PlaySound(SoundLib.Change); - - ChangeMusic; - SetScroll4; - UpdateLCD; - //Break and Exit - Exit; - end; - end; - end - //Jump to Artist - else if (SDL_ModState = KMOD_LALT) then - begin - For I := 1 to high(CatSongs.Song) do - begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND - (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND - (widechar(uppercase(CatSongs.Song[(I + Interaction) mod I2].Artist)[1]) = widechar(Letter)) then - begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - - AudioPlayback.PlaySound(SoundLib.Change); - - ChangeMusic; - SetScroll4; - UpdateLCD; - - //Break and Exit - Exit; - end; - end; - end; - Exit; - end; - - case PressedKey of - SDLK_Q: - begin - Result := false; - end; - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - if (Mode = smNormal) then - begin - //On Escape goto Cat-List Hack - if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then - begin - //Find Category - I := Interaction; - while not catsongs.Song[I].Main do - begin - Dec (I); - if (I < low(catsongs.Song)) then - break; - end; - if (I<= 1) then - Interaction := high(catsongs.Song) - else - Interaction := I - 1; - - //Stop Music - AudioPlayback.Stop; - - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - HideCatTL; - - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - //SelectPrev; - //CatSongs.Song[0].Visible := False; - end - else - begin - //On Escape goto Cat-List Hack End - //Tabs off and in Search or Playlist -> Go back to Song view - if (CatSongs.CatNumShow < -1) then - begin - //Atm: Set Empty Filter - CatSongs.SetFilter('', 0); - - //Show Cat in Top Left Mod - HideCatTL; - Interaction := 0; - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - - ChangeMusic; - end - else - begin - AudioPlayback.Stop; - AudioPlayback.PlaySound(SoundLib.Back); - - FadeTo(@ScreenMain); - end; - - end; - end - //When in party Mode then Ask before Close - else if (Mode = smPartyMode) then - begin - AudioPlayback.PlaySound(SoundLib.Back); - CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); - end; - end; - SDLK_RETURN: - begin - if Songs.SongList.Count > 0 then - begin - {$IFDEF UseSerialPort} - // PortWriteB($378, 0); - {$ENDIF} - if CatSongs.Song[Interaction].Main then - begin // clicked on Category Button - - //Show Cat in Top Left Mod - ShowCatTL (Interaction); - - //I := CatSongs.VisibleIndex(Interaction); - CatSongs.ClickCategoryButton(Interaction); - {I2 := CatSongs.VisibleIndex(Interaction); - SongCurrent := SongCurrent - I + I2; - SongTarget := SongTarget - I + I2; } - -// if I<>I2 then beep; - // SetScroll4; - - //Show Wrong Song when Tabs on Fix - SelectNext; - FixSelected; - - //Play Music: - ChangeMusic; - - end - else - begin // clicked on song - if (Mode = smNormal) then //Normal Mode -> Start Song - begin - //Do the Action that is specified in Ini - case Ini.OnSongClick of - 0: StartSong; - 1: SelectPlayers; - 2:begin - If (CatSongs.CatNumShow = -3) then - ScreenSongMenu.MenuShow(SM_Playlist) - else - ScreenSongMenu.MenuShow(SM_Main); - end; - end; - end - else if (Mode = smPartyMode) then //PartyMode -> Show Menu - begin - if (Ini.PartyPopup = 1) then - ScreenSongMenu.MenuShow(SM_Party_Main) - else - ScreenSong.StartSong; - end; - end; - end; - end; - - SDLK_M: //Show SongMenu - begin - if (Songs.SongList.Count > 0) then begin - if (Mode = smNormal) then begin - if not CatSongs.Song[Interaction].Main then begin // clicked on Song - if CatSongs.CatNumShow = -3 then - ScreenSongMenu.MenuShow(SM_Playlist) - else - ScreenSongMenu.MenuShow(SM_Main); - end - else - begin - ScreenSongMenu.MenuShow(SM_Playlist_Load); - end; - end //Party Mode -> Show Party Menu - else ScreenSongMenu.MenuShow(SM_Party_Main); - end; - end; - - SDLK_P: //Show Playlist Menu - begin - if (Songs.SongList.Count > 0) AND (Mode = smNormal) then begin - ScreenSongMenu.MenuShow(SM_Playlist_Load); - end; - end; - - SDLK_J: //Show Jumpto Menu - begin - if (Songs.SongList.Count > 0) AND (Mode = smNormal) then - begin - ScreenSongJumpto.Visible := True; - end; - end; - - SDLK_DOWN: - begin - if (Mode = smNormal) then - begin - //Only Change Cat when not in Playlist or Search Mode - if (CatSongs.CatNumShow > -2) then - begin - //Cat Change Hack - if Ini.Tabs_at_startup = 1 then - begin - I := Interaction; - if I <= 0 then I := 1; - - while not catsongs.Song[I].Main do - begin - Inc (I); - if (I > high(catsongs.Song)) then - I := low(catsongs.Song); - end; - - Interaction := I; - - //Show Cat in Top Left Mod - ShowCatTL (Interaction); - - CatSongs.ClickCategoryButton(Interaction); - SelectNext; - FixSelected; - - //Play Music: - AudioPlayback.PlaySound(SoundLib.Change); - ChangeMusic; - - end; - - // - //Cat Change Hack End} - end; - end; - end; - SDLK_UP: - begin - if (Mode = smNormal) then - begin - //Only Change Cat when not in Playlist or Search Mode - if (CatSongs.CatNumShow > -2) then - begin - //Cat Change Hack - if Ini.Tabs_at_startup = 1 then - begin - I := Interaction; - I2 := 0; - if I <= 0 then I := 1; - - while not catsongs.Song[I].Main or (I2 = 0) do - begin - if catsongs.Song[I].Main then - Inc(I2); - Dec (I); - if (I < low(catsongs.Song)) then - I := high(catsongs.Song); - end; - - Interaction := I; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - FixSelected; - - //Play Music: - AudioPlayback.PlaySound(SoundLib.Change); - ChangeMusic; - end; - end; - //Cat Change Hack End} - end; - end; - - SDLK_RIGHT: - begin - if (Songs.SongList.Count > 0) AND (Mode = smNormal) then - begin - AudioPlayback.PlaySound(SoundLib.Change); - SelectNext; -// InteractNext; -// SongTarget := Interaction; - ChangeMusic; - SetScroll4; - UpdateLCD; - Light.LightOne(1, 200); - end; - end; - - SDLK_LEFT: - begin - if (Songs.SongList.Count > 0)AND (Mode = smNormal) then begin - AudioPlayback.PlaySound(SoundLib.Change); - SelectPrev; - ChangeMusic; - SetScroll4; - UpdateLCD; - Light.LightOne(0, 200); - end; - end; - - SDLK_E: - begin - OpenEditor; - end; - - SDLK_R: - begin - if (Songs.SongList.Count > 0) AND (Mode = smNormal) then begin - - if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category - begin - I2 := 0; //Count Cats - for I:= low(CatSongs.Song) to high (CatSongs.Song) do - if CatSongs.Song[I].Main then Inc(I2); - - I2 := Random (I2)+1; //Zufall - - //Find Cat: - for I:= low(CatSongs.Song) to high (CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - Dec(I2); - if (I2<=0) then - begin - //Show Cat in Top Left Mod - ShowCatTL (I); - - Interaction := I; - - CatSongs.ShowCategoryList; - CatSongs.ClickCategoryButton(I); - SelectNext; - FixSelected; - break; - end; - end; - - - end - else if (SDL_ModState = KMOD_LCTRL) AND (Ini.Tabs_at_startup = 1) then //random in All Categorys - begin - repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; - - //Search Cat - for I := I2 downto low(CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - break; - end; - //In I ist jetzt die Kategorie in I2 der Song - - //Choose Cat - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - - //Fix: Not Existing Song selected: - //if (I+1=I2) then Inc(I2); - - //Choose Song - SkipTo(I2-I); - - end - else //Random in one Category - begin - SkipTo(Random(CatSongs.VisibleSongs)); - end; - AudioPlayback.PlaySound(SoundLib.Change); - - ChangeMusic; - SetScroll4; - UpdateLCD; - end; - end; - - SDLK_1: - begin //Jocker // to-do : Party - {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[0].Joker); - SelectRandomSong; - SetJoker; - end; } - end; - - SDLK_2: - begin //Jocker - {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[1].Joker); - SelectRandomSong; - SetJoker; - end; } - end; - - SDLK_3: - begin //Jocker - {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[2].Joker); - SelectRandomSong; - SetJoker; - end; } - end; - end; - end; -end; - -constructor TScreenSong.Create; -var -// Pet: integer; - I: integer; -//Label CreateSongButtons; -begin - inherited Create; - - LoadFromTheme(Theme.Song); - - TextArtist := AddText(Theme.Song.TextArtist); - TextTitle := AddText(Theme.Song.TextTitle); - TextNumber := AddText(Theme.Song.TextNumber); - - //Show Cat in Top Left mod - TextCat := AddText(Theme.Song.TextCat); - StaticCat := AddStatic(Theme.Song.StaticCat); - - //Show Video Icon Mod - VideoIcon := AddStatic(Theme.Song.VideoIcon); - - //Party Mode - StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1); - StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2); - StaticTeam1Joker3 := AddStatic(Theme.Song.StaticTeam1Joker3); - StaticTeam1Joker4 := AddStatic(Theme.Song.StaticTeam1Joker4); - StaticTeam1Joker5 := AddStatic(Theme.Song.StaticTeam1Joker5); - - StaticTeam2Joker1 := AddStatic(Theme.Song.StaticTeam2Joker1); - StaticTeam2Joker2 := AddStatic(Theme.Song.StaticTeam2Joker2); - StaticTeam2Joker3 := AddStatic(Theme.Song.StaticTeam2Joker3); - StaticTeam2Joker4 := AddStatic(Theme.Song.StaticTeam2Joker4); - StaticTeam2Joker5 := AddStatic(Theme.Song.StaticTeam2Joker5); - - StaticTeam3Joker1 := AddStatic(Theme.Song.StaticTeam3Joker1); - StaticTeam3Joker2 := AddStatic(Theme.Song.StaticTeam3Joker2); - StaticTeam3Joker3 := AddStatic(Theme.Song.StaticTeam3Joker3); - StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); - StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); - - //Load Party or NonParty specific Statics and Texts - SetLength(StaticParty, Length(Theme.Song.StaticParty)); - for I := 0 to High(Theme.Song.StaticParty) do - StaticParty[I] := AddStatic(Theme.Song.StaticParty[I]); - - SetLength(TextParty, Length(Theme.Song.TextParty)); - for I := 0 to High(Theme.Song.TextParty) do - TextParty[I] := AddText(Theme.Song.TextParty[I]); - - SetLength(StaticNonParty, Length(Theme.Song.StaticNonParty)); - for I := 0 to High(Theme.Song.StaticNonParty) do - StaticNonParty[I] := AddStatic(Theme.Song.StaticNonParty[I]); - - SetLength(TextNonParty, Length(Theme.Song.TextNonParty)); - for I := 0 to High(Theme.Song.TextNonParty) do - TextNonParty[I] := AddText(Theme.Song.TextNonParty[I]); - - // Song List -// Songs.LoadSongList; // moved to the UltraStar unit - CatSongs.Refresh; - - GenerateThumbnails(); -(* - if (length(CatSongs.Song) > 0) then - begin - //Set Length of Button Array one Time Instead of one time for every Song - SetButtonLength(Length(CatSongs.Song)); - - I := 0; - CreateSongButtons: - - try - for Pet := I to High(CatSongs.Song) do begin // creating all buttons - // new - Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 - - if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then - CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' - - if CatSongs.Song[Pet].Cover = '' then - AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) - else begin - // cache texture if there is a need to this - if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then - begin - Texture.CreateCacheMipmap := true; - Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap - Texture.CreateCacheMipmap := false; - - // puts this texture to the cache file - Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); - - // unload full size texture - Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); - - // we should also add mipmap texture by calling createtexture and use mipmap cache as data source - end; - - // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) - AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); - end; - Texture.Limit := 1024*1024; - I := -1; - end; - except - //When Error is reported the First time for this Song - if (I <> Pet) then - begin - //Some Error reporting: - Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); - - //Change Cover to NoCover and Continue Loading - CatSongs.Song[Pet].Cover := ''; - I := Pet; - end - else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song - begin - Log.LogError('NoCover Cover is damaged!'); - try - AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); - except - {$IFDEF MSWINDOWS} - Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); - {$ELSE} - // TODO : JB_linux - better handle this message and display to user.. - writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'); - Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' ); - {$ENDIF} - Halt; - end; - I := Pet + 1; - end; - end; - - if (I <> -1) then - GoTo CreateSongButtons; - - end; -*) - - // Randomize Patch - Randomize; - //Equalizer - SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); - //ClearArray - For I := low(EqualizerBands) to high(EqualizerBands) do - EqualizerBands[I] := 3; - - if (Length(CatSongs.Song) > 0) then - Interaction := 0; -end; - -procedure TScreenSong.GenerateThumbnails(); -var - I : Integer; - Pet: integer; -Label CreateSongButtons; -begin - if (length(CatSongs.Song) > 0) then - begin - //Set Length of Button Array one Time Instead of one time for every Song - SetButtonLength(Length(CatSongs.Song)); - - I := 0; - CreateSongButtons: - - try - for Pet := I to High(CatSongs.Song) do begin // creating all buttons - // new - Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 - - if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then - CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' - - if CatSongs.Song[Pet].Cover = '' then - AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) - else begin - // cache texture if there is a need to this - if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then - begin - Texture.CreateCacheMipmap := true; - Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap - Texture.CreateCacheMipmap := false; - - // puts this texture to the cache file - Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); - - // unload full size texture - Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); - - // we should also add mipmap texture by calling createtexture and use mipmap cache as data source - end; - - // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) - AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); - end; - Texture.Limit := 1024*1024; - I := -1; - end; - except - //When Error is reported the First time for this Song - if (I <> Pet) then - begin - //Some Error reporting: - Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); - - //Change Cover to NoCover and Continue Loading - CatSongs.Song[Pet].Cover := ''; - I := Pet; - end - else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song - begin - Log.LogError('NoCover Cover is damaged!'); - try - AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); - except - {$IFDEF MSWINDOWS} - Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); - {$ELSE} - // TODO : JB_linux - better handle this message and display to user.. - writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'); - Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' ); - {$ENDIF} - Halt; - end; - I := Pet + 1; - end; - end; - - if (I <> -1) then - GoTo CreateSongButtons; - - end; -end; - -procedure TScreenSong.SetScroll; -var - VS, B: Integer; -begin - VS := CatSongs.VisibleSongs; - if VS > 0 then - begin - //Set Positions - Case Theme.Song.Cover.Style of - 3: SetScroll3; - 5:begin - if VS > 5 then - SetScroll5 - else - SetScroll4; - end; - 6: SetScroll6; - else SetScroll4; - end; - //Set Visibility of Video Icon - Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> ''); - - //Set Texts: - Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; - Text[TextTitle].Text := CatSongs.Song[Interaction].Title; - if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then - begin - Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); - Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; - end - else if (CatSongs.CatNumShow = -2) then - Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) - else if (CatSongs.CatNumShow = -3) then - Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) - else if (Ini.Tabs_at_startup = 1) then - Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) - else - Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); - end - else - begin - Text[TextNumber].Text := '0/0'; - Text[TextArtist].Text := ''; - Text[TextTitle].Text := ''; - for B := 0 to High(Button) do - Button[B].Visible := False; - - end; -end; - -procedure TScreenSong.SetScroll1; -var - B: integer; // button - BMin: integer; // button min - BMax: integer; // button max - Src: integer; -// Dst: integer; - Count: integer; // Dst is not used. Count is used. - Ready: boolean; - - VisCount: integer; // count of visible (or selectable) buttons - VisInt: integer; // visible position of interacted button - Typ: integer; // 0 when all songs fits the screen - Placed: integer; // number of placed visible buttons -begin -// Src := 0; -// Dst := -1; - Count := 1; - Typ := 0; - Ready := false; - Placed := 0; - - VisCount := 0; - for B := 0 to High(Button) do - if CatSongs.Song[B].Visible then Inc(VisCount); - - VisInt := 0; - for B := 0 to Interaction-1 do - if CatSongs.Song[B].Visible then Inc(VisInt); - - - if VisCount <= 6 then begin - Typ := 0; - end else begin - if VisInt <= 3 then begin - Typ := 1; - Count := 7; - Ready := true; - end; - - if (VisCount - VisInt) <= 3 then begin - Typ := 2; - Count := 7; - Ready := true; - end; - - if not Ready then begin - Typ := 3; - Src := Interaction; - end; - end; - - - - // hide all buttons - for B := 0 to High(Button) do begin - Button[B].Visible := false; - Button[B].Selectable := CatSongs.Song[B].Visible; - end; - -{ for B := Src to Dst do begin -// Button[B].Visible := true; - Button[B].Visible := CatSongs.Song[B].Visible; - Button[B].Selectable := Button[B].Visible; - Button[B].Y := 140 + (B-Src) * 60; - end;} - - - if Typ = 0 then begin - for B := 0 to High(Button) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (Placed) * 60; - Inc(Placed); - end; - end; - end; - - if Typ = 1 then begin - B := 0; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Inc(B); - end; - end; - - if Typ = 2 then begin - B := High(Button); - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (6-Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Dec(B); - end; - end; - - if Typ = 3 then begin - B := Src; - Count := 4; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (3+Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Inc(B); - end; - - B := Src-1; - Placed := 0; - Count := 3; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin - Button[B].Visible := true; - Button[B].Y := 140 + (2-Placed) * 60; - Inc(Placed); - Dec(Count); - end; - Dec(B); - end; - - end; - - if Length(Button) > 0 then - Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture -end; - -procedure TScreenSong.SetScroll2; -var - B: integer; - Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu - Wsp2: real; -begin - // liniowe - for B := 0 to High(Button) do - Button[B].X := 300 + (B - Interaction) * 260; - - if Length(Button) >= 3 then begin - if Interaction = 0 then - Button[High(Button)].X := 300 - 260; - - if Interaction = High(Button) then - Button[0].X := 300 + 260; - end; - - // kolowe -{ for B := 0 to High(Button) do begin - Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. - Wsp2 := Wsp / Length(Button); - Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); -// Button[B].Y := 140 + 50 * ; - end;} -end; - -procedure TScreenSong.SetScroll3; // with slide -var - B: integer; - Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu - Wsp2: real; -begin - SongTarget := Interaction; - - // liniowe - for B := 0 to High(Button) do - begin - Button[B].X := 300 + (B - SongCurrent) * 260; - if (Button[B].X < -Button[B].W) OR (Button[B].X > 800) then - Button[B].Visible := False - else - Button[B].Visible := True; - end; - -{ if Length(Button) >= 3 then begin - if Interaction = 0 then - Button[High(Button)].X := 300 - 260; - - if Interaction = High(Button) then - Button[0].X := 300 + 260; - end;} - - // kolowe -{ for B := 0 to High(Button) do begin - Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. - Wsp2 := Wsp / Length(Button); - Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); -// Button[B].Y := 140 + 50 * ; - end;} -end; - -procedure TScreenSong.SetScroll4; // rotate -var - B: integer; - Wsp: real; - Z, Z2: real; - VS: integer; -begin - VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important - - // kolowe - for B := 0 to High(Button) do begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2; - Z2 := (1 + 2*Z) / 3; - - - Button[B].X := Theme.Song.Cover.X + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - Button[B].Z := Z / 2 + 0.3; - - Button[B].W := Theme.Song.Cover.H * Z2; - -// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; - Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; - Button[B].H := Button[B].W; - end; - end; -end; - -(* -procedure TScreenSong.SetScroll4; // rotate -var - B: integer; - Wsp: real; - Z: real; - Z2, Z3: real; - VS: integer; - function modreal (const X, Y: real):real; - begin - Result := Frac(x / y) * y; - if Result < -3 then - Result := Result + Y - else if Result > 3 then - Result := Result - Y; - end; -begin - VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important - Z3 := 1; - if VS < 12 then - Z2 := VS - else - Z2 := 12; - - // kolowe - for B := 0 to High(Button) do begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - if ((ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)>-3) AND (ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)<3)) then - begin - if CatSongs.VisibleIndex(B)> SongCurrent then - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2 - else - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2; - - Z3 := 2; - Z := (1 + cos(Wsp)) / 2; - //Z2 := (1 + 2*Z) / 3; - //Z2 := (0.5 + Z/2); - //Z2 := sin(Wsp); - - //Z2 := Power (Z2,Z3); - - Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); - - //Button[B].X := Theme.Song.CoverX + ({Theme.Song.CoverX + Theme.Song.CoverW/2 + Theme.Song.CoverW*0.18 * VS {CatSongs.VisibleSongs {Length(Button) * sin(Wsp) {- Theme.Song.CoverX - Theme.Song.CoverW) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - if (sin(Wsp)<0) then - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W - else //*Theme.Song.CoverW*0.004*Z3 - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; - Button[B].Z := Z-0.00001; - -// Button[B].Y := {50 + 140 + 50 - 50 * Z2; - // Button[B].Y := (Theme.Song.CoverY + 40 + 50 - 50 * Z2); - Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); - Button[B].H := Button[B].W; - Button[B].Visible := True; - end - {else if (((CatSongs.VisibleIndex(B) - SongCurrent)>-3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) OR ((round (CatSongs.VisibleIndex(B) - SongCurrent) mod VS > -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) then - begin - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / 12 ;// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2 -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); - - if (sin(Wsp)<0) then - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W - else - Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; - - Button[B].Z := Z; - - Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); - - Button[B].H := Button[B].W; - Button[B].Visible := True; - end - else Button[B].Visible := False; - end; - end; -end; *) - -procedure TScreenSong.SetScroll5; // rotate -var - B: integer; - Angle: real; - Pos: Real; - VS: integer; - diff: real; - X: Real; - helper: real; -begin - VS := CatSongs.VisibleSongs; // cache Visible Songs - {Vars - Theme.Song.CoverW: Radius des Kreises - Theme.Song.CoverX: X Pos Linke Kante des gewählten Covers - Theme.Song.CoverX: Y Pos Obere Kante des gewählten Covers - Theme.Song.CoverH: Höhe der Cover - - (CatSongs.VisibleIndex(B) - SongCurrent)/VS = Abstand zum MIttleren Cover in % - } - - //Change Pos of all Buttons - for B := low(Button) to high(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility - if Button[B].Visible then //Only Change Pos for Visible Buttons - begin - Pos := (CatSongs.VisibleIndex(B) - SongCurrent); - if (Pos < -VS/2) then - Pos := Pos + VS - else if (Pos > VS/2) then - Pos := Pos - VS; - - if (Abs(Pos) < 2.5) then {fixed Positions} - begin - Angle := Pi * (Pos / 5); -// Button[B].Visible := False; - - Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); - -// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Z := 0.95 - Abs(Pos) * 0.01; - - Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); - - Button[B].W := Button[B].H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - - X := Sin(Angle*1.3)*0.9; - - Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Diff; - - end - else - begin {Behind the Front Covers} - - // limit-bg-covers hack - if (abs(abs(Pos)-VS/2)>10) then Button[B].Visible:=False; - // end of limit-bg-covers hack - - if Pos < 0 then - Pos := (Pos - VS/2)/VS - else - Pos := (Pos + VS/2)/VS; - - Angle := pi * Pos*2; - if VS > 24 then - begin - if Angle < 0 then helper:=-1 else helper:=1; - Angle:=2*pi-abs(Angle); - Angle:=Angle*(VS/24); - Angle:=(2*pi-Angle)*helper; - end; - - Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); - - Button[B].W := Button[B].H; - - Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; - -// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*((Theme.Song.Cover.H)*sin(Angle/2)*1.52); - - end; - - //Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field -// Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); - - end; - end; -end; - -procedure TScreenSong.SetScroll6; // rotate (slotmachine style) -var - B: integer; - Angle: real; - Pos: Real; - VS: integer; - diff: real; - X: Real; - Wsp: real; - Z, Z2: real; -begin - VS := CatSongs.VisibleSongs; // cache Visible Songs - if VS <=5 then begin - // kolowe - for B := 0 to High(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe - if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - - Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Wsp)) / 2; - Z2 := (1 + 2*Z) / 3; - - - Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - Button[B].Z := Z / 2 + 0.3; - - Button[B].W := Theme.Song.Cover.H * Z2; - -// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; - Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; - Button[B].H := Button[B].W; - end; - end; - end - else begin - - //Change Pos of all Buttons - for B := low(Button) to high(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility - if Button[B].Visible then //Only Change Pos for Visible Buttons - begin - Pos := (CatSongs.VisibleIndex(B) - SongCurrent); - if (Pos < -VS/2) then - Pos := Pos + VS - else if (Pos > VS/2) then - Pos := Pos - VS; - - if (Abs(Pos) < 2.5) then {fixed Positions} - begin - Angle := Pi * (Pos / 5); -// Button[B].Visible := False; - - Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); - - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Z := 0.95 - Abs(Pos) * 0.01; - - Button[B].X := (Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); - - Button[B].W := Button[B].H; - - Diff := (Button[B].H - Theme.Song.Cover.H)/2; - - - X := Sin(Angle*1.3)*0.9; - - Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff; - end - else - begin {Behind the Front Covers} - - // limit-bg-covers hack - if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; - if VS > 25 then VS:=25; - // end of limit-bg-covers hack - - if Pos < 0 then - Pos := (Pos - VS/2)/VS - else - Pos := (Pos + VS/2)/VS; - - Angle := pi * Pos*2; - - Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers - - Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); - - Button[B].W := Button[B].H; - - Button[B].X := Theme.Song.Cover.X - (Button[B].H - Theme.Song.Cover.H)*0.5; - - - Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - - Button[B].Y := Theme.Song.Cover.Y+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*(Theme.Song.Cover.H*sin(Angle/2)*1.52); - end; - end; - end; - end; -end; - - -procedure TScreenSong.onShow; -begin - AudioPlayback.Stop; - - if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; - if Ini.Players = 4 then PlayersPlay := 6; - - //Cat Mod etc - if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then - begin - CatSongs.ShowCategoryList; - FixSelected; - //Show Cat in Top Left Mod - HideCatTL; - end; - - - if Length(CatSongs.Song) > 0 then begin - //Load Music only when Song Preview is activated - if ( Ini.PreviewVolume <> 0 ) then - begin - if(AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3)) then - begin - AudioPlayback.SetLoop(false); - AudioPlayback.Position := AudioPlayback.Length / 4; - AudioPlayback.Play; - - //Set Preview Volume - AudioPlayback.SetMusicVolume (Ini.PreviewVolume * 10); - {//if Music Fade is activated, Set Volume to 0 % - if (Ini.PreviewFading <> 0) then - Music.SetMusicVolume(0);} - end; - end; - - SetScroll; - UpdateLCD; - end; - - //Playlist Mode - if (Mode = smNormal) then - begin - //If Playlist Shown -> Select Next automatically - if (CatSongs.CatNumShow = -3) then - begin - SelectNext; - ChangeMusic; - end; - end - //Party Mode - else if (Mode = smPartyMode) then - begin - - SelectRandomSong; - //Show Menu directly in PartyMode - //But only if selected in Options - if (Ini.PartyPopup = 1) then - begin - ScreenSongMenu.MenuShow(SM_Party_Main); - end; - - - end; - - SetJoker; - SetStatics; -end; - -procedure TScreenSong.onHide; -begin - //When Music Fading is activated, Turn Music to 100 % - If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then - AudioPlayback.SetMusicVolume(100); - - //If Preview is deactivated: Load MUsicfile now - If (Ini.PreviewVolume = 0) then - AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); - - //When hide then Stop Music (For Party Mode Popup on Exit) - if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (AudioPlayback <> nil) then - AudioPlayback.Stop; -end; - -procedure TScreenSong.DrawExtensions; -begin - //Draw Song Menu - if (ScreenSongMenu.Visible) then - begin - ScreenSongMenu.Draw; - end - else if (ScreenSongJumpto.Visible) then - begin - ScreenSongJumpto.Draw; - end -end; - -function TScreenSong.Draw: boolean; -var - dx: real; - dt: real; - I: Integer; -begin - dx := SongTarget-SongCurrent; - dt := TimeSkip * 7; - -// writeln( 'TScreenSong.Draw '+ inttostr(trunc(TimeSkip)) ); - - if dt > 1 then - dt := 1; - - SongCurrent := SongCurrent + dx*dt; - -{ if SongCurrent > Catsongs.VisibleSongs then begin - SongCurrent := SongCurrent - Catsongs.VisibleSongs; - SongTarget := SongTarget - Catsongs.VisibleSongs; - end;} - -// Log.BenchmarkStart(5); - SetScroll; -// Log.BenchmarkEnd(5); -// Log.LogBenchmark('SetScroll4', 5); - - //Fading Functions, Only if Covertime is under 5 Seconds - If (CoverTime < 5) then - begin - // 0.5.0: cover fade - if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then - begin - // load new texture - Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); - Button[Interaction].Texture.Alpha := 1; - Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); - Button[Interaction].Texture2.Alpha := 1; - end; - - //Song Fade - if (CatSongs.VisibleSongs > 0) AND (Ini.PreviewVolume <> 0) AND (Not CatSongs.Song[Interaction].Main) AND (Ini.PreviewFading <> 0) then - begin - //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling - if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then - AudioPlayback.Play; - - //Update Song Volume - if (CoverTime < Ini.PreviewFading) then - AudioPlayback.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) - else - AudioPlayback.SetMusicVolume(Ini.PreviewVolume * 10); - - end; - - - //Update Fading Time - CoverTime := CoverTime + TimeSkip; - - //Update Fading Texture - Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; - if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; - - end; - - //inherited Draw; - //heres a little Hack, that causes the Statics - //are Drawn after the Buttons because of some Blending Problems. - //This should cause no Problems because all Buttons on this screen - //Has Z Position. - //Draw BG - DrawBG; - - //Instead of Draw FG Procedure: - //We draw Buttons for our own - for I := 0 to Length(Button) - 1 do - Button[I].Draw; - - // Statics - for I := 0 to Length(Static) - 1 do - Static[I].Draw; - - // and texts - for I := 0 to Length(Text) - 1 do - Text[I].Draw; - - - //Draw Equalizer - if Theme.Song.Equalizer.Visible then - DrawEqualizer; - - DrawExtensions; - -end; - -procedure TScreenSong.SelectNext; -var - Skip: integer; - I: integer; - VS: Integer; -begin - VS := CatSongs.VisibleSongs; - - if VS > 0 then - begin - UnLoadDetailedCover; - - Skip := 1; - - // this 1 could be changed by CatSongs.FindNextVisible - while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); - - SongTarget := SongTarget + 1;//Skip; - - Interaction := (Interaction + Skip) mod Length(Interactions); - - // try to keep all at the beginning - if SongTarget > VS-1 then begin - SongTarget := SongTarget - VS; - SongCurrent := SongCurrent - VS; - end; - - end; - // Interaction -> Button, ktorego okladke przeczytamy - // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture -end; - -procedure TScreenSong.SelectPrev; -var - Skip: integer; - I: integer; - VS: Integer; -begin - VS := CatSongs.VisibleSongs; - - if VS > 0 then - begin - UnLoadDetailedCover; - - Skip := 1; - - while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); - SongTarget := SongTarget - 1;//Skip; - - Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); - - // try to keep all at the beginning - if SongTarget < 0 then begin - SongTarget := SongTarget + CatSongs.VisibleSongs; - SongCurrent := SongCurrent + CatSongs.VisibleSongs; - end; - - // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture - end; -end; - -procedure TScreenSong.UpdateLCD; -begin - LCD.HideCursor; - LCD.Clear; - LCD.WriteText(1, Text[TextArtist].Text); - LCD.WriteText(2, Text[TextTitle].Text); -end; - -//Procedure Change current played Preview -procedure TScreenSong.ChangeMusic; -begin - //When Music Preview is avtivated -> then Change Music - if (Ini.PreviewVolume <> 0) then - begin - if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then - begin - AudioPlayback.Close; - if AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin - AudioPlayback.Position := AudioPlayback.Length / 4; - //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal - if (Ini.PreviewFading = 0) then - AudioPlayback.Play - else - AudioPlayback.SetMusicVolume(0); - end; - end - else - AudioPlayback.Stop; - end; -end; - -procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0 -var - Skip: integer; - I: integer; -begin - UnLoadDetailedCover; - - Interaction := High(CatSongs.Song); - SongTarget := 0; - - for I := 1 to Target+1 do - SelectNext; - - FixSelected2; -end; - -procedure TScreenSong.DrawEqualizer; -var - I, J: Integer; - Res: byte; - A, B: Integer; - PosX, PosY: Integer; - Pos: Real; - lTmp : double; -begin - -if (not AudioPlayback.Finished) AND (Theme.Song.Equalizer.Length > 0) then -begin - - {$ifdef win32} - A := GetTickCount div 44; - - if (A <> EqualizerTime) then - begin - EqualizerTime := A; - AudioPlayback.GetFFTData(EqualizerData); - - B := 0; - Pos := 0; - Res := ceil(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band - - //Change Lengths - for I := 0 to (Res * Theme.Song.Equalizer.Bands - 1) do - begin - A := floor(I/Res); - - if (A<>B) then //Band changed - begin - if (Pos <= Theme.Song.Equalizer.Length) then - begin - if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then - EqualizerBands[B] := EqualizerBands[B] - 1 - else - EqualizerBands[B] := floor(Pos); - end - else - EqualizerBands[B] := 1; - - B := A; - Pos := 0; - end; - - if I > 35 then - EqualizerData[i] := EqualizerData[i] * 8 - else if I > 11 then - EqualizerData[i] := EqualizerData[i] * 4.5 - else - EqualizerData[i] := EqualizerData[i] * 1.1; - - if (EqualizerData[i] >= 1) then - EqualizerData[i] := 0.9999999999999; - - try - if ( assigned( Theme ) ) AND - ( assigned( Theme.Song ) ) AND - ( i < length( EqualizerData ) ) THEN - begin - if single( EqualizerData[i] ) > 1 then - begin - lTmp := Single(EqualizerData[i]) * Theme.Song.Equalizer.Length; - if lTmp > Pos then - Pos := lTmp; - end; - end; - except - {$IFDEF FPC} - on E:EInvalidOp do - writeln( 'UScreenSong - DOH !!!! ('+inttostr(i)+' '+ inttostr( integer( EqualizerData[i] ) )+' * '+ ')' ); - {$ENDIF} - end - - end; - - //Change Last Band - if (EqualizerBands[B] <= Theme.Song.Equalizer.Length) then - begin - if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then - EqualizerBands[B] := EqualizerBands[B] - 1 - else - EqualizerBands[B] := floor(Pos) - end - 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 - glDisable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - - PosY := Theme.Song.Equalizer.Y; - PosX := Theme.Song.Equalizer.X; - - For I := 0 to Theme.Song.Equalizer.Bands-1 do - begin - if Theme.Song.Equalizer.Direction then - PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length - else - PosX := Theme.Song.Equalizer.X; - //Draw for every visible quad - for J := 1 to EqualizerBands[I] do - begin - glBegin(GL_QUADS); - glVertex3f(PosX, PosY, Theme.Song.Equalizer.Z); - glVertex3f(PosX, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); - glVertex3f(PosX+Theme.Song.Equalizer.W, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); - glVertex3f(PosX+Theme.Song.Equalizer.W, PosY, Theme.Song.Equalizer.Z); - glEnd; - - if Theme.Song.Equalizer.Direction then //Vertically - PosY := PosY - Theme.Song.Equalizer.H - Theme.Song.Equalizer.Space - else //Horizontally - PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space; - end; - if Theme.Song.Equalizer.Direction then //Horizontally - PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space - else //Vertically - PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space; - end; -end; -end; - -Procedure TScreenSong.SelectRandomSong; -var - I, I2: Integer; -begin - Case PlaylistMan.Mode of - smNormal: //All Songs Just Select Random Song - begin - //When Tabs are activated then use Tab Method - if (Ini.Tabs_at_startup = 1) then - begin - repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; - - //Search Cat - for I := I2 downto low(CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - break; - end; - //In I ist jetzt die Kategorie in I2 der Song - //I is the CatNum, I2 is the No of the Song within this Cat - - //Choose Cat - CatSongs.ShowCategoryList; - - //Show Cat in Top Left Mod - ShowCatTL (I); - - CatSongs.ClickCategoryButton(I); - SelectNext; - - //Choose Song - SkipTo(I2-I); - end - //When Tabs are deactivated use easy Method - else - SkipTo(Random(CatSongs.VisibleSongs)); - end; - smPartyMode: //One Category Select Category and Select Random Song - begin - CatSongs.ShowCategoryList; - CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); - ShowCatTL(PlaylistMan.CurPlayList); - - SelectNext; - FixSelected2; - - SkipTo(Random(CatSongs.VisibleSongs)); - end; - smPlaylistRandom: //Playlist: Select Playlist and Select Random Song - begin - PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); - - SkipTo(Random(CatSongs.VisibleSongs)); - FixSelected2; - end; - end; - - AudioPlayback.PlaySound(SoundLib.Change); - ChangeMusic; - SetScroll; - UpdateLCD; -end; - -procedure TScreenSong.SetJoker; -begin - {//If Party Mode - // to-do : Party - if Mode = smPartyMode then //Show Joker that are available - begin - if (PartySession.Teams.NumTeams >= 1) then - begin - Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1); - Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2); - Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3); - Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4); - Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5); - end - else - begin - Static[StaticTeam1Joker1].Visible := False; - Static[StaticTeam1Joker2].Visible := False; - Static[StaticTeam1Joker3].Visible := False; - Static[StaticTeam1Joker4].Visible := False; - Static[StaticTeam1Joker5].Visible := False; - end; - - if (PartySession.Teams.NumTeams >= 2) then - begin - Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1); - Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2); - Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3); - Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4); - Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5); - end - else - begin - Static[StaticTeam2Joker1].Visible := False; - Static[StaticTeam2Joker2].Visible := False; - Static[StaticTeam2Joker3].Visible := False; - Static[StaticTeam2Joker4].Visible := False; - Static[StaticTeam2Joker5].Visible := False; - end; - - if (PartySession.Teams.NumTeams >= 3) then - begin - Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1); - Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2); - Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3); - Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4); - Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5); - end - else - begin - Static[StaticTeam3Joker1].Visible := False; - Static[StaticTeam3Joker2].Visible := False; - Static[StaticTeam3Joker3].Visible := False; - Static[StaticTeam3Joker4].Visible := False; - Static[StaticTeam3Joker5].Visible := False; - end; - end - else - begin //Hide all - Static[StaticTeam1Joker1].Visible := False; - Static[StaticTeam1Joker2].Visible := False; - Static[StaticTeam1Joker3].Visible := False; - Static[StaticTeam1Joker4].Visible := False; - Static[StaticTeam1Joker5].Visible := False; - - Static[StaticTeam2Joker1].Visible := False; - Static[StaticTeam2Joker2].Visible := False; - Static[StaticTeam2Joker3].Visible := False; - Static[StaticTeam2Joker4].Visible := False; - Static[StaticTeam2Joker5].Visible := False; - - Static[StaticTeam3Joker1].Visible := False; - Static[StaticTeam3Joker2].Visible := False; - Static[StaticTeam3Joker3].Visible := False; - Static[StaticTeam3Joker4].Visible := False; - Static[StaticTeam3Joker5].Visible := False; - end; } -end; - -procedure TScreenSong.SetStatics; -var - I: Integer; - Visible: Boolean; -begin - //Set Visibility of Party Statics and Text - Visible := (Mode = smPartyMode); - - For I := 0 to high(StaticParty) do - Static[StaticParty[I]].Visible := Visible; - - For I := 0 to high(TextParty) do - Text[TextParty[I]].Visible := Visible; - - //Set Visibility of Non Party Statics and Text - Visible := not Visible; - - For I := 0 to high(StaticNonParty) do - Static[StaticNonParty[I]].Visible := Visible; - - For I := 0 to high(TextNonParty) do - Text[TextNonParty[I]].Visible := Visible; -end; - -//Procedures for Menu - -procedure TScreenSong.StartSong; -begin - CatSongs.Selected := Interaction; - AudioPlayback.Stop; - //Party Mode - if (Mode = smPartyMode) then - begin - FadeTo(@ScreenSingModi); - end - else - begin - FadeTo(@ScreenSing); - end; -end; - -procedure TScreenSong.SelectPlayers; -begin - CatSongs.Selected := Interaction; - AudioPlayback.Stop; - - ScreenName.Goto_SingScreen := True; - FadeTo(@ScreenName); -end; - -procedure TScreenSong.OpenEditor; -begin - if (Songs.SongList.Count > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = smNormal) then - begin - AudioPlayback.Stop; - AudioPlayback.PlaySound(SoundLib.Start); - ScreenEditSub.Path := CatSongs.Song[Interaction].Path; - ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName; - FadeTo(@ScreenEditSub); - end; -end; - -//Team No of Team (0-5) -procedure TScreenSong.DoJoker (Team: Byte); -begin - {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then - begin - //Joker spielen - Dec(PartySession.Teams.Teaminfo[Team].Joker); - SelectRandomSong; - SetJoker; - end; } -end; - -//Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song -procedure TScreenSong.UnLoadDetailedCover; -begin - CoverTime := 0; - - Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture - Button[Interaction].Texture2.Alpha := 0; - - if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then - Texture.UnloadTexture(Button[Interaction].Texture.Name, false); -end; - -procedure TScreenSong.Refresh; -begin { -CatSongs.Refresh; -CatSongs.ShowCategoryList; -Interaction := 0; -SelectNext; -FixSelected; } - -end; - -end. +unit UScreenSong; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +uses + UMenu, + SDL, + UMusic, + UFiles, + UTime, + UDisplay, + USongs, + SysUtils, + ULog, + UThemes, + UTexture, + ULanguage, + ULCD, + ULight, + USong, + UIni; + +type + TScreenSong = class(TMenu) + private + EqualizerData: TFFTData; // moved here to avoid stack overflows + EqualizerBands: array of Byte; + EqualizerTime: Cardinal; + EqualizerTime2: Byte; + public + TextArtist: integer; + TextTitle: integer; + TextNumber: integer; + + //Video Icon Mod + VideoIcon: Cardinal; + + TextCat: integer; + StaticCat: integer; + + SongCurrent: real; + SongTarget: real; + + HighSpeed: boolean; + CoverFull: boolean; + CoverTime: real; + CoverX: integer; + CoverY: integer; + CoverW: integer; + is_jump: boolean; // Jump to Song Mod + is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title + + //Party Mod + Mode: TSingMode; + + //party Statics (Joker) + StaticTeam1Joker1: Cardinal; + StaticTeam1Joker2: Cardinal; + StaticTeam1Joker3: Cardinal; + StaticTeam1Joker4: Cardinal; + StaticTeam1Joker5: Cardinal; + + StaticTeam2Joker1: Cardinal; + StaticTeam2Joker2: Cardinal; + StaticTeam2Joker3: Cardinal; + StaticTeam2Joker4: Cardinal; + StaticTeam2Joker5: Cardinal; + + StaticTeam3Joker1: Cardinal; + StaticTeam3Joker2: Cardinal; + StaticTeam3Joker3: Cardinal; + StaticTeam3Joker4: Cardinal; + StaticTeam3Joker5: Cardinal; + + StaticParty: Array of Cardinal; + TextParty: Array of Cardinal; + StaticNonParty: Array of Cardinal; + TextNonParty: Array of Cardinal; + + + constructor Create; override; + procedure SetScroll; + procedure SetScroll1; + procedure SetScroll2; + procedure SetScroll3; + procedure SetScroll4; + procedure SetScroll5; + procedure SetScroll6; + function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure GenerateThumbnails(); + procedure onShow; override; + procedure onHide; override; + procedure SelectNext; + procedure SelectPrev; + procedure UpdateLCD; + procedure SkipTo(Target: Cardinal); + procedure FixSelected; //Show Wrong Song when Tabs on Fix + procedure FixSelected2; //Show Wrong Song when Tabs on Fix + procedure ShowCatTL(Cat: Integer);// Show Cat in Top left + procedure ShowCatTLCustom(Caption: String);// Show Custom Text in Top left + procedure HideCatTL;// Show Cat in Tob left + procedure Refresh; //Refresh Song Sorting + procedure DrawEqualizer; + procedure ChangeMusic; + //Party Mode + procedure SelectRandomSong; + procedure SetJoker; + procedure SetStatics; + //procedures for Menu + procedure StartSong; + procedure OpenEditor; + procedure DoJoker(Team: Byte); + procedure SelectPlayers; + + procedure UnLoadDetailedCover; + + //Extensions + procedure DrawExtensions; + end; + +implementation +uses UGraphic, + UMain, + UCovers, + math, + OpenGL12, + {$IFDEF win32} + windows, + {$ELSE} + lclintf, + {$ENDIF} + USkins, + UDLLManager, + UParty, + UPlaylist, + UScreenSongMenu; + +// ***** Public methods ****** // + +//Show Wrong Song when Tabs on Fix +procedure TScreenSong.FixSelected; +var I, I2: Integer; + begin + if CatSongs.VisibleSongs > 0 then + begin + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); + + if I = Interaction - 1 then + break; + end; + + SongCurrent := I2; + SongTarget := I2; + end; + end; + +procedure TScreenSong.FixSelected2; +var I, I2: Integer; + begin + if CatSongs.VisibleSongs > 0 then + begin + I2:= 0; + for I := low(CatSongs.Song) to High(Catsongs.Song) do + begin + if CatSongs.Song[I].Visible then + inc(I2); + + if I = Interaction - 1 then + break; + end; + + SongTarget := I2; + end; + end; +//Show Wrong Song when Tabs on Fix End + + procedure TScreenSong.ShowCatTLCustom(Caption: String);// Show Custom Text in Top left + begin + Text[TextCat].Text := Caption; + Text[TextCat].Visible := true; + Static[StaticCat].Visible := False; + end; + + //Show Cat in Top Left Mod + procedure TScreenSong.ShowCatTL(Cat: Integer); + begin + //Change + Text[TextCat].Text := CatSongs.Song[Cat].Artist; + //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover); + //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); + + Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); + //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false); + //Button[Cat]. + //Cover + + + //Show + Text[TextCat].Visible := true; + Static[StaticCat].Visible := True; + end; + + procedure TScreenSong.HideCatTL; + begin + //Hide + //Text[TextCat].Visible := false; + Static[StaticCat].Visible := false; + //New -> Show Text specified in Theme + Text[TextCat].Visible := True; + Text[TextCat].Text := Theme.Song.TextCat.Text; + end; + //Show Cat in Top Left Mod End + + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenSong.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; +var + I: integer; + I2: integer; + HS: integer; + SDL_ModState: Word; + Letter: Char; +begin + Result := true; + + //Song Screen Extensions (Jumpto + Menu) + if (ScreenSongMenu.Visible) then + begin + Result := ScreenSongMenu.ParseInput(PressedKey, ScanCode, PressedDown); + Exit; + end + else if (ScreenSongJumpto.Visible) then + begin + Result := ScreenSongJumpto.ParseInput(PressedKey, ScanCode, PressedDown); + Exit; + end; + + If (PressedDown) Then + begin // Key Down + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + + //Jump to Artist/Titel + if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = smNormal) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then + begin + Letter := UpCase(Chr(ScanCode)); + I2 := Length(CatSongs.Song); + + //Jump To Titel + if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then + begin + For I := 1 to high(CatSongs.Song) do + begin + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND + (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND + (widechar(UpperCase(CatSongs.Song[(I + Interaction) mod I2].Title)[1]) = widechar(Letter)) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + + AudioPlayback.PlaySound(SoundLib.Change); + + ChangeMusic; + SetScroll4; + UpdateLCD; + //Break and Exit + Exit; + end; + end; + end + //Jump to Artist + else if (SDL_ModState = KMOD_LALT) then + begin + For I := 1 to high(CatSongs.Song) do + begin + if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND + (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND + (widechar(uppercase(CatSongs.Song[(I + Interaction) mod I2].Artist)[1]) = widechar(Letter)) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + + AudioPlayback.PlaySound(SoundLib.Change); + + ChangeMusic; + SetScroll4; + UpdateLCD; + + //Break and Exit + Exit; + end; + end; + end; + Exit; + end; + + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + if (Mode = smNormal) then + begin + //On Escape goto Cat-List Hack + if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then + begin + //Find Category + I := Interaction; + while not catsongs.Song[I].Main do + begin + Dec (I); + if (I < low(catsongs.Song)) then + break; + end; + if (I<= 1) then + Interaction := high(catsongs.Song) + else + Interaction := I - 1; + + //Stop Music + AudioPlayback.Stop; + + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + HideCatTL; + + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + //SelectPrev; + //CatSongs.Song[0].Visible := False; + end + else + begin + //On Escape goto Cat-List Hack End + //Tabs off and in Search or Playlist -> Go back to Song view + if (CatSongs.CatNumShow < -1) then + begin + //Atm: Set Empty Filter + CatSongs.SetFilter('', 0); + + //Show Cat in Top Left Mod + HideCatTL; + Interaction := 0; + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + + ChangeMusic; + end + else + begin + AudioPlayback.Stop; + AudioPlayback.PlaySound(SoundLib.Back); + + FadeTo(@ScreenMain); + end; + + end; + end + //When in party Mode then Ask before Close + else if (Mode = smPartyMode) then + begin + AudioPlayback.PlaySound(SoundLib.Back); + CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); + end; + end; + SDLK_RETURN: + begin + if Songs.SongList.Count > 0 then + begin + {$IFDEF UseSerialPort} + // PortWriteB($378, 0); + {$ENDIF} + if CatSongs.Song[Interaction].Main then + begin // clicked on Category Button + + //Show Cat in Top Left Mod + ShowCatTL (Interaction); + + //I := CatSongs.VisibleIndex(Interaction); + CatSongs.ClickCategoryButton(Interaction); + {I2 := CatSongs.VisibleIndex(Interaction); + SongCurrent := SongCurrent - I + I2; + SongTarget := SongTarget - I + I2; } + +// if I<>I2 then beep; + // SetScroll4; + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + + //Play Music: + ChangeMusic; + + end + else + begin // clicked on song + if (Mode = smNormal) then //Normal Mode -> Start Song + begin + //Do the Action that is specified in Ini + case Ini.OnSongClick of + 0: StartSong; + 1: SelectPlayers; + 2:begin + If (CatSongs.CatNumShow = -3) then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end; + end; + end + else if (Mode = smPartyMode) then //PartyMode -> Show Menu + begin + if (Ini.PartyPopup = 1) then + ScreenSongMenu.MenuShow(SM_Party_Main) + else + ScreenSong.StartSong; + end; + end; + end; + end; + + SDLK_M: //Show SongMenu + begin + if (Songs.SongList.Count > 0) then begin + if (Mode = smNormal) then begin + if not CatSongs.Song[Interaction].Main then begin // clicked on Song + if CatSongs.CatNumShow = -3 then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end + else + begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); + end; + end //Party Mode -> Show Party Menu + else ScreenSongMenu.MenuShow(SM_Party_Main); + end; + end; + + SDLK_P: //Show Playlist Menu + begin + if (Songs.SongList.Count > 0) AND (Mode = smNormal) then begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); + end; + end; + + SDLK_J: //Show Jumpto Menu + begin + if (Songs.SongList.Count > 0) AND (Mode = smNormal) then + begin + ScreenSongJumpto.Visible := True; + end; + end; + + SDLK_DOWN: + begin + if (Mode = smNormal) then + begin + //Only Change Cat when not in Playlist or Search Mode + if (CatSongs.CatNumShow > -2) then + begin + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then + begin + I := Interaction; + if I <= 0 then I := 1; + + while not catsongs.Song[I].Main do + begin + Inc (I); + if (I > high(catsongs.Song)) then + I := low(catsongs.Song); + end; + + Interaction := I; + + //Show Cat in Top Left Mod + ShowCatTL (Interaction); + + CatSongs.ClickCategoryButton(Interaction); + SelectNext; + FixSelected; + + //Play Music: + AudioPlayback.PlaySound(SoundLib.Change); + ChangeMusic; + + end; + + // + //Cat Change Hack End} + end; + end; + end; + SDLK_UP: + begin + if (Mode = smNormal) then + begin + //Only Change Cat when not in Playlist or Search Mode + if (CatSongs.CatNumShow > -2) then + begin + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then + begin + I := Interaction; + I2 := 0; + if I <= 0 then I := 1; + + while not catsongs.Song[I].Main or (I2 = 0) do + begin + if catsongs.Song[I].Main then + Inc(I2); + Dec (I); + if (I < low(catsongs.Song)) then + I := high(catsongs.Song); + end; + + Interaction := I; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + + //Play Music: + AudioPlayback.PlaySound(SoundLib.Change); + ChangeMusic; + end; + end; + //Cat Change Hack End} + end; + end; + + SDLK_RIGHT: + begin + if (Songs.SongList.Count > 0) AND (Mode = smNormal) then + begin + AudioPlayback.PlaySound(SoundLib.Change); + SelectNext; +// InteractNext; +// SongTarget := Interaction; + ChangeMusic; + SetScroll4; + UpdateLCD; + Light.LightOne(1, 200); + end; + end; + + SDLK_LEFT: + begin + if (Songs.SongList.Count > 0)AND (Mode = smNormal) then begin + AudioPlayback.PlaySound(SoundLib.Change); + SelectPrev; + ChangeMusic; + SetScroll4; + UpdateLCD; + Light.LightOne(0, 200); + end; + end; + + SDLK_E: + begin + OpenEditor; + end; + + SDLK_R: + begin + if (Songs.SongList.Count > 0) AND (Mode = smNormal) then begin + + if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category + begin + I2 := 0; //Count Cats + for I:= low(CatSongs.Song) to high (CatSongs.Song) do + if CatSongs.Song[I].Main then Inc(I2); + + I2 := Random (I2)+1; //Zufall + + //Find Cat: + for I:= low(CatSongs.Song) to high (CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + Dec(I2); + if (I2<=0) then + begin + //Show Cat in Top Left Mod + ShowCatTL (I); + + Interaction := I; + + CatSongs.ShowCategoryList; + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + break; + end; + end; + + + end + else if (SDL_ModState = KMOD_LCTRL) AND (Ini.Tabs_at_startup = 1) then //random in All Categorys + begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; + + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + + //Choose Cat + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Fix: Not Existing Song selected: + //if (I+1=I2) then Inc(I2); + + //Choose Song + SkipTo(I2-I); + + end + else //Random in one Category + begin + SkipTo(Random(CatSongs.VisibleSongs)); + end; + AudioPlayback.PlaySound(SoundLib.Change); + + ChangeMusic; + SetScroll4; + UpdateLCD; + end; + end; + + SDLK_1: + begin //Jocker // to-do : Party + {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[0].Joker); + SelectRandomSong; + SetJoker; + end; } + end; + + SDLK_2: + begin //Jocker + {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[1].Joker); + SelectRandomSong; + SetJoker; + end; } + end; + + SDLK_3: + begin //Jocker + {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[2].Joker); + SelectRandomSong; + SetJoker; + end; } + end; + end; + end; +end; + +constructor TScreenSong.Create; +var +// Pet: integer; + I: integer; +//Label CreateSongButtons; +begin + inherited Create; + + LoadFromTheme(Theme.Song); + + TextArtist := AddText(Theme.Song.TextArtist); + TextTitle := AddText(Theme.Song.TextTitle); + TextNumber := AddText(Theme.Song.TextNumber); + + //Show Cat in Top Left mod + TextCat := AddText(Theme.Song.TextCat); + StaticCat := AddStatic(Theme.Song.StaticCat); + + //Show Video Icon Mod + VideoIcon := AddStatic(Theme.Song.VideoIcon); + + //Party Mode + StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1); + StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2); + StaticTeam1Joker3 := AddStatic(Theme.Song.StaticTeam1Joker3); + StaticTeam1Joker4 := AddStatic(Theme.Song.StaticTeam1Joker4); + StaticTeam1Joker5 := AddStatic(Theme.Song.StaticTeam1Joker5); + + StaticTeam2Joker1 := AddStatic(Theme.Song.StaticTeam2Joker1); + StaticTeam2Joker2 := AddStatic(Theme.Song.StaticTeam2Joker2); + StaticTeam2Joker3 := AddStatic(Theme.Song.StaticTeam2Joker3); + StaticTeam2Joker4 := AddStatic(Theme.Song.StaticTeam2Joker4); + StaticTeam2Joker5 := AddStatic(Theme.Song.StaticTeam2Joker5); + + StaticTeam3Joker1 := AddStatic(Theme.Song.StaticTeam3Joker1); + StaticTeam3Joker2 := AddStatic(Theme.Song.StaticTeam3Joker2); + StaticTeam3Joker3 := AddStatic(Theme.Song.StaticTeam3Joker3); + StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); + StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); + + //Load Party or NonParty specific Statics and Texts + SetLength(StaticParty, Length(Theme.Song.StaticParty)); + for I := 0 to High(Theme.Song.StaticParty) do + StaticParty[I] := AddStatic(Theme.Song.StaticParty[I]); + + SetLength(TextParty, Length(Theme.Song.TextParty)); + for I := 0 to High(Theme.Song.TextParty) do + TextParty[I] := AddText(Theme.Song.TextParty[I]); + + SetLength(StaticNonParty, Length(Theme.Song.StaticNonParty)); + for I := 0 to High(Theme.Song.StaticNonParty) do + StaticNonParty[I] := AddStatic(Theme.Song.StaticNonParty[I]); + + SetLength(TextNonParty, Length(Theme.Song.TextNonParty)); + for I := 0 to High(Theme.Song.TextNonParty) do + TextNonParty[I] := AddText(Theme.Song.TextNonParty[I]); + + // Song List +// Songs.LoadSongList; // moved to the UltraStar unit + CatSongs.Refresh; + + GenerateThumbnails(); +(* + if (length(CatSongs.Song) > 0) then + begin + //Set Length of Button Array one Time Instead of one time for every Song + SetButtonLength(Length(CatSongs.Song)); + + I := 0; + CreateSongButtons: + + try + for Pet := I to High(CatSongs.Song) do begin // creating all buttons + // new + Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 + + if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' + + if CatSongs.Song[Pet].Cover = '' then + AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) + else begin + // cache texture if there is a need to this + if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + begin + Texture.CreateCacheMipmap := true; + Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap + Texture.CreateCacheMipmap := false; + + // puts this texture to the cache file + Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + + // unload full size texture + Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); + + // we should also add mipmap texture by calling createtexture and use mipmap cache as data source + end; + + // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) + AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + end; + Texture.Limit := 1024*1024; + I := -1; + end; + except + //When Error is reported the First time for this Song + if (I <> Pet) then + begin + //Some Error reporting: + Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); + + //Change Cover to NoCover and Continue Loading + CatSongs.Song[Pet].Cover := ''; + I := Pet; + end + else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song + begin + Log.LogError('NoCover Cover is damaged!'); + try + AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); + except + {$IFDEF MSWINDOWS} + Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); + {$ELSE} + // TODO : JB_linux - better handle this message and display to user.. + writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'); + Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' ); + {$ENDIF} + Halt; + end; + I := Pet + 1; + end; + end; + + if (I <> -1) then + GoTo CreateSongButtons; + + end; +*) + + // Randomize Patch + Randomize; + //Equalizer + SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); + //ClearArray + For I := low(EqualizerBands) to high(EqualizerBands) do + EqualizerBands[I] := 3; + + if (Length(CatSongs.Song) > 0) then + Interaction := 0; +end; + +procedure TScreenSong.GenerateThumbnails(); +var + I : Integer; + Pet: integer; +Label CreateSongButtons; +begin + if (length(CatSongs.Song) > 0) then + begin + //Set Length of Button Array one Time Instead of one time for every Song + SetButtonLength(Length(CatSongs.Song)); + + I := 0; + CreateSongButtons: + + try + for Pet := I to High(CatSongs.Song) do begin // creating all buttons + // new + Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 + + if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' + + if CatSongs.Song[Pet].Cover = '' then + AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) + else begin + // cache texture if there is a need to this + if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + begin + Texture.CreateCacheMipmap := true; + Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap + Texture.CreateCacheMipmap := false; + + // puts this texture to the cache file + Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + + // unload full size texture + Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); + + // we should also add mipmap texture by calling createtexture and use mipmap cache as data source + end; + + // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) + AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + end; + Texture.Limit := 1024*1024; + I := -1; + end; + except + //When Error is reported the First time for this Song + if (I <> Pet) then + begin + //Some Error reporting: + Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); + + //Change Cover to NoCover and Continue Loading + CatSongs.Song[Pet].Cover := ''; + I := Pet; + end + else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song + begin + Log.LogError('NoCover Cover is damaged!'); + try + AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); + except + {$IFDEF MSWINDOWS} + Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); + {$ELSE} + // TODO : JB_linux - better handle this message and display to user.. + writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'); + Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' ); + {$ENDIF} + Halt; + end; + I := Pet + 1; + end; + end; + + if (I <> -1) then + GoTo CreateSongButtons; + + end; +end; + +procedure TScreenSong.SetScroll; +var + VS, B: Integer; +begin + VS := CatSongs.VisibleSongs; + if VS > 0 then + begin + //Set Positions + Case Theme.Song.Cover.Style of + 3: SetScroll3; + 5:begin + if VS > 5 then + SetScroll5 + else + SetScroll4; + end; + 6: SetScroll6; + else SetScroll4; + end; + //Set Visibility of Video Icon + Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> ''); + + //Set Texts: + Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; + Text[TextTitle].Text := CatSongs.Song[Interaction].Title; + if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then + begin + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); + Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; + end + else if (CatSongs.CatNumShow = -2) then + Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) + else if (CatSongs.CatNumShow = -3) then + Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) + else if (Ini.Tabs_at_startup = 1) then + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) + else + Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); + end + else + begin + Text[TextNumber].Text := '0/0'; + Text[TextArtist].Text := ''; + Text[TextTitle].Text := ''; + for B := 0 to High(Button) do + Button[B].Visible := False; + + end; +end; + +procedure TScreenSong.SetScroll1; +var + B: integer; // button + BMin: integer; // button min + BMax: integer; // button max + Src: integer; +// Dst: integer; + Count: integer; // Dst is not used. Count is used. + Ready: boolean; + + VisCount: integer; // count of visible (or selectable) buttons + VisInt: integer; // visible position of interacted button + Typ: integer; // 0 when all songs fits the screen + Placed: integer; // number of placed visible buttons +begin +// Src := 0; +// Dst := -1; + Count := 1; + Typ := 0; + Ready := false; + Placed := 0; + + VisCount := 0; + for B := 0 to High(Button) do + if CatSongs.Song[B].Visible then Inc(VisCount); + + VisInt := 0; + for B := 0 to Interaction-1 do + if CatSongs.Song[B].Visible then Inc(VisInt); + + + if VisCount <= 6 then begin + Typ := 0; + end else begin + if VisInt <= 3 then begin + Typ := 1; + Count := 7; + Ready := true; + end; + + if (VisCount - VisInt) <= 3 then begin + Typ := 2; + Count := 7; + Ready := true; + end; + + if not Ready then begin + Typ := 3; + Src := Interaction; + end; + end; + + + + // hide all buttons + for B := 0 to High(Button) do begin + Button[B].Visible := false; + Button[B].Selectable := CatSongs.Song[B].Visible; + end; + +{ for B := Src to Dst do begin +// Button[B].Visible := true; + Button[B].Visible := CatSongs.Song[B].Visible; + Button[B].Selectable := Button[B].Visible; + Button[B].Y := 140 + (B-Src) * 60; + end;} + + + if Typ = 0 then begin + for B := 0 to High(Button) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (Placed) * 60; + Inc(Placed); + end; + end; + end; + + if Typ = 1 then begin + B := 0; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Inc(B); + end; + end; + + if Typ = 2 then begin + B := High(Button); + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (6-Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Dec(B); + end; + end; + + if Typ = 3 then begin + B := Src; + Count := 4; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (3+Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Inc(B); + end; + + B := Src-1; + Placed := 0; + Count := 3; + while (Count > 0) do begin + if CatSongs.Song[B].Visible then begin + Button[B].Visible := true; + Button[B].Y := 140 + (2-Placed) * 60; + Inc(Placed); + Dec(Count); + end; + Dec(B); + end; + + end; + + if Length(Button) > 0 then + Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture +end; + +procedure TScreenSong.SetScroll2; +var + B: integer; + Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu + Wsp2: real; +begin + // liniowe + for B := 0 to High(Button) do + Button[B].X := 300 + (B - Interaction) * 260; + + if Length(Button) >= 3 then begin + if Interaction = 0 then + Button[High(Button)].X := 300 - 260; + + if Interaction = High(Button) then + Button[0].X := 300 + 260; + end; + + // kolowe +{ for B := 0 to High(Button) do begin + Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. + Wsp2 := Wsp / Length(Button); + Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); +// Button[B].Y := 140 + 50 * ; + end;} +end; + +procedure TScreenSong.SetScroll3; // with slide +var + B: integer; + Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu + Wsp2: real; +begin + SongTarget := Interaction; + + // liniowe + for B := 0 to High(Button) do + begin + Button[B].X := 300 + (B - SongCurrent) * 260; + if (Button[B].X < -Button[B].W) OR (Button[B].X > 800) then + Button[B].Visible := False + else + Button[B].Visible := True; + end; + +{ if Length(Button) >= 3 then begin + if Interaction = 0 then + Button[High(Button)].X := 300 - 260; + + if Interaction = High(Button) then + Button[0].X := 300 + 260; + end;} + + // kolowe +{ for B := 0 to High(Button) do begin + Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd. + Wsp2 := Wsp / Length(Button); + Button[B].X := 300 + 10000 * sin(2*pi*Wsp2); +// Button[B].Y := 140 + 50 * ; + end;} +end; + +procedure TScreenSong.SetScroll4; // rotate +var + B: integer; + Wsp: real; + Z, Z2: real; + VS: integer; +begin + VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important + + // kolowe + for B := 0 to High(Button) do begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2; + Z2 := (1 + 2*Z) / 3; + + + Button[B].X := Theme.Song.Cover.X + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z / 2 + 0.3; + + Button[B].W := Theme.Song.Cover.H * Z2; + +// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; + Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; + Button[B].H := Button[B].W; + end; + end; +end; + +(* +procedure TScreenSong.SetScroll4; // rotate +var + B: integer; + Wsp: real; + Z: real; + Z2, Z3: real; + VS: integer; + function modreal (const X, Y: real):real; + begin + Result := Frac(x / y) * y; + if Result < -3 then + Result := Result + Y + else if Result > 3 then + Result := Result - Y; + end; +begin + VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important + Z3 := 1; + if VS < 12 then + Z2 := VS + else + Z2 := 12; + + // kolowe + for B := 0 to High(Button) do begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + if ((ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)>-3) AND (ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)<3)) then + begin + if CatSongs.VisibleIndex(B)> SongCurrent then + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2 + else + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2; + + Z3 := 2; + Z := (1 + cos(Wsp)) / 2; + //Z2 := (1 + 2*Z) / 3; + //Z2 := (0.5 + Z/2); + //Z2 := sin(Wsp); + + //Z2 := Power (Z2,Z3); + + Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); + + //Button[B].X := Theme.Song.CoverX + ({Theme.Song.CoverX + Theme.Song.CoverW/2 + Theme.Song.CoverW*0.18 * VS {CatSongs.VisibleSongs {Length(Button) * sin(Wsp) {- Theme.Song.CoverX - Theme.Song.CoverW) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + if (sin(Wsp)<0) then + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W + else //*Theme.Song.CoverW*0.004*Z3 + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; + Button[B].Z := Z-0.00001; + +// Button[B].Y := {50 + 140 + 50 - 50 * Z2; + // Button[B].Y := (Theme.Song.CoverY + 40 + 50 - 50 * Z2); + Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); + Button[B].H := Button[B].W; + Button[B].Visible := True; + end + {else if (((CatSongs.VisibleIndex(B) - SongCurrent)>-3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) OR ((round (CatSongs.VisibleIndex(B) - SongCurrent) mod VS > -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) then + begin + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / 12 ;// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2 -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3); + + if (sin(Wsp)<0) then + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W + else + Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX; + + Button[B].Z := Z; + + Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W); + + Button[B].H := Button[B].W; + Button[B].Visible := True; + end + else Button[B].Visible := False; + end; + end; +end; *) + +procedure TScreenSong.SetScroll5; // rotate +var + B: integer; + Angle: real; + Pos: Real; + VS: integer; + diff: real; + X: Real; + helper: real; +begin + VS := CatSongs.VisibleSongs; // cache Visible Songs + {Vars + Theme.Song.CoverW: Radius des Kreises + Theme.Song.CoverX: X Pos Linke Kante des gewählten Covers + Theme.Song.CoverX: Y Pos Obere Kante des gewählten Covers + Theme.Song.CoverH: Höhe der Cover + + (CatSongs.VisibleIndex(B) - SongCurrent)/VS = Abstand zum MIttleren Cover in % + } + + //Change Pos of all Buttons + for B := low(Button) to high(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility + if Button[B].Visible then //Only Change Pos for Visible Buttons + begin + Pos := (CatSongs.VisibleIndex(B) - SongCurrent); + if (Pos < -VS/2) then + Pos := Pos + VS + else if (Pos > VS/2) then + Pos := Pos - VS; + + if (Abs(Pos) < 2.5) then {fixed Positions} + begin + Angle := Pi * (Pos / 5); +// Button[B].Visible := False; + + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); + +// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Z := 0.95 - Abs(Pos) * 0.01; + + Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); + + Button[B].W := Button[B].H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + + X := Sin(Angle*1.3)*0.9; + + Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Diff; + + end + else + begin {Behind the Front Covers} + + // limit-bg-covers hack + if (abs(abs(Pos)-VS/2)>10) then Button[B].Visible:=False; + // end of limit-bg-covers hack + + if Pos < 0 then + Pos := (Pos - VS/2)/VS + else + Pos := (Pos + VS/2)/VS; + + Angle := pi * Pos*2; + if VS > 24 then + begin + if Angle < 0 then helper:=-1 else helper:=1; + Angle:=2*pi-abs(Angle); + Angle:=Angle*(VS/24); + Angle:=(2*pi-Angle)*helper; + end; + + Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); + + Button[B].W := Button[B].H; + + Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; + +// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*((Theme.Song.Cover.H)*sin(Angle/2)*1.52); + + end; + + //Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field +// Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); + + end; + end; +end; + +procedure TScreenSong.SetScroll6; // rotate (slotmachine style) +var + B: integer; + Angle: real; + Pos: Real; + VS: integer; + diff: real; + X: Real; + Wsp: real; + Z, Z2: real; +begin + VS := CatSongs.VisibleSongs; // cache Visible Songs + if VS <=5 then begin + // kolowe + for B := 0 to High(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; // nowe + if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + + Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Wsp)) / 2; + Z2 := (1 + 2*Z) / 3; + + + Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z / 2 + 0.3; + + Button[B].W := Theme.Song.Cover.H * Z2; + +// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; + Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; + Button[B].H := Button[B].W; + end; + end; + end + else begin + + //Change Pos of all Buttons + for B := low(Button) to high(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility + if Button[B].Visible then //Only Change Pos for Visible Buttons + begin + Pos := (CatSongs.VisibleIndex(B) - SongCurrent); + if (Pos < -VS/2) then + Pos := Pos + VS + else if (Pos > VS/2) then + Pos := Pos - VS; + + if (Abs(Pos) < 2.5) then {fixed Positions} + begin + Angle := Pi * (Pos / 5); +// Button[B].Visible := False; + + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); + + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Z := 0.95 - Abs(Pos) * 0.01; + + Button[B].X := (Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); + + Button[B].W := Button[B].H; + + Diff := (Button[B].H - Theme.Song.Cover.H)/2; + + + X := Sin(Angle*1.3)*0.9; + + Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff; + end + else + begin {Behind the Front Covers} + + // limit-bg-covers hack + if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; + if VS > 25 then VS:=25; + // end of limit-bg-covers hack + + if Pos < 0 then + Pos := (Pos - VS/2)/VS + else + Pos := (Pos + VS/2)/VS; + + Angle := pi * Pos*2; + + Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers + + Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3); + + Button[B].W := Button[B].H; + + Button[B].X := Theme.Song.Cover.X - (Button[B].H - Theme.Song.Cover.H)*0.5; + + + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Button[B].Y := Theme.Song.Cover.Y+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*(Theme.Song.Cover.H*sin(Angle/2)*1.52); + end; + end; + end; + end; +end; + + +procedure TScreenSong.onShow; +begin + AudioPlayback.Stop; + + if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; + if Ini.Players = 4 then PlayersPlay := 6; + + //Cat Mod etc + if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then + begin + CatSongs.ShowCategoryList; + FixSelected; + //Show Cat in Top Left Mod + HideCatTL; + end; + + + if Length(CatSongs.Song) > 0 then begin + //Load Music only when Song Preview is activated + if ( Ini.PreviewVolume <> 0 ) then + begin + if(AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3)) then + begin + AudioPlayback.SetLoop(false); + AudioPlayback.Position := AudioPlayback.Length / 4; + AudioPlayback.Play; + + //Set Preview Volume + AudioPlayback.SetMusicVolume (Ini.PreviewVolume * 10); + {//if Music Fade is activated, Set Volume to 0 % + if (Ini.PreviewFading <> 0) then + Music.SetMusicVolume(0);} + end; + end; + + SetScroll; + UpdateLCD; + end; + + //Playlist Mode + if (Mode = smNormal) then + begin + //If Playlist Shown -> Select Next automatically + if (CatSongs.CatNumShow = -3) then + begin + SelectNext; + ChangeMusic; + end; + end + //Party Mode + else if (Mode = smPartyMode) then + begin + + SelectRandomSong; + //Show Menu directly in PartyMode + //But only if selected in Options + if (Ini.PartyPopup = 1) then + begin + ScreenSongMenu.MenuShow(SM_Party_Main); + end; + + + end; + + SetJoker; + SetStatics; +end; + +procedure TScreenSong.onHide; +begin + //When Music Fading is activated, Turn Music to 100 % + If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then + AudioPlayback.SetMusicVolume(100); + + //If Preview is deactivated: Load MUsicfile now + If (Ini.PreviewVolume = 0) then + AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + + //When hide then Stop Music (For Party Mode Popup on Exit) + if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (AudioPlayback <> nil) then + AudioPlayback.Stop; +end; + +procedure TScreenSong.DrawExtensions; +begin + //Draw Song Menu + if (ScreenSongMenu.Visible) then + begin + ScreenSongMenu.Draw; + end + else if (ScreenSongJumpto.Visible) then + begin + ScreenSongJumpto.Draw; + end +end; + +function TScreenSong.Draw: boolean; +var + dx: real; + dt: real; + I: Integer; +begin + dx := SongTarget-SongCurrent; + dt := TimeSkip * 7; + +// writeln( 'TScreenSong.Draw '+ inttostr(trunc(TimeSkip)) ); + + if dt > 1 then + dt := 1; + + SongCurrent := SongCurrent + dx*dt; + +{ if SongCurrent > Catsongs.VisibleSongs then begin + SongCurrent := SongCurrent - Catsongs.VisibleSongs; + SongTarget := SongTarget - Catsongs.VisibleSongs; + end;} + +// Log.BenchmarkStart(5); + SetScroll; +// Log.BenchmarkEnd(5); +// Log.LogBenchmark('SetScroll4', 5); + + //Fading Functions, Only if Covertime is under 5 Seconds + If (CoverTime < 5) then + begin + // 0.5.0: cover fade + if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then + begin + // load new texture + Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture.Alpha := 1; + Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture2.Alpha := 1; + end; + + //Song Fade + if (CatSongs.VisibleSongs > 0) AND (Ini.PreviewVolume <> 0) AND (Not CatSongs.Song[Interaction].Main) AND (Ini.PreviewFading <> 0) then + begin + //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling + if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then + AudioPlayback.Play; + + //Update Song Volume + if (CoverTime < Ini.PreviewFading) then + AudioPlayback.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10)) + else + AudioPlayback.SetMusicVolume(Ini.PreviewVolume * 10); + + end; + + + //Update Fading Time + CoverTime := CoverTime + TimeSkip; + + //Update Fading Texture + Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5; + if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1; + + end; + + //inherited Draw; + //heres a little Hack, that causes the Statics + //are Drawn after the Buttons because of some Blending Problems. + //This should cause no Problems because all Buttons on this screen + //Has Z Position. + //Draw BG + DrawBG; + + //Instead of Draw FG Procedure: + //We draw Buttons for our own + for I := 0 to Length(Button) - 1 do + Button[I].Draw; + + // Statics + for I := 0 to Length(Static) - 1 do + Static[I].Draw; + + // and texts + for I := 0 to Length(Text) - 1 do + Text[I].Draw; + + + //Draw Equalizer + if Theme.Song.Equalizer.Visible then + DrawEqualizer; + + DrawExtensions; + +end; + +procedure TScreenSong.SelectNext; +var + Skip: integer; + I: integer; + VS: Integer; +begin + VS := CatSongs.VisibleSongs; + + if VS > 0 then + begin + UnLoadDetailedCover; + + Skip := 1; + + // this 1 could be changed by CatSongs.FindNextVisible + while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); + + SongTarget := SongTarget + 1;//Skip; + + Interaction := (Interaction + Skip) mod Length(Interactions); + + // try to keep all at the beginning + if SongTarget > VS-1 then begin + SongTarget := SongTarget - VS; + SongCurrent := SongCurrent - VS; + end; + + end; + // Interaction -> Button, ktorego okladke przeczytamy + // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture +end; + +procedure TScreenSong.SelectPrev; +var + Skip: integer; + I: integer; + VS: Integer; +begin + VS := CatSongs.VisibleSongs; + + if VS > 0 then + begin + UnLoadDetailedCover; + + Skip := 1; + + while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); + SongTarget := SongTarget - 1;//Skip; + + Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); + + // try to keep all at the beginning + if SongTarget < 0 then begin + SongTarget := SongTarget + CatSongs.VisibleSongs; + SongCurrent := SongCurrent + CatSongs.VisibleSongs; + end; + + // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture + end; +end; + +procedure TScreenSong.UpdateLCD; +begin + LCD.HideCursor; + LCD.Clear; + LCD.WriteText(1, Text[TextArtist].Text); + LCD.WriteText(2, Text[TextTitle].Text); +end; + +//Procedure Change current played Preview +procedure TScreenSong.ChangeMusic; +begin + //When Music Preview is avtivated -> then Change Music + if (Ini.PreviewVolume <> 0) then + begin + if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then + begin + AudioPlayback.Close; + if AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin + AudioPlayback.Position := AudioPlayback.Length / 4; + //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal + if (Ini.PreviewFading = 0) then + AudioPlayback.Play + else + AudioPlayback.SetMusicVolume(0); + end; + end + else + AudioPlayback.Stop; + end; +end; + +procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0 +var + Skip: integer; + I: integer; +begin + UnLoadDetailedCover; + + Interaction := High(CatSongs.Song); + SongTarget := 0; + + for I := 1 to Target+1 do + SelectNext; + + FixSelected2; +end; + +procedure TScreenSong.DrawEqualizer; +var + I, J: Integer; + Res: byte; + A, B: Integer; + PosX, PosY: Integer; + Pos: Real; + lTmp : double; +begin + +if (not AudioPlayback.Finished) AND (Theme.Song.Equalizer.Length > 0) then +begin + + {$ifdef win32} + A := GetTickCount div 44; + + if (A <> EqualizerTime) then + begin + EqualizerTime := A; + AudioPlayback.GetFFTData(EqualizerData); + + B := 0; + Pos := 0; + Res := ceil(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band + + //Change Lengths + for I := 0 to (Res * Theme.Song.Equalizer.Bands - 1) do + begin + A := floor(I/Res); + + if (A<>B) then //Band changed + begin + if (Pos <= Theme.Song.Equalizer.Length) then + begin + if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then + EqualizerBands[B] := EqualizerBands[B] - 1 + else + EqualizerBands[B] := floor(Pos); + end + else + EqualizerBands[B] := 1; + + B := A; + Pos := 0; + end; + + if I > 35 then + EqualizerData[i] := EqualizerData[i] * 8 + else if I > 11 then + EqualizerData[i] := EqualizerData[i] * 4.5 + else + EqualizerData[i] := EqualizerData[i] * 1.1; + + if (EqualizerData[i] >= 1) then + EqualizerData[i] := 0.9999999999999; + + try + if ( assigned( Theme ) ) AND + ( assigned( Theme.Song ) ) AND + ( i < length( EqualizerData ) ) THEN + begin + if single( EqualizerData[i] ) > 1 then + begin + lTmp := Single(EqualizerData[i]) * Theme.Song.Equalizer.Length; + if lTmp > Pos then + Pos := lTmp; + end; + end; + except + {$IFDEF FPC} + on E:EInvalidOp do + writeln( 'UScreenSong - DOH !!!! ('+inttostr(i)+' '+ inttostr( integer( EqualizerData[i] ) )+' * '+ ')' ); + {$ENDIF} + end + + end; + + //Change Last Band + if (EqualizerBands[B] <= Theme.Song.Equalizer.Length) then + begin + if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then + EqualizerBands[B] := EqualizerBands[B] - 1 + else + EqualizerBands[B] := floor(Pos) + end + 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 + glDisable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + + PosY := Theme.Song.Equalizer.Y; + PosX := Theme.Song.Equalizer.X; + + For I := 0 to Theme.Song.Equalizer.Bands-1 do + begin + if Theme.Song.Equalizer.Direction then + PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length + else + PosX := Theme.Song.Equalizer.X; + //Draw for every visible quad + for J := 1 to EqualizerBands[I] do + begin + glBegin(GL_QUADS); + glVertex3f(PosX, PosY, Theme.Song.Equalizer.Z); + glVertex3f(PosX, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); + glVertex3f(PosX+Theme.Song.Equalizer.W, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z); + glVertex3f(PosX+Theme.Song.Equalizer.W, PosY, Theme.Song.Equalizer.Z); + glEnd; + + if Theme.Song.Equalizer.Direction then //Vertically + PosY := PosY - Theme.Song.Equalizer.H - Theme.Song.Equalizer.Space + else //Horizontally + PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space; + end; + if Theme.Song.Equalizer.Direction then //Horizontally + PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space + else //Vertically + PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space; + end; +end; +end; + +Procedure TScreenSong.SelectRandomSong; +var + I, I2: Integer; +begin + Case PlaylistMan.Mode of + smNormal: //All Songs Just Select Random Song + begin + //When Tabs are activated then use Tab Method + if (Ini.Tabs_at_startup = 1) then + begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; + + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + //I is the CatNum, I2 is the No of the Song within this Cat + + //Choose Cat + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Choose Song + SkipTo(I2-I); + end + //When Tabs are deactivated use easy Method + else + SkipTo(Random(CatSongs.VisibleSongs)); + end; + smPartyMode: //One Category Select Category and Select Random Song + begin + CatSongs.ShowCategoryList; + CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); + ShowCatTL(PlaylistMan.CurPlayList); + + SelectNext; + FixSelected2; + + SkipTo(Random(CatSongs.VisibleSongs)); + end; + smPlaylistRandom: //Playlist: Select Playlist and Select Random Song + begin + PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); + + SkipTo(Random(CatSongs.VisibleSongs)); + FixSelected2; + end; + end; + + AudioPlayback.PlaySound(SoundLib.Change); + ChangeMusic; + SetScroll; + UpdateLCD; +end; + +procedure TScreenSong.SetJoker; +begin + {//If Party Mode + // to-do : Party + if Mode = smPartyMode then //Show Joker that are available + begin + if (PartySession.Teams.NumTeams >= 1) then + begin + Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1); + Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2); + Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3); + Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4); + Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5); + end + else + begin + Static[StaticTeam1Joker1].Visible := False; + Static[StaticTeam1Joker2].Visible := False; + Static[StaticTeam1Joker3].Visible := False; + Static[StaticTeam1Joker4].Visible := False; + Static[StaticTeam1Joker5].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 2) then + begin + Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1); + Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2); + Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3); + Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4); + Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5); + end + else + begin + Static[StaticTeam2Joker1].Visible := False; + Static[StaticTeam2Joker2].Visible := False; + Static[StaticTeam2Joker3].Visible := False; + Static[StaticTeam2Joker4].Visible := False; + Static[StaticTeam2Joker5].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 3) then + begin + Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1); + Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2); + Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3); + Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4); + Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5); + end + else + begin + Static[StaticTeam3Joker1].Visible := False; + Static[StaticTeam3Joker2].Visible := False; + Static[StaticTeam3Joker3].Visible := False; + Static[StaticTeam3Joker4].Visible := False; + Static[StaticTeam3Joker5].Visible := False; + end; + end + else + begin //Hide all + Static[StaticTeam1Joker1].Visible := False; + Static[StaticTeam1Joker2].Visible := False; + Static[StaticTeam1Joker3].Visible := False; + Static[StaticTeam1Joker4].Visible := False; + Static[StaticTeam1Joker5].Visible := False; + + Static[StaticTeam2Joker1].Visible := False; + Static[StaticTeam2Joker2].Visible := False; + Static[StaticTeam2Joker3].Visible := False; + Static[StaticTeam2Joker4].Visible := False; + Static[StaticTeam2Joker5].Visible := False; + + Static[StaticTeam3Joker1].Visible := False; + Static[StaticTeam3Joker2].Visible := False; + Static[StaticTeam3Joker3].Visible := False; + Static[StaticTeam3Joker4].Visible := False; + Static[StaticTeam3Joker5].Visible := False; + end; } +end; + +procedure TScreenSong.SetStatics; +var + I: Integer; + Visible: Boolean; +begin + //Set Visibility of Party Statics and Text + Visible := (Mode = smPartyMode); + + For I := 0 to high(StaticParty) do + Static[StaticParty[I]].Visible := Visible; + + For I := 0 to high(TextParty) do + Text[TextParty[I]].Visible := Visible; + + //Set Visibility of Non Party Statics and Text + Visible := not Visible; + + For I := 0 to high(StaticNonParty) do + Static[StaticNonParty[I]].Visible := Visible; + + For I := 0 to high(TextNonParty) do + Text[TextNonParty[I]].Visible := Visible; +end; + +//Procedures for Menu + +procedure TScreenSong.StartSong; +begin + CatSongs.Selected := Interaction; + AudioPlayback.Stop; + //Party Mode + if (Mode = smPartyMode) then + begin + FadeTo(@ScreenSingModi); + end + else + begin + FadeTo(@ScreenSing); + end; +end; + +procedure TScreenSong.SelectPlayers; +begin + CatSongs.Selected := Interaction; + AudioPlayback.Stop; + + ScreenName.Goto_SingScreen := True; + FadeTo(@ScreenName); +end; + +procedure TScreenSong.OpenEditor; +begin + if (Songs.SongList.Count > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = smNormal) then + begin + AudioPlayback.Stop; + AudioPlayback.PlaySound(SoundLib.Start); + CurrentSong := CatSongs.Song[Interaction]; + FadeTo(@ScreenEditSub); + end; +end; + +//Team No of Team (0-5) +procedure TScreenSong.DoJoker (Team: Byte); +begin + {if (Mode = smPartyMode) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then + begin + //Joker spielen + Dec(PartySession.Teams.Teaminfo[Team].Joker); + SelectRandomSong; + SetJoker; + end; } +end; + +//Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song +procedure TScreenSong.UnLoadDetailedCover; +begin + CoverTime := 0; + + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture + Button[Interaction].Texture2.Alpha := 0; + + if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then + Texture.UnloadTexture(Button[Interaction].Texture.Name, false); +end; + +procedure TScreenSong.Refresh; +begin { +CatSongs.Refresh; +CatSongs.ShowCategoryList; +Interaction := 0; +SelectNext; +FixSelected; } + +end; + +end. -- cgit v1.2.3 From 78c0c01f78b649bdc8e74c7c14d07590070a8765 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 13 Feb 2008 12:04:57 +0000 Subject: small modification to the FadeTo function... it can now take a TAudioPlaybackStream as an optional 2nd paramater. so you can do a screen fade & play the swoosh sound, in 1 function call. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@848 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenMain.pas | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 5824d9fe..cc2ccc80 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -94,29 +94,25 @@ begin //Credits_Y := 600; //Credits_Alpha := 0; //Credits_Visible := True; - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenCredits); + FadeTo(@ScreenCredits , SoundLib.Start ); end; end; SDLK_M: begin if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then begin - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenPartyOptions); + FadeTo(@ScreenPartyOptions, SoundLib.Start); end; end; SDLK_S: begin - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenStatMain); + FadeTo(@ScreenStatMain, SoundLib.Start); end; SDLK_E: begin - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenEdit); + FadeTo(@ScreenEdit, SoundLib.Start); end; SDLK_RETURN: @@ -126,12 +122,11 @@ begin begin if (Songs.SongList.Count >= 1) then begin - AudioPlayback.PlaySound(SoundLib.Start); 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); + FadeTo(@ScreenName, SoundLib.Start); end else //show error message ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); @@ -144,8 +139,7 @@ begin begin if (Length(DLLMan.Plugins)>=1) then begin - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenPartyOptions); + FadeTo(@ScreenPartyOptions, SoundLib.Start); end else //show error message, No Plugins Loaded ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS')); @@ -157,22 +151,19 @@ begin //Stats if Interaction = 2 then begin - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenStatMain); + FadeTo(@ScreenStatMain, SoundLib.Start); end; //Editor if Interaction = 3 then begin - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenEdit); + FadeTo(@ScreenEdit, SoundLib.Start); end; //Options if Interaction = 4 then begin - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenOptions); + FadeTo(@ScreenOptions, SoundLib.Start); end; //Exit @@ -214,7 +205,7 @@ begin //---------------- - TextDescription := AddText(Theme.Main.TextDescription); + TextDescription := AddText(Theme.Main.TextDescription); TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong); LoadFromTheme(Theme.Main); @@ -238,7 +229,7 @@ end; procedure TScreenMain.InteractNext; begin inherited InteractNext; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; UpdateLCD; Light.LightOne(1, 200); @@ -247,7 +238,7 @@ end; procedure TScreenMain.InteractPrev; begin inherited InteractPrev; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; UpdateLCD; Light.LightOne(0, 200); @@ -256,7 +247,7 @@ end; procedure TScreenMain.InteractDec; begin inherited InteractDec; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; UpdateLCD; Light.LightOne(0, 200); -- cgit v1.2.3