From 65ddad359ed3b9b739215ec89a7645455ae10dce Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Tue, 5 Oct 2010 18:28:42 +0000 Subject: - added webcam support - faster program start - faster sorting (mergesort) - sync lyrics to music - some new backgrounds and credits graphics (thx to MezzoX) - own thread for video decoding - finished 6-Player-on-one-screen-mode - changqed player-colors - fixed some bugs... git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2637 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 155 +++++++++---- Game/Code/Screens/UScreenEdit.pas | 4 +- Game/Code/Screens/UScreenEditConvert.pas | 8 +- Game/Code/Screens/UScreenEditHeader.pas | 4 +- Game/Code/Screens/UScreenEditSub.pas | 17 +- Game/Code/Screens/UScreenMain.pas | 117 ++++++---- Game/Code/Screens/UScreenOpen.pas | 4 +- Game/Code/Screens/UScreenOptionsRecord.pas | 130 ++++++++++- Game/Code/Screens/UScreenPartyOptions.pas | 2 +- Game/Code/Screens/UScreenPartyOptionsM2.pas | 1 - Game/Code/Screens/UScreenPopup.pas | 6 +- Game/Code/Screens/UScreenScore.pas | 106 ++++++--- Game/Code/Screens/UScreenSing.pas | 138 +++++++----- Game/Code/Screens/UScreenSingModi.pas | 39 +++- Game/Code/Screens/UScreenSong.pas | 329 +++++++++++----------------- Game/Code/Screens/UScreenSongMenu.pas | 13 +- 16 files changed, 666 insertions(+), 407 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index ecdc332f..a59ba863 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -11,28 +11,29 @@ type TScreenCredits = class(TMenu) public - Credits_X: Real; - Credits_Time: Cardinal; - Credits_Alpha: Cardinal; + Credits_X: Real; + Credits_Time: Cardinal; + Credits_Alpha: Cardinal; CTime: Cardinal; - CTime_hold: Cardinal; - ESC_Alpha: Integer; + CTime_hold: Cardinal; + ESC_Alpha: Integer; - credits_entry_tex: TTexture; - credits_entry_dx_tex: TTexture; - credits_bg_tex: TTexture; - credits_bg_ovl: TTexture; + 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_blindy: TTexture; - credits_canni: TTexture; - credits_ggkfc: TTexture; - credits_jaybinks: TTexture; - credits_linnex: TTexture; - credits_mog: TTexture; - credits_omgdutch: TTexture; - credits_skillmaster: TTexture; - credits_whiteshark: TTexture; + credits_bg_scrollbox_left: TTexture; + credits_blindy: TTexture; + credits_canni: TTexture; + credits_ggkfc: TTexture; + credits_jaybinks: TTexture; + credits_linnex: TTexture; + credits_mog: TTexture; + credits_omgdutch: TTexture; + credits_skillmaster: TTexture; + credits_whiteshark: TTexture; + credits_brunzel: TTexture; intro_layer01: TTexture; intro_layer02: TTexture; intro_layer03: TTexture; @@ -64,13 +65,28 @@ type procedure DrawCredits; procedure Draw_FunkyText; end; - + const - Funky_Text: AnsiString = // | - 'A small step in version number, a huge step for the community - USDX works with any video format now. Thanks and greetings fly out to Mota '+ - '(we miss you!), Skar (additional skins), Atlassian.com, Zanadoo.com and WhirlWind-Records.com. Massive thanks to the translators: Jonaspaulo, '+ - 'Jacobo, Bres, W0nderboy, Dadone - and our betatesters: Theril, Tyris, Murmeltier and Lemon. Greetings to Tronic from NuubSing (you guys rule!) and Corvus5.'; - Timings: array[0..21] of Cardinal=( + Funky_Text: AnsiString = + 'Massive thanks to all the people who have made this possible: Corvus5, for the '+ + 'original program; the USDX team, for creating this deluxe version; igel457 for '+ + 'developing acinerella; the translators: Thursday, UltraClaudio79 and Bruut; the '+ + 'beta-testers: b4St1@fuN, bohning, Thursday and many of you who have been so '+ + 'active on the German forum: ultra-star.de. Additional thanks to MezzoX, merc, gpm, '+ + 'BlindGuard and MasterPhW for your contributions and to our song makers '+ + 'throughout the world - without the music, none of this would be possible.'; + //I hope to see the improvements in this mod implemented into the USDX version someday :) + + (* old one: | + 'A small step in version number, a huge step for the community - USDX works '+ + 'with any video format now. Thanks and greetings fly out to Mota '+ + '(we miss you!), Skar (additional skins), Atlassian.com, Zanadoo.com and '+ + 'WhirlWind-Records.com. Massive thanks to the translators: Jonaspaulo, '+ + 'Jacobo, Bres, W0nderboy, Dadone - and our betatesters: Theril, Tyris, '+ + 'Murmeltier and Lemon. Greetings to Tronic from NuubSing (you guys rule!) and Corvus5.'; + *) + + Timings: array[0..22] of Cardinal=( 20, // 0 Delay vor Start 149, // 1 Ende erster Intro Zoom @@ -83,19 +99,20 @@ const 271, // 7 Start Main Part 280, // 8 Start On-Beat-Sternchen Main Part - 396, // 9 Start blindy - 666, // 10 Start canni - 936, // 11 Start ggkfc - 1206, // 12 Start jaybinks + 351, // 9 Start blindy + 801, // 10 Start canni + 1026, // 11 Start ggkfc + 1251, // 12 Start jaybinks 1476, // 13 Start linnex - 1746, // 14 Start mog - 2016, // 15 Start omgdutch - 2286, // 16 Start SkillMaster - 2556, // 17 Start WhiteShark + 1701, // 14 Start mog + 2151, // 15 Start omgdutch + 2376, // 16 Start SkillMaster + 2601, // 17 Start WhiteShark 2826, // 18 Ende Whiteshark 3096, // 19 Start FadeOut Mainscreen - 3366, // 20 Ende Credits Tune - 60); // 21 start flare im intro + 3450, // 20 Ende Credits Tune (3366) + 60, + 576); // 22 start brunzel implementation @@ -131,28 +148,34 @@ begin credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0); credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0); + SDL_Delay(1); credits_ggkfc := Texture.LoadTexture(true, 'CRDTS_ggkfc', 'PNG', 'Font Black', 0); credits_jaybinks := Texture.LoadTexture(true, 'CRDTS_jaybinks', 'PNG', 'Font Black', 0); credits_linnex := Texture.LoadTexture(true, 'CRDTS_linnex', 'PNG', 'Font Black', 0); credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', 'Font Black', 0); + SDL_Delay(1); credits_omgdutch := Texture.LoadTexture(true, 'CRDTS_omgdutch', '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); + credits_brunzel := Texture.LoadTexture(true, 'CRDTS_brunzel', 'PNG', 'Font Black', 0); + SDL_Delay(1); 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); + SDL_Delay(1); 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); + SDL_Delay(1); 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', 'Plain', 0); - + SDL_Delay(1); CRDTS_Stage:=InitialDelay; end; @@ -471,7 +494,7 @@ Data := Music.GetFFTData; // blindy (von links oben reindrehen, nach rechts unten rausdrehen) STime:=Timings[9]-10; - Delay:=Timings[10]-Timings[9]; + Delay:=Timings[22]-Timings[9]; if CTime > STime then begin k:=0; @@ -522,6 +545,64 @@ Data := Music.GetFFTData; glPopMatrix; end; +// brunzel + STime:=Timings[22]-10; + Delay:=Timings[10]-Timings[22]; + 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, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5, 0); + end; + + glPushMatrix; + if CTime <= STime+10 then + begin + j:=CTime-STime; + glscalef(j*j/100,j*j/100,j*j/100); + gltranslatef(j/10*100+123,j/10*129+200,0); + glrotatef(j/10*180+180,0,-1,1); + end else + gltranslatef(223,329,0); + + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j := (CTime-(STime+Delay-10))*-9; + glscalef(j*j/400+1,j*j/400+1,j*j/400+1); + end; + glBindTexture(GL_TEXTURE_2D, credits_brunzel.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 (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; diff --git a/Game/Code/Screens/UScreenEdit.pas b/Game/Code/Screens/UScreenEdit.pas index b78df989..99d89351 100644 --- a/Game/Code/Screens/UScreenEdit.pas +++ b/Game/Code/Screens/UScreenEdit.pas @@ -71,7 +71,7 @@ end; constructor TScreenEdit.Create; begin inherited Create; - AddButton(400-200, 100 + 0*70, 400, 40, Skin.GetTextureFileName('ButtonF')); + AddButton(400-200, 100 + 0*70, 400, 40, Skin.GetTextureFileName('ButtonF'), false); AddButtonText(10, 5, 0, 0, 0, 'Convert Midi to Txt'); // Button[High(Button)].Text[0].Size := 11; @@ -81,7 +81,7 @@ begin // 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')); + AddButton(400-200, 100 + 3*60, 400, 40, Skin.GetTextureFileName('ButtonF'), false); AddButtonText(10, 5, 0, 0, 0, 'Exit'); end; diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index 4fbd73a2..e71b31fc 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -331,17 +331,17 @@ var P: integer; begin inherited Create; - AddButton(40, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButton(40, 20, 100, 40, Skin.GetTextureFileName('ButtonF'), false); AddButtonText(15, 5, 0, 0, 0, 'Open'); // Button[High(Button)].Text[0].Size := 11; - AddButton(160, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButton(160, 20, 100, 40, Skin.GetTextureFileName('ButtonF'), false); AddButtonText(25, 5, 0, 0, 0, 'Play'); - AddButton(280, 20, 200, 40, Skin.GetTextureFileName('ButtonF')); + AddButton(280, 20, 200, 40, Skin.GetTextureFileName('ButtonF'), false); AddButtonText(25, 5, 0, 0, 0, 'Play Selected'); - AddButton(500, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButton(500, 20, 100, 40, Skin.GetTextureFileName('ButtonF'), false); AddButtonText(20, 5, 0, 0, 0, 'Save'); diff --git a/Game/Code/Screens/UScreenEditHeader.pas b/Game/Code/Screens/UScreenEditHeader.pas index 35d7840f..6662ce8a 100644 --- a/Game/Code/Screens/UScreenEditHeader.pas +++ b/Game/Code/Screens/UScreenEditHeader.pas @@ -132,10 +132,10 @@ constructor TScreenEditHeader.Create; begin inherited Create; - AddButton(40, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButton(40, 20, 100, 40, Skin.GetTextureFileName('ButtonF'), false); AddButtonText(15, 5, 'Open'); - AddButton(160, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButton(160, 20, 100, 40, Skin.GetTextureFileName('ButtonF'), false); AddButtonText(20, 5, 'Save'); AddBox(80, 60, 640, 550); diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index a8c0a20d..6deb4b00 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -529,17 +529,22 @@ begin CP := MedleyNotes.Preview.CP; Czesci[CP].Akt := MedleyNotes.Preview.line; - Czesci[(CP+1) mod 2].Akt := Czesci[CP].Akt; + if AktSong.isDuet then + Czesci[(CP+1) mod 2].Akt := Czesci[CP].Akt; AktNuta[CP] := MedleyNotes.Preview.note; - AktNuta[(CP+1) mod 2] := 0; + if AktSong.isDuet then + AktNuta[(CP+1) mod 2] := 0; Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[CP]].Color := 2; EditorLyric[CP].AddCzesc(CP, Czesci[CP].Akt); EditorLyric[CP].Selected := AktNuta[CP]; - EditorLyric[(CP+1) mod 2].AddCzesc((CP+1) mod 2, Czesci[(CP+1) mod 2].Akt); - EditorLyric[(CP+1) mod 2].Selected := -1; + if AktSong.isDuet then + begin + EditorLyric[(CP+1) mod 2].AddCzesc((CP+1) mod 2, Czesci[(CP+1) mod 2].Akt); + EditorLyric[(CP+1) mod 2].Selected := -1; + end; Music.Stop; PlaySentence := false; PlayOneNote := false; @@ -2984,10 +2989,10 @@ begin else if Blend>1 then Blend := 1; - acDrawGLi(ScreenAct, Window, Blend); + acDrawGLi(ScreenAct, Window, Blend, true); end else if VidVis=full then begin - acDrawGL(ScreenAct); + acDrawGL(ScreenAct, true); end; if (Czas.Teraz>=Czas.Razem) then diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index fbaa2e37..bc2019b9 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -7,6 +7,9 @@ uses type TScreenMain = class(TMenu) + private + IdleTicks: cardinal; + procedure StartScreenScredits; public TextDescription: integer; TextDescriptionLong: integer; @@ -16,6 +19,7 @@ type constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; + function Draw: boolean; override; procedure InteractNext; override; procedure InteractPrev; override; procedure InteractInc; override; @@ -29,25 +33,69 @@ const implementation -uses Windows, UPlaylist, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl, ULanguage, UParty, UDLLManager, UScreenCredits, USkins, ULog; +uses + Windows, + UPlaylist, + UGraphic, + UMain, + UIni, + UTexture, + USongs, + Textgl, + opengl, + ULanguage, + UParty, + UDLLManager, + UScreenCredits, + USkins, + ULog; + +procedure TScreenMain.StartScreenScredits; +begin + //If CreditsScreen is not Created -> Then Create + If (ScreenCredits = nil) then + begin + try + //Display White Loading Text + SetFontStyle(2); //Font: Outlined1 + SetFontSize(12); + SetFontItalic(False); + SetFontPos (400 - glTextWidth ('Loading Credits ...')/2, 250); //Position + glColor4f(1,1,1,1); + glPrint('Loading Credits ...'); + SwapBuffers; + + ScreenCredits := TScreenCredits.Create; + except + Log.LogError ('Couldn''t Create Credits Screen'); + end; + end; + If (ScreenCredits <> nil) then + begin + Music.PlayStart; + FadeTo(@ScreenCredits); + end; +end; function TScreenMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; var -SDL_ModState: Word; + SDL_ModState: Word; + I, num: Integer; begin Result := true; + IdleTicks := SDL_GetTicks; 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; + num := 0; //suitable songs for party-modes + for i := 0 to Length(Songs.Song) - 1 do + begin + if not Songs.Song[i].isDuet then + inc(num); + end; If (PressedDown) Then begin // Key Down @@ -56,7 +104,7 @@ begin begin ScreenPopupHelp.ShowPopup(); end; - + SDLK_Q: begin Result := false; @@ -71,38 +119,13 @@ begin SDLK_C: begin if (SDL_ModState = KMOD_LALT) then - begin - //If CreditsScreen is not Created -> Then Create - If (ScreenCredits = nil) then - begin - try - //Display White Loading Text - SetFontStyle(2); //Font: Outlined1 - SetFontSize(12); - SetFontItalic(False); - SetFontPos (400 - glTextWidth ('Loading Credits ...')/2, 250); //Position - glColor4f(1,1,1,1); - glPrint('Loading Credits ...'); - SwapBuffers; - - ScreenCredits := TScreenCredits.Create; - except - Log.LogError ('Couldn''t Create Credits Screen'); - end; - end; - - If (ScreenCredits <> nil) then - begin - Music.PlayStart; - FadeTo(@ScreenCredits); - end; - end; + StartScreenScredits; end; SDLK_M: begin if SDL_ModState = KMOD_LSHIFT then begin - if (Length(Songs.Song) >= 1) then + if (num >= 1) then begin if (Length(DLLMan.Plugins)>=1) then begin @@ -116,7 +139,7 @@ begin ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); end else begin - if (Length(Songs.Song) >= 1) then + if (num >= 1) then begin if (Length(DLLMan.Plugins)>=1) then begin @@ -163,7 +186,7 @@ begin //Multi if Interaction = 1 then begin - if (Length(Songs.Song) >= 1) then + if (num >= 1) then begin if (Length(DLLMan.Plugins)>=1) then begin @@ -177,9 +200,9 @@ begin ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); end; - //Muilti M2 + //Multi M2 if Interaction = 2 then begin - if (Length(Songs.Song) >= 1) then + if (num >= 1) then begin if (Length(DLLMan.Plugins)>=1) then begin @@ -268,6 +291,7 @@ procedure TScreenMain.onShow; var J: integer; begin + IdleTicks := SDL_GetTicks; ScreenSong.Mode := smNormal; ScreenSong.SongIndex := -1; PlaylistMan.Mode := 0; @@ -289,6 +313,19 @@ begin end; end; +function TScreenMain.Draw: boolean; +begin + Result := inherited Draw; + + if ScreenPopupHelp.Visible or ScreenPopupCheck.Visible or ScreenPopupError.Visible then + IdleTicks := SDL_GetTicks; + + if (IdleTicks + 30*1000 < SDL_GetTicks) then + begin + StartScreenScredits; + end; +end; + procedure TScreenMain.InteractNext; begin inherited InteractNext; diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index 97252b2b..bde39bff 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -131,10 +131,10 @@ begin 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')); + AddButton(540, 540, 100, 40, Skin.GetTextureFileName('ButtonF'), false); AddButtonText(10, 5, 0, 0, 0, 'Cancel'); - AddButton(670, 540, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButton(670, 540, 100, 40, Skin.GetTextureFileName('ButtonF'), false); AddButtonText(30, 5, 0, 0, 0, 'OK'); diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index c4c43674..28bdd59e 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, UFiles, UIni, UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes, UCaptureWDM, UWebCam; type TScreenOptionsRecord = class(TMenu) @@ -11,10 +11,22 @@ type SelectSlideInput: integer; SelectSlideChannelL: integer; SelectSlideChannelR: integer; + + IWebCamDevice: TList; + IWebCamMedia: TList; + + WebCamPreviewOn: boolean; + + SelectSlideWebCamOnOff: integer; + SelectSlideWebCamDevice: integer; + SelectSlideWebCamMedia: integer; public constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; procedure onShow; override; + procedure onHide; override; + procedure UpdateWebCam; procedure UpdateCard; end; @@ -30,6 +42,8 @@ begin Result := true; If (PressedDown) Then begin // Key Down + WebCamPreviewOn := (Ini.EnableWebCam=1); + case PressedKey of SDLK_TAB: begin @@ -49,7 +63,8 @@ begin end; SDLK_RETURN: begin - if SelInteraction = 4 then begin + if (SelInteraction = 7) or ((Length(IWebCamDevice)=0) and (SelInteraction = 5)) then + begin Ini.Save; Music.PlayBack; FadeTo(@ScreenOptions); @@ -61,19 +76,35 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + if (SelInteraction >= 0) and (SelInteraction <= 3) then + begin Music.PlayOption; InteractInc; end; if SelInteraction = 0 then UpdateCard; + + if (SelInteraction >= 4) and (SelInteraction <= 6) then + begin + Music.PlayOption; + InteractInc; + UpdateWebCam; + end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + if (SelInteraction >= 0) and (SelInteraction <= 3) then + begin Music.PlayOption; InteractDec; end; if SelInteraction = 0 then UpdateCard; + + if (SelInteraction >= 4) and (SelInteraction <= 6) then + begin + Music.PlayOption; + InteractDec; + UpdateWebCam; + end; end; end; end; @@ -81,7 +112,6 @@ end; constructor TScreenOptionsRecord.Create; var - //I: integer; SC: integer; SCI: integer; begin @@ -93,7 +123,6 @@ begin for SC := 0 to High(Recording.SoundCard) do ICard[SC] := Recording.SoundCard[SC].Description; -// end; if (Length(Recording.SoundCard)>0) then begin @@ -107,6 +136,26 @@ begin SelectSlideChannelR := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelR, Ini.CardList[0].ChannelR, IChannel); end; + IWebCamDevice := GetCapDevices(); + if (Length(IWebCamDevice)=0) then + Ini.EnableWebCam := 0; + + SelectSlideWebCamOnOff := AddSelectSlide(Theme.OptionsRecord.SelectSlideWebCamOnOff, Ini.EnableWebCam, IEnableWebCam); + + if (Length(IWebCamDevice)>0) then + begin + if (Length(IWebCamDevice)-1 < Ini.WebCamID) then + Ini.WebCamID := 0; + + IWebCamMedia := ListMediaTypes(Ini.WebCamID); + + SelectSlideWebCamDevice := AddSelectSlide(Theme.OptionsRecord.SelectSlideWebCamDevice, Ini.WebCamID, IWebCamDevice); + SelectSlideWebCamMedia := AddSelectSlide(Theme.OptionsRecord.SelectSlideWebCamMedia, Ini.WebCamMediaID, IWebCamMedia); + + WebCamPreviewOn := (Ini.EnableWebCam=1); + end else + WebCamPreviewOn := false; + AddButton(Theme.OptionsRecord.ButtonExit); if (Length(Button[0].Text)=0) then AddButtonText(14, 20, Theme.Options.Description[7]); @@ -119,6 +168,24 @@ begin Interaction := 0; if not Help.SetHelpID(ID) then Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenOptionsRecord)'); + + IWebCamDevice := GetCapDevices(); + + if (Length(IWebCamDevice)>0) then + begin + if (Length(IWebCamDevice)-1 < Ini.WebCamID) then + Ini.WebCamID := 0; + + IWebCamMedia := ListMediaTypes(Ini.WebCamID); + + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideCard, SelectSlideWebCamDevice, IWebCamDevice, Ini.WebCamID); + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideInput, SelectSlideWebCamMedia, IWebCamMedia, Ini.WebCamMediaID); + + WebCamPreviewOn := (Ini.EnableWebCam=1); + end else + WebCamPreviewOn := false; + + WebCamPreviewOn := wStartWebCam; end; procedure TScreenOptionsRecord.UpdateCard; @@ -127,12 +194,11 @@ var 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 + 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); @@ -140,4 +206,50 @@ begin UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideChannelR, SelectSlideChannelR, IChannel, Ini.CardList[SC].ChannelR); end; +procedure TScreenOptionsRecord.onHide; +begin + wClose; +end; + +function TScreenOptionsRecord.Draw: boolean; +begin + DrawBG; + + if WebCamPreviewOn then + begin + try + wDraw(true); + except + WebCamPreviewOn := false; + end; + end; + + DrawFG; + Result := true; +end; + +procedure TScreenOptionsRecord.UpdateWebCam; +begin + wClose; + + IWebCamDevice := GetCapDevices(); + + if (Length(IWebCamDevice)>0) then + begin + if (Length(IWebCamDevice)-1 < Ini.WebCamID) then + Ini.WebCamID := 0; + + IWebCamMedia := ListMediaTypes(Ini.WebCamID); + + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideWebCamDevice, SelectSlideWebCamDevice, IWebCamDevice, Ini.WebCamID); + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideWebCamMedia, SelectSlideWebCamMedia, IWebCamMedia, Ini.WebCamMediaID); + + WebCamPreviewOn := (Ini.EnableWebCam=1); + end else + WebCamPreviewOn := false; + + if WebCamPreviewOn then + WebCamPreviewOn := wStartWebCam; +end; + end. \ No newline at end of file diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 0a58cd79..15b87726 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -167,6 +167,7 @@ begin MenuPluginOpen := false; if not Help.SetHelpID(ID) then Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenPartyOptions)'); + //Don'T start when Playlist is Selected and there are no Playlists If (Playlist = 2) and (Length(PlaylistMan.Playlists) = 0) then Exit; @@ -543,7 +544,6 @@ var ID_NOSCORE: Integer; begin - Randomize; if not Help.SetHelpID(ID) then Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenPartyOptions)'); diff --git a/Game/Code/Screens/UScreenPartyOptionsM2.pas b/Game/Code/Screens/UScreenPartyOptionsM2.pas index f27acc01..d06c7a18 100644 --- a/Game/Code/Screens/UScreenPartyOptionsM2.pas +++ b/Game/Code/Screens/UScreenPartyOptionsM2.pas @@ -689,7 +689,6 @@ var ID_NOSCORE: Byte; begin - Randomize; if not Help.SetHelpID(ID) then Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenPartyOptionsM2)'); diff --git a/Game/Code/Screens/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas index aaed32ed..0169df90 100644 --- a/Game/Code/Screens/UScreenPopup.pas +++ b/Game/Code/Screens/UScreenPopup.pas @@ -126,13 +126,12 @@ begin begin if (Display.ActualScreen = @ScreenMain) and (ScreenMain.ShowNumErrors) then begin - Ini.LoadFaultySongs := 1; + Ini.LoadFaultySongs_temp := 1; Songs.LoadSongList(); UGraphic.UnLoadScreens(); UGraphic.LoadScreens( true ); ScreenSong.Refresh(true); PlaylistMan.LoadPlayLists; - Ini.LoadFaultySongs := 0; ScreenMain.ShowNumErrors := false; FadeTo(@ScreenMain); end else @@ -314,6 +313,9 @@ begin SDLK_BACKSPACE : begin Visible:=False; + if (Help.GetHelpID() = ScreenSing.GetHelpID()) then + ScreenSing.Pause; + Result := false; end; diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 7c5c8253..149541a2 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -23,30 +23,30 @@ type StaticMedleyNav: integer; TextMedleyNav: integer; - TextName: array[1..10] of integer; - TextScore: array[1..10] of integer; + TextName: array[1..16] of integer; + TextScore: array[1..16] of integer; - TextNotes: array[1..10] of integer; - TextNotesScore: array[1..10] of integer; - TextLineBonus: array[1..10] of integer; - TextLineBonusScore: array[1..10] of integer; - TextGoldenNotes: array[1..10] of integer; - TextGoldenNotesScore: array[1..10] of integer; - TextTotal: array[1..10] of integer; - TextTotalScore: array[1..10] of integer; + TextNotes: array[1..16] of integer; + TextNotesScore: array[1..16] of integer; + TextLineBonus: array[1..16] of integer; + TextLineBonusScore: array[1..16] of integer; + TextGoldenNotes: array[1..16] of integer; + TextGoldenNotesScore: array[1..16] of integer; + TextTotal: array[1..16] of integer; + TextTotalScore: array[1..16] of integer; - PlayerStatic: array[1..10] of array of integer; - PlayerTexts : array[1..10] of array of integer; + PlayerStatic: array[1..16] of array of integer; + PlayerTexts : array[1..16] of array of integer; - StaticBoxLightest: array[1..10] of integer; - StaticBoxLight: array[1..10] of integer; - StaticBoxDark: array[1..10] of integer; + StaticBoxLightest: array[1..16] of integer; + StaticBoxLight: array[1..16] of integer; + StaticBoxDark: array[1..16] of integer; - StaticBackLevel: array[1..10] of integer; - StaticBackLevelRound: array[1..10] of integer; - StaticLevel: array[1..10] of integer; - StaticLevelRound: array[1..10] of integer; + StaticBackLevel: array[1..16] of integer; + StaticBackLevelRound: array[1..16] of integer; + StaticLevel: array[1..16] of integer; + StaticLevelRound: array[1..16] of integer; Animation: real; Fadeout: boolean; @@ -227,7 +227,7 @@ begin StaticMedleyNav := AddStatic(Theme.Score.StaticMedleyNav); TextMedleyNav := AddText(Theme.Score.TextMedleyNav); - for P := 1 to 10 do + for P := 1 to 16 do begin TextName[P] := AddText(Theme.Score.TextName[P]); TextScore[P] := AddText(Theme.Score.TextScore[P]); @@ -269,7 +269,7 @@ procedure TScreenScore.onShow; var P: integer; // player I: integer; - V: array[1..10] of boolean; // visibility array + V: array[1..16] of boolean; // visibility array begin if not Help.SetHelpID(ID) then Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenScore)'); @@ -285,7 +285,7 @@ begin Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; // set visibility - if (not ScreenSing.P4Mode) then + if (not ScreenSing.P4Mode) or (ScreenSong.Mode = smChallenge) then begin case PlayersPlay of 1: begin @@ -299,6 +299,12 @@ begin V[8] := false; V[9] := false; V[10] := false; + V[11] := false; + V[12] := false; + V[13] := false; + V[14] := false; + V[15] := false; + V[16] := false; end; 2, 4: begin V[1] := false; @@ -311,6 +317,12 @@ begin V[8] := false; V[9] := false; V[10] := false; + V[11] := false; + V[12] := false; + V[13] := false; + V[14] := false; + V[15] := false; + V[16] := false; end; 3, 6: begin V[1] := false; @@ -323,6 +335,12 @@ begin V[8] := false; V[9] := false; V[10] := false; + V[11] := false; + V[12] := false; + V[13] := false; + V[14] := false; + V[15] := false; + V[16] := false; end; end; end else @@ -339,24 +357,36 @@ begin V[8] := true; V[9] := true; V[10] := true; + V[11] := false; + V[12] := false; + V[13] := false; + V[14] := false; + V[15] := false; + V[16] := false; end; - 6: begin //not finished yet! + 6: begin V[1] := false; V[2] := false; V[3] := false; - V[4] := true; - V[5] := true; - V[6] := true; + V[4] := false; + V[5] := false; + V[6] := false; V[7] := false; V[8] := false; V[9] := false; V[10] := false; + V[11] := true; + V[12] := true; + V[13] := true; + V[14] := true; + V[15] := true; + V[16] := true; end; end; end; - for P := 1 to 10 do + for P := 1 to 16 do begin Text[TextName[P]].Visible := V[P]; Text[TextScore[P]].Visible := V[P]; @@ -370,8 +400,8 @@ begin Text[TextTotal[P]].Visible := V[P]; Text[TextTotalScore[P]].Visible := V[P]; - //4P-hack: - if (P>7) then + //4/6P-hack: + if (P>7) and (P<>11) and (P<>14) then begin Text[TextNotes[P]].Visible := false; Text[TextLineBonus[P]].Visible := false; @@ -440,7 +470,6 @@ begin end; // for end; // if - // 0.5.0: try also use 4 players screen with nicks if (not ScreenSing.P4Mode) and (PlayersPlay = 4) then begin for Item := 2 to 3 do @@ -463,7 +492,7 @@ begin // Singstar - let it be...... with 6 statics - if PlayersPlay = 6 then + if (not ScreenSing.P4Mode) and (PlayersPlay = 6) then begin for Item := 4 to 6 do begin @@ -471,7 +500,15 @@ begin if ScreenAct = 2 then P := Item-1; FillPlayer(Item, P); + end; + end; + if (ScreenSing.P4Mode) and (PlayersPlay = 6) then + begin + for Item := 11 to 16 do + begin + P := Item-11; + FillPlayer(Item, P); end; end; @@ -570,11 +607,14 @@ begin end; //Load Colors of Player Buttons and Nicks - LoadColor( + (*LoadColor( Text[TextName[Item]].ColR, Text[TextName[Item]].ColG, Text[TextName[Item]].ColB, - 'P' + IntToStr(P+1) + 'Dark'); + 'P' + IntToStr(P+1) + 'Dark');*) + Text[TextName[Item]].ColR := 1; + Text[TextName[Item]].ColG := 1; + Text[TextName[Item]].ColB := 1; LoadColor( Static[StaticBoxLightest[Item]].Texture.ColR, diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 472d11dc..402e24aa 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -25,8 +25,9 @@ type TScreenSing = class(TMenu) protected - paused: boolean; //Pause Mod PauseTime: Real; + WebCam: boolean; //Try WebCam? + paused: boolean; //Pause Mod public NumEmptySentences: array [0..1] of integer; //TextTime: integer; @@ -38,8 +39,8 @@ type StaticLyricDuetBar: integer; //TimeBar mod - StaticTimeProgress: integer; - TextTimeText: integer; + StaticTimeProgress: integer; + TextTimeText: integer; //eoa TimeBar mod SaveCoords: TSaveCoords; @@ -144,6 +145,8 @@ type procedure onShowFinish; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; function Draw: boolean; override; + function GetHelpID(): string; + procedure Finish; virtual; procedure Pause; //Pause Mod(Toggles Pause) @@ -166,8 +169,14 @@ const implementation uses UGraphic, UDataBase, UDraw, UMain, Classes, URecord, ULanguage, UHelp, math, - UPartyM2, UParty; - + UPartyM2, UParty, UWebCam; + + +function TScreenSing.GetHelpID(): string; +begin + Result := ID; +end; + // 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; @@ -262,8 +271,16 @@ begin SDLK_S: begin - Ini.PossibleScore := (Ini.PossibleScore+1) mod 3; - Ini.Save; + Ini.PossibleScore := (Ini.PossibleScore+1) mod 4; + //Ini.Save; + end; + + SDLK_W: + begin + if WebCam then + WebCam := false + else + WebCam := wStartWebCam(); end; SDLK_RETURN: @@ -448,6 +465,7 @@ begin UVideo.Init; MP3Volume := 100; + WebCam := false; end; procedure TScreenSing.onShow; @@ -624,6 +642,10 @@ begin end else begin P4Mode := true; + + if (PlayersPlay=6) then + Ini.PossibleScore := 3; + NR.Left := 10; NR.Right := 390; @@ -704,7 +726,7 @@ begin V5 := false; V6 := false; end; - 4: begin // double screen + 4: begin V1 := false; V1TwoP := true; //added for ps3 skin V1ThreeP := false; //added for ps3 skin @@ -717,7 +739,7 @@ begin V5 := false; V6 := false; end; - 6: begin // double screen + 6: begin V1 := false; V1TwoP := false; //added for ps3 skin V1ThreeP := true; //added for ps3 skin @@ -796,9 +818,9 @@ begin Text[TextP1TwoPScore].Visible := V1TwoP; //This one is shown in 3/6P mode - Static[StaticP1ThreeP].Visible := V1ThreeP; + Static[StaticP1ThreeP].Visible := V1ThreeP and not (PlayersPlay=6); Static[StaticP1ThreePScoreBG].Visible := V1ThreeP; - Text[TextP1ThreeP].Visible := V1ThreeP; + Text[TextP1ThreeP].Visible := V1ThreeP and not (PlayersPlay=6); Text[TextP1ThreePScore].Visible := V1ThreeP; //eoa @@ -807,14 +829,14 @@ begin Text[TextP2R].Visible := V2R; Text[TextP2RScore].Visible := V2R; - Static[StaticP2M].Visible := V2M; + Static[StaticP2M].Visible := V2M and not (PlayersPlay=6); Static[StaticP2MScoreBG].Visible := V2M; - Text[TextP2M].Visible := V2M; + Text[TextP2M].Visible := V2M and not (PlayersPlay=6); Text[TextP2MScore].Visible := V2M; - Static[StaticP3R].Visible := V3R; + Static[StaticP3R].Visible := V3R and not (PlayersPlay=6); Static[StaticP3RScoreBG].Visible := V3R; - Text[TextP3R].Visible := V3R; + Text[TextP3R].Visible := V3R and not (PlayersPlay=6); Text[TextP3RScore].Visible := V3R; Static[StaticP3FourP].Visible := V3FourP; @@ -827,19 +849,19 @@ begin Text[TextP4FourP].Visible := V4FourP; Text[TextP4FourPScore].Visible := V4FourP; - Static[StaticP4SixP].Visible := V4SixP; + Static[StaticP4SixP].Visible := false and V4SixP; Static[StaticP4SixPScoreBG].Visible := V4SixP; - Text[TextP4SixP].Visible := V4SixP; + Text[TextP4SixP].Visible := false and V4SixP; Text[TextP4SixPScore].Visible := V4SixP; - Static[StaticP5].Visible := V5; + Static[StaticP5].Visible := false and V5; Static[StaticP5ScoreBG].Visible := V5; - Text[TextP5].Visible := V5; + Text[TextP5].Visible := false and V5; Text[TextP5Score].Visible := V5; - Static[StaticP6].Visible := V6; + Static[StaticP6].Visible := false and V6; Static[StaticP6ScoreBG].Visible := V6; - Text[TextP6].Visible := V6; + Text[TextP6].Visible := false and V6; Text[TextP6Score].Visible := V6; //Set Position of Line Bonus - PhrasenBonus @@ -1182,6 +1204,9 @@ begin LoadNextSong; Log.LogStatus('End', 'onShow'); + + if not PerfLog.isActive and (Ini.Debug = 1) then + PerfLog.StartNewLog; end; procedure TScreenSing.SongError; @@ -1247,10 +1272,7 @@ begin Lyric.Size := 14; // 13 Lyric.ColR := Skin_FontR; Lyric.ColG := Skin_FontG; - Lyric.ColB := Skin_FontB; //Change für Crazy Joker - {Lyric.ColSR := Skin_FontHighlightR; - Lyric.ColSG := Skin_FontHighlightG; - Lyric.ColSB := Skin_FontHighlightB;1aa5dc} + Lyric.ColB := Skin_FontB; Lyric.ColSR := 5/255; //26 Lyric.ColSG := 163/255; //165 Lyric.ColSB := 210/255; //220 @@ -1259,22 +1281,22 @@ begin begin Lyric.FontStyle := 2; Lyric.Size := 14; - Lyric.ColR := 0.75; - Lyric.ColG := 0.75; + Lyric.ColR := 0.6; + Lyric.ColG := 0.6; Lyric.ColB := 1; - Lyric.ColSR := 0.5; - Lyric.ColSG := 0.5; + Lyric.ColSR := 0.25; + Lyric.ColSG := 0.25; Lyric.ColSB := 1; end; 2: begin Lyric.FontStyle := 3; Lyric.Size := 12; - Lyric.ColR := 0.75; - Lyric.ColG := 0.75; + Lyric.ColR := 0.6; + Lyric.ColG := 0.6; Lyric.ColB := 1; - Lyric.ColSR := 0.5; - Lyric.ColSG := 0.5; + Lyric.ColSR := 0.25; + Lyric.ColSG := 0.25; Lyric.ColSB := 1; end; end; // case @@ -1382,7 +1404,8 @@ begin end; // set movie - if (Ini.MovieSize<2) and (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin + if (Ini.MovieSize<2) and (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then + begin acOpenFile(PAnsiChar(AktSong.Path + AktSong.Video)); if (ScreenSong.Mode = smMedley) or ScreenSong.PartyMedley then @@ -1552,6 +1575,8 @@ begin end; end; + wStartWebCam(); + // play music (II) if (ScreenSong.Mode = smMedley) or ScreenSong.PartyMedley then Music.Fade(10, MP3Volume, AktSong.Medley.FadeIn_time) @@ -1578,11 +1603,13 @@ var T: integer; I, J, K:integer; ab: real; + tt: real; lastLine, LastWord: integer; medley_end: boolean; medley_start_applause: boolean; CurTime: real; begin + PerfLog.AddComment('ScreenSing: Start Draw'); //ScoreBG Mod // set player colors @@ -1873,26 +1900,16 @@ 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 SingDrawBackground; // update and draw movie - if ShowFinish and AktSong.VideoLoaded then begin + if ShowFinish and AktSong.VideoLoaded then + begin try acGetFrame(Czas.Teraz); - acDrawGL(ScreenAct); // this only draws + acDrawGL(ScreenAct, not WebCam); // this only draws except //If an Error occurs drawing: prevent Video from being Drawn again and Close Video AktSong.VideoLoaded := False; @@ -1906,6 +1923,7 @@ begin end; end; + wDraw(WebCam); // draw static menu (FG) DrawFG; @@ -1963,18 +1981,22 @@ begin Czesci[I].Czesc[K].Nuta[Czesci[I].Czesc[K].HighNut].Dlugosc); //lyric main and other nice things - if (ab>2.5*dt) or ((K = Czesci[I].High) and (ab>dt)) then + if (ab>2.3*dt) or ((K = Czesci[I].High) and (ab>dt)) then begin - Alpha[I] := Alpha[I]-TimeSkip/dt; + if (ab>3.3*dt) or (Alpha[I]<1) or (K = Czesci[I].High) then + Alpha[I] := Alpha[I]-TimeSkip/dt; if (Alpha[I]<0) then Alpha[I] := 0; - end else if (ab>2*dt) then - begin end else if (ab>dt) then begin - Alpha[I] := Alpha[I]+TimeSkip/dt; - if (Alpha[I]>1) then - Alpha[I] := 1; + tt := ab-dt; + if (tt<0) then + Alpha[I] := 1 + else + begin + if (1-tt/dt>Alpha[I]) or (K = Czesci[I].High)then + Alpha[I] := 1-tt/dt; + end; end else Alpha[I] := 1; @@ -2080,8 +2102,9 @@ begin ' mt: ' + FormatFloat('#0.00', Music.Position) + ' dt: ' + FormatFloat('#0.000', Czas.Teraz-Music.Position))); end; + PerfLog.AddComment('ScreenSing: End Draw'); end; - + procedure TScreenSing.UpdateMedleyStats(medley_end: boolean); var len, num, I : integer; @@ -2125,6 +2148,7 @@ var CurTime: real; begin + PerfLog.StopLogging; Music.CaptureStop; Music.Stop; @@ -2223,6 +2247,8 @@ begin LoadNextSong; end else begin + wStopWebCam(); + Ini.Save; //build sums len := Length(PlaylistMedley.Stats); num := PlaylistMedley.NumPlayer; @@ -2318,6 +2344,8 @@ begin end; end else begin + wStopWebCam(); + Ini.Save; SetLength(PlaylistMedley.Stats, 1); SetLength(PlaylistMedley.Stats[0].Player, PlayersPlay); for I := 0 to PlayersPlay - 1 do diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 56ea438a..715ec0b2 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -63,7 +63,20 @@ procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sou function ToSentences(Const Czeski: TCzesci): TSentences; implementation -uses UGraphic, UPartyM2, UParty, UDraw, UMain, Classes, URecord, ULanguage, math, UDLLManager, USkins, UGraphicClasses; +uses + UGraphic, + UPartyM2, + UParty, + UDraw, + UMain, + Classes, + URecord, + ULanguage, + math, + UDLLManager, + USkins, + UGraphicClasses, + UWebCam; // Method for input parsing. If False is returned, GetNextWindow // should be checked to know the next window to load; @@ -186,8 +199,7 @@ begin PlayerInfo.NumPlayers := PlayersPlay; for I := 0 to PlayerInfo.NumPlayers-1 do begin - if (ScreenSong.Mode=smChallenge) then - Ini.Name[I] := TeamInfo.TeamInfo[I].Playerinfo[TeamInfo.TeamInfo[I].CurPlayer].Name; + Ini.Name[I] := TeamInfo.TeamInfo[I].Playerinfo[TeamInfo.TeamInfo[I].CurPlayer].Name; PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); PlayerInfo.Playerinfo[I].Score:= 0; PlayerInfo.Playerinfo[I].Bar := 50; @@ -292,6 +304,7 @@ var medley_start_applause: boolean; CurTime: real; ab: real; + tt: real; begin //Aspect @@ -585,9 +598,11 @@ end; if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin acGetFrame(Czas.Teraz); - acDrawGL(ScreenAct); // this only draws + acDrawGL(ScreenAct, not WebCam); // this only draws end; + wDraw(WebCam); + // draw static menu (FG) DrawFG; @@ -646,16 +661,22 @@ end; Czesci[I].Czesc[K].Nuta[Czesci[I].Czesc[K].HighNut].Dlugosc); //lyric main and other nice things - if (ab>2.5*dt) or ((K = Czesci[I].High) and (ab>dt)) then + if (ab>2.3*dt) or ((K = Czesci[I].High) and (ab>dt)) then begin - Alpha[I] := Alpha[I]-TimeSkip/dt; + if (ab>3.3*dt) or (Alpha[I]<1) or (K = Czesci[I].High) then + Alpha[I] := Alpha[I]-TimeSkip/dt; if (Alpha[I]<0) then Alpha[I] := 0; end else if (ab>dt) then begin - Alpha[I] := Alpha[I]+TimeSkip/dt; - if (Alpha[I]>1) then - Alpha[I] := 1; + tt := ab-dt; + if (tt<0) then + Alpha[I] := 1 + else + begin + if (1-tt/dt>Alpha[I]) or (K = Czesci[I].High)then + Alpha[I] := 1-tt/dt; + end; end else Alpha[I] := 1; diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 7c7d04ba..7450fadb 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -39,6 +39,7 @@ type SkippedSongs: array of integer; ChooseableSongs: integer; isScrolling: boolean; + FadeOut: boolean; public Sel3: integer; //Selection in party mode (0=current, -1=left, 1=right) @@ -616,8 +617,7 @@ begin end; end; - SDLK_ESCAPE, - SDLK_BACKSPACE : + SDLK_ESCAPE: begin if UVideo.VideoOpened then begin @@ -669,8 +669,6 @@ begin //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 @@ -696,6 +694,7 @@ begin acClose; FadeTo(@ScreenMain); + FadeOut := true; end else if (Mode = smChallenge) then begin Music.PlayBack; @@ -718,21 +717,13 @@ begin 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; @@ -743,9 +734,10 @@ begin end else begin // clicked on song - if (CatSongs.Song[Interaction].isDuet and (PlayersPlay=1)) then + if (CatSongs.Song[Interaction].isDuet and ((PlayersPlay=1) or + (PlayersPlay=3) or (PlayersPlay=6))) then begin - ScreenPopupError.ShowPopup('It is a Duet Song! You need at least 2 Players.'); + ScreenPopupError.ShowPopup(Language.Translate('SING_ERROR_DUET_NUM_PLAYERS')); Exit; end; @@ -761,6 +753,7 @@ begin 1: SelectPlayers; 2: FadeTo(@ScreenSing); end; + FadeOut := true; end else begin WaitHandler.changed := false; @@ -972,7 +965,7 @@ begin (((Mode = smNormal) or ((Mode = smChallenge) and CatSongs.Song[Interaction].Main)) or ((Mode = smParty) and (PartySession.Rand3) and (Sel3<=0))) then begin - if (Mode = smParty) then + if (Mode = smParty) and (Sel3<1) then Inc(Sel3); Music.PlayChange; @@ -988,7 +981,7 @@ begin (((Mode = smNormal) or ((Mode = smChallenge) and CatSongs.Song[Interaction].Main)) or ((Mode = smParty) and (PartySession.Rand3) and (Sel3>=0))) then begin - if (Mode = smParty) then + if (Mode = smParty) and (Sel3>-1) then Dec(Sel3); Music.PlayChange; @@ -1103,7 +1096,7 @@ begin for I := 0 to Length(CatSongs.Song) - 1 do begin - if CatSongs.Song[I].Visible and not (I=Interaction)then + if CatSongs.Song[I].Visible and not (I=Interaction) then begin SetLength(VisArr, Length(VisArr)+1); VisArr[Length(VisArr)-1] := I; @@ -1119,7 +1112,6 @@ begin //Choose Song SkipTo2(I); end; - //old: SkipTo(Random(CatSongs.VisibleSongs)); end; Music.PlayChange; ChangeMusic; @@ -1915,90 +1907,6 @@ begin end; end; end; -{ old version -procedure TScreenSong.SetScroll5; // rotate -var - B: integer; - Angle: real; - Pos: Real; - VS: integer; - diff: real; - X: Real; -begin - VS := CatSongs.VisibleSongs; // cache Visible Songs - - //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/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 -// 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 := 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].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.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; } //new version from 1.1 (copy) procedure TScreenSong.SetScroll5; @@ -2089,7 +1997,7 @@ end; procedure TScreenSong.onShow; var - I: integer; + I: integer; begin if Music.VocalRemoverActivated() then @@ -2099,6 +2007,7 @@ begin Music.Stop; PartyMedley := false; + FadeOut := false; SungToEnd := false; if Mode = smMedley then @@ -2414,22 +2323,6 @@ begin 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; @@ -2580,7 +2473,7 @@ begin begin try if (VidVis<>full) or VidVisHandler.changed then - acDrawGLi(ScreenAct, Window, Blend); + acDrawGLi(ScreenAct, Window, Blend, true); if (Czas.Teraz>=Czas.Razem) then acClose; @@ -2612,7 +2505,7 @@ begin begin try if (VidVis=full) and not VidVisHandler.changed then - acDrawGL(ScreenAct); + acDrawGL(ScreenAct, true); if (Czas.Teraz>=Czas.Razem) then acClose; @@ -2675,7 +2568,7 @@ begin begin if (WaitHandler.changed and Music.isOpen and (((Ini.ShuffleTime<9) and (WaitHandler.change_time + TimeSkip>Ini.ShuffleTime*15)) - or (Music.Finished))) then + or (Music.Finished and not FadeOut))) then begin WaitHandler.change_time := 0; if (not WaitHandler.active) then @@ -2801,12 +2694,13 @@ begin Skip := 1; Skip2:= 0; - + if (Mode=smChallenge) and not PartyMedley then begin while (not CatSongs.Song[(Interaction + Skip + Skip2) mod Length(Interactions)].Visible or PartySessionM2.SongPlayed(CatSongs.CatNumShow, (Interaction + Skip + Skip2) mod Length(Interactions)) or - SongSkipped((Interaction + Skip + Skip2) mod Length(Interactions))) do + SongSkipped((Interaction + Skip + Skip2) mod Length(Interactions)) or + CatSongs.Song[(Interaction + Skip + Skip2) mod Length(Interactions)].isDuet) do begin if not CatSongs.Song[(Interaction + Skip + Skip2) mod Length(Interactions)].Visible then Inc(Skip) @@ -2818,7 +2712,8 @@ begin while (not CatSongs.Song[(Interaction + Skip + Skip2) mod Length(Interactions)].Visible or (CatSongs.Song[(Interaction + Skip + Skip2) mod Length(Interactions)].Medley.Source < MinSource) or PartyPlayedMedley((Interaction + Skip + Skip2) mod Length(Interactions)) or - SongSkipped((Interaction + Skip + Skip2) mod Length(Interactions))) do + SongSkipped((Interaction + Skip + Skip2) mod Length(Interactions)) or + CatSongs.Song[(Interaction + Skip + Skip2) mod Length(Interactions)].isDuet) do begin if not CatSongs.Song[(Interaction + Skip + Skip2) mod Length(Interactions)].Visible then Inc(Skip) @@ -2829,7 +2724,8 @@ begin begin while (not CatSongs.Song[(Interaction + Skip + Skip2) mod Length(Interactions)].Visible or PartyPlayedSong((Interaction + Skip + Skip2) mod Length(Interactions)) or - SongSkipped((Interaction + Skip + Skip2) mod Length(Interactions))) do + SongSkipped((Interaction + Skip + Skip2) mod Length(Interactions)) or + CatSongs.Song[(Interaction + Skip + Skip2) mod Length(Interactions)].isDuet) do begin if not CatSongs.Song[(Interaction + Skip + Skip2) mod Length(Interactions)].Visible then Inc(Skip) @@ -2860,13 +2756,12 @@ begin 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; + Skip, Skip2: integer; + //I: integer; VS: Integer; begin VS := CatSongs.VisibleSongs; @@ -2877,19 +2772,68 @@ begin UnLoadDetailedCover; Skip := 1; + Skip2:= 0; + + if (Mode=smChallenge) and not PartyMedley then + begin + while (not CatSongs.Song[(Interaction - Skip - Skip2 + Length(Interactions)) mod Length(Interactions)].Visible or + PartySessionM2.SongPlayed(CatSongs.CatNumShow, (Interaction - Skip - Skip2 + Length(Interactions)) mod Length(Interactions)) or + SongSkipped((Interaction - Skip - Skip2 + Length(Interactions)) mod Length(Interactions)) or + CatSongs.Song[(Interaction - Skip - Skip2 + Length(Interactions)) mod Length(Interactions)].isDuet) do + begin + if not CatSongs.Song[(Interaction - Skip - Skip2 + Length(Interactions)) mod Length(Interactions)].Visible then + Inc(Skip) + else + Inc(Skip2); + end; + end else if PartyMedley then + begin + while (not CatSongs.Song[(Interaction - Skip - Skip2 + Length(Interactions)) mod Length(Interactions)].Visible or + (CatSongs.Song[(Interaction - Skip - Skip2 + Length(Interactions)) mod Length(Interactions)].Medley.Source < MinSource) or + PartyPlayedMedley((Interaction - Skip - Skip2 + Length(Interactions)) mod Length(Interactions)) or + SongSkipped((Interaction - Skip - Skip2 + Length(Interactions)) mod Length(Interactions)) or + CatSongs.Song[(Interaction - Skip - Skip2 + Length(Interactions)) mod Length(Interactions)].isDuet) do + begin + if not CatSongs.Song[(Interaction - Skip - Skip2 + Length(Interactions)) mod Length(Interactions)].Visible then + Inc(Skip) + else + Inc(Skip2); + end; + end else if (Mode=smParty) then + begin + while (not CatSongs.Song[(Interaction - Skip - Skip2 + Length(Interactions)) mod Length(Interactions)].Visible or + PartyPlayedSong((Interaction - Skip - Skip2 + Length(Interactions)) mod Length(Interactions)) or + SongSkipped((Interaction - Skip - Skip2 + Length(Interactions)) mod Length(Interactions)) or + CatSongs.Song[(Interaction - Skip - Skip2 + Length(Interactions)) mod Length(Interactions)].isDuet) do + begin + if not CatSongs.Song[(Interaction - Skip - Skip2 + Length(Interactions)) mod Length(Interactions)].Visible then + Inc(Skip) + else + Inc(Skip2); + end; + end else + begin + while (not CatSongs.Song[(Interaction - Skip - Skip2 + Length(Interactions)) mod Length(Interactions)].Visible or + SongSkipped((Interaction - Skip - Skip2 + Length(Interactions)) mod Length(Interactions))) do + begin + if not CatSongs.Song[(Interaction - Skip - Skip2 + Length(Interactions)) mod Length(Interactions)].Visible then + Inc(Skip) + else + Inc(Skip2); + end; + end; - 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); + SongTarget := SongTarget - 1 - Skip2;//Skip; + Interaction := (Interaction - Skip - Skip2 + 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; + if SongTarget < 0 then + begin + SongTarget := SongTarget + VS; + SongCurrent := SongCurrent + VS; end; - // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture end; end; @@ -2903,26 +2847,7 @@ begin begin Music.Close; acClose; - { - if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then - begin - if (CatSongs.Song[Interaction].PreviewStart>0) then - Music.MoveTo(CatSongs.Song[Interaction].PreviewStart) - else - Music.MoveTo(Music.Length / 4); - - StartVideoPreview; - //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal - if (Ini.PreviewFading = 0) then - begin - Music.SetMusicVolume (MP3Volume); - Music.Play; - end else - begin - Music.Fade(0, MP3Volume, Ini.PreviewFading); - Music.Play; - end; - end; } + CoverTime := 0; end else begin Music.Stop; @@ -3034,7 +2959,7 @@ begin not MakeMedley and not PartyMedley then begin AktSong := CatSongs.Song[Interaction]; - DataBase.ReadScore(AktSong, 3, {Ini.SumPlayers}0); + DataBase.ReadScore(AktSong, 3, Ini.SumPlayers); for I := 0 to 2 do begin @@ -3436,7 +3361,6 @@ begin if (ChooseableSongs > 1) then begin RandomSongChallenge; - //SkipTo(Random(CatSongs.VisibleSongs - PartySessionM2.GetSongsPlayed(CatSongs.CatNumShow) - GetSongsSkipped())); SetJoker; Music.PlayChange; @@ -3675,10 +3599,12 @@ begin if (Mode = smParty) or (Mode = smChallenge) then begin FadeTo(@ScreenSingModi); + FadeOut := true; end else begin FadeTo(@ScreenSing); + FadeOut := true; end; end; @@ -3690,6 +3616,7 @@ begin VidVis := none; ScreenName.Goto_SingScreen := True; FadeTo(@ScreenName); + FadeOut := true; end; procedure TScreenSong.OpenEditor; @@ -3703,6 +3630,7 @@ begin ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName; ScreenEditSub.SongIndex := Interaction; FadeTo(@ScreenEditSub); + FadeOut := true; end; end; @@ -3720,9 +3648,6 @@ begin SetLength(SkippedSongs, Length(SkippedSongs)+1); SkippedSongs[Length(SkippedSongs)-1] := Interaction; - //SetLength(PartyPlayed, Length(PartyPlayed)+1); - //PartyPlayed[Length(PartyPlayed)-1] := Interaction; - SelectRandomSong; SetJoker; end; @@ -3736,9 +3661,6 @@ begin SetLength(SkippedSongs, Length(SkippedSongs)+1); SkippedSongs[Length(SkippedSongs)-1] := Interaction; - //SetLength(MedleyPlayed, Length(MedleyPlayed)+1); - //MedleyPlayed[Length(MedleyPlayed)-1] := Interaction; - SelectRandomSong; SetJoker; end; @@ -3780,12 +3702,21 @@ procedure TScreenSong.Refresh(GiveStats: boolean); var Pet: integer; I: integer; + Name: string; Label CreateSongButtons; begin + Log.BenchmarkStart(2); ClearButtons(); + Log.BenchmarkEnd(2); + Log.LogBenchmark('--> Refresh Clear Buttons', 2); + + Log.BenchmarkStart(2); CatSongs.Refresh; + Log.BenchmarkEnd(2); + Log.LogBenchmark('--> Refresh CatSongs', 2); + Log.BenchmarkStart(2); if (length(CatSongs.Song) > 0) then begin //Set Length of Button Array one Time Instead of one time for every Song @@ -3798,48 +3729,46 @@ begin 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].CoverTex.TexNum = -1) then + begin + Texture.Limit := 512; + if CatSongs.Song[Pet].Cover = '' then + AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), + 'JPG', 'Plain', Theme.Song.Cover.Reflections, true) + else + begin + Name := CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover; + // cache texture if there is a need to this + if not Covers.CoverExists(Name) then + begin + Texture.CreateCacheMipmap := true; + Texture.GetTexture(Name, '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(Name); - // puts this texture to the cache file - Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + // unload full size texture + Texture.UnloadTexture(Name, 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 + // 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, Name, 'JPG', 'Plain', Theme.Song.Cover.Reflections, true); end; + Texture.Limit := 1024*1024; + end else + AddButton(300 + Pet*250, 140, 200, 200, Theme.Song.Cover.Reflections, CatSongs.Song[Pet].CoverTex); - // 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; - if GiveStats then - begin - if (Pet mod 5 = 0) then - UpdateScreenLoading('Songs: '+IntToStr(Pet)); - end; - 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); + Log.LogError('Could not load Cover (maybe damaged?): ' + CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); //Change Cover to NoCover and Continue Loading CatSongs.Song[Pet].Cover := ''; @@ -3849,7 +3778,7 @@ begin begin Log.LogError('NoCover Cover is damaged!'); try - AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); + AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections, true); 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; @@ -3862,6 +3791,8 @@ begin GoTo CreateSongButtons; end; + Log.BenchmarkEnd(2); + Log.LogBenchmark('--> Refresh Create Buttons', 2); FixSelected; end; @@ -3959,7 +3890,7 @@ procedure TScreenSong.StartMedley(num: integer; MinS: TMedleySource); end; end; - num := random(Length(unused_arr)); + num := Random(Length(unused_arr)); Result := unused_arr[num]; end; @@ -3968,6 +3899,7 @@ var VS: integer; begin + Sel3 := 0; if (num>0) and not PartyMedley and not MakeMedley then begin VS := Length(getVisibleMedleyArr(MinS)); @@ -3976,7 +3908,6 @@ begin else PlaylistMedley.NumMedleySongs := num; - Randomize; //set up Playlist Medley SetLength(PlaylistMedley.Song, 0); for I := 0 to PlaylistMedley.NumMedleySongs - 1 do @@ -4014,8 +3945,6 @@ begin end else PlaylistMedley.NumMedleySongs := num; - Randomize; - //set up Playlist Medley for I := 1 to PlaylistMedley.NumMedleySongs - 1 do begin @@ -4051,6 +3980,7 @@ begin ScreenSongMenu.MenuShow(SM_Main); end;} end; + FadeOut := true; end else if PartyMedley then begin if (PlaylistMedley.NumMedleySongs = num) or @@ -4059,6 +3989,7 @@ begin begin Music.Stop; FadeTo(@ScreenSingModi); + FadeOut := true; end else if (ChooseableSongs=1) then begin VS := Length(getVisibleMedleyArr(MinS)); @@ -4070,6 +4001,7 @@ begin begin Music.Stop; FadeTo(@ScreenSingModi); + FadeOut := true; end else SelectRandomSong; end; @@ -4093,6 +4025,7 @@ begin ScreenSongMenu.MenuShow(SM_Main); end;} end; + FadeOut := true; end; end; end; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index 72ec1337..dbdea42e 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -151,8 +151,7 @@ begin Result := false; end; - SDLK_ESCAPE, - SDLK_BACKSPACE : + SDLK_ESCAPE: begin Music.PlayBack; Visible := False; @@ -180,9 +179,10 @@ begin if (CurMenu = SM_Sort) then Button[3].Visible := (Ini.Sorting <> SelectValue); - if (ScreenSong.Mode = smParty) and (ScreenSong.Sel3<=0) then + if (ScreenSong.Mode = smParty) and (PartySession.Rand3) and (ScreenSong.Sel3<=0) then begin - Inc(ScreenSong.Sel3); + if (ScreenSong.Sel3<1) then + Inc(ScreenSong.Sel3); Music.PlayChange; ScreenSong.SelectNext; ScreenSong.ChangeMusic; @@ -197,9 +197,10 @@ begin if (CurMenu = SM_Sort) then Button[3].Visible := (Ini.Sorting <> SelectValue); - if (ScreenSong.Mode = smParty) and (ScreenSong.Sel3>=0) then + if (ScreenSong.Mode = smParty) and (PartySession.Rand3) and (ScreenSong.Sel3>=0) then begin - Dec(ScreenSong.Sel3); + if (ScreenSong.Sel3>-1) then + Dec(ScreenSong.Sel3); Music.PlayChange; ScreenSong.SelectPrev; ScreenSong.ChangeMusic; -- cgit v1.2.3