aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Screens
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Game/Code/Screens/UScreenCredits.pas1110
-rw-r--r--Game/Code/Screens/UScreenEdit.pas109
-rw-r--r--Game/Code/Screens/UScreenEditConvert.pas531
-rw-r--r--Game/Code/Screens/UScreenEditHeader.pas366
-rw-r--r--Game/Code/Screens/UScreenEditSub.pas1854
-rw-r--r--Game/Code/Screens/UScreenLevel.pas104
-rw-r--r--Game/Code/Screens/UScreenLoading.pas46
-rw-r--r--Game/Code/Screens/UScreenMain.pas329
-rw-r--r--Game/Code/Screens/UScreenName.pas243
-rw-r--r--Game/Code/Screens/UScreenOpen.pas165
-rw-r--r--Game/Code/Screens/UScreenOptions.pas176
-rw-r--r--Game/Code/Screens/UScreenOptionsAdvanced.pas112
-rw-r--r--Game/Code/Screens/UScreenOptionsGame.pas117
-rw-r--r--Game/Code/Screens/UScreenOptionsGraphics.pas107
-rw-r--r--Game/Code/Screens/UScreenOptionsLyrics.pas101
-rw-r--r--Game/Code/Screens/UScreenOptionsRecord.pas142
-rw-r--r--Game/Code/Screens/UScreenOptionsSound.pas107
-rw-r--r--Game/Code/Screens/UScreenOptionsThemes.pas166
-rw-r--r--Game/Code/Screens/UScreenPartyNewRound.pas376
-rw-r--r--Game/Code/Screens/UScreenPartyNewRoundM2.pas313
-rw-r--r--Game/Code/Screens/UScreenPartyOptions.pas649
-rw-r--r--Game/Code/Screens/UScreenPartyOptionsM2.pas819
-rw-r--r--Game/Code/Screens/UScreenPartyPlayer.pas340
-rw-r--r--Game/Code/Screens/UScreenPartyPlayerM2.pas256
-rw-r--r--Game/Code/Screens/UScreenPartyScore.pas301
-rw-r--r--Game/Code/Screens/UScreenPartyWin.pas267
-rw-r--r--Game/Code/Screens/UScreenPopup.pas862
-rw-r--r--Game/Code/Screens/UScreenScore.pas544
-rw-r--r--Game/Code/Screens/UScreenSing.pas1611
-rw-r--r--Game/Code/Screens/UScreenSingModi.pas772
-rw-r--r--Game/Code/Screens/UScreenSong.pas3133
-rw-r--r--Game/Code/Screens/UScreenSongJumpto.pas213
-rw-r--r--Game/Code/Screens/UScreenSongMenu.pas661
-rw-r--r--Game/Code/Screens/UScreenStatDetail.pas259
-rw-r--r--Game/Code/Screens/UScreenStatMain.pas235
-rw-r--r--Game/Code/Screens/UScreenTop.pas210
-rw-r--r--Game/Code/Screens/UScreenWelcome.pas118
37 files changed, 17824 insertions, 0 deletions
diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas
new file mode 100644
index 00000000..96eb1642
--- /dev/null
+++ b/Game/Code/Screens/UScreenCredits.pas
@@ -0,0 +1,1110 @@
+unit UScreenCredits;
+
+interface
+
+uses
+ UMenu, SDL, UDisplay, UTexture, gl, 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_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;
+ 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;
+ 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 = // |
+ '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=(
+ 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 blindy
+ 666, // 10 Start canni
+ 936, // 11 Start ggkfc
+ 1206, // 12 Start jaybinks
+ 1476, // 13 Start linnex
+ 1746, // 14 Start mog
+ 2016, // 15 Start omgdutch
+ 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, USongs, Textgl, opengl, ULanguage, 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_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0);
+ credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0);
+ 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);
+ 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);
+
+ 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', 'Plain', 0);
+
+ CRDTS_Stage:=InitialDelay;
+end;
+
+function TScreenCredits.Draw: boolean;
+begin
+ DrawCredits;
+end;
+
+procedure TScreenCredits.onShow;
+begin
+ CRDTS_Stage:=InitialDelay;
+ Credits_X := 580;
+ deluxe_slidein := 0;
+ Credits_Alpha := 0;
+ Music.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!!
+ Music.SetVolume(100); //Whiteshark, you hear me now? :P
+ CTime:=0;
+// setlength(CTime_hold,0);
+end;
+
+procedure TScreenCredits.onHide;
+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;
+ 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
+
+// blindy (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_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 (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_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;
+
+// ggkfc (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_ggkfc.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;
+
+// jaybinks (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;
+ 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
+ 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_jaybinks.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;
+
+// linnex (just scrolls from left to right, no twinkling stars, no on-beat flashing)
+ STime:=Timings[13]-10;
+ Delay:=Timings[14]-Timings[13]+10;
+ 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_linnex.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;
+
+// omgdutch (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_omgdutch.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.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;
+
+ //timing hack
+// Draw_FunkyText;
+end;
+
+end.
diff --git a/Game/Code/Screens/UScreenEdit.pas b/Game/Code/Screens/UScreenEdit.pas
new file mode 100644
index 00000000..b78df989
--- /dev/null
+++ b/Game/Code/Screens/UScreenEdit.pas
@@ -0,0 +1,109 @@
+unit UScreenEdit;
+
+interface
+
+uses UMenu, SDL, UThemes;
+
+type
+ TScreenEdit = class(TMenu)
+ 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 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_Q:
+ begin
+ Result := false;
+ end;
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ 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;
+begin
+ 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;
+
+// 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.pas b/Game/Code/Screens/UScreenEditConvert.pas
new file mode 100644
index 00000000..d19d95e3
--- /dev/null
+++ b/Game/Code/Screens/UScreenEditConvert.pas
@@ -0,0 +1,531 @@
+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; 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, gl, 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
+ 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;
+ 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;
+
+procedure TScreenEditConvert.MidiFile1MidiEvent(event: PMidiEvent);
+begin
+// Log.LogStatus(IntToStr(event.event), 'MIDI');
+ MidiOut.PutShort(event.event, event.data1, event.data2);
+end;
+
+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';
+ 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
+ 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;
+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.pas b/Game/Code/Screens/UScreenEditHeader.pas
new file mode 100644
index 00000000..35d7840f
--- /dev/null
+++ b/Game/Code/Screens/UScreenEditHeader.pas
@@ -0,0 +1,366 @@
+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; 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, UFiles, 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_Q:
+ begin
+ Result := false;
+ end;
+ 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
+ Text[T].DeleteLastL;
+ 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;
+begin
+ inherited Create;
+
+ 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.pas b/Game/Code/Screens/UScreenEditSub.pas
new file mode 100644
index 00000000..3b132810
--- /dev/null
+++ b/Game/Code/Screens/UScreenEditSub.pas
@@ -0,0 +1,1854 @@
+unit UScreenEditSub;
+
+interface
+
+uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, UMenuText,
+ ULyrics, Math, gl, UThemes, MidiOut, UHelp;
+
+type
+ TMedleyNotes = record
+ start: TPos;
+ end_: TPos;
+ Preview: TPos;
+ isStart: boolean; //start beat is declared
+ isEnd: boolean; //end beat is declared
+ end;
+
+ TScreenEditSub = class(TMenu)
+ const
+ ID='ID_001'; //for help system
+
+ private
+ //Variable is True if no SOng is loaded
+ Error: Boolean;
+ MP3Volume: Integer;
+
+ 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;
+ MedleyNotes: TMedleyNotes;
+
+ editText: string; //backup of current text in text-edit-mode
+ noteStart: integer; //Start note when playing sentence
+ LineChanged: 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;
+ function GetMedleyLength: real; //returns if availible the length of the medley in seconds, else 0
+ public
+ Tex_Background: TTexture;
+ FadeOut: boolean;
+ Path: string;
+ FileName: string;
+ SongIndex: integer; //SongIndex from CatSongs.Song
+ 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;
+ SResult: boolean;
+begin
+ Result := true;
+
+ Text[TextDebug].Text := '';
+
+ 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_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ 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
+ //Medley MOD:
+ if (MedleyNotes.isStart and MedleyNotes.isEnd) and
+ (MedleyNotes.start.line < MedleyNotes.end_.line) then
+ begin
+ AktSong.Medley.Source := msTag;
+ AktSong.Medley.StartBeat:=Czesci[0].Czesc[MedleyNotes.start.line].Nuta[MedleyNotes.start.note].Start;
+ AktSong.Medley.EndBeat:=Czesci[0].Czesc[MedleyNotes.end_.line].Nuta[MedleyNotes.end_.note].Start +
+ Czesci[0].Czesc[MedleyNotes.end_.line].Nuta[MedleyNotes.end_.note].Dlugosc;
+ AktSong.Medley.FadeIn_time := DEFAULT_FADE_IN_TIME;
+ AktSong.Medley.FadeOut_time := DEFAULT_FADE_OUT_TIME;
+ end else begin
+ AktSong.Medley.Source := msNone;
+ AktSong.Medley.StartBeat:=0;
+ AktSong.Medley.EndBeat:=0;
+ end;
+
+ // Save Song
+ if SDL_ModState = KMOD_LSHIFT then
+ begin
+ if (AktSong.Medley.Source = msTag) then
+ begin
+ ScreenPopupError.ShowPopup(Language.Translate('Medley and Relative is not supported!'));
+ Exit;
+ end;
+
+ SResult := SaveSong(AktSong, Czesci[0], Path + FileName, true); //save with relative
+ end else
+ SResult := SaveSong(AktSong, Czesci[0], Path + FileName, false);
+
+ if SResult then
+ begin
+ Text[TextDebug].Text := Language.Translate('INFO_FILE_SAVED');
+ CatSongs.Song[SongIndex] := AktSong;
+ end else
+ begin
+ ScreenPopupError.ShowPopup(Language.Translate('ERROR_SAVE_FILE_FAILED'));
+ end;
+
+ Exit;
+ end;
+
+ // set Medley tags
+ SDLK_A:
+ begin
+ if AktSong.Relative then
+ begin
+ ScreenPopupError.ShowPopup(Language.Translate('Medley and Relative is not supported!'));
+ Exit;
+ end;
+
+ if SDL_ModState = KMOD_LSHIFT then //Medley End Note
+ begin
+ if MedleyNotes.isEnd then
+ begin
+ if (Czesci[0].Akt=MedleyNotes.end_.line) and (AktNuta=MedleyNotes.end_.note) then
+ begin
+ MedleyNotes.isEnd := false;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].IsMedley := false;
+ end else
+ begin
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].IsMedley := true;
+ Czesci[0].Czesc[MedleyNotes.end_.line].Nuta[MedleyNotes.end_.note].IsMedley := false;
+ MedleyNotes.end_.line := Czesci[0].Akt;
+ MedleyNotes.end_.note := AktNuta;
+ end;
+ end else
+ begin
+ MedleyNotes.isEnd := true;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].IsMedley := true;
+ MedleyNotes.end_.line := Czesci[0].Akt;
+ MedleyNotes.end_.note := AktNuta;
+ end;
+ end else
+ begin //Medley Start Note
+ if MedleyNotes.isStart then
+ begin
+ if (Czesci[0].Akt=MedleyNotes.start.line) and (AktNuta=MedleyNotes.start.note) then
+ begin
+ MedleyNotes.isStart := false;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].IsMedley := false;
+ end else
+ begin
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].IsMedley := true;
+ Czesci[0].Czesc[MedleyNotes.start.line].Nuta[MedleyNotes.start.note].IsMedley := false;
+ MedleyNotes.start.line := Czesci[0].Akt;
+ MedleyNotes.start.note := AktNuta;
+ end;
+ end else
+ begin
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].IsMedley := true;
+ MedleyNotes.isStart := true;
+ MedleyNotes.start.line := Czesci[0].Akt;
+ MedleyNotes.start.note := AktNuta;
+ end;
+ end;
+
+ //show length of medley
+ Text[TextDebug].Text := FormatFloat('MedleyLength: #0.00s', GetMedleyLength);
+ Exit;
+ end;
+
+ // jump to Medley tags
+ SDLK_J:
+ begin
+ if AktSong.Relative then
+ begin
+ ScreenPopupError.ShowPopup(Language.Translate('Medley and Relative is not supported!'));
+ Exit;
+ end;
+
+ if (SDL_ModState = KMOD_LSHIFT) and MedleyNotes.IsEnd then //Medley End Note
+ 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;
+ Czesci[0].Akt := MedleyNotes.end_.line;
+ AktNuta := MedleyNotes.end_.note;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 2;
+
+ Lyric.AddCzesc(Czesci[0].Akt);
+ Lyric.Selected := AktNuta;
+ Music.Stop;
+ PlaySentence := false;
+ end else if MedleyNotes.IsStart 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;
+ Czesci[0].Akt := MedleyNotes.start.line;
+ AktNuta := MedleyNotes.start.note;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 2;
+
+ Lyric.AddCzesc(Czesci[0].Akt);
+ Lyric.Selected := AktNuta;
+ Music.Stop;
+ PlaySentence := false
+ end;
+
+ if (SDL_ModState = KMOD_LALT) then
+ begin
+ PlaySentenceMidi := false;
+ Music.Stop;
+ LineChanged:=false;
+ R := GetTimeFromBeat(Czesci[0].Czesc[MedleyNotes.start.line].Nuta[MedleyNotes.start.note].Start);
+ if R <= Music.Length then begin
+ Music.MoveTo(R);
+ PlayStopTime := GetTimeFromBeat(
+ Czesci[0].Czesc[MedleyNotes.end_.line].Nuta[MedleyNotes.end_.note].Start +
+ Czesci[0].Czesc[MedleyNotes.end_.line].Nuta[MedleyNotes.end_.note].Dlugosc);
+ PlaySentence := true;
+ Music.Play;
+ LastClick := -100;
+ end;
+ end;
+
+ //show length of medley
+ Text[TextDebug].Text := FormatFloat('MedleyLength: #0.00s', GetMedleyLength);
+ Exit;
+ end;
+
+ SDLK_K: //Preview Start
+ begin
+ if (SDL_ModState = KMOD_LSHIFT) then //jump to...
+ 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;
+ Czesci[0].Akt := MedleyNotes.Preview.line;
+ AktNuta := MedleyNotes.Preview.note;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 2;
+
+ Lyric.AddCzesc(Czesci[0].Akt);
+ Lyric.Selected := AktNuta;
+ Music.Stop;
+ PlaySentence := false
+ end else
+ begin
+ if (Czesci[0].Akt = MedleyNotes.Preview.line) and (AktNuta = MedleyNotes.Preview.note) then //reset ?
+ begin
+
+ end else //set
+ begin
+ Czesci[0].Czesc[MedleyNotes.Preview.line].Nuta[MedleyNotes.Preview.note].IsStartPreview := false;
+ MedleyNotes.Preview.line := Czesci[0].Akt;
+ MedleyNotes.Preview.note := AktNuta;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].IsStartPreview := true;
+ AktSong.PreviewStart := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].start);
+ end;
+ end;
+ 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_R: //reload
+ begin
+ onHide;
+ onShow;
+ 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
+ editText := Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst;
+ TextEditMode := true;
+ end;
+
+ SDLK_P:
+ begin
+ if SDL_ModState = 0 then begin
+ // Play Sentence
+ MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127);
+ PlaySentenceMidi := false;
+ 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;
+ Music.Stop;
+ PlaySentence := false;
+ 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;
+
+ //new: play hole file + LALT
+ if SDL_ModState = KMOD_LALT then begin
+ // Play Sentence
+ MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127);
+ PlaySentenceMidi := false;
+ Click := true;
+ Music.Stop;
+ R := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote);
+ if R <= Music.Length then begin
+ Music.MoveTo(R);
+ PlayStopTime := Music.Length;
+ PlaySentence := true;
+ Music.Play;
+ LastClick := -100;
+ end;
+ end;
+
+ if SDL_ModState = KMOD_LSHIFT or KMOD_LALT then begin
+ PlaySentenceMidi := true;
+ Music.Stop;
+ PlaySentence := false;
+ MidiTime := USTime.GetTime;
+ MidiStart := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote);
+ MidiStop := Music.Length;
+
+ LastClick := -100;
+ end;
+
+ if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL or KMOD_LALT then begin
+ PlaySentenceMidi := true;
+ MidiTime := USTime.GetTime;
+ MidiStart := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote);
+ MidiStop := Music.Length;
+ LastClick := -100;
+
+ PlaySentence := true;
+ Click := true;
+ Music.Stop;
+ Music.MoveTo(GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].StartNote)+0{-0.10});
+ PlayStopTime := Music.Length;
+ Music.Play;
+ LastClick := -100;
+ end;
+
+ if PlaySentenceMidi or PlaySentence then
+ begin
+ noteStart := AktNuta;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0;
+ AktNuta := 0;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 2;
+ Lyric.Selected := AktNuta;
+ LineChanged:=false;
+ end;
+
+ end;
+
+ SDLK_SPACE:
+ begin
+ //Thx to f1fth_freed0m for his One Note Midi Playback
+ if SDL_ModState = KMOD_LSHIFT then begin //Play One Notes Midi [Shift + Space]
+ PlaySentenceMidi := true;
+ Music.Stop;
+ PlaySentence := false;
+ MidiTime := USTime.GetTime;
+ MidiStart := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start);
+ MidiStop := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc);
+ LastClick := -100;
+ end
+
+ else if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL then begin
+ //Play One Notes Midi + MP3 [CTRL + Shift + Space]
+ PlaySentenceMidi := true;
+ MidiTime := USTime.GetTime;
+ MidiStart := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start);
+ MidiStop := GetTimeFromBeat(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc);
+ LastClick := -100;
+
+ PlaySentence := true;
+ Click := true;
+ 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
+
+ Else
+ begin
+ // Play One Notes MP3 [Space]
+ MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127);
+ 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;
+
+
+ if PlaySentence or PlaySentenceMidi then
+ begin
+ noteStart := AktNuta;
+ LineChanged:=false;
+ end;
+ 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 := 2;
+ 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;
+ FixTimings;
+ 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);
+ FixTimings;
+ 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);
+ FixTimings;
+ end;
+
+ // alt + ctrl + shift + right = move all from cursor to right
+ if SDL_ModState = KMOD_LALT + KMOD_LCTRL + KMOD_LSHIFT then begin
+ MoveAllToEnd(1);
+ FixTimings;
+ end;
+
+ MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127);
+ PlaySentenceMidi := false;
+ Music.Stop;
+ LineChanged:=false;
+ PlaySentence := false;
+ 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 := 2;
+ 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;
+ FixTimings;
+ 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);
+ FixTimings;
+ 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;
+ FixTimings;
+ end;
+
+ // alt + ctrl + shift + right = move all from cursor to left
+ if SDL_ModState = KMOD_LALT + KMOD_LCTRL + KMOD_LSHIFT then begin
+ MoveAllToEnd(-1);
+ FixTimings;
+ end;
+
+ MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127);
+ PlaySentenceMidi := false;
+ Music.Stop;
+ LineChanged:=false;
+ PlaySentence := false;
+ 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 := 2;
+
+ 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 := 2;
+
+ 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, 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;
+
+ //MP3-Volume Up
+ SDLK_PAGEUP:
+ begin
+ if (MP3Volume<100) then
+ MP3Volume := MP3Volume+5;
+ Music.SetVolume(MP3Volume);
+ Text[TextDebug].Text := 'MP3 Volume: ' + IntToStr(MP3Volume) + '%';
+ end;
+
+ //MP3-Volume Down
+ SDLK_PAGEDOWN:
+ begin
+ if (MP3Volume>0) then
+ MP3Volume := MP3Volume-5;
+ Music.SetVolume(MP3Volume);
+ Text[TextDebug].Text := 'MP3 Volume: ' + IntToStr(MP3Volume) + '%';
+ 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 Ini.Debug=1 then
+ Text[TextDebug].Text := 'PressedKey: ' + IntToStr(PressedKey) + ' ScanCode: ' + IntToStr(ScanCode);
+
+ // check normal keys
+ if not (ScanCode in [0..31, 127..159]) then //=isPrintable
+ begin
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst :=
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst + chr(ScanCode);
+
+ Lyric.ChangeCurText(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst);
+ Lyric.AddCzesc(Czesci[0].Akt);
+ Exit;
+ end;
+
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_ESCAPE:
+ begin
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst := editText;
+ Lyric.AddCzesc(Czesci[0].Akt);
+ TextEditMode := false;
+ end;
+ SDLK_F4, SDLK_RETURN:
+ begin
+ // Exit Text Edit Mode
+ TextEditMode := false;
+ 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);
+
+ Lyric.ChangeCurText(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst);
+ Lyric.AddCzesc(Czesci[0].Akt);
+ 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 := 2;
+ Lyric.Selected := AktNuta;
+ editText := Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst;
+ 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 := 2;
+ Lyric.Selected := AktNuta;
+ editText := Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst;
+ 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
+ Lyric.AddCzesc(Czesci[0].Akt);
+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
+ Lyric.AddCzesc(Czesci[0].Akt);
+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
+ S := Min + 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 := 2;
+ 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);
+ Lyric.AddCzesc(Czesci[0].Akt);
+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 := 2;
+ Lyric.AddCzesc(Czesci[0].Akt);
+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 := 2;
+ 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 := 2;
+ end;
+ end;
+ Lyric.AddCzesc(Czesci[0].Akt);
+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
+ Lyric.AddCzesc(Czesci[0].Akt);
+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 := '- ';
+ Lyric.AddCzesc(Czesci[0].Akt);
+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;
+ Lyric.AddCzesc(Czesci[0].Akt);
+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;
+begin
+ inherited Create;
+ SetLength(Player, 1);
+
+ //Theme:
+ //bg
+ AddStatic(0, 0, 800, 600, 0.3, 0.5, 0.6, Skin.GetTextureFileName('ButtonFade'), 'JPG', 'Font Black');
+
+ // Line
+ AddStatic(20, 5, 200, 40, 0.95, 0.95, 0.95, Skin.GetTextureFileName('ButtonFade'), 'JPG', 'Font Black');
+ AddText(40, 14, 1, 8, 0, 0, 0, 'Line:');
+ TextSentence := AddText(110, 14, 1, 8, 0, 0, 0, '0 / 0');
+
+ // Note
+ AddStatic(260, 5, 200, 40, 0.95, 0.95, 0.95, Skin.GetTextureFileName('ButtonFade'), 'JPG', 'Font Black');
+ AddText(282, 14, 1, 8, 0, 0, 0, 'Note:');
+ TextNote := AddText(360, 14, 1, 8, 0, 0, 0, '0 / 0');
+
+ // some borders
+ AddStatic(18, 53, 764, 240, 0, 0, 0, Skin.GetTextureFileName('ButtonFade'), 'JPG', 'Font Black');
+ AddStatic(20, 55, 760, 236, 0.95, 0.95, 0.95, Skin.GetTextureFileName('ButtonFade'), 'JPG', 'Font Black');
+
+ AddStatic(18, 303, 764, 139, 0, 0, 0, Skin.GetTextureFileName('ButtonFade'), 'JPG', 'Font Black');
+ AddStatic(20, 305, 760, 135, 0.95, 0.95, 0.95, Skin.GetTextureFileName('ButtonFade'), 'JPG', 'Font Black');
+
+ AddStatic(18, 498, 764, 44, 0, 0, 0, Skin.GetTextureFileName('ButtonFade'), 'JPG', 'Font Black');
+ AddStatic(20, 500, 760, 40, 0.95, 0.95, 0.95, Skin.GetTextureFileName('ButtonFade'), 'JPG', 'Font Black');
+
+
+ AddText(30, 65, 0, 8, 0, 0, 0, 'Title:');
+ AddText(30, 90, 0, 8, 0, 0, 0, 'Artist:');
+ AddText(30, 115, 0, 8, 0, 0, 0, 'Mp3:');
+ AddText(30, 140, 0, 8, 0, 0, 0, 'BPM:');
+ AddText(30, 165, 0, 8, 0, 0, 0, 'GAP:');
+
+ TextTitle := AddText(180, 65, 0, 8, 0, 0, 0, 'a');
+ TextArtist := AddText(180, 90, 0, 8, 0, 0, 0, 'b');
+ TextMp3 := AddText(180, 115, 0, 8, 0, 0, 0, 'c');
+ TextBPM := AddText(180, 140, 0, 8, 0, 0, 0, 'd');
+ TextGAP := AddText(180, 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(30, 190, 0, 8, 0, 0, 0, 'Start:');
+ AddText(30, 215, 0, 8, 0, 0, 0, 'Duration:');
+ AddText(30, 240, 0, 8, 0, 0, 0, 'Tone:');
+ AddText(30, 265, 0, 8, 0, 0, 0, 'Text:');
+
+ TextNStart := AddText(180, 190, 0, 8, 0, 0, 0, 'a');
+ TextNDlugosc := AddText(180, 215, 0, 8, 0, 0, 0, 'b');
+ TextNTon := AddText(180, 240, 0, 8, 0, 0, 0, 'c');
+ TextNText := AddText(180, 265, 0, 8, 0, 0, 0, 'd');
+
+ // debug
+ TextDebug := AddText(30, 550, 0, 9, 0, 0, 0, '');
+end;
+
+procedure TScreenEditSub.onShow;
+begin
+ Log.LogStatus('Initializing', 'TEditScreen.onShow');
+
+ try
+ ResetSingTemp;
+ AktSong := CatSongs.Song[SongIndex];
+ Error := not LoadSong(Path + FileName, SONG_LOAD_COMPLETE);
+ if not Error then
+ FindRefrainStart(AktSong);
+ 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
+ MidiOut := TMidiOutput.Create(nil);
+ MidiOut.Open;
+
+ //Set Volume
+ MP3Volume := 50;
+ Music.SetVolume(MP3Volume);
+
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenEditSub)');
+
+ Text[TextTitle].Text := AktSong.Title;
+ Text[TextArtist].Text := AktSong.Artist;
+ Text[TextMp3].Text := AktSong.Mp3;
+
+ Czesci[0].Akt := 0;
+ AktNuta := 0;
+ noteStart := 0; //when playing sentence
+ Czesci[0].Czesc[0].Nuta[0].Color := 2;
+
+ if AktSong.Medley.Source <> msNone then
+ begin
+ MedleyNotes.isStart := true;
+ MedleyNotes.isEnd := true;
+ MedleyNotes.start := FindNote(AktSong.Medley.StartBeat);
+ MedleyNotes.end_ := FindNote(AktSong.Medley.EndBeat);
+ Czesci[0].Czesc[MedleyNotes.start.line].Nuta[MedleyNotes.start.note].IsMedley := true;
+ Czesci[0].Czesc[MedleyNotes.end_.line].Nuta[MedleyNotes.end_.note].IsMedley := true;
+ end;
+
+ //set Preview Start
+ MedleyNotes.Preview := FindNote(round(GetMidBeat(AktSong.PreviewStart-AktSong.Gap/1000)));
+ Czesci[0].Czesc[MedleyNotes.Preview.line].Nuta[MedleyNotes.Preview.note].IsStartPreview := true;
+ AktSong.PreviewStart := GetTimeFromBeat(Czesci[0].Czesc[MedleyNotes.Preview.line].Nuta[MedleyNotes.Preview.note].start);
+
+ 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;
+ 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;
+ PlayClick: boolean;
+ line, note: integer;
+ end_: boolean;
+begin
+ glClearColor(1,1,1,1);
+
+ PlayClick := false;
+ if PlaySentenceMidi or PlaySentence then
+ begin
+ MidiPos := USTime.GetTime - MidiTime + MidiStart;
+ // click
+ if PlaySentence then
+ begin
+ AktBeat := Floor(GetMidBeat(Music.Position - AktSong.GAP / 1000));
+ if Music.Position>PlayStopTime then
+ end_ := true
+ else
+ end_ := false;
+ end else
+ begin
+ AktBeat := Floor(GetMidBeat(MidiPos - AktSong.GAP / 1000));
+ if MidiPos>MidiStop then
+ end_ := true
+ else
+ end_ := false;
+ end;
+
+ if AktBeat <> LastClick then
+ begin
+ for line := 0 to Length(Czesci[0].Czesc) - 1 do
+ begin
+ for note := 0 to Length(Czesci[0].Czesc[line].Nuta) - 1 do
+ begin
+ //line change
+ if (Czesci[0].Czesc[line].Start = AktBeat) and (line <> Czesci[0].Akt) and not end_ then
+ begin
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0;
+ AktNuta := 0;
+ Inc(Czesci[0].Akt);
+ if Czesci[0].Akt > Length(Czesci[0].Czesc)-1 then //useful?
+ Czesci[0].Akt := 0;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1;
+ Lyric.AddCzesc(Czesci[0].Akt);
+ Lyric.Selected := AktNuta;
+ LineChanged := true;
+ end;
+
+ if (Czesci[0].Czesc[line].Nuta[note].Start = AktBeat) then
+ begin
+ LastClick := AktBeat;
+ PlayClick := true;
+ end;
+ end;
+ end;
+ end;
+ end else
+ LineChanged := false;
+
+ // midi music
+ if PlaySentenceMidi then begin
+
+ // stop the music
+ if end_ 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;
+ AktNuta := noteStart;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 2;
+ Lyric.Selected := AktNuta;
+ end;
+
+ // click
+ Text[TextDebug].Text := IntToStr(AktBeat);
+
+ if PlayClick 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 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 end_ then begin
+ Music.Stop;
+ PlaySentence := false;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0;
+ AktNuta := noteStart;
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 2;
+ Lyric.Selected := AktNuta;
+ end;
+
+ if (Click) and (PlaySentence) then
+ begin
+ Text[TextDebug].Text := IntToStr(AktBeat);
+ if PlayClick then
+ Music.PlayClick;
+ end; // click
+ end;
+
+ // move "cursor"
+ if (PlaySentence or PlaySentenceMidi) then
+ begin
+ for line := 0 to Length(Czesci[0].Czesc) - 1 do
+ begin
+ for note := 0 to Length(Czesci[0].Czesc[line].Nuta) - 1 do
+ begin
+ //note change
+ if (Czesci[0].Czesc[line].Nuta[note].Start = AktBeat) and
+ ((note <> AktNuta) or LineChanged) then
+ begin
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 0;
+ if not LineChanged then
+ Inc(AktNuta)
+ else
+ LineChanged := false;
+
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 2;
+ Lyric.AddCzesc(Czesci[0].Akt);
+ Lyric.Selected := AktNuta;
+ end;
+ end;
+ end;
+ end;
+
+ 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;
+
+ //F and G and Medley Mod:
+ if Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].FreeStyle then
+ Text[TextNTon].Text := Text[TextNTon].Text + ' *F*'
+ else if Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Wartosc = 2 then
+ Text[TextNTon].Text := Text[TextNTon].Text + ' *G*';
+
+ if MedleyNotes.isStart and (Czesci[0].Akt = MedleyNotes.start.line)
+ and (AktNuta = MedleyNotes.start.note) then
+ Text[TextNTon].Text := Text[TextNTon].Text + ' MedleyStart';
+ if MedleyNotes.isEnd and (Czesci[0].Akt = MedleyNotes.end_.line) and
+ (AktNuta = MedleyNotes.end_.note) then
+ Text[TextNTon].Text := Text[TextNTon].Text + ' MedleyEnd';
+
+ //preview mod
+ if Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].IsStartPreview then
+ Text[TextNTon].Text := Text[TextNTon].Text + ' [PreviewStart]';
+ end;
+
+ // Text Edit Mode
+ if TextEditMode then
+ Text[TextNText].Text := Text[TextNText].Text + '|';
+
+ // draw static menu
+ inherited Draw;
+
+ // draw notes
+ SingDrawNoteLines(20, 305, 780, 15);
+ //Error Drawing when no Song is loaded
+ if not Error then
+ begin
+ SingDrawBeatDelimeters(40, 305, 760, 0);
+ EditDrawCzesc(40, 410, 760, 0, 15);
+ end;
+
+ // draw text
+ Lyric.Draw;
+
+end;
+
+procedure TScreenEditSub.onHide;
+begin
+ MidiOut.Close;
+ MidiOut.Free;
+ //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;
+
+function TScreenEditSub.GetMedleyLength: real;
+begin
+ if MedleyNotes.isStart and MedleyNotes.isEnd then
+ begin
+ Result := GetTimeFromBeat(
+ Czesci[0].Czesc[MedleyNotes.end_.line].Nuta[MedleyNotes.end_.note].Start +
+ Czesci[0].Czesc[MedleyNotes.end_.line].Nuta[MedleyNotes.end_.note].Dlugosc) -
+ GetTimeFromBeat(Czesci[0].Czesc[MedleyNotes.start.line].Nuta[MedleyNotes.start.note].Start);
+ end else
+ Result := 0;
+end;
+
+end.
diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas
new file mode 100644
index 00000000..31b5046d
--- /dev/null
+++ b/Game/Code/Screens/UScreenLevel.pas
@@ -0,0 +1,104 @@
+unit UScreenLevel;
+
+interface
+
+uses
+ UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes, UHelp;
+
+type
+ TScreenLevel = class(TMenu)
+ const
+ ID='ID_002'; //for help system
+
+ 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, ULog;
+
+function TScreenLevel.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+var
+ SDL_ModState: Word;
+begin
+ 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_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ Music.PlayBack;
+ FadeTo(@ScreenName);
+ end;
+
+ SDLK_RETURN:
+ begin
+ Ini.Difficulty := Interaction;
+ Ini.SaveLevel;
+ Music.PlayStart;
+ //Set Standard Mode
+ ScreenSong.Mode := smNormal;
+ 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;
+end;
+
+constructor TScreenLevel.Create;
+var
+ I: integer;
+begin
+ inherited Create;
+
+ LoadFromTheme(Theme.Level);
+
+ AddButton(Theme.Level.ButtonEasy);
+ AddButton(Theme.Level.ButtonMedium);
+ AddButton(Theme.Level.ButtonHard);
+
+ Interaction := 0;
+end;
+
+procedure TScreenLevel.onShow;
+begin
+ Interaction := Ini.Difficulty;
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenLevel)');
+// 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.pas b/Game/Code/Screens/UScreenLoading.pas
new file mode 100644
index 00000000..82dfdab2
--- /dev/null
+++ b/Game/Code/Screens/UScreenLoading.pas
@@ -0,0 +1,46 @@
+unit UScreenLoading;
+
+interface
+
+uses
+ UMenu, SDL, SysUtils, UThemes, gl;
+
+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;
+ 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
new file mode 100644
index 00000000..b2b4c497
--- /dev/null
+++ b/Game/Code/Screens/UScreenMain.pas
@@ -0,0 +1,329 @@
+unit UScreenMain;
+
+interface
+
+uses
+ UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes, ULCD, ULight, UHelp;
+
+type
+ TScreenMain = class(TMenu)
+ const
+ ID='ID_003'; //for help system
+
+ 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, UPlaylist, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl, ULanguage, UParty, UDLLManager, UScreenCredits, USkins, ULog;
+
+
+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_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ Result := False;
+ end;
+
+ 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;
+ end;
+ SDLK_M:
+ begin
+ if SDL_ModState = KMOD_LSHIFT then
+ begin
+ if (Length(Songs.Song) >= 1) then
+ begin
+ if (Length(DLLMan.Plugins)>=1) then
+ begin
+ Music.PlayStart;
+ FadeTo(@ScreenPartyOptionsM2);
+ 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 else
+ 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;
+ 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;
+
+ //Muilti M2
+ if Interaction = 2 then begin
+ if (Length(Songs.Song) >= 1) then
+ begin
+ if (Length(DLLMan.Plugins)>=1) then
+ begin
+ Music.PlayStart;
+ FadeTo(@ScreenPartyOptionsM2);
+ 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 = 3 then begin
+ Music.PlayStart;
+ FadeTo(@ScreenStatMain);
+ end;
+
+ //Editor
+ if Interaction = 4 then begin
+ Music.PlayStart;
+ FadeTo(@ScreenEdit);
+ end;
+
+ //Options
+ if Interaction = 5 then begin
+ Music.PlayStart;
+ FadeTo(@ScreenOptions);
+ end;
+
+ //Exit
+ if Interaction = 6 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.ButtonMultiM2);
+ 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;
+ ScreenSong.Mode := smNormal;
+ ScreenSong.SongIndex := -1;
+ PlaylistMan.Mode := 0;
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenMain)');
+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, ' multi ');
+ 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/UScreenName.pas b/Game/Code/Screens/UScreenName.pas
new file mode 100644
index 00000000..d754899b
--- /dev/null
+++ b/Game/Code/Screens/UScreenName.pas
@@ -0,0 +1,243 @@
+unit UScreenName;
+
+interface
+
+uses
+ UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes;
+
+type
+ TScreenName = class(TMenu)
+ const
+ ID='ID_004'; //for help system
+
+ 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;
+ procedure SetAnimationProgress(Progress: real); override;
+ end;
+
+implementation
+
+uses UGraphic, UMain, UIni, UTexture, UHelp, ULog;
+
+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
+ Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + chr(ScanCode);
+ end;
+
+ SDLK_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ // Templates for Names Mod
+ SDLK_F1:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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
+ Button[Interaction].Text[0].DeleteLastL;
+ end;
+
+ SDLK_ESCAPE:
+ begin
+ Ini.SaveNames;
+ Music.PlayBack;
+ if GoTo_SingScreen then
+ FadeTo(@ScreenSong)
+ else
+ 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;
+
+ if GoTo_SingScreen then
+ FadeTo(@ScreenSing)
+ else
+ FadeTo(@ScreenLevel);
+
+ GoTo_SingScreen := False;
+ 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;
+
+ LoadFromTheme(Theme.Name);
+
+
+ for I := 1 to 6 do
+ AddButton(Theme.Name.ButtonPlayer[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;
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenName)');
+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.pas b/Game/Code/Screens/UScreenOpen.pas
new file mode 100644
index 00000000..6b80354c
--- /dev/null
+++ b/Game/Code/Screens/UScreenOpen.pas
@@ -0,0 +1,165 @@
+unit UScreenOpen;
+
+interface
+
+uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, UMenuText,
+ ULyrics, Math, gl, 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; 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);
+ end;
+ end;
+ end;
+
+ case PressedKey of
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+ 8: // del
+ begin
+ if Interaction = 0 then
+ begin
+ Text[TextN].DeleteLastL;
+ end;
+ end;
+
+ SDLK_ESCAPE :
+ begin
+ //Empty Filename and go to last Screen
+ FileName := '';
+ Music.PlayBack;
+ FadeTo(BackScreen);
+ end;
+
+ SDLK_RETURN:
+ 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;
+ 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;
+begin
+ inherited Create;
+
+ // 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.pas b/Game/Code/Screens/UScreenOptions.pas
new file mode 100644
index 00000000..9e0f922b
--- /dev/null
+++ b/Game/Code/Screens/UScreenOptions.pas
@@ -0,0 +1,176 @@
+unit UScreenOptions;
+
+interface
+
+uses
+ UMenu, SDL, SysUtils, UDisplay, UMusic, UFiles, UIni, UThemes;
+
+type
+ TScreenOptions = class(TMenu)
+ const
+ ID='ID_006'; //for help system
+
+ public
+ TextDescription: integer;
+ constructor Create; 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, UHelp, ULog;
+
+function TScreenOptions.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE:
+ 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
+ Music.PlayStart;
+ FadeTo(@ScreenOptionsAdvanced);
+ end;
+
+ if SelInteraction = 7 then begin
+ Ini.Save;
+ Music.PlayBack;
+ FadeTo(@ScreenMain);
+ end;
+ end;
+ SDLK_DOWN: InteractInc;
+ SDLK_UP: InteractDec;
+ SDLK_RIGHT: InteractNext;
+ SDLK_LEFT: InteractPrev;
+ end;
+ end;
+end;
+
+constructor TScreenOptions.Create;
+var
+ I: integer;
+begin
+ inherited Create;
+
+ TextDescription := AddText(Theme.Options.TextDescription);
+
+ LoadFromTheme(Theme.Options);
+
+ AddButton(Theme.Options.ButtonGame);
+ if (Length(Button[0].Text)=0) then
+ AddButtonText(14, 20, Theme.Options.Description[0]);
+
+ AddButton(Theme.Options.ButtonGraphics);
+ if (Length(Button[1].Text)=0) then
+ AddButtonText(14, 20, Theme.Options.Description[1]);
+
+ AddButton(Theme.Options.ButtonSound);
+ if (Length(Button[2].Text)=0) then
+ AddButtonText(14, 20, Theme.Options.Description[2]);
+
+ AddButton(Theme.Options.ButtonLyrics);
+ if (Length(Button[3].Text)=0) then
+ AddButtonText(14, 20, Theme.Options.Description[3]);
+
+ AddButton(Theme.Options.ButtonThemes);
+ if (Length(Button[4].Text)=0) then
+ AddButtonText(14, 20, Theme.Options.Description[4]);
+
+ AddButton(Theme.Options.ButtonRecord);
+ if (Length(Button[5].Text)=0) then
+ AddButtonText(14, 20, Theme.Options.Description[5]);
+
+ 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]);
+
+ Interaction := 0;
+end;
+
+procedure TScreenOptions.onShow;
+begin
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenOptions)');
+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;
+ Button[6].Texture.ScaleW := Progress;
+ Button[7].Texture.ScaleW := Progress;
+end;
+
+end.
diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas
new file mode 100644
index 00000000..730f333f
--- /dev/null
+++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas
@@ -0,0 +1,112 @@
+unit UScreenOptionsAdvanced;
+
+interface
+
+uses
+ UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes;
+
+type
+ TScreenOptionsAdvanced = class(TMenu)
+ const
+ ID='ID_007'; //for help system
+
+ public
+ constructor Create; override;
+ function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
+ procedure onShow; override;
+ end;
+
+implementation
+
+uses UGraphic, UHelp, ULog;
+
+function TScreenOptionsAdvanced.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ Ini.Save;
+ Music.PlayBack;
+ FadeTo(@ScreenOptions);
+ end;
+ SDLK_RETURN:
+ begin
+ //SelectLoadAnimation Hidden because it is useless atm
+ //if SelInteraction = 7 then begin
+ if SelInteraction = 6 then begin
+ Ini.Save;
+ Music.PlayBack;
+ FadeTo(@ScreenOptions);
+ end;
+ end;
+ SDLK_DOWN:
+ InteractNext;
+ SDLK_UP :
+ InteractPrev;
+ SDLK_RIGHT:
+ 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
+ //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;
+ end;
+ end;
+ end;
+end;
+
+constructor TScreenOptionsAdvanced.Create;
+var
+ I: integer;
+begin
+ inherited Create;
+
+ LoadFromTheme(Theme.OptionsAdvanced);
+
+ //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);
+ 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
+ AddButtonText(14, 20, Theme.Options.Description[7]);
+
+ Interaction := 0;
+end;
+
+procedure TScreenOptionsAdvanced.onShow;
+begin
+ Interaction := 0;
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenOptionsAdvanced)');
+end;
+
+end.
diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas
new file mode 100644
index 00000000..29c36330
--- /dev/null
+++ b/Game/Code/Screens/UScreenOptionsGame.pas
@@ -0,0 +1,117 @@
+unit UScreenOptionsGame;
+
+interface
+
+uses
+ UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes, USongs;
+
+type
+ TScreenOptionsGame = class(TMenu)
+ const
+ ID='ID_008'; //for help system
+
+ public
+ old_Tabs, old_Sorting: integer;
+ constructor Create; override;
+ function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
+ procedure onShow; override;
+ procedure RefreshSongs;
+ end;
+
+implementation
+
+uses UGraphic, UHelp, ULog;
+
+function TScreenOptionsGame.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ 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;
+var
+ I: integer;
+begin
+ inherited Create;
+
+ LoadFromTheme(Theme.OptionsGame);
+
+ //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);
+ if (Length(Button[0].Text)=0) then
+ AddButtonText(14, 20, Theme.Options.Description[7]);
+
+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;
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenOptionsGame)');
+end;
+
+end.
diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas
new file mode 100644
index 00000000..999fb054
--- /dev/null
+++ b/Game/Code/Screens/UScreenOptionsGraphics.pas
@@ -0,0 +1,107 @@
+unit UScreenOptionsGraphics;
+
+interface
+
+uses
+ UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes;
+
+type
+ TScreenOptionsGraphics = class(TMenu)
+ const
+ ID='ID_009'; //for help system
+
+ public
+ constructor Create; override;
+ function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
+ procedure onShow; override;
+ end;
+
+implementation
+
+uses UGraphic, UMain, UHelp, ULog;
+
+function TScreenOptionsGraphics.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE:
+ 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;
+var
+ I: integer;
+begin
+ inherited Create;
+
+ LoadFromTheme(Theme.OptionsGraphics);
+
+ 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.SelectMovieSize, Ini.MovieSize, IMovieSize);
+ AddSelect(Theme.OptionsGraphics.SelectMoviePreview, Ini.MoviePreview, IMoviePreview);
+
+
+ AddButton(Theme.OptionsGraphics.ButtonExit);
+ if (Length(Button[0].Text)=0) then
+ AddButtonText(14, 20, Theme.Options.Description[7]);
+
+end;
+
+procedure TScreenOptionsGraphics.onShow;
+begin
+ Interaction := 0;
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenOptionsGraphics)');
+end;
+
+end.
diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas
new file mode 100644
index 00000000..4d6cdf2d
--- /dev/null
+++ b/Game/Code/Screens/UScreenOptionsLyrics.pas
@@ -0,0 +1,101 @@
+unit UScreenOptionsLyrics;
+
+interface
+
+uses
+ UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes;
+
+type
+ TScreenOptionsLyrics = class(TMenu)
+ const
+ ID='ID_010'; //for help system
+
+ public
+ constructor Create; override;
+ function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
+ procedure onShow; override;
+ end;
+
+implementation
+
+uses UGraphic, UHelp, ULog;
+
+function TScreenOptionsLyrics.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ 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;
+var
+ I: integer;
+begin
+ inherited Create;
+
+ LoadFromTheme(Theme.OptionsLyrics);
+
+ 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);
+ if (Length(Button[0].Text)=0) then
+ AddButtonText(14, 20, Theme.Options.Description[7]);
+
+end;
+
+procedure TScreenOptionsLyrics.onShow;
+begin
+ Interaction := 0;
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenOptionsLyrics)');
+end;
+
+end.
diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas
new file mode 100644
index 00000000..9f75f78a
--- /dev/null
+++ b/Game/Code/Screens/UScreenOptionsRecord.pas
@@ -0,0 +1,142 @@
+unit UScreenOptionsRecord;
+
+interface
+
+uses
+ UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes;
+
+type
+ TScreenOptionsRecord = class(TMenu)
+ const
+ ID='ID_011'; //for help system
+
+ 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, UHelp, ULog;
+
+function TScreenOptionsRecord.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ 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;
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenOptionsRecord)');
+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.pas b/Game/Code/Screens/UScreenOptionsSound.pas
new file mode 100644
index 00000000..dc465e0f
--- /dev/null
+++ b/Game/Code/Screens/UScreenOptionsSound.pas
@@ -0,0 +1,107 @@
+unit UScreenOptionsSound;
+
+interface
+
+uses
+ UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes;
+
+type
+ TScreenOptionsSound = class(TMenu)
+ const
+ ID='ID_012'; //for help system
+
+ public
+ constructor Create; override;
+ function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
+ procedure onShow; override;
+ end;
+
+implementation
+
+uses UGraphic, UHelp, ULog;
+
+function TScreenOptionsSound.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ 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 TScreenOptionsSound.Create;
+var
+ I: integer;
+begin
+ inherited Create;
+
+ 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);
+
+ //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]);
+
+ Interaction := 0;
+end;
+
+procedure TScreenOptionsSound.onShow;
+begin
+ Interaction := 0;
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenOptionsSound)');
+end;
+
+end.
diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas
new file mode 100644
index 00000000..ce156446
--- /dev/null
+++ b/Game/Code/Screens/UScreenOptionsThemes.pas
@@ -0,0 +1,166 @@
+unit UScreenOptionsThemes;
+
+interface
+
+uses
+ UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes;
+
+type
+ TScreenOptionsThemes = class(TMenu)
+ const
+ ID='ID_013'; //for help system
+
+ 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, UHelp, ULog;
+
+function TScreenOptionsThemes.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ 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( false );
+
+ Music.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( false );
+
+ 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;
+
+ 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;
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenOptionsThemes)');
+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.
diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas
new file mode 100644
index 00000000..45e3be8d
--- /dev/null
+++ b/Game/Code/Screens/UScreenPartyNewRound.pas
@@ -0,0 +1,376 @@
+unit UScreenPartyNewRound;
+
+interface
+
+uses
+ UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes;
+
+type
+ TScreenPartyNewRound = class(TMenu)
+ const
+ ID='ID_014'; //for help system
+
+ private
+ ScreenRound: Integer;
+ procedure Update;
+ public
+ //Texts:
+ TextRound: array [1..7] of Cardinal;
+ TextWinner: array [1..7] of Cardinal;
+
+ TextNextRound: Cardinal;
+ TextNextRoundNo: Cardinal;
+ TextNextPlayer1: Cardinal;
+ TextNextPlayer2: Cardinal;
+ TextNextPlayer3: Cardinal;
+
+ //Statics
+ StaticRound: array [1..7] of 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, UHelp, ULog;
+
+function TScreenPartyNewRound.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ Music.PlayBack;
+ CheckFadeTo(@ScreenMain,'MSG_END_PARTY');
+ end;
+
+ SDLK_RETURN:
+ begin
+ Music.PlayStart;
+ if DLLMan.Selected.LoadSong then
+ begin
+ //Select PartyMode ScreenSong
+ ScreenSong.Mode := smParty;
+ FadeTo(@ScreenSong);
+ end
+ else
+ begin
+ FadeTo(@ScreenSingModi);
+ end;
+ end;
+
+ SDLK_UP:
+ begin
+ if ScreenRound>=1 then
+ dec(ScreenRound);
+ Update;
+ end;
+
+ SDLK_DOWN:
+ begin
+ if ScreenRound<=(Length(PartySession.Rounds)-7) then
+ inc(ScreenRound);
+ Update;
+ end;
+ end;
+ end;
+end;
+
+constructor TScreenPartyNewRound.Create;
+var
+ I: integer;
+begin
+ inherited Create;
+
+ TextRound[1] := AddText (Theme.PartyNewRound.TextRound1);
+ TextRound[2] := AddText (Theme.PartyNewRound.TextRound2);
+ TextRound[3] := AddText (Theme.PartyNewRound.TextRound3);
+ TextRound[4] := AddText (Theme.PartyNewRound.TextRound4);
+ TextRound[5] := AddText (Theme.PartyNewRound.TextRound5);
+ TextRound[6] := AddText (Theme.PartyNewRound.TextRound6);
+ TextRound[7] := AddText (Theme.PartyNewRound.TextRound7);
+
+ TextWinner[1] := AddText (Theme.PartyNewRound.TextWinner1);
+ TextWinner[2] := AddText (Theme.PartyNewRound.TextWinner2);
+ TextWinner[3] := AddText (Theme.PartyNewRound.TextWinner3);
+ TextWinner[4] := AddText (Theme.PartyNewRound.TextWinner4);
+ TextWinner[5] := AddText (Theme.PartyNewRound.TextWinner5);
+ TextWinner[6] := AddText (Theme.PartyNewRound.TextWinner6);
+ TextWinner[7] := 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);
+
+ StaticRound[1] := AddStatic (Theme.PartyNewRound.StaticRound1);
+ StaticRound[2] := AddStatic (Theme.PartyNewRound.StaticRound2);
+ StaticRound[3] := AddStatic (Theme.PartyNewRound.StaticRound3);
+ StaticRound[4] := AddStatic (Theme.PartyNewRound.StaticRound4);
+ StaticRound[5] := AddStatic (Theme.PartyNewRound.StaticRound5);
+ StaticRound[6] := AddStatic (Theme.PartyNewRound.StaticRound6);
+ StaticRound[7] := 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;
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenPartyNewRound)');
+
+ ScreenRound:=PartySession.CurRound-2;
+ if ScreenRound<0 then
+ begin
+ ScreenRound:=PartySession.CurRound-1;
+ if ScreenRound<0 then
+ ScreenRound:=0;
+ end;
+ Update;
+
+ //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 := PartySession.Plugins[PartySession.Rounds[PartySession.CurRound].PluginNr].Desc;
+
+ 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.Update;
+{
+ //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; }
+
+
+
+var
+ N, R: Integer;
+ T: Integer;
+ NumRounds: Integer;
+begin
+ N:=0;
+ //current round-number
+ R:=PartySession.CurRound;
+
+ //Set Visibility of Round Infos
+ NumRounds := Length(PartySession.Rounds);
+
+ N:=ScreenRound;
+
+ if ((NumRounds-7)<N) then
+ begin
+ N:=NumRounds-7;
+ ScreenRound:=N;
+ end;
+
+ if (N<0) then
+ begin
+ N:=0;
+ ScreenRound:=0;
+ end;
+
+ for T := 1 to 7 do
+ begin
+ if (NumRounds >= T) then
+ begin
+ Static[StaticRound[T]].Visible := true;
+ Text[TextRound[T]].Visible := true;
+ if (N+T-1<R) then
+ Text[TextWinner[T]].Visible := true
+ else
+ Text[TextWinner[T]].Visible := false;
+
+ Text[TextRound[T]].Text := IntToStr(N+T)+') '+ PartySession.Plugins[PartySession.Rounds[N+T-1].PluginNr].Name;
+ Text[TextWinner[T]].Text := PartySession.GetWinnerString(N+T-1);
+ end else
+ begin
+ Static[StaticRound[T]].Visible := false;
+ Text[TextRound[T]].Visible := false;
+ Text[TextWinner[T]].Visible := false;
+ end;
+ end;
+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/UScreenPartyNewRoundM2.pas b/Game/Code/Screens/UScreenPartyNewRoundM2.pas
new file mode 100644
index 00000000..f25b928f
--- /dev/null
+++ b/Game/Code/Screens/UScreenPartyNewRoundM2.pas
@@ -0,0 +1,313 @@
+unit UScreenPartyNewRoundM2;
+
+interface
+
+uses
+ UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes;
+
+type
+ TScreenPartyNewRoundM2 = class(TMenu)
+ const
+ ID='ID_019'; //for help system
+
+ public
+ //Texts:
+ TextRound: array [1..9] of cardinal;
+ TextWinner: array [1..9] of cardinal;
+
+ TextNextRound: cardinal;
+
+ TextNextPlayer1: cardinal;
+ TextNextPlayer2: cardinal;
+ TextHandicap: cardinal;
+
+ //Statics
+ StaticRound: array [1..9] of cardinal;
+ StaticTable: array [1..9] of cardinal;
+
+ StaticNextPlayer1: cardinal;
+ StaticNextPlayer2: cardinal;
+ StaticHandicap: cardinal;
+
+ TextTableName: array[1..9,1..7] of cardinal;
+
+ ScreenRound: Integer;
+
+ constructor Create; override;
+ function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
+ function FillNulls(number: integer): String;
+ procedure onShow; override;
+ procedure SetAnimationProgress(Progress: real); override;
+ procedure Update;
+ end;
+
+implementation
+
+uses UGraphic, UMain, UIni, UTexture, UPartyM2, UDLLManager, ULanguage, ULog, UHelp;
+
+function TScreenPartyNewRoundM2.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ Music.PlayBack;
+ CheckFadeTo(@ScreenMain,'MSG_END_PARTY');
+ end;
+
+ SDLK_RETURN:
+ begin
+ if(PartySessionM2.CurRound<Length(PartySessionM2.Rounds)) then
+ begin
+ Music.PlayStart;
+ //Select PartyMode M2 ScreenSong
+ //Select PartyMode ScreenSong
+ ScreenSong.Mode := smChallenge;
+ FadeTo(@ScreenSong);
+ end else
+ begin
+ Music.PlayBack;
+ CheckFadeTo(@ScreenMain,'MSG_END_PARTY');
+ end;
+ end;
+ SDLK_DOWN:
+ begin
+ if ScreenRound<=(Length(PartySessionM2.Rounds)-9) then
+ inc(ScreenRound);
+ Update;
+ end;
+ SDLK_UP:
+ begin
+ if ScreenRound>=1 then
+ dec(ScreenRound);
+ Update;
+ end;
+ SDLK_RIGHT:
+ begin
+ if ScreenRound<=(Length(PartySessionM2.Rounds)-9) then
+ inc(ScreenRound);
+ Update;
+ end;
+ SDLK_LEFT:
+ begin
+ if ScreenRound>=1 then
+ dec(ScreenRound);
+ Update;
+ end;
+ end;
+ end;
+end;
+
+constructor TScreenPartyNewRoundM2.Create;
+var
+ I, J: integer;
+begin
+ inherited Create;
+
+ LoadFromTheme(Theme.PartyNewRoundM2);
+
+ for I := 1 to 9 do
+ begin
+ TextRound[I] := AddText (Theme.PartyNewRoundM2.TextRound[I]);
+ TextWinner[I] := AddText (Theme.PartyNewRoundM2.TextWinner[I]);
+ StaticRound[I] := AddStatic (Theme.PartyNewRoundM2.StaticRound[I]);
+ StaticTable[I] := AddStatic (Theme.PartyNewRoundM2.StaticTable[I]);
+ end;
+
+ TextNextRound := AddText (Theme.PartyNewRoundM2.TextNextRound);
+ TextNextPlayer1 := AddText (Theme.PartyNewRoundM2.TextNextPlayer1);
+ TextNextPlayer2 := AddText (Theme.PartyNewRoundM2.TextNextPlayer2);
+ TextHandicap := AddText (Theme.PartyNewRoundM2.TextHandicap);
+
+ StaticNextPlayer1 := AddStatic (Theme.PartyNewRoundM2.StaticNextPlayer1);
+ StaticNextPlayer2 := AddStatic (Theme.PartyNewRoundM2.StaticNextPlayer2);
+ StaticHandicap := AddStatic (Theme.PartyNewRoundM2.StaticHandicap);
+
+ //Table
+ for I := 1 to 9 do
+ begin
+ for J := 1 to 7 do
+ begin
+ TextTableName[I,J] := AddText (Theme.PartyNewRoundM2.TextTableName[I,J]);
+ end;
+ end;
+end;
+
+procedure TScreenPartyNewRoundM2.onShow;
+var
+ x,y: Integer;
+begin
+ inherited;
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenPartyNewRoundM2)');
+
+ PartySessionM2.StartRound;
+ ScreenRound:=PartySessionM2.CurRound-2;
+ if ScreenRound<0 then
+ begin
+ ScreenRound:=PartySessionM2.CurRound-1;
+ if ScreenRound<0 then
+ ScreenRound:=0;
+ end;
+ Update;
+
+ //Display Scores
+ for x := 1 to 9 do
+ begin
+ if x<=PartySessionM2.Players.NumPlayer then
+ begin
+ Static[StaticTable[x]].Visible := true;
+ Text[TextTableName[x,1]].Text := IntToStr(x);
+ Text[TextTableName[x,2]].Text := PartySessionM2.Players.Playerinfo[PartySessionM2.Order[x-1]].Name;
+ Text[TextTableName[x,3]].Text := IntToStr(PartySessionM2.Players.Playerinfo[PartySessionM2.Order[x-1]].Wins);
+ Text[TextTableName[x,4]].Text := IntToStr(PartySessionM2.Players.Playerinfo[PartySessionM2.Order[x-1]].Draws);
+ Text[TextTableName[x,5]].Text := IntToStr(PartySessionM2.Players.Playerinfo[PartySessionM2.Order[x-1]].Defeats);
+ Text[TextTableName[x,6]].Text := IntToStr(PartySessionM2.Players.Playerinfo[PartySessionM2.Order[x-1]].ScoreP -
+ PartySessionM2.Players.Playerinfo[PartySessionM2.Order[x-1]].ScoreN);
+ Text[TextTableName[x,7]].Text := IntToStr(PartySessionM2.Players.Playerinfo[PartySessionM2.Order[x-1]].Points);
+ end else
+ begin
+ for y := 1 to 7 do
+ begin
+ Text[TextTableName[x,y]].Text := '';
+ Static[StaticTable[x]].Visible := false;
+ end;
+ end;
+ end;
+
+ //nextRound Texts
+ if PartySessionM2.CurRound<Length(PartySessionM2.Rounds) then
+ begin
+ if PartySessionM2.Option_Plugins then
+ begin
+ Text[TextNextRound].Text := Language.Translate('PARTY_ROUND') + ' ' + IntToStr(PartySessionM2.CurRound + 1) +
+ ': ' + PartySessionM2.Plugins[PartySessionM2.Rounds[PartySessionM2.CurRound].PluginNr].Name;
+ end else
+ Text[TextNextRound].Text := Language.Translate('PARTY_ROUND') + ' ' + IntToStr(PartySessionM2.CurRound + 1);
+
+ Text[TextNextPlayer1].Text := PartySessionM2.Players.Playerinfo[PartySessionM2.Rounds[PartySessionM2.CurRound].Player1].Name;
+ Text[TextNextPlayer1].Visible := true;
+
+ Text[TextNextPlayer2].Text := PartySessionM2.Players.Playerinfo[PartySessionM2.Rounds[PartySessionM2.CurRound].Player2].Name;
+ Text[TextNextPlayer2].Visible := true;
+
+ Static[StaticNextPlayer1].Visible := true;
+ Static[StaticNextPlayer2].Visible := true;
+
+ //Handicap-mode
+ if PartySessionM2.HandicapMode then
+ begin
+ Text[TextHandicap].Text := '[' + FormatFloat('#0.00', PartySessionM2.Handicap.P1m) +
+ ' : ' + FormatFloat('#0.00', PartySessionM2.Handicap.P2m) + ']';
+ Text[TextHandicap].visible := true;
+ Static[StaticHandicap].visible := true;
+ end else
+ begin
+ Text[TextHandicap].visible := false;
+ Static[StaticHandicap].visible := false;
+ end;
+ end else
+ begin
+ Text[TextNextRound].Text := Language.Translate('PARTY_ROUNDM2_END');
+
+ Text[TextNextPlayer1].Visible := false;
+ Text[TextNextPlayer2].Visible := false;
+
+ Static[StaticNextPlayer1].Visible := false;
+ Static[StaticNextPlayer2].Visible := false;
+ end;
+end;
+
+procedure TScreenPartyNewRoundM2.Update;
+var
+ N, R: Integer;
+ T: Integer;
+ NumRounds: Integer;
+begin
+ N:=0;
+ //current round-number
+ R:=PartySessionM2.CurRound;
+
+ //Set Visibility of Round Infos
+ NumRounds := Length(PartySessionM2.Rounds);
+
+ N:=ScreenRound;
+
+ if ((NumRounds-9)<N) then
+ begin
+ N:=NumRounds-9;
+ ScreenRound:=N;
+ end;
+
+ if (N<0) then
+ begin
+ N:=0;
+ ScreenRound:=0;
+ end;
+
+ for T := 1 to 9 do
+ begin
+ if (NumRounds >= T) then
+ begin
+ Static[StaticRound[T]].Visible := true;
+ Text[TextRound[T]].Visible := true;
+ if (N+T-1<R) then
+ Text[TextWinner[T]].Visible := true
+ else
+ Text[TextWinner[T]].Visible := false;
+
+ //Texts:
+ if (N+T-1<R) then
+ Text[TextRound[T]].Text := IntToStr(N+T)+ ') ' + PartySessionM2.Players.Playerinfo[PartySessionM2.Rounds[N+T-1].Player1].Name +
+ ' - ' + PartySessionM2.Players.Playerinfo[PartySessionM2.Rounds[N+T-1].Player2].Name
+ else
+ begin
+ Text[TextRound[T]].Text := IntToStr(N+T)+ ') ';
+ Text[TextRound[T]].Text := Text[TextRound[T]].Text +
+ PartySessionM2.Plugins[PartySessionM2.Rounds[N+T-1].PluginNr].Name
+ end;
+
+ Text[TextWinner[T]].Text :=FillNulls(PartySessionM2.Rounds[N+T-1].ScoreP) +
+ ':' + FillNulls(PartySessionM2.Rounds[N+T-1].ScoreN);
+ end else
+ begin
+ Static[StaticRound[T]].Visible := false;
+ Text[TextRound[T]].Visible := false;
+ Text[TextWinner[T]].Visible := false;
+ end;
+ end;
+end;
+
+function TScreenPartyNewRoundM2.FillNulls(number: integer): String;
+begin
+ if number<10 then
+ Result := '000' + IntToStr(number)
+ else if number<100 then
+ Result := '00' + IntToStr(number)
+ else if number <1000 then
+ Result := '0' + IntToStr(number)
+ else
+ Result := IntToStr(number);
+end;
+
+procedure TScreenPartyNewRoundM2.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
new file mode 100644
index 00000000..7baa3743
--- /dev/null
+++ b/Game/Code/Screens/UScreenPartyOptions.pas
@@ -0,0 +1,649 @@
+unit UScreenPartyOptions;
+
+interface
+
+uses
+ UMenu, gl, glu, TextGL, SDL, UDisplay, UMusic, UParty, UFiles, SysUtils, UThemes;
+
+type
+ TScreenPartyOptions = class(TMenu)
+ const
+ ID='ID_015'; //for help system
+
+ public
+ SelectLevel: Cardinal;
+ SelectPlayList: Cardinal;
+ SelectPlayList2: Cardinal;
+ SelectRounds: Cardinal;
+ SelectTeams: Cardinal;
+ SelectPlayers1: Cardinal;
+ SelectPlayers2: Cardinal;
+ SelectPlayers3: Cardinal;
+
+ PluginList: array of TPartyPlugin;
+ SelectedPlugin: Integer;
+ MenuPluginOpen: boolean;
+
+ 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;
+ function Draw: boolean; override;
+ procedure SetAnimationProgress(Progress: real); override;
+ procedure SetPlaylist2;
+
+ procedure Draw_MenuPlugin;
+ function PartyInput_MenuPlugin(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): boolean;
+ 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..30] of String = ('2', '3', '4', '5', '6', '7', '8', '9', '10',
+ '11', '12', '13', '14', '15', '16', '17', '18', '19', '20',
+ '21', '22', '23', '24', '25', '26', '27', '28', '29', '30',
+ '31', '32');
+
+implementation
+
+uses UGraphic, UMain, UIni, UTexture, ULanguage, UDLLManager, UPlaylist, USongs, UHelp, ULog;
+
+function TScreenPartyOptions.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+
+ if MenuPluginOpen then
+ begin
+ PartyInput_MenuPlugin(PressedKey, ScanCode, PressedDown);
+ Exit;
+ end;
+
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ Music.PlayBack;
+ FadeTo(@ScreenMain);
+ end;
+
+ SDLK_RETURN:
+ begin
+ MenuPluginOpen := true;
+ if not Help.SetHelpID('ID_030') then
+ Log.LogError('No Entry for Help-ID ID_030 (ScreenPartyOptions, SelectPlugins)');
+ 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;
+
+ //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
+ 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
+ SelectsS[7].Visible := (NumTeams = 1);
+ end;
+ end;
+ end;
+ end;
+end;
+
+function TScreenPartyOptions.PartyInput_MenuPlugin(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): boolean;
+var
+ I, J, Len: Integer;
+ OnlyMultiPlayer: boolean;
+ SinglePlayerTeams: boolean;
+
+begin
+ Result := true;
+
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_ESCAPE:
+ begin
+ MenuPluginOpen := false;
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenPartyOptions)');
+ end;
+
+ SDLK_RETURN:
+ 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;
+ // Don't start when SinglePlayer Teams but only Multiplayer Plugins available
+ OnlyMultiPlayer:=true;
+ SinglePlayerTeams := ((NumPlayer1 = 0) OR (NumPlayer2 = 0) OR ((NumPlayer3 = 0) AND
+ (NumTeams = 1)));
+
+ SetLength(PartySession.Plugins, 0);
+ for I := 0 to Length(PluginList)-1 do
+ begin
+ if PluginList[I].Selected then
+ begin
+ if PluginList[I].Medley or
+ (not DLLMan.Plugins[PluginList[I].ID].TeamModeOnly) or
+ (not SinglePlayerTeams and DLLMan.Plugins[PluginList[I].ID].TeamModeOnly) then
+ begin
+ Len := Length(PartySession.Plugins);
+ SetLength(PartySession.Plugins, Len+1);
+ PartySession.Plugins[Len] := PluginList[I];
+ end;
+
+ if not PluginList[I].Medley then
+ OnlyMultiPlayer := (OnlyMultiPlayer AND
+ DLLMan.Plugins[PluginList[I].ID].TeamModeOnly)
+ else
+ OnlyMultiPlayer := false;
+ end;
+ end;
+
+ if (OnlyMultiPlayer) AND SinglePlayerTeams or
+ (Length(PartySession.Plugins)=0) then begin
+ ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS'));
+ Exit;
+ end;
+ //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);
+
+ Music.PlayStart;
+ //Go to Player Screen
+ FadeTo(@ScreenPartyPlayer);
+ end;
+
+ SDLK_SPACE:
+ begin
+ Music.PlayOption;
+ PluginList[SelectedPlugin].Selected := not PluginList[SelectedPlugin].Selected;
+ end;
+
+ SDLK_LEFT:
+ begin
+ if PluginList[SelectedPlugin].Selected then
+ begin
+ Music.PlayOption;
+ PluginList[SelectedPlugin].Selected := false;
+ end;
+ end;
+
+ SDLK_RIGHT:
+ begin
+ if not PluginList[SelectedPlugin].Selected then
+ begin
+ Music.PlayOption;
+ PluginList[SelectedPlugin].Selected := true;
+ end;
+ end;
+
+ SDLK_UP:
+ begin
+ if SelectedPlugin>0 then
+ Dec(SelectedPlugin);
+ end;
+
+ SDLK_DOWN:
+ begin
+ if SelectedPlugin<Length(PluginList)-1 then
+ Inc(SelectedPlugin);
+ end;
+ end; //of case
+ end; //of if
+end;
+
+procedure TScreenPartyOptions.Draw_MenuPlugin;
+Type
+ TRect = record
+ left, right, top, bottom: integer;
+ end;
+
+Const
+ h = 40;
+
+ procedure DrawPlugin(num: integer; Rect: TRect; Plug: TPartyPlugin; selected: boolean);
+ var
+ text: PChar;
+ name: string;
+
+ begin
+ glColor4f(1, 1, 1, 1);
+ glLineWidth(1);
+ if selected then
+ begin
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(Rect.left-5, Rect.top+h*num);
+ glVertex2f(Rect.right+5, Rect.top+h*num);
+ glVertex2f(Rect.right+5, Rect.top+h*(num+1));
+ glVertex2f(Rect.left-5, Rect.top+h*(num+1));
+ glEnd;
+ end;
+
+ SetFontStyle(1);
+ SetFontItalic(false);
+ SetFontSize(13);
+
+ SetFontPos (Rect.left, Rect.top+ num*h);
+
+ name := Plug.Name;
+
+ text := Addr(name[1]);
+ glPrint(text);
+
+ SetFontPos (Rect.left+Round((Rect.right-Rect.left)/4*3), Rect.top+ num*h);
+ if Plug.Selected then
+ name := Language.Translate('SONG_MENU_YES')
+ else
+ name := Language.Translate('SONG_MENU_NO');
+
+ text := Addr(name[1]);
+ glPrint(text);
+ end;
+
+ procedure DrawScroll(X, Y, W, H: integer; pos, len: double);
+ var
+ fY, tY: double;
+ begin
+ glColor4f(1, 1, 1, 1);
+
+ glLineWidth(1);
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(X, Y);
+ glVertex2f(X+W, Y);
+ glVertex2f(X+W, Y+H);
+ glVertex2f(X, Y+H);
+ glEnd;
+
+ fY := Y+(H-H*len)*pos;
+ tY := fY+H*len;
+ if tY+0.001>=Y+H then
+ tY := Y+H;
+
+ glBegin(GL_QUADS);
+ glVertex2f(X, fY);
+ glVertex2f(X+W, fY);
+ glVertex2f(X+W, tY);
+ glVertex2f(X, tY);
+ glEnd;
+ end;
+
+var
+ Rect: TRect;
+ abs: real;
+ ab: real;
+ I: integer;
+ barH: double;
+ pos: double;
+
+begin
+ Rect.left := 150;
+ Rect.right := 650;
+ Rect.top := 30;
+ Rect.bottom := 550;
+
+ abs := 15;
+
+ if Length(PluginList)<=13 then
+ begin
+ ab := 0;
+ barH := 1;
+ end else
+ begin
+ ab := 10;
+ barH := h*13/(h*Length(PluginList));
+ end;
+
+ glEnable(GL_BLEND);
+ glBegin(gl_quads);
+ //Background:
+ glColor4f(0.2, 0.2, 0.2, 0.8); glVertex2f(Rect.left-abs, Rect.top-abs);
+ glColor4f(0.2, 0.2, 0.2, 0.8); glVertex2f(Rect.right+abs+ab, Rect.top-abs);
+ glColor4f(0.2, 0.2, 0.2, 0.8); glVertex2f(Rect.right+abs+ab, Rect.bottom+abs);
+ glColor4f(0.2, 0.2, 0.2, 0.8); glVertex2f(Rect.left-abs, Rect.bottom+abs);
+ glEnd;
+ glDisable(GL_BLEND);
+
+ //Draw MainFrame
+ glColor4f(1, 1, 1, 1);
+
+ glLineWidth(1);
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(Rect.left-abs+1, Rect.top-abs+1);
+ glVertex2f(Rect.right+abs-1, Rect.top-abs+1);
+ glVertex2f(Rect.right+abs-1, Rect.bottom+abs-1);
+ glVertex2f(Rect.left-abs+1, Rect.bottom+abs-1);
+ glEnd;
+
+ if barH<1 then
+ begin
+ pos := SelectedPlugin/(Length(PluginList)-1);
+
+ //draw plugin names and selections
+ for I := 0 to 12 do
+ begin
+ if (SelectedPlugin<=6) then
+ DrawPlugin(I, Rect, PluginList[I], I=SelectedPlugin)
+ else if ((SelectedPlugin-6)<=(Length(PluginList)-13)) then
+ DrawPlugin(I, Rect, PluginList[I+(SelectedPlugin-6)],
+ I+(SelectedPlugin-6)=SelectedPlugin)
+ else
+ DrawPlugin(I, Rect, PluginList[I+(Length(PluginList)-13)],
+ I+(Length(PluginList)-13)=SelectedPlugin);
+ end;
+
+ DrawScroll(Round(Rect.right+abs-1), Rect.top-round(abs)+1,
+ Round(ab), Rect.bottom-Rect.top+round(abs+abs)-2,
+ pos, barH);
+ end else
+ begin
+ for I := 0 to Length(PluginList)-1 do
+ DrawPlugin(I, Rect, PluginList[I], I=SelectedPlugin)
+ end;
+end;
+
+function TScreenPartyOptions.Draw: boolean;
+begin
+ // draw static menu
+ inherited Draw;
+
+ if MenuPluginOpen then
+ Draw_MenuPlugin;
+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;
+var
+ Len, I: Integer;
+ ID_DUELL: Integer;
+ ID_BLIND: Integer;
+ ID_NOSCORE: Integer;
+
+begin
+ Randomize;
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenPartyOptions)');
+
+ MenuPluginOpen := false;
+
+ //Fill plugin array
+ ID_DUELL := high(Byte);
+ ID_BLIND := high(Byte);
+ ID_NOSCORE := high(Byte);
+
+ SetLength(PluginList, 0);
+ for I := 0 to high(DLLMan.Plugins) do
+ begin
+ if DLLMan.Plugins[I].Name='PLUGIN_DUELL_NAME' then
+ ID_DUELL := I;
+
+ if DLLMan.Plugins[I].Name='PLUGIN_BLIND_NAME' then
+ ID_BLIND := I;
+
+ if DLLMan.Plugins[I].Name='PLUGIN_NOSCORE_NAME' then
+ ID_NOSCORE := I;
+
+ Len := Length(PluginList);
+ SetLength(PluginList, Len + 1);
+ PluginList[Len].ID := I;
+ PluginList[Len].TimesPlayed := 0;
+ PluginList[Len].Medley := false;
+ PluginList[Len].MedleySurprise := false;
+ PluginList[Len].Selected := true;
+ PluginList[Len].Name := Language.Translate(DLLMan.Plugins[I].Name);
+ PluginList[Len].Desc := Language.Translate(DLLMan.Plugins[I].PluginDesc);
+ end;
+
+ //Add Medley "Plugin" (if Plugin DUELL availible)
+ if ID_DUELL<>high(Byte) then
+ begin
+ Len := Length(PluginList);
+ SetLength(PluginList, Len + 1);
+ PluginList[Len].ID := ID_DUELL;
+ PluginList[Len].TimesPlayed := 0;
+ PluginList[Len].Medley := true;
+ PluginList[Len].MedleySurprise := false;
+ PluginList[Len].Selected := true;
+ PluginList[Len].Name := Language.Translate('PLUGIN_MEDLEY_NAME');
+ PluginList[Len].Desc := Language.Translate('PLUGIN_MEDLEY_DESC');
+ end;
+
+ //Add Medley blind "Plugin" (if Plugin BLIND availible)
+ if ID_BLIND<>high(Byte) then
+ begin
+ Len := Length(PluginList);
+ SetLength(PluginList, Len + 1);
+ PluginList[Len].ID := ID_BLIND;
+ PluginList[Len].TimesPlayed := 0;
+ PluginList[Len].Medley := true;
+ PluginList[Len].MedleySurprise := false;
+ PluginList[Len].Selected := true;
+ PluginList[Len].Name := Language.Translate('PLUGIN_MEDLEYBLIND_NAME');
+ PluginList[Len].Desc := Language.Translate('PLUGIN_MEDLEYBLIND_DESC');
+ end;
+
+ //Add Medley noscore "Plugin" (if Plugin NOSCORE availible)
+ if ID_NOSCORE<>high(Byte) then
+ begin
+ Len := Length(PluginList);
+ SetLength(PluginList, Len + 1);
+ PluginList[Len].ID := ID_NOSCORE;
+ PluginList[Len].TimesPlayed := 0;
+ PluginList[Len].Medley := true;
+ PluginList[Len].MedleySurprise := false;
+ PluginList[Len].Selected := true;
+ PluginList[Len].Name := Language.Translate('PLUGIN_MEDLEYNOSCORE_NAME');
+ PluginList[Len].Desc := Language.Translate('PLUGIN_MEDLEYNOSCORE_DESC');
+ end;
+
+ //Add Medley Surprise "Plugin" (if Plugin DUELL availible)
+ if ID_DUELL<>high(Byte) then
+ begin
+ Len := Length(PluginList);
+ SetLength(PluginList, Len + 1);
+ PluginList[Len].ID := ID_DUELL;
+ PluginList[Len].TimesPlayed := 0;
+ PluginList[Len].Medley := true;
+ PluginList[Len].MedleySurprise := true;
+ PluginList[Len].Selected := true;
+ PluginList[Len].Name := Language.Translate('PLUGIN_MEDLEYSURPRISE_NAME');
+ PluginList[Len].Desc := Language.Translate('PLUGIN_MEDLEYSURPRISE_DESC');
+ end;
+
+ //Add Medley Surprise blind "Plugin" (if Plugin BLIND availible)
+ if ID_BLIND<>high(Byte) then
+ begin
+ Len := Length(PluginList);
+ SetLength(PluginList, Len + 1);
+ PluginList[Len].ID := ID_BLIND;
+ PluginList[Len].TimesPlayed := 0;
+ PluginList[Len].Medley := true;
+ PluginList[Len].MedleySurprise := true;
+ PluginList[Len].Selected := true;
+ PluginList[Len].Name := Language.Translate('PLUGIN_MEDLEYSURPRISEBLIND_NAME');
+ PluginList[Len].Desc := Language.Translate('PLUGIN_MEDLEYSURPRISEBLIND_DESC');
+ end;
+
+ SelectedPlugin := 0;
+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/UScreenPartyOptionsM2.pas b/Game/Code/Screens/UScreenPartyOptionsM2.pas
new file mode 100644
index 00000000..186983a1
--- /dev/null
+++ b/Game/Code/Screens/UScreenPartyOptionsM2.pas
@@ -0,0 +1,819 @@
+unit UScreenPartyOptionsM2;
+
+interface
+
+uses
+ UMenu,
+ gl,
+ glu,
+ TextGL,
+ SDL,
+ UDisplay,
+ UMusic,
+ UFiles,
+ SysUtils,
+ UPartyM2,
+ UThemes;
+
+type
+ TScreenPartyOptionsM2 = class(TMenu)
+ const
+ ID='ID_020'; //for help system
+
+ public
+ ID_DUELL: Byte;
+ SelectLevel: cardinal;
+ SelectPlayList: cardinal;
+ SelectPlayList2: cardinal;
+ NameRounds: cardinal;
+ CountRounds: cardinal;
+ SelectPlayers: cardinal;
+ SelectRounds: cardinal;
+ SelectOptionPlugin: cardinal;
+ SelectOptionHandicap: cardinal;
+
+ MenuPluginOpen: boolean;
+
+ PluginList: array of TPartyPlugin;
+ SelectedPlugin: Integer;
+
+ PlayList: integer;
+ PlayList2: integer;
+ Rounds: integer;
+ NumPlayer: integer;
+ OptionPlugin: integer;
+ OptionHandicap: integer;
+
+ constructor Create; override;
+ function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
+ procedure onShow; override;
+ function Draw: boolean; override;
+ procedure SetAnimationProgress(Progress: real); override;
+ procedure SetPlaylist2;
+
+ procedure Draw_MenuPlugin;
+ function PartyInput_MenuPlugin(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): boolean;
+ end;
+
+var
+ IPlaylist: array[0..2] of String;
+ IPlaylist2: array of String;
+ IRounds: array of String;
+ IOptionYesNo: array of String;
+
+const
+ IPlayers: array[0..7] of String = ('2', '3', '4', '5', '6', '7', '8', '9');
+ MAX_ROUNDS: Integer = 100;
+
+implementation
+
+uses
+ UGraphic,
+ UMain,
+ UIni,
+ UTexture,
+ ULanguage,
+ UDLLManager,
+ UPlaylist,
+ UHelp,
+ ULog,
+ USongs;
+
+function TScreenPartyOptionsM2.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+var
+ I, J, Len: integer;
+ DuellAvailible: boolean;
+
+begin
+ Result := true;
+
+ if MenuPluginOpen then
+ begin
+ PartyInput_MenuPlugin(PressedKey, ScanCode, PressedDown);
+ Exit;
+ end;
+
+ if (PressedDown) then
+ begin
+ // check special keys
+ case PressedKey of
+ SDLK_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ Music.PlayBack;
+ FadeTo(@ScreenMain);
+ end;
+
+ SDLK_RETURN:
+ begin
+ if not (OptionPlugin=1) then
+ begin
+ //Don'T start when Playlist is Selected and there are no Playlists
+ if (Playlist = 2) and (Length(PlaylistMan.Playlists) = 0) then
+ Exit;
+
+ //check plugins
+ SetLength(PartySessionM2.Plugins, 0);
+ DuellAvailible := false;
+ for I := 0 to Length(PluginList)-1 do
+ begin
+ //deactivate if not select plugins
+ //deselect all Plugins
+ if (OptionPlugin=0) then
+ PluginList[I].Selected := false;
+
+ //activate only duell plugin
+ if (OptionPlugin=0) and (PluginList[I].ID=ID_DUELL) and not PluginList[I].Medley then
+ begin
+ DuellAvailible := true;
+ if OptionPlugin=0 then
+ PluginList[I].Selected := true;
+ end;
+
+ if PluginList[I].Selected then
+ begin
+ Len := Length(PartySessionM2.Plugins);
+ SetLength(PartySessionM2.Plugins, Len+1);
+ PartySessionM2.Plugins[Len] := PluginList[I];
+ end;
+ end;
+
+ // Don't start when OptionPlugin=0 and no DUEL-Plugin
+ if not DuellAvailible and (OptionPlugin=0) then
+ begin
+ ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS') + ' (Duell)');
+ Exit;
+ end;
+
+ if Length(PartySessionM2.Plugins)=0 then
+ begin
+ ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS'));
+ Exit;
+ end;
+
+ //Save OptionPlugin
+ if OptionPlugin=0 then
+ PartySessionM2.Option_Plugins := false
+ else
+ PartySessionM2.Option_Plugins := true;
+
+ //Save Option Handicap
+ if OptionHandicap=0 then
+ PartySessionM2.HandicapMode := false
+ else
+ PartySessionM2.HandicapMode := true;
+
+ //Save Difficulty
+ Ini.Difficulty := SelectsS[SelectLevel].SelectedOption;
+ Ini.SaveLevel;
+
+ //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
+ PartySessionM2.StartNewParty(NumPlayer+2, Rounds+1);
+
+ Music.PlayStart;
+ //Go to Player Screen
+ FadeTo(@ScreenPartyPlayerM2);
+ end else
+ begin
+ MenuPluginOpen := true;
+ if not Help.SetHelpID('ID_030') then
+ Log.LogError('No Entry for Help-ID ID_030 (ScreenPartyOptionsM2, SelectPlugins)');
+ 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:
+ begin
+ InteractNext;
+ if Interaction=7 then
+ MenuPluginOpen := true;
+ end;
+ SDLK_UP: InteractPrev;
+ SDLK_RIGHT:
+ begin
+ Music.PlayOption;
+ InteractInc;
+
+ //Change Playlist2 if Playlist is Changed
+ if (Interaction = 1) then
+ begin
+ SetPlaylist2;
+ end
+ else if(Interaction = 3) then
+ begin
+ Rounds:=(((NumPlayer+2)*(NumPlayer+2))-NumPlayer-2)-1;
+ SelectsS[SelectRounds].SetSelectOpt(Rounds);
+ end else if(Interaction = 4) then
+ begin
+ if (Rounds+1 + NumPlayer + 1 <= MAX_ROUNDS-1) then
+ Rounds:=Rounds + NumPlayer + 1
+ else
+ dec(Rounds);
+
+ SelectsS[SelectRounds].SetSelectOpt(Rounds);
+ end else if(Interaction = 5) then //Option Plugins
+ begin
+ //select all Plugins
+ for I := 0 to Length(PluginList) - 1 do
+ begin
+ PluginList[I].Selected := true;
+ end;
+ end;
+ end;
+ SDLK_LEFT:
+ begin
+ Music.PlayOption;
+ InteractDec;
+
+ //Change Playlist2 if Playlist is Changed
+ if (Interaction = 1) then
+ begin
+ SetPlaylist2;
+ end
+ else if(Interaction = 3) then
+ begin
+ Rounds:=(((NumPlayer+2)*(NumPlayer+2))-NumPlayer-2)-1;
+ SelectsS[SelectRounds].SetSelectOpt(Rounds);
+ end else if(Interaction = 4) then
+ begin
+ if (Rounds+1 - NumPlayer - 1 >= 2) then
+ Rounds:=Rounds - NumPlayer - 1
+ else
+ inc(Rounds);
+
+ SelectsS[SelectRounds].SetSelectOpt(Rounds);
+ end;
+ end;
+ end;
+ end;
+end;
+
+function TScreenPartyOptionsM2.PartyInput_MenuPlugin(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): boolean;
+var
+ I, J, Len: integer;
+ DuellAvailible: boolean;
+
+begin
+ Result := true;
+
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_ESCAPE:
+ begin
+ MenuPluginOpen := false;
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenPartyOptions)');
+ end;
+
+ SDLK_RETURN:
+ 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;
+
+ //check plugins
+ SetLength(PartySessionM2.Plugins, 0);
+ DuellAvailible := false;
+ for I := 0 to Length(PluginList)-1 do
+ begin
+ if (PluginList[I].ID=ID_DUELL) then
+ begin
+ DuellAvailible := true;
+ if OptionPlugin=0 then
+ PluginList[I].Selected := true;
+ end;
+
+ if PluginList[I].Selected then
+ begin
+ Len := Length(PartySessionM2.Plugins);
+ SetLength(PartySessionM2.Plugins, Len+1);
+ PartySessionM2.Plugins[Len] := PluginList[I];
+ end;
+ end;
+
+ // Don't start when OptionPlugin=0 and no DUEL-Plugin
+ if not DuellAvailible and (OptionPlugin=0) then
+ begin
+ ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS') + ' (Duell)');
+ Exit;
+ end;
+
+ if Length(PartySessionM2.Plugins)=0 then
+ begin
+ ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS'));
+ Exit;
+ end;
+
+ //Save OptionPlugin
+ if OptionPlugin=0 then
+ PartySessionM2.Option_Plugins := false
+ else
+ PartySessionM2.Option_Plugins := true;
+
+ //Save Option Handicap
+ if OptionHandicap=0 then
+ PartySessionM2.HandicapMode := false
+ else
+ PartySessionM2.HandicapMode := true;
+
+ //Save Difficulty
+ Ini.Difficulty := SelectsS[SelectLevel].SelectedOption;
+ Ini.SaveLevel;
+
+ //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
+ PartySessionM2.StartNewParty(NumPlayer+2, Rounds+1);
+
+ Music.PlayStart;
+ //Go to Player Screen
+ FadeTo(@ScreenPartyPlayerM2);
+ end;
+
+ SDLK_SPACE:
+ begin
+ Music.PlayOption;
+ PluginList[SelectedPlugin].Selected := not PluginList[SelectedPlugin].Selected;
+ end;
+
+ SDLK_LEFT:
+ begin
+ if PluginList[SelectedPlugin].Selected then
+ begin
+ Music.PlayOption;
+ PluginList[SelectedPlugin].Selected := false;
+ end;
+ end;
+
+ SDLK_RIGHT:
+ begin
+ if not PluginList[SelectedPlugin].Selected then
+ begin
+ Music.PlayOption;
+ PluginList[SelectedPlugin].Selected := true;
+ end;
+ end;
+
+ SDLK_UP:
+ begin
+ if SelectedPlugin>0 then
+ Dec(SelectedPlugin);
+ end;
+
+ SDLK_DOWN:
+ begin
+ if SelectedPlugin<Length(PluginList)-1 then
+ Inc(SelectedPlugin);
+ end;
+ end; //of case
+ end; //of if
+end;
+
+procedure TScreenPartyOptionsM2.Draw_MenuPlugin;
+Type
+ TRect = record
+ left, right, top, bottom: integer;
+ end;
+
+Const
+ h = 40;
+
+ procedure DrawPlugin(num: integer; Rect: TRect; Plug: TPartyPlugin; selected: boolean);
+ var
+ text: PChar;
+ name: string;
+
+ begin
+ glColor4f(1, 1, 1, 1);
+ glLineWidth(1);
+ if selected then
+ begin
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(Rect.left-5, Rect.top+h*num);
+ glVertex2f(Rect.right+5, Rect.top+h*num);
+ glVertex2f(Rect.right+5, Rect.top+h*(num+1));
+ glVertex2f(Rect.left-5, Rect.top+h*(num+1));
+ glEnd;
+ end;
+
+ SetFontStyle(1);
+ SetFontItalic(false);
+ SetFontSize(13);
+
+ SetFontPos (Rect.left, Rect.top+ num*h);
+
+ name := Plug.Name;
+
+ text := Addr(name[1]);
+ glPrint(text);
+
+ SetFontPos (Rect.left+Round((Rect.right-Rect.left)/4*3), Rect.top+ num*h);
+ if Plug.Selected then
+ name := Language.Translate('SONG_MENU_YES')
+ else
+ name := Language.Translate('SONG_MENU_NO');
+
+ text := Addr(name[1]);
+ glPrint(text);
+ end;
+
+ procedure DrawScroll(X, Y, W, H: integer; pos, len: double);
+ var
+ fY, tY: double;
+ begin
+ glColor4f(1, 1, 1, 1);
+
+ glLineWidth(1);
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(X, Y);
+ glVertex2f(X+W, Y);
+ glVertex2f(X+W, Y+H);
+ glVertex2f(X, Y+H);
+ glEnd;
+
+ fY := Y+(H-H*len)*pos;
+ tY := fY+H*len;
+ if tY+0.001>=Y+H then
+ tY := Y+H;
+
+ glBegin(GL_QUADS);
+ glVertex2f(X, fY);
+ glVertex2f(X+W, fY);
+ glVertex2f(X+W, tY);
+ glVertex2f(X, tY);
+ glEnd;
+ end;
+
+var
+ Rect: TRect;
+ abs: real;
+ ab: real;
+ I: integer;
+ barH: double;
+ pos: double;
+
+begin
+ Rect.left := 150;
+ Rect.right := 650;
+ Rect.top := 30;
+ Rect.bottom := 550;
+
+ abs := 15;
+
+ if Length(PluginList)<=13 then
+ begin
+ ab := 0;
+ barH := 1;
+ end else
+ begin
+ ab := 10;
+ barH := h*13/(h*Length(PluginList));
+ end;
+
+ glEnable(GL_BLEND);
+ glBegin(gl_quads);
+ //Background:
+ glColor4f(0.2, 0.2, 0.2, 0.8); glVertex2f(Rect.left-abs, Rect.top-abs);
+ glColor4f(0.2, 0.2, 0.2, 0.8); glVertex2f(Rect.right+abs+ab, Rect.top-abs);
+ glColor4f(0.2, 0.2, 0.2, 0.8); glVertex2f(Rect.right+abs+ab, Rect.bottom+abs);
+ glColor4f(0.2, 0.2, 0.2, 0.8); glVertex2f(Rect.left-abs, Rect.bottom+abs);
+ glEnd;
+ glDisable(GL_BLEND);
+
+ //Draw MainFrame
+ glColor4f(1, 1, 1, 1);
+
+ glLineWidth(1);
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(Rect.left-abs+1, Rect.top-abs+1);
+ glVertex2f(Rect.right+abs-1, Rect.top-abs+1);
+ glVertex2f(Rect.right+abs-1, Rect.bottom+abs-1);
+ glVertex2f(Rect.left-abs+1, Rect.bottom+abs-1);
+ glEnd;
+
+ if barH<1 then
+ begin
+ pos := SelectedPlugin/(Length(PluginList)-1);
+
+ //draw plugin names and selections
+ for I := 0 to 12 do
+ begin
+ if (SelectedPlugin<=6) then
+ DrawPlugin(I, Rect, PluginList[I], I=SelectedPlugin)
+ else if ((SelectedPlugin-6)<=(Length(PluginList)-13)) then
+ DrawPlugin(I, Rect, PluginList[I+(SelectedPlugin-6)],
+ I+(SelectedPlugin-6)=SelectedPlugin)
+ else
+ DrawPlugin(I, Rect, PluginList[I+(Length(PluginList)-13)],
+ I+(Length(PluginList)-13)=SelectedPlugin);
+ end;
+
+ DrawScroll(Round(Rect.right+abs-1), Rect.top-round(abs)+1,
+ Round(ab), Rect.bottom-Rect.top+round(abs+abs)-2,
+ pos, barH);
+ end else
+ begin
+ for I := 0 to Length(PluginList)-1 do
+ DrawPlugin(I, Rect, PluginList[I], I=SelectedPlugin)
+ end;
+end;
+
+constructor TScreenPartyOptionsM2.Create;
+var
+ I: integer;
+begin
+ inherited Create;
+ //Fill IPlaylist
+
+ SetLength(IOptionYesNo, 2);
+ IOptionYesNo[0] := Language.Translate('SONG_MENU_NO');
+ IOptionYesNo[1] := Language.Translate('SONG_MENU_YES');
+
+ SetLength(IRounds, Round(MAX_ROUNDS));
+ for I := 1 to MAX_ROUNDS do
+ begin
+ IRounds[I-1]:=IntToStr(I);
+ end;
+
+ 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
+ NumPlayer := 0;
+ Rounds := 0;
+ PlayList := 0;
+ PlayList2 := 0;
+
+ //Load Screen From Theme
+ LoadFromTheme(Theme.PartyOptionsM2);
+
+ SelectLevel := AddSelectSlide (Theme.PartyOptionsM2.SelectLevel, Ini.Difficulty, Theme.ILevel);
+ SelectPlayList := AddSelectSlide (Theme.PartyOptionsM2.SelectPlayList, PlayList, IPlaylist);
+ SelectPlayList2 := AddSelectSlide (Theme.PartyOptionsM2.SelectPlayList2, PlayList2, IPlaylist2);
+ SelectPlayers := AddSelectSlide (Theme.PartyOptionsM2.SelectPlayers1, NumPlayer, IPlayers);
+ SelectRounds := AddSelectSlide (Theme.PartyOptionsM2.SelectRounds, Rounds, IRounds);
+ SelectOptionPlugin := AddSelectSlide (Theme.PartyOptionsM2.SelectOptionPlugin, OptionPlugin, IOptionYesNo);
+ SelectOptionHandicap := AddSelectSlide (Theme.PartyOptionsM2.SelectOptionHandicap, OptionHandicap, IOptionYesNo);
+
+ Interaction := 0;
+ Rounds:=1;
+ SelectsS[SelectRounds].SetSelectOpt(Rounds);
+
+end;
+
+procedure TScreenPartyOptionsM2.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.PartyOptionsM2.SelectPlayList2, 2, IPlaylist2, Playlist2);
+end;
+
+procedure TScreenPartyOptionsM2.onShow;
+var
+ Len, I: Integer;
+ ID_BLIND: Byte;
+ ID_NOSCORE: Byte;
+
+begin
+ Randomize;
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenPartyOptionsM2)');
+
+ MenuPluginOpen := false;
+
+ //Fill plugin array
+ ID_DUELL := high(Byte);
+ ID_BLIND := high(Byte);
+ ID_NOSCORE := high(Byte);
+
+ SetLength(PluginList, 0);
+ for I := 0 to high(DLLMan.Plugins) do
+ begin
+ if DLLMan.Plugins[I].Name='PLUGIN_DUELL_NAME' then
+ ID_DUELL := I;
+
+ if DLLMan.Plugins[I].Name='PLUGIN_BLIND_NAME' then
+ ID_BLIND := I;
+
+ if DLLMan.Plugins[I].Name='PLUGIN_NOSCORE_NAME' then
+ ID_NOSCORE := I;
+
+ if (not DLLMan.Plugins[I].TeamModeOnly) then
+ begin
+ Len := Length(PluginList);
+ SetLength(PluginList, Len + 1);
+ PluginList[Len].ID := I;
+ PluginList[Len].TimesPlayed := 0;
+ PluginList[Len].Medley := false;
+ PluginList[Len].MedleySurprise := false;
+
+ if I=ID_DUELL then
+ PluginList[Len].Selected := true
+ else
+ PluginList[Len].Selected := false;
+
+ PluginList[Len].Name := Language.Translate(DLLMan.Plugins[I].Name);
+ PluginList[Len].Desc := Language.Translate(DLLMan.Plugins[I].PluginDesc);
+ end;
+ end;
+
+ //Add Medley "Plugin" (if Plugin DUELL availible)
+ if ID_DUELL<>high(Byte) then
+ begin
+ Len := Length(PluginList);
+ SetLength(PluginList, Len + 1);
+ PluginList[Len].ID := ID_DUELL;
+ PluginList[Len].TimesPlayed := 0;
+ PluginList[Len].Medley := true;
+ PluginList[Len].MedleySurprise := false;
+ PluginList[Len].Selected := true;
+ PluginList[Len].Name := Language.Translate('PLUGIN_MEDLEY_NAME');
+ PluginList[Len].Desc := Language.Translate('PLUGIN_MEDLEY_DESC');
+ end;
+
+ //Add Medley blind "Plugin" (if Plugin BLIND availible)
+ if ID_BLIND<>high(Byte) then
+ begin
+ Len := Length(PluginList);
+ SetLength(PluginList, Len + 1);
+ PluginList[Len].ID := ID_BLIND;
+ PluginList[Len].TimesPlayed := 0;
+ PluginList[Len].Medley := true;
+ PluginList[Len].MedleySurprise := false;
+ PluginList[Len].Selected := true;
+ PluginList[Len].Name := Language.Translate('PLUGIN_MEDLEYBLIND_NAME');
+ PluginList[Len].Desc := Language.Translate('PLUGIN_MEDLEYBLIND_DESC');
+ end;
+
+ //Add Medley noscore "Plugin" (if Plugin NOSCORE availible)
+ if ID_NOSCORE<>high(Byte) then
+ begin
+ Len := Length(PluginList);
+ SetLength(PluginList, Len + 1);
+ PluginList[Len].ID := ID_NOSCORE;
+ PluginList[Len].TimesPlayed := 0;
+ PluginList[Len].Medley := true;
+ PluginList[Len].MedleySurprise := false;
+ PluginList[Len].Selected := true;
+ PluginList[Len].Name := Language.Translate('PLUGIN_MEDLEYNOSCORE_NAME');
+ PluginList[Len].Desc := Language.Translate('PLUGIN_MEDLEYNOSCORE_DESC');
+ end;
+
+ //Add Medley Surprise "Plugin" (if Plugin DUELL availible)
+ if ID_DUELL<>high(Byte) then
+ begin
+ Len := Length(PluginList);
+ SetLength(PluginList, Len + 1);
+ PluginList[Len].ID := ID_DUELL;
+ PluginList[Len].TimesPlayed := 0;
+ PluginList[Len].Medley := true;
+ PluginList[Len].MedleySurprise := true;
+ PluginList[Len].Selected := true;
+ PluginList[Len].Name := Language.Translate('PLUGIN_MEDLEYSURPRISE_NAME');
+ PluginList[Len].Desc := Language.Translate('PLUGIN_MEDLEYSURPRISE_DESC');
+ end;
+
+ //Add Medley Surprise blind "Plugin" (if Plugin BLIND availible)
+ if ID_BLIND<>high(Byte) then
+ begin
+ Len := Length(PluginList);
+ SetLength(PluginList, Len + 1);
+ PluginList[Len].ID := ID_BLIND;
+ PluginList[Len].TimesPlayed := 0;
+ PluginList[Len].Medley := true;
+ PluginList[Len].MedleySurprise := true;
+ PluginList[Len].Selected := true;
+ PluginList[Len].Name := Language.Translate('PLUGIN_MEDLEYSURPRISEBLIND_NAME');
+ PluginList[Len].Desc := Language.Translate('PLUGIN_MEDLEYSURPRISEBLIND_DESC');
+ end;
+
+ SelectedPlugin := 0;
+end;
+
+function TScreenPartyOptionsM2.Draw: boolean;
+begin
+ // draw static menu
+ inherited Draw;
+
+ if MenuPluginOpen then
+ Draw_MenuPlugin;
+end;
+
+procedure TScreenPartyOptionsM2.SetAnimationProgress(Progress: real);
+begin
+ {for I := 0 to 6 do
+ SelectS[I].Texture.ScaleW := Progress;}
+end;
+
+end.
diff --git a/Game/Code/Screens/UScreenPartyPlayer.pas b/Game/Code/Screens/UScreenPartyPlayer.pas
new file mode 100644
index 00000000..70e08adb
--- /dev/null
+++ b/Game/Code/Screens/UScreenPartyPlayer.pas
@@ -0,0 +1,340 @@
+unit UScreenPartyPlayer;
+
+Interface
+
+uses
+ UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes;
+
+type
+ TScreenPartyPlayer = class(TMenu)
+ const
+ ID='ID_016'; //for help system
+
+ 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, UHelp, ULog;
+
+function TScreenPartyPlayer.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+var
+ I, J: integer;
+ SDL_ModState: Word;
+ 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
+
+ SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT
+ + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT);
+
+ begin // Key Down
+ case PressedKey of
+ SDLK_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ 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
+ Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + chr(ScanCode);
+ end;
+
+ // Templates for Names Mod
+ SDLK_F1:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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
+ Button[Interaction].Text[0].DeleteLastL;
+ end;
+
+ SDLK_ESCAPE :
+ begin
+ Ini.SaveNames;
+ Music.PlayBack;
+ FadeTo(@ScreenPartyOptions);
+ end;
+
+ SDLK_RETURN:
+ begin
+ Ini.SaveNames;
+ //Save PlayerNames
+ 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;
+ end;
+
+ 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;
+
+ LoadFromTheme(Theme.PartyPlayer);
+
+ 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);
+
+ Interaction := 0;
+end;
+
+procedure TScreenPartyPlayer.onShow;
+var
+ I: integer;
+begin
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenPartyPlayer)');
+
+ // 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;
+ 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/UScreenPartyPlayerM2.pas b/Game/Code/Screens/UScreenPartyPlayerM2.pas
new file mode 100644
index 00000000..0486dfda
--- /dev/null
+++ b/Game/Code/Screens/UScreenPartyPlayerM2.pas
@@ -0,0 +1,256 @@
+unit UScreenPartyPlayerM2;
+
+Interface
+
+uses
+ UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes;
+
+type
+ TScreenPartyPlayerM2 = class(TMenu)
+ const
+ ID='ID_021'; //for help system
+
+ 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, UPartyM2, UHelp, ULog;
+
+function TScreenPartyPlayerM2.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+var
+ I, J: integer;
+ SDL_ModState: Word;
+ 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
+
+ SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT
+ + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT);
+
+ begin // Key Down
+ case PressedKey of
+ SDLK_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ 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
+ Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + chr(ScanCode);
+ end;
+
+ // Templates for Names Mod
+ SDLK_F1:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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:
+ 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
+ Button[Interaction].Text[0].DeleteLastL;
+ end;
+
+ SDLK_ESCAPE :
+ begin
+ Ini.SaveNames;
+ Music.PlayBack;
+ FadeTo(@ScreenPartyOptionsM2);
+ end;
+
+ SDLK_RETURN:
+ begin
+ Ini.SaveNames;
+ //Save PlayerNames
+ for J := 0 to PartySessionM2.Players.NumPlayer-1 do
+ begin
+ PartySessionM2.Players.Playerinfo[J].Name := PChar(Button[J].Text[0].Text);
+ PartySessionM2.Players.Playerinfo[J].NumPlayed := 0;
+ end;
+
+ Music.PlayStart;
+ FadeTo(@ScreenPartyNewRoundM2);
+ 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 TScreenPartyPlayerM2.Create;
+var
+ I: integer;
+begin
+ inherited Create;
+
+ LoadFromTheme(Theme.PartyPlayerM2);
+
+ AddButton(Theme.PartyPlayerM2.Player1Name);
+ AddButton(Theme.PartyPlayerM2.Player2Name);
+ AddButton(Theme.PartyPlayerM2.Player3Name);
+ AddButton(Theme.PartyPlayerM2.Player4Name);
+ AddButton(Theme.PartyPlayerM2.Player5Name);
+ AddButton(Theme.PartyPlayerM2.Player6Name);
+ AddButton(Theme.PartyPlayerM2.Player7Name);
+ AddButton(Theme.PartyPlayerM2.Player8Name);
+ AddButton(Theme.PartyPlayerM2.Player9Name);
+
+ Interaction := 0;
+end;
+
+procedure TScreenPartyPlayerM2.onShow;
+var
+ I: integer;
+begin
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenPartyPlayerM2)');
+
+ // Templates for Names Mod
+ for I := 1 to 9 do
+ begin
+ Button[I-1].Text[0].Text := Ini.NameTemplate[I-1];
+ if (PartySessionM2.Players.NumPlayer >=I) then
+ begin
+ Button[I-1].Visible := true;
+ end else
+ begin
+ Button[I-1].Visible := false;
+ end;
+ end;
+end;
+
+procedure TScreenPartyPlayerM2.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.pas b/Game/Code/Screens/UScreenPartyScore.pas
new file mode 100644
index 00000000..fb6d6022
--- /dev/null
+++ b/Game/Code/Screens/UScreenPartyScore.pas
@@ -0,0 +1,301 @@
+unit UScreenPartyScore;
+
+interface
+
+uses
+ UMenu, SDL, UDisplay, UMusic, SysUtils, UThemes;
+
+type
+ TScreenPartyScore = class(TMenu)
+ const
+ ID='ID_017'; //for help system
+
+ public
+ TextScoreTeam1: Cardinal;
+ TextScoreTeam2: Cardinal;
+ TextScoreTeam3: Cardinal;
+ TextNameTeam1: Cardinal;
+ TextNameTeam2: Cardinal;
+ TextNameTeam3: Cardinal;
+ StaticTeam1: Cardinal;
+ StaticTeam1BG: Cardinal;
+ StaticTeam1Deco: Cardinal;
+ StaticTeam2: Cardinal;
+ StaticTeam2BG: Cardinal;
+ StaticTeam2Deco: Cardinal;
+ StaticTeam3: Cardinal;
+ StaticTeam3BG: Cardinal;
+ 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;
+ 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, UTexture, USkins, UHelp, ULog;
+
+function TScreenPartyScore.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ 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
+ FadeTo(@ScreenPartyWin);
+ end;
+ end;
+ end;
+end;
+
+constructor TScreenPartyScore.Create;
+var
+ I: integer;
+ Tex: TTexture;
+ R, G, B: Real;
+ Color: Integer;
+begin
+ inherited Create;
+
+ 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);
+ 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);
+
+ //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, J: Integer;
+ Placings: Array [0..5] of Byte;
+begin
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenPartyScore)');
+
+ //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;
+
+ //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;
+ 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;
+
+ //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);
+
+ //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;
+ 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
+ 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;
+ 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
+ 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;
+ 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;
+
+
+// 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.pas b/Game/Code/Screens/UScreenPartyWin.pas
new file mode 100644
index 00000000..e40a48d8
--- /dev/null
+++ b/Game/Code/Screens/UScreenPartyWin.pas
@@ -0,0 +1,267 @@
+unit UScreenPartyWin;
+
+interface
+
+uses
+ UMenu, SDL, UDisplay, UMusic, SysUtils, UThemes;
+
+type
+ TScreenPartyWin = class(TMenu)
+ const
+ ID='ID_018'; //for help system
+
+ public
+ TextScoreTeam1: Cardinal;
+ TextScoreTeam2: Cardinal;
+ TextScoreTeam3: Cardinal;
+ TextNameTeam1: Cardinal;
+ 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;
+ procedure SetAnimationProgress(Progress: real); override;
+ end;
+
+implementation
+
+uses UGraphic, UMain, UParty, UScreenSingModi, ULanguage, UHelp, ULog;
+
+function TScreenPartyWin.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ 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;
+
+ 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);
+ 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);
+
+ LoadFromTheme(Theme.PartyWin);
+end;
+
+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
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenParyWin)');
+
+ //Get Team Placing
+ Placing := PartySession.GetTeamOrder;
+
+ //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);
+
+ Text[TextScoreTeam1].Visible := True;
+ Text[TextNameTeam1].Visible := True;
+ 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
+ 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
+ begin
+ 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;
+ 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
+ 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
+ begin
+ 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;
+ 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
+ Text[TextScoreTeam3].Visible := False;
+ Text[TextNameTeam3].Visible := False;
+ Static[StaticTeam3].Visible := False;
+ Static[StaticTeam3BG].Visible := False;
+ Static[StaticTeam3Deco].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/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas
new file mode 100644
index 00000000..5a8bacc7
--- /dev/null
+++ b/Game/Code/Screens/UScreenPopup.pas
@@ -0,0 +1,862 @@
+unit UScreenPopup;
+
+interface
+
+uses
+ UMenu, SDL, UMusic, math, UFiles, SysUtils, UThemes, UHelp, gl, glu;
+
+type
+ TScreenPopupCheck = class(TMenu)
+ 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(msg: String);
+ function Draw: boolean; override;
+ end;
+
+ 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: String);
+ function Draw: boolean; override;
+ end;
+
+ TRect = record
+ left, right, top, bottom: integer;
+ end;
+
+ TLine = record
+ fX, fY, tX, tY: integer;
+ end;
+
+ TText = record
+ X, Y: integer;
+ Style: integer;
+ Size: real;
+ Italic: boolean;
+ text: string;
+ end;
+
+ TResLine = record
+ Y: integer;
+ H: integer;
+ lines: array of TLine;
+ texts: array of TText;
+ end;
+
+ TScreenPopupHelp = class(TMenu)
+ private
+ CurMenu: Byte; //Num of the cur. Shown Menu
+
+ TextsGFX: array of TResLine;
+ msg: TTextResult;
+ Rect: TRect;
+
+ max_high: real;
+ step: double;
+ barH: double;
+
+ procedure DrawTable;
+ procedure DrawLine(line, index, Y: integer);
+ procedure DrawText(line, index, Y: integer);
+ procedure DrawScroll(X, Y, W, H: integer; pos, len: double);
+ 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();
+ function Draw: boolean; override;
+ end;
+var
+// ISelections: Array of String;
+ SelectValue: Integer;
+
+
+implementation
+
+uses Classes, TextGL, UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist, UDisplay;
+
+function TScreenPopupCheck.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
+ Display.CheckOK:=False;
+ Display.NextScreenWithCheck:=NIL;
+ Visible:=False;
+ Result := false;
+ end;
+
+ SDLK_RETURN:
+ 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
+ Display.CheckOK:=False;
+ Display.NextScreenWithCheck:=NIL;
+ end;
+ end;
+ Visible:=False;
+ Result := false;
+ end;
+
+ SDLK_DOWN: InteractNext;
+ SDLK_UP: InteractPrev;
+
+ SDLK_RIGHT: InteractNext;
+ SDLK_LEFT: InteractPrev;
+ end;
+ end;
+end;
+
+constructor TScreenPopupCheck.Create;
+var
+ I: integer;
+begin
+ inherited Create;
+
+ 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 TScreenPopupCheck.Draw: boolean;
+begin
+ inherited Draw;
+end;
+
+procedure TScreenPopupCheck.onShow;
+begin
+
+end;
+
+procedure TScreenPopupCheck.ShowPopup(msg: String);
+begin
+ Interaction := 0; //Reset Interaction
+ Visible := True; //Set Visible
+
+ 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;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+
+ case PressedKey of
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ Visible:=False;
+ Result := false;
+ end;
+
+ SDLK_RETURN:
+ begin
+ Visible:=False;
+ Result := false;
+ end;
+
+ SDLK_DOWN: InteractNext;
+ SDLK_UP: InteractPrev;
+
+ SDLK_RIGHT: InteractNext;
+ SDLK_LEFT: InteractPrev;
+ 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
+end;
+
+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
+ 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;}
+ Text[0].Text:=msg;
+
+ Button[0].Visible := True;
+
+ Button[0].Text[0].Text := 'OK';
+end;
+
+// Help popup
+
+function TScreenPopupHelp.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+var
+ pos: double;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ pos := Help.GetScrollPos();
+ case PressedKey of
+ SDLK_TAB,
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ Visible:=False;
+ Result := false;
+ end;
+
+ SDLK_RETURN:
+ begin
+ Visible:=False;
+ Result := false;
+ end;
+
+ SDLK_DOWN:
+ begin
+ InteractNext;
+ if pos<(1-step) then
+ Help.SetScrollPos(pos+step)
+ else if pos>0 then
+ Help.SetScrollPos(1);
+ end;
+ SDLK_UP:
+ begin
+ InteractPrev;
+ if pos>step then
+ Help.SetScrollPos(pos-step)
+ else if pos>0 then
+ Help.SetScrollPos(0);
+ end;
+
+ SDLK_RIGHT: InteractNext;
+ SDLK_LEFT: InteractPrev;
+ end;
+ end;
+end;
+
+constructor TScreenPopupHelp.Create;
+var
+ I: integer;
+begin
+ inherited Create;
+
+ AddButton(Theme.HelpPopup.Button1);
+ if (Length(Button[0].Text) = 0) then
+ AddButtonText(14, 20, 'Button 1');
+ Button[0].Visible := false;
+ Interaction := 0;
+end;
+
+function TScreenPopupHelp.Draw: boolean;
+var
+ msg: TTextResult;
+ I: integer;
+ abs: real;
+begin
+ inherited Draw;
+ if step<1 then
+ abs := 20
+ else
+ abs := 5;
+
+ //Background:
+ glEnable(GL_BLEND);
+ glbegin(gl_quads);
+ glColor4f(0.2, 0.2, 0.2, 0.8); glVertex2f(Rect.left-5, Rect.top-5);
+ glColor4f(0.2, 0.2, 0.2, 0.8); glVertex2f(Rect.right+abs, Rect.top-5);
+ glColor4f(0.2, 0.2, 0.2, 0.8); glVertex2f(Rect.right+abs, Rect.bottom+5);
+ glColor4f(0.2, 0.2, 0.2, 0.8); glVertex2f(Rect.left-5, Rect.bottom+5);
+ glEnd;
+ glDisable(GL_BLEND);
+ //glScissor(Rect.left-1, ScreenH-Rect.bottom-1, Rect.right-Rect.left+2, Rect.bottom-Rect.top+2);
+ glScissor(round((Rect.left-1)*(ScreenW/Screens)/RenderW+(ScreenW/Screens)*(ScreenAct-1)),
+ round((RenderH-Rect.bottom-1)*ScreenH/RenderH),
+ round((Rect.right-Rect.left+2)*(ScreenW/Screens)/RenderW),
+ round((Rect.bottom-Rect.top+2)*ScreenH/RenderH));
+ glEnable(GL_SCISSOR_TEST);
+ DrawTable();
+ glDisable(GL_SCISSOR_TEST);
+ if step<1 then
+ DrawScroll(Rect.right+5, Rect.top, 10, Rect.bottom-Rect.top, Help.GetScrollPos(), barH);
+end;
+
+procedure TScreenPopupHelp.onShow;
+begin
+
+end;
+
+procedure TScreenPopupHelp.onHide;
+var i: integer;
+begin
+end;
+
+procedure TScreenPopupHelp.ShowPopup();
+var
+ I, J, K: integer;
+ line: integer;
+ SL: TStringList;
+ tempStr: String;
+ KeyEnd: integer;
+ Style: integer;
+ Size: real;
+ Italic: boolean;
+ fieldh: integer;
+ tline: integer;
+ countline:integer;
+
+ procedure AddLine(l, i, fX, fY, tX, tY: integer);
+ begin
+ TextsGFX[l].lines[i].fX := fX;
+ TextsGFX[l].lines[i].fY := fY;
+ TextsGFX[l].lines[i].tX := tX;
+ TextsGFX[l].lines[i].tY := tY;
+ end;
+
+ procedure NewLine(h, lines: integer);
+ begin
+ inc(line);
+ tline := -1;
+ SetLength(TextsGFX, line+1);
+ TextsGFX[line].H := h;
+ TextsGFX[line].Y := TextsGFX[line-1].Y + TextsGFX[line-1].H;
+ SetLength(TextsGFX[line].lines, lines);
+ end;
+
+ procedure NewText(X, Y: integer);
+ begin
+ inc(tline);
+ SetLength(TextsGFX[line].texts, tline+1);
+ TextsGFX[line].texts[tline].X := X;
+ TextsGFX[line].texts[tline].Y := Y;
+ TextsGFX[line].texts[tline].Style := Style;
+ TextsGFX[line].texts[tline].Size := Size;
+ TextsGFX[line].texts[tline].Italic := Italic;
+ end;
+
+begin
+ Interaction := 0; //Reset Interaction
+ Visible := True; //Set Visible
+
+ SetLength(TextsGFX, 0);
+ line := 0;
+ tline := -1;
+
+ Style := 1;
+ Size := 7;
+ Italic := false;
+
+ SetFontStyle(Style);
+ SetFontSize(Size);
+ SetFontItalic(Italic);
+
+
+ Rect.left := 25;
+ Rect.right := 770;
+ Rect.top := 25;
+ Rect.bottom := 575;
+
+ KeyEnd := round((Rect.right - Rect.left)*0.4);
+ fieldh := 22;
+
+ msg := Help.GetHelpStr();
+
+ //Title
+ SetLength(TextsGFX, 1);
+ TextsGFX[line].H := round(fieldh/4);
+ TextsGFX[line].Y := Rect.top;
+ SetLength(TextsGFX[line].lines, 3);
+
+ AddLine(line, 0, Rect.left, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y);
+ AddLine(line, 1, Rect.left, TextsGFX[line].Y, Rect.left, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 2, Rect.right, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+
+ NewLine(fieldh*2, 2);
+ AddLine(line, 0, Rect.left, TextsGFX[line].Y, Rect.left, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 1, Rect.right, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+
+ NewText(Rect.left + 5, TextsGFX[line].Y + 2);
+ TextsGFX[line].texts[tline].Size:=12;
+ TextsGFX[line].texts[tline].text := Language.Translate('MSG_HELP_TITLE') + ': ' + msg.Title;
+
+ NewLine(round(fieldh/4), 3);
+ AddLine(line, 0, Rect.left, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y);
+ AddLine(line, 1, Rect.left, TextsGFX[line].Y, Rect.left, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 2, Rect.right, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+
+ //Description
+ Style := 1;
+ SetFontStyle(Style);
+ SL:=TStringList.Create;
+ try
+ ExtractStrings([' '], [], PChar(msg.Description), SL);
+ if SL.Count>0 then
+ begin
+ NewLine(round(fieldh/4), 3);
+ AddLine(line, 0, Rect.left, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y);
+ AddLine(line, 1, Rect.left, TextsGFX[line].Y, Rect.left, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 2, Rect.right, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+
+ NewLine(fieldh, 2);
+ AddLine(line, 0, Rect.left, TextsGFX[line].Y, Rect.left, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 1, Rect.right, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+
+ NewText(Rect.left + 5, TextsGFX[line].Y + 2);
+ end;
+ tempStr := '';
+ for I := 0 to SL.Count-1 do
+ begin
+ if glTextWidth(PChar(tempStr + SL[I] + ' ')) <= (Rect.right - Rect.left - 10) then
+ begin
+ if I<SL.Count-1 then
+ tempStr := tempStr + SL[I] + ' '
+ else
+ tempStr := tempStr + SL[I];
+ TextsGFX[line].texts[tline].text := tempStr;
+ end else
+ begin
+ TextsGFX[line].texts[tline].text := tempStr;
+ NewLine(fieldh, 2);
+ AddLine(line, 0, Rect.left, TextsGFX[line].Y, Rect.left, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 1, Rect.right, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+
+ NewText(Rect.left + 5, TextsGFX[line].Y + 2);
+
+ if I<SL.Count-1 then
+ tempStr := SL[I] + ' '
+ else
+ tempStr := SL[I];
+ TextsGFX[line].texts[tline].text := tempStr;
+ end;
+ end;
+ Finally
+ SL.Free;
+ if Length(msg.Subs)<1 then
+ begin
+ NewLine(round(fieldh/4), 3);
+ AddLine(line, 0, Rect.left, TextsGFX[line].Y + TextsGFX[line].H , Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 1, Rect.left, TextsGFX[line].Y, Rect.left, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 2, Rect.right, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+ end else
+ begin
+ NewLine(round(fieldh/4), 2);
+ AddLine(line, 0, Rect.left, TextsGFX[line].Y, Rect.left, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 1, Rect.right, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+ end;
+ end;
+
+ //Subs
+ for K := 0 to Length(msg.Subs) - 1 do
+ begin
+ //Sub title
+ Style := 1;
+ SetFontStyle(Style);
+ Size := 7;
+ SetFontSize(Size);
+
+ tempStr := '';
+ NewLine(round(fieldh/2), 2);
+ AddLine(line, 0, Rect.left, TextsGFX[line].Y, Rect.left, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 1, Rect.right, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+
+ NewLine(round(fieldh), 2);
+ AddLine(line, 0, Rect.left, TextsGFX[line].Y, Rect.left, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 1, Rect.right, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+
+ NewText(Rect.left+5, TextsGFX[line].Y + 2);
+ TextsGFX[line].texts[tline].text := msg.Subs[K].title+':';
+
+ //text
+ Style := 1;
+ SetFontStyle(Style);
+ Size := 7;
+ SetFontSize(Size);
+
+
+ for J := 0 to length(msg.Subs[K].text) - 1 do
+ begin
+ NewLine(fieldh, 2);
+ AddLine(line, 0, Rect.left, TextsGFX[line].Y, Rect.left, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 1, Rect.right, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+
+ SL:=TStringList.Create;
+ try
+ ExtractStrings([' '], [], PChar(msg.Subs[K].text[J]), SL);
+
+ NewText(Rect.left + 5, TextsGFX[line].Y + 2);
+ tempStr := '';
+ for I := 0 to SL.Count-1 do
+ begin
+ if glTextWidth(PChar(tempStr + SL[I] + ' ')) <= (Rect.right - Rect.left - 10) then
+ begin
+ if I<SL.Count-1 then
+ tempStr := tempStr + SL[I] + ' '
+ else
+ tempStr := tempStr + SL[I];
+ TextsGFX[line].texts[tline].text := tempStr;
+ end else
+ begin
+ TextsGFX[line].texts[tline].text := tempStr;
+
+ NewLine(fieldh, 2);
+ AddLine(line, 0, Rect.left, TextsGFX[line].Y, Rect.left, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 1, Rect.right, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+
+ NewText(Rect.left + 5, TextsGFX[line].Y + 2);
+
+ if I<SL.Count-1 then
+ tempStr := SL[I] + ' '
+ else
+ tempStr := SL[I];
+ TextsGFX[line].texts[tline].text := tempStr;
+ end;
+ end;
+ Finally
+ SL.Free;
+ end;
+ end;
+
+ if K<Length(msg.Subs) - 1 then
+ begin
+ NewLine(round(fieldh/4), 2);
+ AddLine(line, 0, Rect.left, TextsGFX[line].Y, Rect.left, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 1, Rect.right, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+ end else
+ begin
+ NewLine(round(fieldh/2), 3);
+ AddLine(line, 0, Rect.left, TextsGFX[line].Y + TextsGFX[line].H , Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 1, Rect.left, TextsGFX[line].Y, Rect.left, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 2, Rect.right, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+ end;
+ end;
+
+ //Sections
+ for K := 0 to Length(msg.Sections) - 1 do
+ begin
+ //Section title
+ Style := 1;
+ SetFontStyle(Style);
+ Size := 9;
+ SetFontSize(Size);
+
+ tempStr := '';
+ NewLine(round(fieldh/2), 2);
+ AddLine(line, 0, Rect.left, TextsGFX[line].Y, Rect.left, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 1, Rect.right, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+
+ NewLine(round(fieldh*1.4), 2);
+ AddLine(line, 0, Rect.left, TextsGFX[line].Y, Rect.left, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 1, Rect.right, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+
+ tempStr := msg.Sections[K].name;
+ NewText(Rect.left + round((Rect.right - Rect.left - 10)/2 - glTextWidth((PChar(tempStr)))/2), TextsGFX[line].Y + 2);
+ TextsGFX[line].texts[tline].text := tempStr;
+
+ NewLine(round(fieldh/2), 3);
+ AddLine(line, 0, Rect.left, TextsGFX[line].Y + TextsGFX[line].H , Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 1, Rect.left, TextsGFX[line].Y, Rect.left, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 2, Rect.right, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+
+ Style := 1;
+ SetFontStyle(Style);
+ Size := 7;
+ SetFontSize(Size);
+ //keys
+ for J := 0 to Length(msg.Sections[K].Keys) - 1 do
+ begin
+ NewLine(fieldh, 3);
+ AddLine(line, 0, Rect.left, TextsGFX[line].Y, Rect.left, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 1, KeyEnd, TextsGFX[line].Y, KeyEnd, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 2, Rect.right, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+
+ countline := 1;
+ NewText(Rect.left + 5, TextsGFX[line].Y + 2);
+ tempStr := '';
+ for I := 0 to Length(msg.Sections[K].Keys[J].Key) - 1 do
+ begin
+ if glTextWidth(PChar(tempStr + msg.Sections[K].Keys[J].Key[I] + '+')) <= (KeyEnd - Rect.left - 10) then
+ begin
+ if I<Length(msg.Sections[K].Keys[J].Key)-1 then
+ tempStr := tempStr + msg.Sections[K].Keys[J].Key[I] + '+'
+ else
+ tempStr := tempStr + msg.Sections[K].Keys[J].Key[I];
+ TextsGFX[line].texts[tline].text := tempStr;
+ end else
+ begin
+ TextsGFX[line].texts[tline].text := tempStr;
+ NewLine(fieldh, 3);
+ AddLine(line, 0, Rect.left, TextsGFX[line].Y, Rect.left, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 1, KeyEnd, TextsGFX[line].Y, KeyEnd, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 2, Rect.right, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+
+ NewText(Rect.left + 5, TextsGFX[line].Y + 2);
+
+ if I<Length(msg.Sections[K].Keys[J].Key)-1 then
+ tempStr := msg.Sections[K].Keys[J].Key[I] + '+'
+ else
+ tempStr := msg.Sections[K].Keys[J].Key[I];
+ TextsGFX[line].texts[tline].text := tempStr;
+ inc(countline);
+ end;
+ end;
+
+ //key-description
+ SL:=TStringList.Create;
+ try
+ ExtractStrings([' '], [], PChar(msg.Sections[K].KeyDescription[J]), SL);
+ line := line - countline + 1;
+ tline := Length(TextsGFX[line].texts) -1;
+
+ NewText(KeyEnd + 5, TextsGFX[line].Y + 2);
+ tempStr := '';
+ for I := 0 to SL.Count-1 do
+ begin
+ if glTextWidth(PChar(tempStr + SL[I] + ' ')) <= (Rect.right - KeyEnd - 10) then
+ begin
+ if I<SL.Count-1 then
+ tempStr := tempStr + SL[I] + ' '
+ else
+ tempStr := tempStr + SL[I];
+ TextsGFX[line].texts[tline].text := tempStr;
+ end else
+ begin
+ TextsGFX[line].texts[tline].text := tempStr;
+ if countline<2 then
+ begin
+ NewLine(fieldh, 3);
+ AddLine(line, 0, Rect.left, TextsGFX[line].Y, Rect.left, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 1, KeyEnd, TextsGFX[line].Y, KeyEnd, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 2, Rect.right, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+ end else
+ begin
+ dec(countline);
+ inc(line);
+ tline := Length(TextsGFX[line].texts) -1;
+ end;
+
+ NewText(KeyEnd + 5, TextsGFX[line].Y + 2);
+
+ if I<SL.Count-1 then
+ tempStr := SL[I] + ' '
+ else
+ tempStr := SL[I];
+ TextsGFX[line].texts[tline].text := tempStr;
+ end;
+ end;
+ Finally
+ SL.Free;
+ line := line + countline -1;
+ NewLine(round(fieldh/4), 4);
+ AddLine(line, 0, Rect.left, TextsGFX[line].Y, Rect.left, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 1, KeyEnd, TextsGFX[line].Y, KeyEnd, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 2, Rect.right, TextsGFX[line].Y, Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+ AddLine(line, 3, Rect.left, TextsGFX[line].Y+TextsGFX[line].H, Rect.right, TextsGFX[line].Y + TextsGFX[line].H);
+ end;
+ end;
+ end;
+
+ max_high := (TextsGFX[Length(TextsGFX)-1].Y + TextsGFX[Length(TextsGFX)-1].H);
+
+ if max_high=0 then
+ max_high:=1.0; //TODO error.log!
+ if max_high<=Rect.bottom-Rect.top then
+ begin
+ barH := 1;
+ step := 1;
+ end
+ else
+ begin
+ barH := (Rect.bottom-Rect.top)/max_high;
+ step := barH/(1/barH);
+ end;
+end;
+
+procedure TScreenPopupHelp.DrawTable();
+var
+ I, J:integer;
+ maxh: integer;
+ h, offset: integer;
+begin
+
+ maxh := ScreenH+ScreenH-Rect.Bottom;
+ h := 0;
+
+ offset := round(Help.GetScrollPos()*(max_high-ScreenH+ScreenH-Rect.Bottom));
+
+ I := 0;
+ while (I<Length(TextsGFX)) and (h<maxh) do
+ begin
+ if (TextsGFX[I].Y >= offset-20) then
+ begin
+ for J := 0 to Length(TextsGFX[I].lines) - 1 do
+ DrawLine(I, J, offset);
+ for J := 0 to Length(TextsGFX[I].texts) - 1 do
+ DrawText(I, J, offset);
+
+ h := h + TextsGFX[I].H;
+ end;
+ inc(I);
+ end;
+end;
+
+procedure TScreenPopupHelp.DrawLine(line, index, Y: integer);
+begin
+ //glEnable(GL_BLEND);
+ glColor4f(1, 1, 1, 1);
+ glLineWidth(2);
+ glBegin(GL_LINES);
+ glVertex2f(TextsGFX[line].lines[index].fX, TextsGFX[line].lines[index].fY - Y);
+ glVertex2f(TextsGFX[line].lines[index].tX, TextsGFX[line].lines[index].tY - Y);
+ glEnd;
+ //glDisable(GL_BLEND);
+end;
+
+procedure TScreenPopupHelp.DrawText(line, index, Y: integer);
+var
+ text: PChar;
+
+begin
+ glColor4f(1, 1, 1, 1);
+ SetFontStyle(TextsGFX[line].texts[index].Style);
+ SetFontItalic(TextsGFX[line].texts[index].Italic);
+ SetFontSize(TextsGFX[line].texts[index].Size);
+ SetFontPos (TextsGFX[line].texts[index].X, TextsGFX[line].texts[index].Y - Y);
+ text := Addr(TextsGFX[line].texts[index].text[1]);
+ glPrint(text);
+end;
+
+procedure TScreenPopupHelp.DrawScroll(X, Y, W, H: integer; pos, len: double);
+var
+ fY, tY: double;
+begin
+ //glEnable(GL_BLEND);
+ glColor4f(1, 1, 1, 1);
+
+ glLineWidth(1);
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(X, Y);
+ glVertex2f(X+W, Y);
+ glVertex2f(X+W, Y+H);
+ glVertex2f(X, Y+H);
+ glEnd;
+
+ fY := Y+(H-H*len)*Pos;
+ tY := fY+H*len;
+ if tY+0.001>=Y+H then
+ tY := Y+H;
+
+ glBegin(GL_QUADS);
+ glVertex2f(X, fY);
+ glVertex2f(X+W, fY);
+ glVertex2f(X+W, tY);
+ glVertex2f(X, tY);
+ glEnd;
+ //glDisable(GL_BLEND);
+end;
+
+end.
diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas
new file mode 100644
index 00000000..fca4a84a
--- /dev/null
+++ b/Game/Code/Screens/UScreenScore.pas
@@ -0,0 +1,544 @@
+unit UScreenScore;
+
+interface
+
+uses
+ UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes, ULCD, gl;
+
+type
+ TScreenScore = class(TMenu)
+ const
+ ID='ID_022'; //for help system
+
+ public
+ TextArtist: integer;
+ TextTitle: integer;
+
+ TextArtistTitle: integer;
+
+ StaticMedleyNav: integer;
+ TextMedleyNav: 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;
+ ActualRound: integer;
+ constructor Create; override;
+ function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
+ procedure onShow; override;
+ function Draw: boolean; override;
+ procedure FillPlayer(Item, P: integer);
+ procedure RefreshTexts;
+ procedure StartPreview;
+ end;
+
+implementation
+
+{{$IFDEF TRANSLATE}
+uses UGraphic, UScreenSong, UPartyM2, UMenuStatic, UTime, UMain, UIni, ULanguage, UHelp, ULog;
+{{$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_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE,
+ SDLK_RETURN:
+ begin
+ if (not Fadeout) then
+ begin
+// Music.StopShuffle;
+ if ScreenSong.PartyMedley and (ScreenSong.Mode=smChallenge) then
+ begin
+ ScreenSong.SongIndex := -1;
+ Music.FadeStop(Ini.PreviewFading);
+ FadeTo(@ScreenPartyNewRoundM2);
+ end else if (ScreenSong.Mode <> smMedley) then
+ FadeTo(@ScreenTop)
+ else
+ begin
+ FadeTo(@ScreenSong);
+ end;
+ Fadeout := true;
+ end;
+ end;
+
+ SDLK_SYSREQ:
+ begin
+ Display.PrintScreen;
+ end;
+
+ SDLK_RIGHT:
+ begin
+ if ActualRound<Length(PlaylistMedley.Stats)-1 then
+ begin
+ Music.PlayChange;
+ inc(ActualRound);
+ RefreshTexts;
+ StartPreview;
+ end;
+ end;
+
+ SDLK_LEFT:
+ begin
+ if ActualRound>0 then
+ begin
+ Music.PlayChange;
+ dec(ActualRound);
+ RefreshTexts;
+ StartPreview;
+ end;
+ end;
+ end;
+ end;
+end;
+
+procedure TScreenScore.RefreshTexts;
+begin
+ if (ActualRound < Length(PlaylistMedley.Stats)-1) then
+ begin
+ Text[TextArtist].Text := IntToStr(ActualRound+1) + '/' +
+ IntToStr(Length(PlaylistMedley.Stats)-1) + ': ' +
+ PlaylistMedley.Stats[ActualRound].SongArtist;
+ Text[TextTitle].Text := PlaylistMedley.Stats[ActualRound].SongTitle;
+ Text[TextTitle].Visible := true;
+ Text[TextArtistTitle].Text := IntToStr(ActualRound+1) + '/' +
+ IntToStr(Length(PlaylistMedley.Stats)-1) + ': ' +
+ PlaylistMedley.Stats[ActualRound].SongArtist +
+ ' - ' + PlaylistMedley.Stats[ActualRound].SongTitle;
+ end else
+ begin
+ if (ScreenSong.Mode = smMedley) or ScreenSong.PartyMedley then
+ begin
+ Text[TextArtist].Text := Language.Translate('SING_TOTAL');
+ Text[TextTitle].Visible := false;
+ Text[TextArtistTitle].Text := Language.Translate('SING_TOTAL');
+ end else
+ begin
+ Text[TextArtist].Text := PlaylistMedley.Stats[ActualRound].SongArtist;
+ Text[TextTitle].Text := PlaylistMedley.Stats[ActualRound].SongTitle;
+ Text[TextTitle].Visible := true;
+ Text[TextArtistTitle].Text := PlaylistMedley.Stats[ActualRound].SongArtist + ' - ' +
+ PlaylistMedley.Stats[ActualRound].SongTitle;
+ 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);
+
+ StaticMedleyNav := AddStatic(Theme.Score.StaticMedleyNav);
+ TextMedleyNav := AddText(Theme.Score.TextMedleyNav);
+
+ 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;
+ Skip: integer;
+ V: array[1..6] of boolean; // visibility array
+begin
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenScore)');
+
+ // Singstar
+ Fadeout := false;
+ ActualRound:=0;
+ 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];
+
+ 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 := 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;
+
+ //Replaced this whole thing with one Procedure call
+ FillPlayer(PP, P);
+
+ end; // for
+ end; // if }
+
+ if (ScreenSong.Mode = smMedley) or ScreenSong.PartyMedley then
+ begin
+ Static[StaticMedleyNav].Visible := true;
+ Text[TextMedleyNav].Visible := true;
+ end else
+ begin
+ Static[StaticMedleyNav].Visible := false;
+ Text[TextMedleyNav].Visible := false;
+ end;
+
+ RefreshTexts;
+
+ LCD.HideCursor;
+ LCD.Clear;
+ LCD.WriteText(1, Ini.Name[0]);
+ LCD.WriteText(2, 'Score: ' + Text[TextTotalScore[1]].Text);
+
+ StartPreview;
+end;
+
+function TScreenScore.Draw: boolean;
+var
+{ Min: real;
+ Max: real;
+ Wsp: real;
+ Wsp2: real;
+ Pet: integer;}
+
+ Item: integer;
+ P: integer;
+ C: integer;
+begin
+ if PlayersPlay <= 3 then begin // only for 1 screen mode
+ for P := 0 to PlayersPlay-1 do begin
+ case PlayersPlay of
+ 1: Item := 1;
+ 2: Item := P + 2;
+ 3: Item := P + 4;
+ end;
+
+ //Replaced this whole thing with one Procedure call
+ FillPlayer(Item, P);
+
+ end; // for
+ end; // if
+
+ // 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);
+
+ end;
+ end;
+
+ inherited Draw;
+end;
+
+procedure TScreenScore.FillPlayer(Item, P: integer);
+var
+ S: string;
+ Lev: real;
+ MaxH: real; // maximum height of score bar
+ Wsp: real;
+begin
+ Text[TextName[Item]].Text := Ini.Name[P];
+
+ Text[PlayerTexts[Item, 0]].Text := 'P' + IntToStr(P+1);
+
+ if (ScreenSong.Mode = smMedley) or ScreenSong.PartyMedley then
+ begin
+ Player[P] := PlaylistMedley.Stats[ActualRound].Player[P];
+ end;
+
+ case (Player[P].ScoreTotalI) of
+ 0..2000: Text[TextScore[Item]].Text := Language.Translate('SING_SCORE_TONE_DEAF');
+ 2010..4000: Text[TextScore[Item]].Text := Language.Translate('SING_SCORE_AMATEUR');
+ 4010..6000: Text[TextScore[Item]].Text := Language.Translate('SING_SCORE_RISING_STAR');
+ 6010..8000: Text[TextScore[Item]].Text := Language.Translate('SING_SCORE_LEAD_SINGER');
+ 8010..9000: Text[TextScore[Item]].Text := Language.Translate('SING_SCORE_HIT_ARTIST');
+ 9010..9800: Text[TextScore[Item]].Text := Language.Translate('SING_SCORE_SUPERSTAR');
+ 9810..10000: Text[TextScore[Item]].Text := Language.Translate('SING_SCORE_ULTRASTAR');
+ end;
+
+
+ S := IntToStr(Player[P].ScoreI);
+ while (Length(S)<4) do S := '0' + S;
+ Text[TextNotesScore[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;
+
+ S := IntToStr(Player[P].ScoreTotalI);
+ while (Length(S)<5) do S := '0' + S;
+ Text[TextTotalScore[Item]].Text := S;
+
+ // Level bar length
+
+
+ Lev := Player[P].ScoreTotalI / 10000;
+ MaxH := Static[StaticBackLevel[Item]].Texture.H + Static[StaticBackLevelRound[Item]].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[Item]].Visible := true;
+ Static[StaticLevel[Item]].Texture.H := Lev * MaxH - Static[StaticBackLevelRound[Item]].Texture.H / 2;
+ if Static[StaticLevel[Item]].Texture.H < 0 then Static[StaticLevel[Item]].Visible := false;
+
+ // Y doesn't change and depend on the back texture coordinate
+ Static[StaticLevel[Item]].Texture.Y := Static[StaticBackLevel[Item]].Texture.Y + Static[StaticBackLevel[Item]].Texture.H - Static[StaticLevel[Item]].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[Item]].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[Item]].Texture.Y := Static[StaticBackLevel[Item]].Texture.Y + Static[StaticBackLevel[Item]].Texture.H - Static[StaticBackLevelRound[Item]].Texture.H;
+ // - 0.25 when points = 0
+ // - 0 wnen there are more points
+ // if Lev * MaxH = Static[StaticBackLevelRound[Item]].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[Item]].Texture.H / 2)
+ Wsp := Lev * MaxH / (Static[StaticBackLevelRound[Item]].Texture.H / 2);
+ Static[StaticLevelRound[Item]].Texture.TexY1 := Static[StaticBackLevelRound[Item]].Texture.TexY1 - 0.25 + 0.25 * Wsp;
+ Static[StaticLevelRound[Item]].Texture.TexY2 := Static[StaticBackLevelRound[Item]].Texture.TexY2 - 0.25 + 0.25 * Wsp;
+ end else begin
+ // when it's higher or equal 20 => full texture is being shown
+ Static[StaticLevelRound[Item]].Texture.TexY1 := Static[StaticBackLevelRound[Item]].Texture.TexY1;
+ Static[StaticLevelRound[Item]].Texture.TexY2 := Static[StaticBackLevelRound[Item]].Texture.TexY2;
+ Static[StaticLevelRound[Item]].Texture.Y := Static[StaticLevel[Item]].Texture.Y - Static[StaticBackLevelRound[Item]].Texture.H;
+ end;
+
+ //Load Colors of Player Buttons and Nicks
+ 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');
+
+ {StaticBackLevel[Item]
+ StaticLevelRound[Item]
+ and another static has to be colored here to.
+ S/o please do this ^^}
+end;
+
+//Procedure Change current played Preview
+procedure TScreenSCore.StartPreview;
+var
+ select: integer;
+ changed: boolean;
+begin
+ //When Music Preview is avtivated -> then Change Music
+ if (Ini.PreviewVolume <> 0) then
+ begin
+ changed := false;
+ if (ScreenSong.Mode = smMedley) or ScreenSong.PartyMedley then
+ begin
+ if (ActualRound<Length(PlaylistMedley.Stats)-1) and (ScreenSong.SongIndex <> PlaylistMedley.Song[ActualRound]) then
+ begin
+ select := PlaylistMedley.Song[ActualRound];
+ changed := true;
+ ScreenSong.SongIndex := select;
+ end;
+ end else
+ begin
+ select := ScreenSong.Interaction;
+ ScreenSong.SongIndex := select;
+ changed := true;
+ end;
+
+ if changed then
+ begin
+ Music.Close;
+ if Music.Open(CatSongs.Song[select].Path + CatSongs.Song[select].Mp3) then
+ begin
+ if (CatSongs.Song[select].PreviewStart>0) then
+ Music.MoveTo(CatSongs.Song[select].PreviewStart)
+ else
+ 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
+ begin
+ Music.SetMusicVolume (Ini.PreviewVolume * 10);
+ Music.Play;
+ end else
+ begin
+ Music.Fade(0, Ini.PreviewVolume*10, Ini.PreviewFading);
+ Music.Play;
+ end;
+ end;
+ end;
+ end;
+end;
+
+end.
diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas
new file mode 100644
index 00000000..034eba5f
--- /dev/null
+++ b/Game/Code/Screens/UScreenSing.pas
@@ -0,0 +1,1611 @@
+unit UScreenSing;
+
+interface
+
+uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, ULyrics,
+ TextGL, gl, BASS, UThemes, ULCD, UGraphicClasses, UVideo;
+
+type
+ THandler = record
+ changed: boolean;
+ change_time: real;
+ end;
+
+ TScreenSing = class(TMenu)
+ const
+ ID='ID_023'; //for help system
+
+ 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;
+
+ //VideoAspect
+ VideoAspectText: integer;
+ VideoAspectStatic: integer;
+ AspectHandler: THandler;
+
+ //for Medley
+ SongNameStatic: integer;
+ SongNameText: integer;
+ MedleyHandler: THandler;
+ CountDownText: string;
+
+ MedleyStart, MedleyEnd: real;
+ StartNote, EndNote: TPos;
+
+ 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 LoadNextSong;
+ procedure UpdateMedleyStats(medley_end: boolean);
+ procedure DrawMedleyCountdown();
+ end;
+
+implementation
+uses UGraphic, UDataBase, UDraw, UMain, Classes, URecord, ULanguage, UHelp, math,
+ UPartyM2, UParty;
+
+// 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_K:
+ begin
+ if Music.VocalRemoverActivated() then
+ Music.DisableVocalRemover
+ else
+ Music.EnableVocalRemover;
+ end;
+
+ SDLK_TAB:
+ begin
+ Pause;
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_A:
+ begin
+ ToggleAspectCorrection;
+ AspectHandler.changed := true;
+ AspectHandler.change_time := Czas.Teraz;
+ Static[VideoAspectStatic].Visible := true;
+ case UVideo.fAspectCorrection of
+ acoStretch: Text[VideoAspectText].Text := Language.Translate('VIDEO_ASPECT_STRETCH');
+ acoCrop: Text[VideoAspectText].Text := Language.Translate('VIDEO_ASPECT_CROP');
+ acoLetterBox: Text[VideoAspectText].Text := Language.Translate('VIDEO_ASPECT_LETTER_BOX');
+ end;
+ DataBase.SetAspect(AktSong.Artist, AktSong.Title, integer(UVideo.fAspectCorrection));
+ Text[VideoAspectText].Visible := true;
+ end;
+ 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
+ if (ScreenSong.Mode=smMedley) or ScreenSong.PartyMedley then
+ PlaylistMedley.CurrentMedleySong:=PlaylistMedley.NumMedleySongs+1;
+
+ Finish;
+ Music.PlayBack;
+
+ if ScreenSong.Mode<>smParty then
+ 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
+ PauseTime := Czas.Teraz;
+ Paused := true;
+ //stop Music
+ Music.Pause;
+ if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then //Video
+ acTogglePause; //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
+ acTogglePause;
+ Paused := false;
+ end;
+end;
+//Pause Mod End
+
+constructor TScreenSing.Create;
+var
+ I: integer;
+ P: integer;
+begin
+ inherited Create;
+
+ 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);
+ 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);
+
+ SongNameStatic := AddStatic(Theme.Sing.StaticSongName);
+ SongNameText := AddText(Theme.Sing.TextSongName);
+
+ VideoAspectStatic:= AddStatic(Theme.Sing.VideoAspectStatic);
+ VideoAspectText:= AddText(Theme.Sing.VideoAspectText);
+
+ 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');
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenSing)');
+
+ FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented
+
+ AspectHandler.changed := false;
+ Text[VideoAspectText].Visible := false;
+ Static[VideoAspectStatic].Visible := false;
+
+ //Reset Player Medley stats
+ if (ScreenSong.Mode = smMedley) or ScreenSong.PartyMedley then
+ begin
+ PlaylistMedley.CurrentMedleySong:=1;
+
+ //max_song_score_medley := round(MAX_SONG_SCORE / NumMedleySongs);
+ //max_song_line_bonus_medley := round(MAX_SONG_LINE_BONUS / NumMedleySongs);
+ PlaylistMedley.NumPlayer := PlayersPlay;
+ SetLength(PlaylistMedley.Stats, 0);
+ //max_song_score_medley := round(MAX_SONG_SCORE / PlaylistMedley.NumMedleySongs);
+ //max_song_line_bonus_medley := round(MAX_SONG_LINE_BONUS / PlaylistMedley.NumMedleySongs);
+ end;
+
+ // prepare players
+ 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
+ V2R := false;
+ V2M := false;
+ V3R := false;
+ end;
+ 2: begin
+ V1 := false;
+ V1TwoP := true; //added for ps3 skin
+ V1ThreeP := false; //added for ps3 skin
+ V2R := true;
+ V2M := false;
+ V3R := false;
+ end;
+ 3: begin
+ 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 := 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 := 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;
+ 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.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
+ //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 - 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
+
+ // 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
+
+ LoadNextSong;
+
+ Log.LogStatus('End', 'onShow');
+end;
+
+procedure TScreenSing.LoadNextSong;
+var
+ P: integer;
+ numNotes: integer;
+begin
+ // load notes
+ ResetSingTemp;
+ PlaylistMedley.ApplausePlayed := false;
+ if (ScreenSong.Mode = smMedley) or ScreenSong.PartyMedley then
+ begin
+ CatSongs.Selected := PlaylistMedley.Song[PlaylistMedley.CurrentMedleySong-1];
+ Music.Open(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].Mp3);
+ end;
+
+ AktSong := CatSongs.Song[CatSongs.Selected];
+ try
+ if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, SONG_LOAD_COMPLETE) 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 = smParty 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 = smParty 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
+
+ if (ScreenSong.Mode = smMedley) or ScreenSong.PartyMedley then
+ begin
+ SetMedleyMode;
+ Text[SongNameText].Text := IntToStr(PlaylistMedley.CurrentMedleySong) +
+ '/' + IntToStr(PlaylistMedley.NumMedleySongs) + ': ' +
+ AktSong.Artist + ' - ' + AktSong.Title;
+
+ //medley start and end timestamps
+ StartNote := FindNote(AktSong.Medley.StartBeat - round(AktSong.BPM[0].BPM*AktSong.Medley.FadeIn_time/60));
+ MedleyStart := GetTimeFromBeat(Czesci[0].Czesc[StartNote.line].Nuta[0].Start);
+
+ //check Medley-Start
+ if (MedleyStart+AktSong.Medley.FadeIn_time*0.5>GetTimeFromBeat(AktSong.Medley.StartBeat)) then
+ MedleyStart := GetTimeFromBeat(AktSong.Medley.StartBeat) - AktSong.Medley.FadeIn_time;
+ if MedleyStart<0 then
+ MedleyStart := 0;
+
+ //that one is better:
+ MedleyEnd := GetTimeFromBeat(AktSong.Medley.EndBeat) + AktSong.Medley.FadeOut_time;
+ end;
+
+ // set movie
+ 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
+ acSkip(AktSong.VideoGAP, MedleyStart)
+ else
+ acSkip(AktSong.VideoGAP, AktSong.Start);
+
+ if (UVideo.VideoOpened) then
+ AktSong.VideoLoaded := true;
+
+ UVideo.SetAspectCorrection(TAspectCorrection(
+ DataBase.GetAspect(AktSong.Artist, AktSong.Title, Ini.AspectCorrect)));
+ 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+timer (I)
+ Music.CaptureStart;
+
+ if (ScreenSong.Mode = smMedley) or ScreenSong.PartyMedley then
+ begin
+ Music.MoveTo(MedleyStart);
+ Czas.Teraz := MedleyStart;
+ Czas.Razem := MedleyEnd;
+ end else
+ begin
+ Music.MoveTo(AktSong.Start);
+
+ Czas.Teraz := AktSong.Start;
+ Czas.Razem := Music.Length;
+ if (AktSong.Finish > 0) then
+ Czas.Razem := AktSong.Finish / 1000;
+ end;
+
+ Czas.OldBeat := -1;
+
+
+ for P := 0 to High(Player) do
+ ClearScores(P);
+
+ // 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 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);
+
+ if (ScreenSong.Mode = smMedley) or ScreenSong.PartyMedley then
+ begin
+ MedleyHandler.changed := true;
+ MedleyHandler.change_time := Czas.Teraz;
+
+ Static[SongNameStatic].Visible := true;
+ Text[SongNameText].Visible := true;
+ end else
+ begin
+ Static[SongNameStatic].Visible := false;
+ Text[SongNameText].Visible := false;
+ end;
+
+ if ((ScreenSong.Mode = smMedley) or ScreenSong.PartyMedley)
+ and (PlaylistMedley.CurrentMedleySong>1) then
+ onShowFinish;
+end;
+
+procedure TScreenSing.onShowFinish;
+begin
+ // play movie (II)
+
+ if AktSong.VideoLoaded then
+ begin
+ try
+ acGetFrame(Czas.Teraz);
+ 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
+ acClose;
+ except
+
+ end;
+ end;
+ end;
+
+ // play music (II)
+ if (ScreenSong.Mode = smMedley) or ScreenSong.PartyMedley then
+ Music.Fade(10, 100, AktSong.Medley.FadeIn_time)
+ else
+ Music.SetVolume(100);
+
+ Music.Play;
+
+ // prepare timer (II)
+ CountSkipTimeSet;
+end;
+
+function TScreenSing.Draw: boolean;
+var
+ Min: integer;
+ Sec: integer;
+ Tekst: string;
+ Flash: real;
+ S: integer;
+ T: integer;
+ lastLine, LastWord: integer;
+ medley_end: boolean;
+ medley_start_applause: boolean;
+ CurTime: real;
+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;
+
+ // 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
+{ 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?
+ 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
+ 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 ...
+ if ScreenSong.Mode <> smMedley then
+ CurTime := Czas.Razem - Czas.Teraz
+ else
+ CurTime := MedleyEnd - Czas.Teraz;
+
+ Min := Round(CurTime) div 60;
+ Sec := Round(CurTime) 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);
+
+ lastLine := Length(Czesci[0].Czesc)-1;
+ lastWord := Length(Czesci[0].Czesc[lastLine].Nuta)-1;
+ if (Czas.AktBeat>(Czesci[0].Czesc[lastLine].Nuta[lastWord].Start+
+ Czesci[0].Czesc[lastLine].Nuta[lastWord].Dlugosc)) then
+ ScreenSong.SungToEnd := true;
+
+ // for medley-mode:
+ CurTime := Czas.Teraz;
+ if (ScreenSong.Mode = smMedley) and (CurTime > MedleyEnd) then
+ medley_end := true
+ else
+ medley_end := false;
+
+ if (ScreenSong.Mode = smMedley) and (CurTime >
+ GetTimeFromBeat(AktSong.Medley.EndBeat)) then
+ medley_start_applause := true
+ else
+ medley_start_applause := false;
+
+ // .. 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;
+
+
+ // 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
+ try
+ acGetFrame(Czas.Teraz);
+ acDrawGL(ScreenAct); // 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
+ acClose;
+ except
+
+ end;
+ end;
+ end;
+
+ // draw static menu (FG)
+ DrawFG;
+
+ //Medley Countdown
+ if ScreenSong.Mode = smMedley then
+ DrawMedleyCountdown;
+
+ // 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 (not medley_end or (ScreenSong.Mode <> smMedley))
+ and ((AktSong.Finish = 0) or (CurTime*1000 <= AktSong.Finish)) then
+ begin
+ //Pause Mod:
+ if not Paused then
+ begin
+ Sing(Self); // analyze song
+ //Update Medley Stats
+ if (ScreenSong.Mode = smMedley) and not FadeOut then
+ UpdateMedleyStats(medley_start_applause);
+ end;
+ end else
+ begin
+ if not FadeOut then
+ begin
+ Finish;
+ if ScreenSong.Mode = smNormal then
+ begin
+ FadeOut := true;
+ FadeTo(@ScreenScore);
+ end;
+ 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?
+ 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
+ Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX;
+
+ for T := 0 to 1 do
+ Text[T].X := Text[T].X - 10*ScreenX;
+
+ //Aspect
+ if AspectHandler.changed and (Czas.Teraz>AspectHandler.change_time + 3) then
+ begin
+ AspectHandler.changed:=false;
+ Text[VideoAspectText].Visible := false;
+ Static[VideoAspectStatic].Visible := false;
+ end;
+
+ //Medley
+ if MedleyHandler.changed and (Czas.Teraz>MedleyHandler.change_time + AktSong.Medley.FadeIn_time) then
+ begin
+ MedleyHandler.changed:=false;
+ Static[SongNameStatic].Visible := false;
+ Text[SongNameText].Visible := false;
+ end;
+end;
+
+procedure TScreenSing.UpdateMedleyStats(medley_end: boolean);
+var
+ len, num, I : integer;
+ lastline: boolean;
+ vol: real;
+begin
+ len := Length(PlaylistMedley.Stats);
+ num := PlaylistMedley.NumPlayer;
+
+ if (PlaylistMedley.CurrentMedleySong>len) and
+ (PlaylistMedley.CurrentMedleySong<=PlaylistMedley.NumMedleySongs) then
+ begin
+ inc(len);
+ SetLength(PlaylistMedley.Stats, len);
+ SetLength(PlaylistMedley.Stats[len-1].Player, num);
+ PlaylistMedley.Stats[len-1].SongArtist := AktSong.Artist;
+ PlaylistMedley.Stats[len-1].SongTitle := AktSong.Title;
+ end;
+
+ if (PlaylistMedley.CurrentMedleySong<=PlaylistMedley.NumMedleySongs) then
+ for I := 0 to num - 1 do
+ PlaylistMedley.Stats[len-1].Player[I] := Player[I];
+
+ if medley_end and not PlaylistMedley.ApplausePlayed and
+ (PlaylistMedley.CurrentMedleySong<=PlaylistMedley.NumMedleySongs) then
+ begin
+ PlaylistMedley.ApplausePlayed:=true;
+ Music.PlayApplause;
+ Music.Fade(100, 10, AktSong.Medley.FadeOut_time);
+ end;
+end;
+
+procedure TScreenSing.Finish;
+var
+ I, J: integer;
+ len, num: integer;
+
+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
+ acClose;
+ AktSong.VideoLoaded := false; // to prevent drawing closed video
+ end;
+
+ SetFontItalic (False);
+
+ if (ScreenSong.Mode = smMedley) or ScreenSong.PartyMedley then
+ begin
+ if not FadeOut then
+ begin
+ inc(PlaylistMedley.CurrentMedleySong);
+ if PlaylistMedley.CurrentMedleySong<=PlaylistMedley.NumMedleySongs then
+ begin
+ //AudioPlayback.PlaySound(SoundLib.Applause);
+ LoadNextSong;
+ end else
+ begin
+ //build sums
+ len := Length(PlaylistMedley.Stats);
+ num := PlaylistMedley.NumPlayer;
+
+ SetLength(PlaylistMedley.Stats, len+1);
+ SetLength(PlaylistMedley.Stats[len].Player, num);
+
+ for J := 0 to len - 1 do
+ begin
+ for I := 0 to num - 1 do
+ begin
+ PlaylistMedley.Stats[len].Player[I].Score :=
+ PlaylistMedley.Stats[len].Player[I].Score +
+ PlaylistMedley.Stats[J].Player[I].Score;
+
+ PlaylistMedley.Stats[len].Player[I].ScoreLine :=
+ PlaylistMedley.Stats[len].Player[I].ScoreLine +
+ PlaylistMedley.Stats[J].Player[I].ScoreLine;
+
+ PlaylistMedley.Stats[len].Player[I].ScoreGolden :=
+ PlaylistMedley.Stats[len].Player[I].ScoreGolden +
+ PlaylistMedley.Stats[J].Player[I].ScoreGolden;
+
+ PlaylistMedley.Stats[len].Player[I].ScoreI :=
+ PlaylistMedley.Stats[len].Player[I].ScoreI +
+ PlaylistMedley.Stats[J].Player[I].ScoreI;
+
+ PlaylistMedley.Stats[len].Player[I].ScoreLineI :=
+ PlaylistMedley.Stats[len].Player[I].ScoreLineI +
+ PlaylistMedley.Stats[J].Player[I].ScoreLineI;
+
+ PlaylistMedley.Stats[len].Player[I].ScoreGoldenI :=
+ PlaylistMedley.Stats[len].Player[I].ScoreGoldenI +
+ PlaylistMedley.Stats[J].Player[I].ScoreGoldenI;
+
+ PlaylistMedley.Stats[len].Player[I].ScoreTotalI :=
+ PlaylistMedley.Stats[len].Player[I].ScoreTotalI +
+ PlaylistMedley.Stats[J].Player[I].ScoreTotalI;
+ end; //of for I
+ end; //of for J
+
+ //build mean on sum
+ for I := 0 to num - 1 do
+ begin
+ PlaylistMedley.Stats[len].Player[I].Score := round(
+ PlaylistMedley.Stats[len].Player[I].Score / len);
+
+ PlaylistMedley.Stats[len].Player[I].ScoreLine := round(
+ PlaylistMedley.Stats[len].Player[I].ScoreLine / len);
+
+ PlaylistMedley.Stats[len].Player[I].ScoreGolden := round(
+ PlaylistMedley.Stats[J].Player[I].ScoreGolden / len);
+
+ PlaylistMedley.Stats[len].Player[I].ScoreI := round(
+ PlaylistMedley.Stats[len].Player[I].ScoreI / len);
+
+ PlaylistMedley.Stats[len].Player[I].ScoreLineI := round(
+ PlaylistMedley.Stats[len].Player[I].ScoreLineI / len);
+
+ PlaylistMedley.Stats[len].Player[I].ScoreGoldenI := round(
+ PlaylistMedley.Stats[len].Player[I].ScoreGoldenI / len);
+
+ PlaylistMedley.Stats[len].Player[I].ScoreTotalI := round(
+ PlaylistMedley.Stats[len].Player[I].ScoreTotalI / len);
+ end;
+
+ FadeOut:=true;
+ if ScreenSong.PartyMedley then
+ begin
+ for I := 0 to PlayersPlay-1 do
+ begin
+ Player[I].ScoreTotalI := PlaylistMedley.Stats[Length(PlaylistMedley.Stats)-1].Player[I].ScoreTotalI;
+ if(ScreenSong.Mode=smChallenge) then
+ ScreenSingModi.TeamInfo.TeamInfo[I].Score:=Player[I].ScoreTotalI;
+ end;
+
+ if ScreenSong.Mode=smChallenge then
+ begin
+ PartySessionM2.Teams:=ScreenSingModi.TeamInfo;
+ PartySessionM2.EndRound;
+ end;{ else if ScreenSong.Mode = smParty then
+ begin
+ PartySession.Teams := ScreenSingModi.TeamInfo;
+ PartySession.EndRound;
+ end; }
+ end;
+
+ if (ScreenSong.Mode=smMedley) or (ScreenSong.Mode=smChallenge) then
+ FadeTo(@ScreenScore)
+ else
+ FadeTo(@ScreenPartyScore);
+ end;
+ end;
+ end else
+ begin
+ SetLength(PlaylistMedley.Stats, 1);
+ SetLength(PlaylistMedley.Stats[0].Player, PlayersPlay);
+ for I := 0 to PlayersPlay - 1 do
+ PlaylistMedley.Stats[0].Player[I] := Player[I];
+ PlaylistMedley.Stats[0].SongArtist := AktSong.Artist;
+ PlaylistMedley.Stats[0].SongTitle := AktSong.Title;
+ 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
+
+ //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;
+
+procedure TScreenSing.DrawMedleyCountdown();
+var
+ txt: PChar;
+ w, h: real;
+ timeDiff: real;
+ t: real;
+begin
+ if (Czas.Teraz < GetTimeFromBeat(AktSong.Medley.StartBeat)) then
+ begin
+ timeDiff := GetTimeFromBeat(AktSong.Medley.StartBeat)-Czas.Teraz+1;
+ t := frac(timeDiff);
+ CountDownText := IntToStr(round(timeDiff-t));
+ glColor4f(0.15, 0.30, 0.6, t);
+
+ h := 130*t*ScreenH/RenderH;
+ SetFontStyle(1);
+ SetFontItalic(false);
+ SetFontSize(h);
+ w := glTextWidth(PChar(CountDownText));
+
+ SetFontPos (RenderW/2-w/2, RenderH/2-h/2*3);
+ txt := Addr(CountDownText[1]);
+ glPrint(txt);
+ end;
+end;
+
+end.
diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas
new file mode 100644
index 00000000..1f766ebe
--- /dev/null
+++ b/Game/Code/Screens/UScreenSingModi.pas
@@ -0,0 +1,772 @@
+unit UScreenSingModi;
+
+interface
+
+uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, ULyrics,
+ TextGL, gl, BASS, UThemes, ULCD, UScreenSing, ModiSDK, UVideo;
+
+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, UPartyM2, UParty, 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;
+var
+ I: integer;
+
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ if ScreenSong.PartyMedley then
+ begin
+ PlaylistMedley.CurrentMedleySong:=PlaylistMedley.NumMedleySongs+1;
+ Finish;
+ Music.PlayBack;
+
+ for I := 0 to PlayersPlay-1 do //TODO: leave all this?
+ begin
+ Player[I].ScoreTotalI := PlaylistMedley.Stats[Length(PlaylistMedley.Stats)-1].Player[I].ScoreTotalI;
+ if(ScreenSong.Mode=smChallenge) then
+ TeamInfo.TeamInfo[I].Score:=Player[I].ScoreTotalI;
+ end;
+
+ {if ScreenSong.Mode=smChallenge then
+ begin
+ PartySessionM2.Teams:=TeamInfo;
+ PartySessionM2.EndRound;
+ end;}
+
+ if ScreenSong.Mode = smChallenge then
+ FadeTo(@ScreenScore)
+ else
+ FadeTo(@ScreenPartyScore);
+
+ end else
+ begin
+ Finish;
+ Music.PlayBack;
+
+ if (ScreenSong.Mode=smParty) then
+ FadeTo(@ScreenPartyScore)
+ else
+ FadeTo(@ScreenScore);
+ end;
+ 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
+ if (ScreenSong.Mode=smChallenge) then
+ 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;
+ 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;
+ lastLine, LastWord: integer;
+ medley_end: boolean;
+ medley_start_applause: boolean;
+ CurTime: real;
+begin
+ //Aspect
+ if AspectHandler.changed and (Czas.Teraz>AspectHandler.change_time + 3) then
+ begin
+ AspectHandler.changed:=false;
+ Text[VideoAspectText].Visible := false;
+ Static[VideoAspectStatic].Visible := false;
+ end;
+
+ // Set Background (Little Workaround, maybe change sometime)
+ if (DLLMan.Selected.LoadBack) AND (DLLMan.Selected.LoadSong) then
+ ScreenSing.Tex_Background := Tex_Background;
+
+//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 ...
+ CurTime := Czas.Razem - Czas.Teraz;
+
+ // update static menu with time ...
+ if ScreenSong.PartyMedley then
+ CurTime := MedleyEnd - Czas.Teraz
+ else
+ CurTime := Czas.Razem - Czas.Teraz ;
+
+ Min := Round(CurTime) div 60;
+ Sec := Round(CurTime) 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;
+
+ lastLine := Length(Czesci[0].Czesc)-1;
+ lastWord := Length(Czesci[0].Czesc[lastLine].Nuta)-1;
+ if (Czas.AktBeat>(Czesci[0].Czesc[lastLine].Nuta[lastWord].Start+
+ Czesci[0].Czesc[lastLine].Nuta[lastWord].Dlugosc)) then
+ ScreenSong.SungToEnd := true
+ else
+ ScreenSong.SungToEnd := false;
+
+ // for medley-mode:
+ CurTime := Czas.Teraz;
+ if ScreenSong.PartyMedley and (CurTime > MedleyEnd) then
+ medley_end := true
+ else
+ medley_end := false;
+
+ if ScreenSong.PartyMedley and (CurTime >
+ GetTimeFromBeat(AktSong.Medley.EndBeat)) then
+ medley_start_applause := true
+ else
+ medley_start_applause := false;
+
+ // 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
+ acGetFrame(Czas.Teraz);
+ acDrawGL(ScreenAct); // this only draws
+ end;
+
+ // draw static menu (FG)
+ DrawFG;
+
+ //Medley Countdown
+ if ScreenSong.PartyMedley then
+ DrawMedleyCountdown;
+
+ if ShowFinish and DllMan.Selected.LoadSong then
+ begin
+ if (not Music.Finished) and (not medley_end or not ScreenSong.PartyMedley)
+ and ((AktSong.Finish = 0) or (CurTime*1000 <= AktSong.Finish)) then
+ begin
+ //Pause Mod:
+ if not Paused then
+ begin
+ Sing(Self); // analyze song
+ //Update Medley Stats
+ if ScreenSong.PartyMedley and not FadeOut then
+ UpdateMedleyStats(medley_start_applause);
+ end;
+ end else
+ begin
+ if not FadeOut then
+ begin
+ Finish;
+ if not ScreenSong.PartyMedley then
+ begin
+ FadeOut := true;
+ if (ScreenSong.Mode=smParty) then
+ FadeTo(@ScreenPartyScore)
+ else
+ FadeTo(@ScreenScore);
+ 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;
+ if not ScreenSong.PartyMedley then
+ begin
+ FadeOut := true;
+ if (ScreenSong.Mode=smParty) then
+ FadeTo(@ScreenPartyScore)
+ else
+ FadeTo(@ScreenScore);
+ end;
+ 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;
+
+ //Aspect
+ if AspectHandler.changed and (Czas.Teraz>AspectHandler.change_time + 3) then
+ begin
+ AspectHandler.changed:=false;
+ Text[VideoAspectText].Visible := false;
+ Static[VideoAspectStatic].Visible := false;
+ end;
+
+ //Medley
+ if MedleyHandler.changed and (Czas.Teraz>MedleyHandler.change_time + AktSong.Medley.FadeIn_time) then
+ begin
+ MedleyHandler.changed:=false;
+ Static[SongNameStatic].Visible := false;
+ Text[SongNameText].Visible := false;
+ end;
+
+ if ((ScreenSong.Mode=smParty) and
+ (DLLMan.Plugins[PartySession.Rounds[PartySession.CurRound].Plugin].Name='PLUGIN_HAUDENLUKAS_NAME')) or
+ ((ScreenSong.Mode=smChallenge) and
+ (DLLMan.Plugins[PartySessionM2.Rounds[PartySessionM2.CurRound].Plugin].Name='PLUGIN_HAUDENLUKAS_NAME')) then
+ begin
+
+ end;
+
+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
new file mode 100644
index 00000000..a6908278
--- /dev/null
+++ b/Game/Code/Screens/UScreenSong.pas
@@ -0,0 +1,3133 @@
+unit UScreenSong;
+
+interface
+
+uses
+ UMenu, TextGL, SDL, UMusic, UFiles, UTime, UDisplay, USongs, SysUtils, ULog, UThemes, UTexture, ULanguage,
+ ULCD, ULight, UIni, UVideo;
+
+type
+ TVisArr = array of integer;
+
+ TVidVis = (none, windowed, full);
+
+ THandler = record
+ changed: boolean;
+ change_time: real;
+ end;
+
+ TScreenSong = class(TMenu)
+ private
+ SkippedSongs: array of integer; //for M2-MOD
+ ChooseableSongs: integer; //for M2-MOD
+
+ public
+ TextArtist: integer;
+ TextTitle: integer;
+ TextNumber: integer;
+
+ TextPlugin: integer;
+ TextP1: integer; //for M2-MOD: show actual player-name p1
+ TextP2: integer; //for M2-MOD: show actual player-name p2
+
+ TextMedley: array[1..4] of integer;
+
+ FoundCAT: boolean; //for M2-MOD: a cat is chosen, see whats next...
+
+ SongIndex: integer; //Index of Song that is playing since UScreenScore...
+
+ //Video Icon Mod
+ VideoIcon: Cardinal;
+
+ VidVis: TVidVis; //video visiability
+ StartTry: boolean;
+
+ MinSource: TMedleySource;
+
+ MakeMedley: boolean;
+
+ //VideoAspect
+ AspectHandler: THandler;
+
+ //Medley Icons
+ MedleyIcon: cardinal;
+ CalcMedleyIcon: 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;
+
+ ID: string; //for help-system
+
+ //Party Mod
+ Mode: TSongMode; //0 = Standard, 1= Go to PartyMode after Selection + Change to Random Song at Show
+ //2 = M2-Mode, 3=Medley-Mode
+ PartyMedley: boolean;
+
+ SungToEnd: boolean; //Song was sung to the end?
+
+ //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;
+
+ TextNumJokerTeam1: Cardinal;
+ TextNumJokerTeam2: Cardinal;
+ TextNumJokerTeam3: Cardinal;
+
+ StaticParty: Array of Cardinal;
+ TextParty: Array of Cardinal;
+ StaticNonParty: Array of Cardinal;
+ TextNonParty: Array of Cardinal;
+ StaticM2Party: Array of Cardinal;
+ TextM2Party: Array of 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 onHide; override;
+ procedure SelectNext;
+ procedure SelectPrev;
+ procedure UpdateLCD;
+ procedure SkipTo(Target: Cardinal);
+ procedure RandomSongChallenge();
+ procedure SkipTo2(Target: Cardinal); //skipt exactly to the target song nr.
+ 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;
+ procedure StartVideoPreview;
+ //Party Mode
+ procedure SelectRandomSong;
+ procedure SetJoker;
+ procedure SetStatics;
+ //procedures for Menu
+ procedure StartSong;
+ procedure OpenEditor;
+ procedure DoJoker(Team: Byte; SDL_ModState: Word);
+ procedure SelectPlayers;
+
+ procedure UnLoadDetailedCover;
+
+ //Extensions
+ procedure DrawExtensions;
+
+ //for M2-MOD:
+ function SongSkipped(SongNr: integer): boolean;
+ function GetSongsSkipped(): Integer;
+ procedure DoJokerM2;
+ function getVisibleMedleyArr(MinS: TMedleySource): TVisArr;
+ procedure StartMedley(num: integer; MinS: TMedleySource);
+ procedure DrawAspect;
+ end;
+
+implementation
+uses UGraphic, UMain,
+ UCovers,
+ math,
+ gl,
+ Windows,
+ USkins,
+ UHelp,
+ UDLLManager, UDataBase, UParty, UPartyM2, UPlaylist, UScreenSongMenu;
+
+// ***** Public methods ****** //
+function TScreenSong.SongSkipped(SongNr: integer): boolean;
+var
+ i: integer;
+ skipped :boolean;
+begin
+ skipped := false;
+ for i := 0 to Length(SkippedSongs) - 1 do
+ begin
+ if (SongNr=SkippedSongs[i]) then
+ begin
+ skipped:=true;
+ break;
+ end;
+ end;
+ Result:=skipped;
+end;
+
+function TScreenSong.GetSongsSkipped(): Integer;
+begin
+ Result := Length(SkippedSongs);
+end;
+
+//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;
+ VisArr: array of integer;
+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 (not in party-mode)
+ 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
+ (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_K:
+ begin
+ if Music.VocalRemoverActivated() then
+ Music.DisableVocalRemover
+ else
+ Music.EnableVocalRemover;
+ end;
+
+ SDLK_A:
+ begin
+ if VidVis = full then
+
+ ToggleAspectCorrection;
+
+ DataBase.SetAspect(CatSongs.Song[Interaction].Artist,
+ CatSongs.Song[Interaction].Title, integer(UVideo.fAspectCorrection));
+
+ AspectHandler.changed := true;
+ AspectHandler.change_time := Czas.Teraz;
+ end;
+ SDLK_V:
+ begin
+ if UVideo.VideoOpened then
+ begin
+ if VidVis=full then
+ VidVis:=windowed
+ else begin
+ VidVis:=full;
+ UVideo.SetAspectCorrection(TAspectCorrection(
+ DataBase.GetAspect(CatSongs.Song[Interaction].Artist,
+ CatSongs.Song[Interaction].Title, Ini.AspectCorrect)));
+ AspectHandler.changed := true;
+ AspectHandler.change_time := Czas.Teraz;
+ end;
+
+ end;
+ end;
+
+ SDLK_TAB:
+ begin
+ Help.SetHelpID(ID);
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+
+ SDLK_S:
+ begin
+ if (SDL_ModState = KMOD_LSHIFT) and not MakeMedley and
+ (CatSongs.Song[Interaction].Medley.Source>=msCalculated) and
+ (Mode = smNormal)then
+ StartMedley(0, msCalculated)
+ else if (CatSongs.Song[Interaction].Medley.Source>=msTag) and not MakeMedley and
+ (Mode = smNormal) then
+ StartMedley(0, msTag);
+ end;
+
+ SDLK_D:
+ begin
+ if (Mode = smNormal) and (SDL_ModState = KMOD_LSHIFT) and not MakeMedley and
+ (length(getVisibleMedleyArr(msCalculated))>0) then
+ StartMedley(5, msCalculated)
+ else if (Mode = smNormal) and (Length(getVisibleMedleyArr(msTag)) > 0)
+ and MakeMedley then
+ StartMedley(5, msTag);
+ end;
+
+ SDLK_F:
+ begin
+ if (Mode = smNormal) and (SDL_ModState = KMOD_LSHIFT) and MakeMedley then
+ begin
+ if Length(PlaylistMedley.Song)>0 then
+ begin
+ SetLength(PlaylistMedley.Song, Length(PlaylistMedley.Song)-1);
+ PlaylistMedley.NumMedleySongs := Length(PlaylistMedley.Song);
+ end;
+
+ if Length(PlaylistMedley.Song)=0 then
+ MakeMedley := false;
+ end else if (Mode = smNormal) and (Length(getVisibleMedleyArr(msCalculated)) > 0) then
+ begin
+ MakeMedley := true;
+ StartMedley(99, msCalculated);
+ end;
+ end;
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ if (Mode = smNormal) or ((Mode = smChallenge) and not PartyMedley and not FoundCAT) 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;
+
+ //Stop Video
+ acClose;
+ VidVis := none;
+ 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 if (Mode = smNormal) then
+ begin
+ Music.Stop;
+ Music.PlayBack;
+ acClose;
+ VidVis := none;
+ FadeTo(@ScreenMain);
+ end;
+
+ end;
+ end
+ //When in party Mode then Ask before Close
+ else if (Mode = smParty) then
+ begin
+ Music.PlayBack;
+ CheckFadeTo(@ScreenMain,'MSG_END_PARTY');
+ 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:
+ ChangeMusic;
+
+ end else
+ begin // clicked on song
+ if (Mode = smNormal) then //Normal Mode -> Start Song
+ begin
+ if MakeMedley then
+ begin
+ Mode := smMedley;
+ Music.Stop;
+ //Do the Action that is specified in Ini
+ case Ini.OnSongClick of
+ 0: FadeTo(@ScreenSing);
+ 1: SelectPlayers;
+ 2: FadeTo(@ScreenSing);
+ end;
+ end else
+ begin
+ //Do the Action that is specified in Ini
+ case Ini.OnSongClick of
+ 0: StartSong;
+ 1: SelectPlayers;
+ 2:begin
+ VidVis := windowed;
+ If (CatSongs.CatNumShow = -3) then
+ ScreenSongMenu.MenuShow(SM_Playlist)
+ else
+ ScreenSongMenu.MenuShow(SM_Main);
+ end;
+ end;
+ end;
+ end
+ else if (Mode = smParty) and not PartyMedley then //PartyMode classic -> Show Menu
+ begin
+ VidVis := windowed;
+ if (Ini.PartyPopup = 1) then
+ ScreenSongMenu.MenuShow(SM_Party_Main)
+ else
+ ScreenSong.StartSong;
+ end else if (Mode = smChallenge) and (ChooseableSongs>0) and
+ not PartyMedley then //PartyMode M2
+ begin
+ PartySessionM2.AddSongPlayed(CatSongs.CatNumShow, Interaction);
+ ScreenSong.StartSong;
+ end else if PartyMedley then
+ begin
+ StartMedley(5, MinSource);
+ end;
+ end;
+ end;
+ end;
+
+ SDLK_M: //Show SongMenu
+ begin
+ if (Length(Songs.Song) > 0) and (Mode <> smChallenge) then begin //not in M2-Mode
+ 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 (Length(Songs.Song) > 0) AND (Mode = smNormal) then begin //not in party-modes
+ ScreenSongMenu.MenuShow(SM_Playlist_Load);
+ end;
+ end;
+
+ SDLK_J: //Show Jumpto Menu / Joker
+ begin
+ if (Length(Songs.Song) > 0) AND (Mode = smNormal) then //not in party-modes
+ begin
+ VidVis := windowed;
+ ScreenSongJumpto.Visible := True;
+ end else if (Mode=smChallenge) and not PartyMedley then //M2-MOD-mode
+ DoJokerM2
+ else if PartyMedley and (Mode=smChallenge) then
+ begin
+ DoJoker(0, SDL_ModState)
+ end;
+ end;
+
+ SDLK_DOWN:
+ begin
+ if (Mode = smNormal) or ((Mode = smChallenge) and not FoundCAT) 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 = smNormal) or ((Mode = smChallenge) and not FoundCAT) 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 = smNormal) or ((Mode = smChallenge) and CatSongs.Song[Interaction].Main)) then
+ begin
+ Music.PlayChange;
+ SelectNext;
+ ChangeMusic;
+ SetScroll4;
+ UpdateLCD;
+ Light.LightOne(1, 200);
+ end;
+ end;
+
+ SDLK_LEFT:
+ begin
+ if (Length(Songs.Song) > 0) AND
+ ((Mode = smNormal) or ((Mode = smChallenge) and CatSongs.Song[Interaction].Main)) then
+ begin
+ Music.PlayChange;
+ SelectPrev;
+ ChangeMusic;
+ SetScroll4;
+ UpdateLCD;
+ Light.LightOne(0, 200);
+ end;
+ end;
+
+ SDLK_E:
+ begin
+ if (Mode = smNormal) then
+ OpenEditor;
+ end;
+
+ SDLK_R:
+ begin
+ if (Length(Songs.Song) > 0) and (Mode = smNormal) then
+ begin
+ if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then
+ //Random Category
+ begin
+ SetLength(VisArr, 0);
+
+ //Search Cat
+ for I2 := Interaction downto low(CatSongs.Song) do
+ begin
+ if CatSongs.Song[I2].Main then
+ break;
+ end;
+
+ for I := 0 to Length(CatSongs.Song) - 1 do
+ begin
+ if CatSongs.Song[I].Main and not (I=I2) then
+ begin
+ SetLength(VisArr, Length(VisArr)+1);
+ VisArr[Length(VisArr)-1] := I;
+ end;
+ end;
+
+ if (Length(VisArr)>0) then
+ begin
+ I2 := Random(Length(VisArr));
+ I2 := VisArr[I2];
+
+ //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
+ SkipTo2(I);
+ end;
+ end else if (SDL_ModState = KMOD_LCTRL) AND (Ini.Tabs_at_startup = 1) then
+ //random in All Categorys
+ begin
+ SetLength(VisArr, 0);
+
+ for I := 0 to Length(CatSongs.Song) - 1 do
+ begin
+ if not CatSongs.Song[I].Main and (I<>Interaction)then
+ begin
+ SetLength(VisArr, Length(VisArr)+1);
+ VisArr[Length(VisArr)-1] := I;
+ end;
+ end;
+
+
+ if (Length(VisArr)>0) then
+ begin
+ I2 := Random(Length(VisArr));
+ I2 := VisArr[I2];
+
+ //Search Cat
+ for I := I2 downto low(CatSongs.Song) do
+ begin
+ if CatSongs.Song[I].Main then
+ break;
+ end;
+
+ //Choose Cat
+ CatSongs.ShowCategoryList;
+
+ //Show Cat in Top Left Mod
+ ShowCatTL (I);
+
+ CatSongs.ClickCategoryButton(I);
+ //SelectNext;
+
+ //Choose Song
+ SkipTo2(I2);
+ end;
+ end else //Random in one Category
+ begin
+ SetLength(VisArr, 0);
+
+ for I := 0 to Length(CatSongs.Song) - 1 do
+ begin
+ if CatSongs.Song[I].Visible and not (I=Interaction)then
+ begin
+ SetLength(VisArr, Length(VisArr)+1);
+ VisArr[Length(VisArr)-1] := I;
+ end;
+ end;
+
+
+ if (Length(VisArr)>0) then
+ begin
+ I := Random(Length(VisArr));
+ I := VisArr[I];
+
+ //Choose Song
+ SkipTo2(I);
+ end;
+ //old: SkipTo(Random(CatSongs.VisibleSongs));
+ end;
+ Music.PlayChange;
+ ChangeMusic;
+ SetScroll4;
+ end else if (Mode = smChallenge) and not PartyMedley then //M2-MOD-mode
+ DoJokerM2
+ else if (Mode = smChallenge) and PartyMedley then
+ DoJoker(0, SDL_ModState);
+ end;
+
+ SDLK_1:
+ begin //Joker Team 1
+ if (Mode = smParty) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then
+ begin
+ //Joker spielen
+ DoJoker(0, SDL_ModState);
+ end;
+ end;
+
+ SDLK_2:
+ begin //Joker Team 2
+ if (Mode = smParty) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then
+ begin
+ //Joker spielen
+ DoJoker(1, SDL_ModState);
+ end;
+ end;
+
+ SDLK_3:
+ begin //Joker Team 3
+ if (Mode = smParty) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then
+ begin
+ //Joker spielen
+ DoJoker(2, SDL_ModState);
+ 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);
+
+ TextPlugin := AddText(Theme.Song.TextPlugin);
+
+ for I := 1 to 4 do
+ TextMedley[I] := AddText(Theme.Song.TextMedley[I]);
+
+ //for M2-MOD-mode:
+ TextP1 := AddText(Theme.Song.TextP1);
+ TextP2 := AddText(Theme.Song.TextP2);
+
+ //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);
+
+ //Meldey Icons
+ MedleyIcon := AddStatic(Theme.Song.MedleyIcon);
+ CalcMedleyIcon := AddStatic(Theme.Song.CalculatedMedleyIcon);
+
+ //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);
+
+ TextNumJokerTeam1 := AddText(Theme.Song.SongTextPartyTeam1NumJoker);
+ TextNumJokerTeam2 := AddText(Theme.Song.SongTextPartyTeam2NumJoker);
+ TextNumJokerTeam3 := AddText(Theme.Song.SongTextPartyTeam3NumJoker);
+
+ //Load Party and 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]);
+
+ SetLength(StaticM2Party, Length(Theme.Song.StaticM2Party));
+ for I := 0 to High(Theme.Song.StaticM2Party) do
+ StaticM2Party[I] := AddStatic(Theme.Song.StaticM2Party[I]);
+
+ SetLength(TextM2Party, Length(Theme.Song.TextM2Party));
+ for I := 0 to High(Theme.Song.TextM2Party) do
+ TextM2Party[I] := AddText(Theme.Song.TextM2Party[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, I: Integer;
+ VisArr: array of 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;
+ else SetScroll4;
+ end;
+ //Set Visibility of Video Icon
+ Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> '');
+
+ // Set visibility of medley icons
+ if Mode=smNormal then
+ begin
+ Static[MedleyIcon].Visible := (CatSongs.Song[Interaction].Medley.Source = msTag);
+ Static[CalcMedleyIcon].Visible := (CatSongs.Song[Interaction].Medley.Source = msCalculated);
+ end else
+ begin
+ Static[MedleyIcon].Visible := false;
+ Static[CalcMedleyIcon].Visible := false;
+ end;
+
+ //Set Texts:
+ Text[TextArtist].Text := CatSongs.Song[Interaction].Artist;
+ Text[TextTitle].Text := CatSongs.Song[Interaction].Title;
+ if (Mode=smNormal) then
+ begin
+ 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 if (Mode=smChallenge) and not PartyMedley then
+ begin
+ 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 - PartySessionM2.GetSongsPlayed(CatSongs.Song[Interaction].OrderNum)) +
+ '/' +
+ IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; //AND HERE!
+ end else if (CatSongs.CatNumShow = -2) then
+ Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS)
+ else if (CatSongs.CatNumShow = -3) then
+ begin
+ ChooseableSongs := VS - PartySessionM2.GetSongsPlayed(CatSongs.CatNumShow) - GetSongsSkipped();
+ Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) +
+ ' (' + IntToStr(ChooseableSongs) + ')';
+ end else if (Ini.Tabs_at_startup = 1) then
+ begin
+ ChooseableSongs:=CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber -
+ PartySessionM2.GetSongsPlayed(CatSongs.CatNumShow) - GetSongsSkipped();
+
+ Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' +
+ IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) + ' (' +
+ IntToStr(ChooseableSongs) + ')'; //HERE!
+ end else
+ begin
+ ChooseableSongs:=Length(CatSongs.Song)-PartySessionM2.GetSongsPlayed(CatSongs.CatNumShow)-GetSongsSkipped();
+ Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)) + ' (' +
+ IntToStr(ChooseableSongs) + ')'; //HERE!
+ end
+ end else if PartyMedley then//PartyMedley
+ begin
+ SetLength(VisArr, 0);
+
+ if (CatSongs.CatNumShow = -2) then
+ begin
+ Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS);
+ end
+ else if (CatSongs.CatNumShow = -3) then //Playlist!
+ begin
+ for I := 0 to Length(CatSongs.Song) - 1 do
+ begin
+ if CatSongs.Song[I].Visible and not SongSkipped(I) and (CatSongs.Song[I].Medley.Source>=MinSource) then
+ begin
+ SetLength(VisArr, Length(VisArr)+1);
+ VisArr[Length(VisArr)-1] := I;
+ end;
+ end;
+ ChooseableSongs := Length(VisArr);
+ Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) +
+ ' (' + IntToStr(ChooseableSongs) + ')'; //HERE!
+ end else if (Ini.Tabs_at_startup = 1) then
+ begin
+ for I := 0 to Length(CatSongs.Song) - 1 do
+ begin
+ if not CatSongs.Song[I].Main and not SongSkipped(I) and (CatSongs.Song[I].Medley.Source>=MinSource) then
+ begin
+ SetLength(VisArr, Length(VisArr)+1);
+ VisArr[Length(VisArr)-1] := I;
+ end;
+ end;
+ ChooseableSongs := Length(VisArr);
+
+ Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' +
+ IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) + ' (' +
+ IntToStr(ChooseableSongs) + ')'; //HERE!
+ end else
+ begin
+ for I := 0 to Length(CatSongs.Song) - 1 do
+ begin
+ if CatSongs.Song[I].Visible and not SongSkipped(I) and (CatSongs.Song[I].Medley.Source>=MinSource) then
+ begin
+ SetLength(VisArr, Length(VisArr)+1);
+ VisArr[Length(VisArr)-1] := I;
+ end;
+ end;
+ ChooseableSongs := Length(VisArr);
+ Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)) + ' (' +
+ IntToStr(ChooseableSongs) + ')'; //HERE!
+ end;
+ end else if (Mode=smParty) then
+ begin
+ SetLength(VisArr, 0);
+
+ if (CatSongs.CatNumShow = -2) then
+ begin
+ Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) +
+ '/' + IntToStr(VS);
+ end
+ else if (CatSongs.CatNumShow = -3) then //Playlist!
+ begin
+ for I := 0 to Length(CatSongs.Song) - 1 do
+ begin
+ if CatSongs.Song[I].Visible and not SongSkipped(I) then
+ begin
+ SetLength(VisArr, Length(VisArr)+1);
+ VisArr[Length(VisArr)-1] := I;
+ end;
+ end;
+ ChooseableSongs := Length(VisArr);
+ Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) +
+ '/' + IntToStr(VS) +
+ ' (' + IntToStr(ChooseableSongs) + ')'; //HERE!
+ end else if (Ini.Tabs_at_startup = 1) then
+ begin
+ for I := 0 to Length(CatSongs.Song) - 1 do
+ begin
+ if not CatSongs.Song[I].Main and not SongSkipped(I) then
+ begin
+ SetLength(VisArr, Length(VisArr)+1);
+ VisArr[Length(VisArr)-1] := I;
+ end;
+ end;
+ ChooseableSongs := Length(VisArr);
+
+ Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' +
+ IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) + ' (' +
+ IntToStr(ChooseableSongs) + ')'; //HERE!
+ end else
+ begin
+ for I := 0 to Length(CatSongs.Song) - 1 do
+ begin
+ if CatSongs.Song[I].Visible and not SongSkipped(I) then
+ begin
+ SetLength(VisArr, Length(VisArr)+1);
+ VisArr[Length(VisArr)-1] := I;
+ end;
+ end;
+ ChooseableSongs := Length(VisArr);
+ Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)) + ' (' +
+ IntToStr(ChooseableSongs) + ')'; //HERE!
+ end;
+ end;
+ 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.SetScroll5; // rotate
+var
+ B: integer;
+ Angle: real;
+ Pos: Real;
+ VS: integer;
+ diff: real;
+ X: 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 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;
+
+procedure TScreenSong.onShow;
+var
+ I: Integer;
+
+begin
+ if SongIndex<>Interaction then
+ Music.Stop;
+
+ PartyMedley := false;
+
+ SungToEnd := false;
+ if Mode = smMedley then
+ Mode := smNormal;
+
+ MakeMedley := false;
+
+ StartTry := false;
+ AspectHandler.changed := false;
+
+ SetLength(PlaylistMedley.Song, 0);
+ SetLength(SkippedSongs, 0);
+
+ 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) AND
+ (PlaylistMan.Mode=0) then
+ begin
+ CatSongs.ShowCategoryList;
+ SelectNext;
+ //Show Cat in Top Left Mod
+ HideCatTL;
+ end else if (PlaylistMan.Mode=0) and (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -3) 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;
+
+ //Stop Video
+ acClose;
+ VidVis := none;
+ CatSongs.ShowCategoryList;
+
+ //Show Cat in Top Left Mod
+ HideCatTL;
+
+ //Show Wrong Song when Tabs on Fix
+ SelectNext;
+ FixSelected;
+ end else if (Mode<>smNormal) and (PlaylistMan.Mode=0) and (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;
+
+
+ //Playlist Mode
+ if (Mode = smNormal) then
+ begin
+ ScreenSongMenu.Visible := False;
+
+ //If Playlist Shown -> Select Next automatically
+ if (CatSongs.CatNumShow = -3) then
+ begin
+ SelectNext;
+ end;
+ Text[TextP1].visible := false;
+ Text[TextP2].visible := false;
+ ID := 'ID_024';
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenSong, smNormal)');
+ Text[TextPlugin].Visible := false;
+ end else if (Mode = smParty) then //Party Mode classic
+ begin
+ //TODO: PartyMedley
+ PartyMedley := PartySession.Rounds[PartySession.CurRound].Medley;
+
+ //Show Menu directly in PartyMode
+ //But only if selected in Options
+ if (Ini.PartyPopup = 1) then
+ begin
+ ScreenSongMenu.MenuShow(SM_Party_Main);
+ end;
+ Text[TextP1].visible := false;
+ Text[TextP2].visible := false;
+ ID := 'ID_025';
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenSong, smParty)');
+
+ Text[TextPlugin].Visible := true;
+ if PartyMedley then
+ MinSource := msCalculated;
+
+ Text[TextPlugin].Text := PartySession.Plugins[PartySession.Rounds[PartySession.CurRound].PluginNr].Name;
+ SelectRandomSong;
+ end else if (Mode = smChallenge) then //M2-MOD
+ begin
+ PartyMedley := PartySessionM2.Rounds[PartySessionM2.CurRound].Medley;
+
+ ID := 'ID_026';
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenSong, smChallenge)');
+
+ if not PartyMedley then
+ begin
+ if (PlaylistMan.Mode=1) then //One Category Select Category and Select Random Song
+ begin
+ CatSongs.ShowCategoryList;
+ CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList);
+ ShowCatTL(PlaylistMan.CurPlayList);
+ end else if (PlaylistMan.Mode=2) then
+ begin
+ PlaylistMan.SetPlayList(PlaylistMan.CurPlayList);
+ end;
+
+ if (CatSongs.VisibleSongs - PartySessionM2.GetSongsPlayed(CatSongs.CatNumShow))=0 then
+ PartySessionM2.ResetSongsPlayed(CatSongs.CatNumShow);
+
+ RandomSongChallenge;
+ //SkipTo(Random(CatSongs.VisibleSongs - PartySessionM2.GetSongsPlayed(CatSongs.CatNumShow)));
+
+ if (Ini.Tabs_at_startup = 1) and (PlaylistMan.Mode <> 2) and
+ (PlaylistMan.Mode <> 1) then
+ FoundCAT:=false
+ else
+ FoundCAT:=true;
+ end else
+ begin
+ MinSource := msCalculated;
+ FoundCAT:=true;
+ SelectRandomSong;
+ end;
+
+ Text[TextP1].Text := 'P1: ' + PartySessionM2.Teams.Teaminfo[0].Playerinfo[0].Name;
+ Text[TextP2].Text := 'P2: ' + PartySessionM2.Teams.Teaminfo[1].Playerinfo[0].Name;
+ Text[TextP1].visible := true;
+ Text[TextP2].visible := true;
+ if PartySessionM2.Option_Plugins then
+ begin
+ Text[TextPlugin].Visible := true;
+ Text[TextPlugin].Text := PartySessionM2.Plugins[PartySessionM2.Rounds[PartySessionM2.CurRound].PluginNr].Name;
+ end else
+ Text[TextPlugin].Visible := false;
+ end;
+
+ if Length(CatSongs.Song) > 0 then begin
+ if SongIndex<>Interaction then
+ ChangeMusic
+ else
+ begin
+ StartVideoPreview;
+ CoverTime := 0;
+ end;
+
+ SongIndex := -1;
+ SetScroll;
+ UpdateLCD;
+ end;
+
+ SetJoker;
+ SetStatics;
+end;
+
+procedure TScreenSong.RandomSongChallenge();
+var
+ VisArr: array of integer;
+ I: integer;
+begin
+ SetLength(VisArr, 0);
+ for I := 0 to Length(CatSongs.Song) - 1 do
+ begin
+ if not PartyMedley then
+ begin
+ if CatSongs.Song[I].Visible and not SongSkipped(I) and
+ not PartySessionM2.SongPlayed(CatSongs.CatNumShow, I) then
+ begin
+ SetLength(VisArr, Length(VisArr)+1);
+ VisArr[Length(VisArr)-1] := I;
+ end;
+ end else
+ begin
+ if CatSongs.Song[I].Visible and not SongSkipped(I) and
+ (CatSongs.Song[I].Medley.Source >= MinSource) then
+ begin
+ SetLength(VisArr, Length(VisArr)+1);
+ VisArr[Length(VisArr)-1] := I;
+ end;
+ end;
+ end;
+
+ if (Length(VisArr)>0) then
+ begin
+ I := Random(Length(VisArr));
+ I := VisArr[I];
+
+ //Choose Song
+ SkipTo2(I);
+ end;
+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, J: Integer;
+ Window: TRectCoords;
+ Blend: 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);
+
+ //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;
+
+ //Medley Playlist
+ if Length(PlaylistMedley.Song)>4 then
+ J := Length(PlaylistMedley.Song)-4
+ else
+ J := 0;
+
+ for I := 1 to 4 do
+ begin
+ if Length(PlaylistMedley.Song)>=I+J then
+ begin
+ Text[TextMedley[I]].Visible := true;
+ Text[TextMedley[I]].Text := IntToStr(I+J)+') ' +
+ CatSongs.Song[PlaylistMedley.Song[I-1+J]].Artist + '\n' +
+ CatSongs.Song[PlaylistMedley.Song[I-1+J]].Title;
+ end else
+ Text[TextMedley[I]].Visible := false;
+ end;
+
+ //Medley Mode
+ if (Mode=smNormal) then
+ begin
+ if MakeMedley then
+ begin
+ Text[TextPlugin].Text := 'Medley-Mode';
+ Text[TextPlugin].Visible := true;
+ end else
+ Text[TextPlugin].Visible := false;
+ end;
+
+ //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;
+
+ if (CatSongs.Song[Interaction].Main) or (CatSongs.VisibleSongs = 0) then
+ begin
+ acClose;
+ VidVis := none;
+ end;
+
+ if UVideo.VideoOpened then
+ begin
+ Czas.Teraz := Czas.Teraz + TimeSkip;
+ try
+ acGetFrame(Czas.Teraz);
+
+ if VidVis=windowed then
+ begin
+ Window.Left := Button[Interaction].X;
+ Window.Right := Button[Interaction].X+Button[Interaction].W;
+ Window.Upper := Button[Interaction].Y;
+ Window.Lower := Button[Interaction].Y+Button[Interaction].H;
+ Window.windowed := true;
+
+ {if CoverTime>=Ini.PreviewFading then
+ begin
+ glColor4f(0, 0, 0, 1);
+
+ glbegin(gl_quads);
+ glVertex2f(Window.Left, Window.Upper);
+ glVertex2f(Window.Left, Window.Lower);
+ glVertex2f(Window.Right, Window.Lower);
+ glVertex2f(Window.Right, Window.Upper);
+ glEnd;
+ end; }
+ SetAspectCorrection(acoCrop);
+ Blend := (CoverTime-1.75)/Ini.PreviewFading;
+ if Blend<0 then
+ Blend := 0
+ else if Blend>1 then
+ Blend := 1;
+
+ acDrawGLi(ScreenAct, Window, Blend);
+ end else if VidVis=full then
+ begin
+ acDrawGL(ScreenAct);
+ end;
+
+ //ResetAspectCorrection;
+
+ if (Czas.Teraz>=Czas.Razem) then
+ begin
+ acClose;
+ VidVis := none;
+ end;
+ except
+ //If an Error occurs drawing: prevent Video from being Drawn again and Close Video
+ log.LogError('Error drawing Video, Video has been disabled for this Song/Session.');
+ Log.LogError('Corrupted File: ' + CatSongs.Song[Interaction].Video);
+ try
+ acClose;
+ VidVis := none;
+ except
+
+ end;
+ end;
+ end else
+ StartVideoPreview;
+
+ if (VidVis = full) and AspectHandler.changed and
+ (AspectHandler.change_time+3>Czas.Teraz) then
+ begin
+ DrawAspect;
+ end else if AspectHandler.changed and
+ (AspectHandler.change_time+3<Czas.Teraz) then
+ AspectHandler.changed := false;
+
+ DrawExtensions;
+end;
+
+procedure TScreenSong.DrawAspect();
+var
+ txt: PChar;
+ w, h: real;
+ str: string;
+
+begin
+ //draw quad
+ glColor4f(0.7, 0.7, 0.7, 0.6);
+ glEnable(GL_BLEND);
+ glbegin(gl_quads);
+ glVertex2f(270, 20);
+ glVertex2f(270, 60);
+ glVertex2f(530, 60);
+ glVertex2f(530, 20);
+ glEnd;
+ glDisable(GL_BLEND);
+
+ //print Text
+ case UVideo.fAspectCorrection of
+ acoStretch: str := Language.Translate('VIDEO_ASPECT_STRETCH');
+ acoCrop: str := Language.Translate('VIDEO_ASPECT_CROP');
+ acoLetterBox: str := Language.Translate('VIDEO_ASPECT_LETTER_BOX');
+ else
+ str := 'error';
+ end;
+
+ glColor4f(1, 1, 1, 1);
+
+ h := 11*ScreenH/RenderH;
+ SetFontStyle(1);
+ SetFontItalic(false);
+ SetFontSize(h);
+ w := glTextWidth(PChar(str));
+
+ SetFontPos (RenderW/2-w/2, 20);
+ txt := Addr(str[1]);
+ glPrint(txt);
+end;
+
+procedure TScreenSong.SelectNext;
+var
+ Skip, Skip2: integer;
+ I: integer;
+ VS: Integer;
+begin
+ VS := CatSongs.VisibleSongs;
+
+ if VS > 0 then
+ begin
+ UnLoadDetailedCover;
+
+ 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
+ begin
+ if not CatSongs.Song[(Interaction + Skip + Skip2) mod Length(Interactions)].Visible then
+ Inc(Skip)
+ else
+ Inc(Skip2);
+ end;
+ end else if PartyMedley then
+ 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
+ SongSkipped((Interaction + Skip + Skip2) mod Length(Interactions))) do
+ begin
+ if not CatSongs.Song[(Interaction + Skip + Skip2) mod Length(Interactions)].Visible then
+ Inc(Skip)
+ else
+ Inc(Skip2);
+ end;
+ end else
+ begin
+ while (not CatSongs.Song[(Interaction + Skip + Skip2) mod Length(Interactions)].Visible or
+ SongSkipped((Interaction + Skip + Skip2) mod Length(Interactions))) do
+ begin
+ if not CatSongs.Song[(Interaction + Skip + Skip2) mod Length(Interactions)].Visible then
+ Inc(Skip)
+ else
+ Inc(Skip2);
+ end;
+ end;
+
+
+ SongTarget := SongTarget + 1 + Skip2;//Skip;
+ Interaction := (Interaction + Skip + Skip2) 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
+ 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 (Ini.PreviewVolume * 10);
+ Music.Play;
+ end else
+ begin
+ Music.Fade(0, Ini.PreviewVolume*10, Ini.PreviewFading);
+ Music.Play;
+ end;
+ end;
+ end else
+ Music.Stop;
+ end;
+end;
+
+procedure TScreenSong.StartVideoPreview;
+begin
+ if (Ini.PreviewVolume <> 0) and (Ini.MovieSize < 2) then
+ begin
+ if (NOT CatSongs.Song[Interaction].Main) AND (CatSongs.VisibleSongs > 0) then
+ begin
+ if CoverTime<0.75 then
+ begin
+ acClose;
+ VidVis := none;
+ StartTry := true;
+ AspectHandler.changed := false;
+ end else if (Ini.MoviePreview=1) and StartTry then
+ begin
+ if (CatSongs.Song[Interaction].Video <> '') and
+ FileExists(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Video) then
+ begin
+ acOpenFile(PAnsiChar(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Video));
+
+ acSkip2(CatSongs.Song[Interaction].VideoGAP, Music.Position);
+ Czas.Teraz := Music.Position;
+ Czas.Razem := Music.Length;
+ StartTry := false;
+ try
+ acGetFrame(Czas.Teraz);
+ VidVis := windowed;
+ except
+ //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video
+ Log.LogError('Error drawing Video, Video has been disabled for this Song/Session.');
+ Log.LogError('Corrupted File: ' + CatSongs.Song[Interaction].Video);
+ CatSongs.Song[Interaction].Video := ''; //dirt fix
+ try
+ acClose;
+ VidVis := none;
+ except
+
+ end;
+ end;
+ end else
+ VidVis := none;
+ end;
+ end;
+ end;
+end;
+
+
+procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0
+var
+ I: integer;
+begin
+ UnLoadDetailedCover;
+
+ Interaction := High(CatSongs.Song);
+ SongTarget := 0;
+
+ for I := 1 to Target+1 do
+ SelectNext;
+
+ FixSelected2;
+end;
+
+procedure TScreenSong.SkipTo2(Target: Cardinal); //new
+var
+ I: integer;
+
+begin
+ UnLoadDetailedCover;
+
+ Interaction := High(CatSongs.Song);
+ SongTarget := 0;
+
+ while Interaction<>Target do
+ begin
+ SelectNext;
+ end;
+
+ 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;
+ VisArr: array of 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
+ SetLength(VisArr, 0);
+ for I := 0 to Length(CatSongs.Song) - 1 do
+ begin
+ if not PartyMedley then
+ begin
+ if not CatSongs.Song[I].Main and not SongSkipped(I)then
+ begin
+ SetLength(VisArr, Length(VisArr)+1);
+ VisArr[Length(VisArr)-1] := I;
+ end;
+ end else
+ begin
+ if not CatSongs.Song[I].Main and not SongSkipped(I) and
+ (CatSongs.Song[I].Medley.Source >= MinSource) then
+ begin
+ SetLength(VisArr, Length(VisArr)+1);
+ VisArr[Length(VisArr)-1] := I;
+ end;
+ end;
+ end;
+
+ if (Length(VisArr)>0) then
+ begin
+ I2 := Random(Length(VisArr));
+ I2 := VisArr[I2];
+
+ //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
+ SkipTo2(I2);
+ end;
+ end
+ //When Tabs are deactivated use easy Method
+ else
+ begin
+ SetLength(VisArr, 0);
+ for I := 0 to Length(CatSongs.Song) - 1 do
+ begin
+ if not PartyMedley then
+ begin
+ if not CatSongs.Song[I].Main and not SongSkipped(I)then
+ begin
+ SetLength(VisArr, Length(VisArr)+1);
+ VisArr[Length(VisArr)-1] := I;
+ end;
+ end else
+ begin
+ if not CatSongs.Song[I].Main and not SongSkipped(I) and
+ (CatSongs.Song[I].Medley.Source >= MinSource) then
+ begin
+ SetLength(VisArr, Length(VisArr)+1);
+ VisArr[Length(VisArr)-1] := I;
+ end;
+ end;
+ end;
+ if (Length(VisArr)>0) then
+ begin
+ I2 := Random(Length(VisArr));
+ I2 := VisArr[I2];
+
+ //Search Cat
+ for I := I2 downto low(CatSongs.Song) do
+ begin
+ if CatSongs.Song[I].Main then
+ break;
+ end;
+ //Choose Song
+ SkipTo2(I2);
+ end;
+ end;
+ end;
+ 1: //One Category Select Category and Select Random Song
+ begin
+ CatSongs.ShowCategoryList;
+ CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList);
+ ShowCatTL(PlaylistMan.CurPlayList);
+
+ SetLength(VisArr, 0);
+ for I := 0 to Length(CatSongs.Song) - 1 do
+ begin
+ if not PartyMedley then
+ begin
+ if CatSongs.Song[I].Visible and not SongSkipped(I)then
+ begin
+ SetLength(VisArr, Length(VisArr)+1);
+ VisArr[Length(VisArr)-1] := I;
+ end;
+ end else
+ begin
+ if CatSongs.Song[I].Visible and not SongSkipped(I) and
+ (CatSongs.Song[I].Medley.Source >= MinSource) then
+ begin
+ SetLength(VisArr, Length(VisArr)+1);
+ VisArr[Length(VisArr)-1] := I;
+ end;
+ end;
+ end;
+ if (Length(VisArr)>0) then
+ begin
+ I2 := Random(Length(VisArr));
+ I2 := VisArr[I2];
+
+ //Search Cat
+ for I := I2 downto low(CatSongs.Song) do
+ begin
+ if CatSongs.Song[I].Main then
+ break;
+ end;
+ //Choose Song
+ SkipTo2(I2);
+ end;
+ end;
+ 2: //Playlist: Select Playlist and Select Random Song
+ begin
+ PlaylistMan.SetPlayList(PlaylistMan.CurPlayList);
+
+ SetLength(VisArr, 0);
+ for I := 0 to Length(CatSongs.Song) - 1 do
+ begin
+ if not PartyMedley then
+ begin
+ if CatSongs.Song[I].Visible and not SongSkipped(I)then
+ begin
+ SetLength(VisArr, Length(VisArr)+1);
+ VisArr[Length(VisArr)-1] := I;
+ end;
+ end else
+ begin
+ if CatSongs.Song[I].Visible and not SongSkipped(I) and
+ (CatSongs.Song[I].Medley.Source >= MinSource) then
+ begin
+ SetLength(VisArr, Length(VisArr)+1);
+ VisArr[Length(VisArr)-1] := I;
+ end;
+ end;
+ end;
+ if (Length(VisArr)>0) then
+ begin
+ I2 := Random(Length(VisArr));
+ I2 := VisArr[I2];
+
+ //Search Cat
+ for I := I2 downto low(CatSongs.Song) do
+ begin
+ if CatSongs.Song[I].Main then
+ break;
+ end;
+ //Choose Song
+ SkipTo2(I2);
+ end;
+
+ FixSelected2;
+ end;
+ end;
+
+ Music.PlayChange;
+ ChangeMusic;
+ SetScroll;
+ UpdateLCD;
+end;
+
+//do Joker in M2-MOD mode
+procedure TScreenSong.DoJokerM2;
+begin
+ if (PartySessionM2.Teams.Teaminfo[0].Joker>0) then
+ begin
+ if (((not CatSongs.Song[Interaction].Main) or (Ini.Tabs_at_startup=0)) and (ChooseableSongs>1)) then
+ begin
+ if (FoundCAT) then Dec(PartySessionM2.Teams.Teaminfo[0].Joker);
+ FoundCAT:=true;
+
+ SetLength(SkippedSongs, Length(SkippedSongs)+1);
+ SkippedSongs[Length(SkippedSongs)-1] := Interaction;
+ end;
+
+ if (ChooseableSongs > 1) then
+ begin
+ RandomSongChallenge;
+ //SkipTo(Random(CatSongs.VisibleSongs - PartySessionM2.GetSongsPlayed(CatSongs.CatNumShow) - GetSongsSkipped()));
+ SetJoker;
+
+ Music.PlayChange;
+ ChangeMusic;
+ SetScroll4;
+ end;
+ end;
+end;
+
+procedure TScreenSong.SetJoker;
+var
+ txt: string;
+ h, x, y: real;
+ ptxt: pchar;
+begin
+ //If Party Mode
+ if Mode = smParty then //Show Joker that are available
+ begin
+ if (PartySession.Teams.NumTeams >= 1) then
+ begin
+ Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1);
+ if PartySession.Teams.Teaminfo[0].Joker > 5 then
+ begin
+ Text[TextNumJokerTeam1].Text := 'x'+IntToStr(PartySession.Teams.Teaminfo[0].Joker);
+ Text[TextNumJokerTeam1].Visible := true;
+
+ Static[StaticTeam1Joker2].Visible := False;
+ Static[StaticTeam1Joker3].Visible := False;
+ Static[StaticTeam1Joker4].Visible := False;
+ Static[StaticTeam1Joker5].Visible := False;
+ end else
+ begin
+ Text[TextNumJokerTeam1].Visible := false;
+ 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;
+ end
+ else
+ begin
+ Static[StaticTeam1Joker1].Visible := False;
+ Static[StaticTeam1Joker2].Visible := False;
+ Static[StaticTeam1Joker3].Visible := False;
+ Static[StaticTeam1Joker4].Visible := False;
+ Static[StaticTeam1Joker5].Visible := False;
+ Text[TextNumJokerTeam1].Visible := false;
+ end;
+
+ if (PartySession.Teams.NumTeams >= 2) then
+ begin
+ Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1);
+
+ if PartySession.Teams.Teaminfo[1].Joker > 5 then
+ begin
+ Text[TextNumJokerTeam2].Text := 'x'+IntToStr(PartySession.Teams.Teaminfo[1].Joker);
+ Text[TextNumJokerTeam2].Visible := true;
+
+ Static[StaticTeam2Joker2].Visible := False;
+ Static[StaticTeam2Joker3].Visible := False;
+ Static[StaticTeam2Joker4].Visible := False;
+ Static[StaticTeam2Joker5].Visible := False;
+ end else
+ begin
+ Text[TextNumJokerTeam2].Visible := false;
+ 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;
+ end
+ else
+ begin
+ Static[StaticTeam2Joker1].Visible := False;
+ Static[StaticTeam2Joker2].Visible := False;
+ Static[StaticTeam2Joker3].Visible := False;
+ Static[StaticTeam2Joker4].Visible := False;
+ Static[StaticTeam2Joker5].Visible := False;
+ Text[TextNumJokerTeam2].Visible := false;
+ end;
+
+ if (PartySession.Teams.NumTeams >= 3) then
+ begin
+ Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1);
+
+ if PartySession.Teams.Teaminfo[2].Joker > 5 then
+ begin
+ Text[TextNumJokerTeam3].Text := 'x'+IntToStr(PartySession.Teams.Teaminfo[2].Joker);
+ Text[TextNumJokerTeam3].Visible := true;
+
+ Static[StaticTeam3Joker2].Visible := False;
+ Static[StaticTeam3Joker3].Visible := False;
+ Static[StaticTeam3Joker4].Visible := False;
+ Static[StaticTeam3Joker5].Visible := False;
+ end else
+ begin
+ Text[TextNumJokerTeam3].Visible := false;
+ 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;
+ end
+ else
+ begin
+ Static[StaticTeam3Joker1].Visible := False;
+ Static[StaticTeam3Joker2].Visible := False;
+ Static[StaticTeam3Joker3].Visible := False;
+ Static[StaticTeam3Joker4].Visible := False;
+ Static[StaticTeam3Joker5].Visible := False;
+ Text[TextNumJokerTeam3].Visible := false;
+ end;
+ end
+ else if (Mode = smChallenge) then //M2-MOD-mode
+ begin
+ if (PartySessionM2.Teams.NumTeams >= 1) then
+ begin
+ Static[StaticTeam1Joker1].Visible := (PartySessionM2.Teams.Teaminfo[0].Joker >= 1);
+ Static[StaticTeam1Joker2].Visible := (PartySessionM2.Teams.Teaminfo[0].Joker >= 2);
+ Static[StaticTeam1Joker3].Visible := (PartySessionM2.Teams.Teaminfo[0].Joker >= 3);
+ Static[StaticTeam1Joker4].Visible := (PartySessionM2.Teams.Teaminfo[0].Joker >= 4);
+ Static[StaticTeam1Joker5].Visible := (PartySessionM2.Teams.Teaminfo[0].Joker >= 5);
+ Text[TextNumJokerTeam1].Visible := false;
+ end
+ else
+ begin
+ Static[StaticTeam1Joker1].Visible := false;
+ Static[StaticTeam1Joker2].Visible := false;
+ Static[StaticTeam1Joker3].Visible := false;
+ Static[StaticTeam1Joker4].Visible := false;
+ Static[StaticTeam1Joker5].Visible := false;
+ Text[TextNumJokerTeam1].Visible := false;
+ end;
+
+ if (PartySessionM2.Teams.NumTeams >= 2) then
+ begin
+ Static[StaticTeam2Joker1].Visible := (PartySessionM2.Teams.Teaminfo[1].Joker >= 1);
+ Static[StaticTeam2Joker2].Visible := (PartySessionM2.Teams.Teaminfo[1].Joker >= 2);
+ Static[StaticTeam2Joker3].Visible := (PartySessionM2.Teams.Teaminfo[1].Joker >= 3);
+ Static[StaticTeam2Joker4].Visible := (PartySessionM2.Teams.Teaminfo[1].Joker >= 4);
+ Static[StaticTeam2Joker5].Visible := (PartySessionM2.Teams.Teaminfo[1].Joker >= 5);
+ Text[TextNumJokerTeam2].Visible := false;
+ end
+ else
+ begin
+ Static[StaticTeam2Joker1].Visible := false;
+ Static[StaticTeam2Joker2].Visible := false;
+ Static[StaticTeam2Joker3].Visible := false;
+ Static[StaticTeam2Joker4].Visible := false;
+ Static[StaticTeam2Joker5].Visible := false;
+ Text[TextNumJokerTeam2].Visible := false;
+ end;
+
+ if (PartySessionM2.Teams.NumTeams >= 3) then
+ begin
+ Static[StaticTeam3Joker1].Visible := (PartySessionM2.Teams.Teaminfo[2].Joker >= 1);
+ Static[StaticTeam3Joker2].Visible := (PartySessionM2.Teams.Teaminfo[2].Joker >= 2);
+ Static[StaticTeam3Joker3].Visible := (PartySessionM2.Teams.Teaminfo[2].Joker >= 3);
+ Static[StaticTeam3Joker4].Visible := (PartySessionM2.Teams.Teaminfo[2].Joker >= 4);
+ Static[StaticTeam3Joker5].Visible := (PartySessionM2.Teams.Teaminfo[2].Joker >= 5);
+ Text[TextNumJokerTeam3].Visible := false;
+ end
+ else
+ begin
+ Static[StaticTeam3Joker1].Visible := false;
+ Static[StaticTeam3Joker2].Visible := false;
+ Static[StaticTeam3Joker3].Visible := false;
+ Static[StaticTeam3Joker4].Visible := false;
+ Static[StaticTeam3Joker5].Visible := false;
+ Text[TextNumJokerTeam3].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;
+ Text[TextNumJokerTeam1].Visible := false;
+
+ Static[StaticTeam2Joker1].Visible := False;
+ Static[StaticTeam2Joker2].Visible := False;
+ Static[StaticTeam2Joker3].Visible := False;
+ Static[StaticTeam2Joker4].Visible := False;
+ Static[StaticTeam2Joker5].Visible := False;
+ Text[TextNumJokerTeam2].Visible := false;
+
+ Static[StaticTeam3Joker1].Visible := False;
+ Static[StaticTeam3Joker2].Visible := False;
+ Static[StaticTeam3Joker3].Visible := False;
+ Static[StaticTeam3Joker4].Visible := False;
+ Static[StaticTeam3Joker5].Visible := False;
+ Text[TextNumJokerTeam3].Visible := false;
+ end;
+end;
+
+procedure TScreenSong.SetStatics;
+var
+ I: Integer;
+ Visible: Boolean;
+begin
+ //Set Visibility of Party M2 Statics and Text
+ Visible := (Mode = smChallenge);
+
+ For I := 0 to high(StaticM2Party) do
+ Static[StaticM2Party[I]].Visible := Visible;
+
+ For I := 0 to high(TextM2Party) do
+ Text[TextM2Party[I]].Visible := Visible;
+
+ //Set Visibility of Party Statics and Text
+ Visible := (Mode = smParty);
+
+ 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 := (Mode = smNormal);
+
+ 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 = smParty) or (Mode = smChallenge) then
+ begin
+ FadeTo(@ScreenSingModi);
+ end
+ else
+ begin
+ FadeTo(@ScreenSing);
+ end;
+end;
+
+procedure TScreenSong.SelectPlayers;
+begin
+ CatSongs.Selected := Interaction;
+ Music.Stop;
+ acClose;
+ VidVis := none;
+ ScreenName.Goto_SingScreen := True;
+ FadeTo(@ScreenName);
+end;
+
+procedure TScreenSong.OpenEditor;
+begin
+ if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = smNormal) then begin
+ Music.Stop;
+ acClose;
+ VidVis := none;
+ Music.PlayStart;
+ ScreenEditSub.Path := CatSongs.Song[Interaction].Path;
+ ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName;
+ ScreenEditSub.SongIndex := Interaction;
+ FadeTo(@ScreenEditSub);
+ end;
+end;
+
+//Team No of Team (0-5)
+procedure TScreenSong.DoJoker (Team: Byte; SDL_ModState: Word);
+begin
+ if not PartyMedley and (ChooseableSongs>1) and
+ (Mode = smParty) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then
+ begin
+ //Joker spielen
+ if (SDL_ModState <> KMOD_LALT) then
+ Dec(PartySession.Teams.Teaminfo[Team].Joker);
+
+ SetLength(SkippedSongs, Length(SkippedSongs)+1);
+ SkippedSongs[Length(SkippedSongs)-1] := Interaction;
+ SelectRandomSong;
+ SetJoker;
+ end;
+
+ if PartyMedley and (Mode=smChallenge) and (PartySessionM2.Teams.Teaminfo[0].Joker>0) then
+ begin
+ if (ChooseableSongs>1) then
+ begin
+ Dec(PartySessionM2.Teams.Teaminfo[0].Joker);
+
+ SetLength(SkippedSongs, Length(SkippedSongs)+1);
+ SkippedSongs[Length(SkippedSongs)-1] := Interaction;
+
+ SelectRandomSong;
+ SetJoker;
+ end;
+ end;
+
+ if PartyMedley and (Mode=smParty) and (PartySession.Teams.Teaminfo[Team].Joker>0) then
+ begin
+ if (ChooseableSongs>1) then
+ begin
+ if (SDL_ModState <> KMOD_LALT) then
+ Dec(PartySession.Teams.Teaminfo[Team].Joker);
+
+ SetLength(SkippedSongs, Length(SkippedSongs)+1);
+ SkippedSongs[Length(SkippedSongs)-1] := Interaction;
+
+ SelectRandomSong;
+ SetJoker;
+ end;
+ 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;
+
+function TScreenSong.getVisibleMedleyArr(MinS: TMedleySource): TVisArr;
+var
+ I: integer;
+ res: TVisArr;
+begin
+ SetLength(res, 0);
+ if CatSongs.Song[Interaction].main then
+ begin
+ for I := 0 to Length(CatSongs.Song) - 1 do
+ begin
+ if not CatSongs.Song[I].main and (CatSongs.Song[I].Medley.Source >= MinS) then
+ begin
+ SetLength(res, Length(res)+1);
+ res[Length(res)-1] := I;
+ end;
+ end;
+ end else begin
+ for I := 0 to Length(CatSongs.Song) - 1 do
+ begin
+ if CatSongs.Song[I].Visible and (CatSongs.Song[I].Medley.Source >= MinS) then
+ begin
+ SetLength(res, Length(res)+1);
+ res[Length(res)-1] := I;
+ end;
+ end;
+ end;
+ Result := res;
+end;
+
+//start Medley round
+procedure TScreenSong.StartMedley(num: integer; MinS: TMedleySource);
+ procedure AddSong(SongNr: integer);
+ begin
+ SetLength(PlaylistMedley.Song, Length(PlaylistMedley.Song)+1);
+ PlaylistMedley.Song[Length(PlaylistMedley.Song)-1] := SongNr;
+ end;
+
+ function SongAdded(SongNr: integer): boolean;
+ var
+ i: integer;
+ skipped :boolean;
+ begin
+ skipped := false;
+ for i := 0 to Length(PlaylistMedley.Song) - 1 do
+ begin
+ if (SongNr=PlaylistMedley.Song[i]) then
+ begin
+ skipped:=true;
+ break;
+ end;
+ end;
+ Result:=skipped;
+ end;
+
+ function NumSongsAdded(): Integer;
+ begin
+ Result := Length(PlaylistMedley.Song);
+ end;
+
+ function GetNextSongNr(MinS: TMedleySource): integer;
+ var
+ I, num: integer;
+ unused_arr: array of integer;
+ visible_arr: TVisArr;
+ begin
+ SetLength(unused_arr, 0);
+ visible_arr := getVisibleMedleyArr(MinS);
+ for I := 0 to Length(visible_arr) - 1 do
+ begin
+ if (not SongAdded(visible_arr[I])) then
+ begin
+ SetLength(unused_arr, Length(unused_arr)+1);
+ unused_arr[Length(unused_arr)-1] := visible_arr[I];
+ end;
+ end;
+
+ num := random(Length(unused_arr));
+ Result := unused_arr[num];
+end;
+
+var
+ I: integer;
+ VS: integer;
+
+begin
+ if (num>0) and not PartyMedley and not MakeMedley then
+ begin
+ VS := Length(getVisibleMedleyArr(MinS));
+ if VS < num then
+ PlaylistMedley.NumMedleySongs := VS
+ else
+ PlaylistMedley.NumMedleySongs := num;
+
+ Randomize;
+ //set up Playlist Medley
+ SetLength(PlaylistMedley.Song, 0);
+ for I := 0 to PlaylistMedley.NumMedleySongs - 1 do
+ begin
+ AddSong(GetNextSongNr(MinS));
+ end;
+ end else if not PartyMedley and not MakeMedley then //start this song
+ begin
+ SetLength(PlaylistMedley.Song, 1);
+ PlaylistMedley.Song[0] := Interaction;
+ PlaylistMedley.NumMedleySongs := 1;
+ end else if PartyMedley then //PartyMedley
+ begin
+ AddSong(Interaction);
+ PlaylistMedley.NumMedleySongs := Length(PlaylistMedley.Song);
+
+ SetLength(SkippedSongs, Length(SkippedSongs)+1);
+ SkippedSongs[Length(SkippedSongs)-1] := Interaction;
+
+ if ((Mode=smParty) and (PartySession.Rounds[PartySession.CurRound].MedleySurprise)) or
+ ((Mode=smChallenge) and (PartySessionM2.Rounds[PartySessionM2.CurRound].MedleySurprise)) then
+ begin
+ VS := Length(getVisibleMedleyArr(MinS));
+ if VS < num then
+ PlaylistMedley.NumMedleySongs := VS
+ else
+ PlaylistMedley.NumMedleySongs := num;
+
+ Randomize;
+
+ //set up Playlist Medley
+ for I := 1 to PlaylistMedley.NumMedleySongs - 1 do
+ begin
+ AddSong(GetNextSongNr(MinS));
+ end;
+ end;
+ end else if MakeMedley then
+ begin
+ if (CatSongs.Song[Interaction].Medley.Source>=MinS) then
+ begin
+ AddSong(Interaction);
+ PlaylistMedley.NumMedleySongs := Length(PlaylistMedley.Song);
+ end;
+ end;
+
+ if (Mode=smNormal) and not MakeMedley then
+ begin
+ Mode := smMedley;
+ Music.Stop;
+ //TODO: how about case 2? menu for medley mode?
+ case Ini.OnSongClick of
+ 0: FadeTo(@ScreenSing);
+ 1: SelectPlayers;
+ 2: FadeTo(@ScreenSing);
+ {2: begin
+ if (CatSongs.CatNumShow = -3) then
+ ScreenSongMenu.MenuShow(SM_Playlist)
+ else
+ ScreenSongMenu.MenuShow(SM_Main);
+ end;}
+ end;
+ end else if PartyMedley then
+ begin
+ if (PlaylistMedley.NumMedleySongs=num) or
+ (ChooseableSongs=1) then
+ begin
+ Music.Stop;
+ FadeTo(@ScreenSingModi);
+ end else
+ SelectRandomSong;
+ end else if MakeMedley then
+ begin
+ if PlaylistMedley.NumMedleySongs=num then
+ begin
+ Mode := smMedley;
+ Music.Stop;
+ //TODO: how about case 2? menu for medley mode?
+ case Ini.OnSongClick of
+ 0: FadeTo(@ScreenSing);
+ 1: SelectPlayers;
+ 2: FadeTo(@ScreenSing);
+ {2: begin
+ if (CatSongs.CatNumShow = -3) then
+ ScreenSongMenu.MenuShow(SM_Playlist)
+ else
+ ScreenSongMenu.MenuShow(SM_Main);
+ end;}
+ end;
+ end;
+ end;
+end;
+
+
+end. \ No newline at end of file
diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas
new file mode 100644
index 00000000..0b643ebc
--- /dev/null
+++ b/Game/Code/Screens/UScreenSongJumpto.pas
@@ -0,0 +1,213 @@
+unit UScreenSongJumpto;
+
+interface
+
+uses
+ UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes, UVideo;
+
+type
+ TScreenSongJumpto = class(TMenu)
+ const
+ ID='ID_031'; //for help system
+ private
+ //For ChangeMusic
+ LastPlayed: Integer;
+ VisibleBool: Boolean;
+ public
+ 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;
+
+ procedure SetTextFound(const Count: Cardinal);
+ end;
+
+var
+ IType: Array [0..2] of String;
+ SelectType: Integer;
+
+
+implementation
+
+uses UGraphic, UHelp, UMain, UIni, UTexture, ULanguage, UParty, USongs, UScreenSong, ULog;
+
+function TScreenSongJumpto.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+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, SDLK_LEFTBRACKET, SDLK_SEMICOLON:
+ 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_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_BACKSPACE:
+ begin
+ 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_RETURN,
+ SDLK_ESCAPE:
+ begin
+ Visible := False;
+ 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);
+ 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:
+ 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
+ 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
+ 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;
+end;
+
+constructor TScreenSongJumpto.Create;
+var
+ I: integer;
+begin
+ inherited Create;
+
+ AddText(Theme.SongJumpto.TextFound);
+
+ LoadFromTheme(Theme.SongJumpto);
+
+ AddButton(Theme.SongJumpto.ButtonSearchText);
+ if (Length(Button[0].Text) = 0) then
+ AddButtonText(14, 20, '');
+
+ SelectType := 0;
+ AddSelectSlide(Theme.SongJumpto.SelectSlideType, SelectType, Theme.SongJumpto.IType);
+
+
+ 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
+ //Reset Screen if no Old Search is Displayed
+ if (CatSongs.CatNumShow <> -2) then
+ begin
+ SelectsS[0].SetSelectOpt(0);
+
+ Button[0].Text[0].Text := '';
+ Text[0].Text := Theme.SongJumpto.NoSongsFound;
+ end;
+
+ //Select Input
+ Interaction := 0;
+ Button[0].Text[0].Selected := True;
+
+ LastPlayed := ScreenSong.Interaction;
+
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenSongJumpTo)');
+end;
+
+function TScreenSongJumpto.Draw: boolean;
+begin
+ Result := inherited Draw;
+end;
+
+procedure TScreenSongJumpto.SetTextFound(const Count: Cardinal);
+begin
+ if (Count = 0) then
+ begin
+ Text[0].Text := Theme.SongJumpto.NoSongsFound;
+ 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
+ Text[0].Text := Format(Theme.SongJumpto.SongsFound, [Count]);
+
+ //Set CatTopLeftText
+ ScreenSong.ShowCatTLCustom(Format(Theme.SongJumpto.CatText, [Button[0].Text[0].Text]));
+ end;
+
+
+ //Set visSongs
+ VisSongs := Count;
+
+ //Fix SongSelection
+ ScreenSong.Interaction := high(CatSongs.Song);
+ ScreenSong.SelectNext;
+ ScreenSong.FixSelected;
+
+ //Play Correct Music
+ if (ScreenSong.Interaction <> LastPlayed) then
+ begin
+ LastPlayed := ScreenSong.Interaction;
+
+ ScreenSong.ChangeMusic;
+ end;
+end;
+
+end.
diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas
new file mode 100644
index 00000000..880e3855
--- /dev/null
+++ b/Game/Code/Screens/UScreenSongMenu.pas
@@ -0,0 +1,661 @@
+unit UScreenSongMenu;
+
+interface
+
+uses
+ UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes;
+
+type
+ TScreenSongMenu = class(TMenu)
+ private
+ CurMenu: Byte; //Num of the cur. Shown Menu
+ ID: String; //for help-system
+
+ 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, UDatabase, UScreenSong, UVideo, ULog, UIni, UTexture, ULanguage, UParty, UPlaylist, USongs, UHelp;
+
+function TScreenSongMenu.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+var
+ 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);
+
+ 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_TAB:
+ begin
+ Help.SetHelpID(ID);
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_V:
+ begin
+ if UVideo.VideoOpened then
+ begin
+ if ScreenSong.VidVis=full then
+ ScreenSong.VidVis:=windowed
+ else begin
+ ScreenSong.VidVis:=full;
+ UVideo.SetAspectCorrection(TAspectCorrection(
+ DataBase.GetAspect(CatSongs.Song[Interaction].Artist,
+ CatSongs.Song[Interaction].Title, Ini.AspectCorrect)));
+ ScreenSong.AspectHandler.changed := true;
+ ScreenSong.AspectHandler.change_time := Czas.Teraz;
+ end;
+ Visible := False;
+ end;
+ end;
+
+ 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, SDL_ModState)
+ end;
+ end;
+ end;
+ SDLK_2:
+ begin //Jocker
+ //Joker spielen
+ case CurMenu of
+ SM_Party_Main:
+ begin
+ ScreenSong.DoJoker(1, SDL_ModState)
+ end;
+ end;
+ end;
+ SDLK_3:
+ begin //Jocker
+ //Joker spielen
+ case CurMenu of
+ SM_Party_Main:
+ begin
+ ScreenSong.DoJoker(2, SDL_ModState)
+ 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
+ ID := 'ID_032';
+ 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
+ ID := 'ID_032';
+ 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
+ ID := 'ID_032';
+ 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
+ ID := 'ID_032';
+ 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
+ ID := 'ID_032';
+ 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
+ ID := 'ID_032';
+ 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
+ ID := 'ID_032';
+ 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
+ ID := 'ID_033';
+ 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
+ ID := 'ID_033';
+ 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;
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenSongMenu)');
+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
+ if not ScreenSong.PartyMedley then
+ begin
+ ScreenSong.StartSong;
+ Visible := False;
+ end else
+ ScreenSong.StartMedley(5, msCalculated);
+ 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, 0);
+ end;
+
+ 1: //Button 2
+ begin
+ //Joker Team 2
+ ScreenSong.DoJoker(1, 0);
+ end;
+
+ 2: //Button 3
+ begin
+ //Joker Team 3
+ ScreenSong.DoJoker(2, 0);
+ 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/UScreenStatDetail.pas b/Game/Code/Screens/UScreenStatDetail.pas
new file mode 100644
index 00000000..452c5cc2
--- /dev/null
+++ b/Game/Code/Screens/UScreenStatDetail.pas
@@ -0,0 +1,259 @@
+unit UScreenStatDetail;
+
+interface
+
+uses
+ UMenu, SDL, SysUtils, UDisplay, UMusic, UIni, UThemes;
+
+type
+ TScreenStatDetail = class(TMenu)
+ const
+ ID='ID_027'; //for help system
+
+ 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, UHelp;
+
+function TScreenStatDetail.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE:
+ 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;
+
+ 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
+ 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]);
+
+ Interaction := 0;
+ Typ := 0;
+end;
+
+procedure TScreenStatDetail.onShow;
+begin
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenStatDetail)');
+ //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,
+ Result[I].Date])
+ 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,
+ Result[I].SungTimes])
+ 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..8f5c3cd1
--- /dev/null
+++ b/Game/Code/Screens/UScreenStatMain.pas
@@ -0,0 +1,235 @@
+unit UScreenStatMain;
+
+interface
+
+uses
+ UMenu, SDL, SysUtils, UDisplay, UMusic, UIni, UThemes;
+
+type
+ TScreenStatMain = class(TMenu)
+ const
+ ID='ID_028'; //for help system
+
+ 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, UHelp;
+
+function TScreenStatMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ 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;
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenStatMain)');
+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. \ No newline at end of file
diff --git a/Game/Code/Screens/UScreenTop.pas b/Game/Code/Screens/UScreenTop.pas
new file mode 100644
index 00000000..340fe2ad
--- /dev/null
+++ b/Game/Code/Screens/UScreenTop.pas
@@ -0,0 +1,210 @@
+unit UScreenTop;
+
+interface
+
+uses
+ UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes, ULCD, ModiSDK;
+
+type
+ TScreenTop = class(TMenu)
+ const
+ ID='ID_029'; //for help system
+
+ public
+ TextLevel: integer;
+ TextArtistTitle: integer;
+
+ DifficultyShow: integer; //TODO
+ TeamInfo : TTeamInfo; //for M2-MOD
+
+ StaticNumber: array[1..8] of integer;
+ TextNumber: array[1..8] of integer;
+ TextName: array[1..8] of integer;
+ TextScore: array[1..8] of integer;
+ TextDate: array[1..8] of integer;
+
+ Fadeout: boolean;
+ constructor Create; override;
+ function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
+ procedure onShow; override;
+ function Draw: boolean; override;
+ //procedure DrawScores(difficulty: integer); TODO
+ end;
+
+implementation
+
+uses UGraphic, UDataBase, UMain, UIni, UPartyM2, DateUtils, UHelp, ULog;
+
+function TScreenTop.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then begin
+ case PressedKey of
+ SDLK_TAB:
+ begin
+ ScreenPopupHelp.ShowPopup();
+ end;
+
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE,
+ SDLK_RETURN:
+ begin
+ if (not Fadeout) then begin
+ if(ScreenSong.Mode = smNormal) or (ScreenSong.Mode = smMedley) then
+ FadeTo(@ScreenSong)
+ else
+ begin
+ ScreenSong.SongIndex := -1;
+ Music.FadeStop(Ini.PreviewFading);
+ FadeTo(@ScreenPartyNewRoundM2);
+ end;
+ Fadeout := true;
+ end;
+ end;
+ SDLK_SYSREQ:
+ begin
+ Display.PrintScreen;
+ end;
+ end;
+ end;
+end;
+
+constructor TScreenTop.Create;
+var
+ I: integer;
+begin
+ inherited Create;
+
+ LoadFromTheme(Theme.Top);
+
+
+ TextLevel := AddText(Theme.Top.TextLevel);
+ TextArtistTitle := AddText(Theme.Top.TextArtistTitle);
+
+ for I := 0 to 7 do
+ StaticNumber[I+1] := AddStatic(Theme.Top.StaticNumber[I]);
+
+ for I := 0 to 7 do
+ TextNumber[I+1] := AddText(Theme.Top.TextNumber[I]);
+ for I := 0 to 7 do
+ TextName[I+1] := AddText(Theme.Top.TextName[I]);
+ for I := 0 to 7 do
+ TextScore[I+1] := AddText(Theme.Top.TextScore[I]);
+ for I := 0 to 7 do
+ TextDate[I+1] := AddText(Theme.Top.TextDate[I]);
+
+end;
+
+procedure TScreenTop.onShow;
+var
+ I: integer;
+ PMax: integer;
+ sung: boolean;
+ TimeStamp: integer;
+begin
+ if not Help.SetHelpID(ID) then
+ Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenTop)');
+
+ Fadeout := false;
+ sung:=false;
+ TimeStamp := DateTimeToUnix(Now());
+
+ PMax := PlayersPlay - 1;
+
+ for I := 0 to PMax do
+ begin
+ if(ScreenSong.Mode=smChallenge) then
+ TeamInfo.TeamInfo[I].Score:=Player[I].ScoreTotalI;
+
+ if (Player[I].ScoreTotalI>100) and ScreenSong.SungToEnd and (ScreenSong.Mode<>smMedley) and
+ (not ScreenSong.PartyMedley) then
+ begin
+ DataBase.AddScore(AktSong, Ini.Difficulty, Ini.Name[I], Player[I].ScoreTotalI, TimeStamp);
+ sung := true;
+ end;
+ end;
+
+ if ScreenSong.Mode=smChallenge then
+ begin
+ PartySessionM2.Teams:=TeamInfo;
+ PartySessionM2.EndRound;
+ end;
+
+ if sung then
+ 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[TextDate[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[TextDate[I]].Text := AktSong.Score[Ini.Difficulty, I-1].Date;
+ end;
+
+ for I := Length(AktSong.Score[Ini.Difficulty])+1 to 8 do begin
+ Static[StaticNumber[I]].Visible := false;
+ Text[TextNumber[I]].Visible := false;
+ Text[TextName[I]].Visible := false;
+ Text[TextScore[I]].Visible := false;
+ Text[TextDate[I]].Visible := false;
+ end;
+
+ Text[TextLevel].Text := IDifficulty[Ini.Difficulty];
+end;
+
+function TScreenTop.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.pas b/Game/Code/Screens/UScreenWelcome.pas
new file mode 100644
index 00000000..35e159f8
--- /dev/null
+++ b/Game/Code/Screens/UScreenWelcome.pas
@@ -0,0 +1,118 @@
+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, USkins;
+
+function TScreenWelcome.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then begin
+ case PressedKey of
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ 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.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;
+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.