aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Screens
diff options
context:
space:
mode:
authorjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-09-20 06:36:58 +0000
committerjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-09-20 06:36:58 +0000
commitdb82b7e30a1b58b56fdb4bfc6089b47200ca1da1 (patch)
treeca00bcb8355baf814762e3dfb4932020632667e2 /Game/Code/Screens
parent77ac0ce6d082dfc0bfd2c9a7efaa304aadfe3683 (diff)
downloadusdx-db82b7e30a1b58b56fdb4bfc6089b47200ca1da1.tar.gz
usdx-db82b7e30a1b58b56fdb4bfc6089b47200ca1da1.tar.xz
usdx-db82b7e30a1b58b56fdb4bfc6089b47200ca1da1.zip
Ultrastar-DX now compiles in linux
(using lazarus) Bass etc is commented out.. but it compiles, and im working through the runtime errors. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@408 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Screens')
-rw-r--r--Game/Code/Screens/UScreenCredits.pas2197
-rw-r--r--Game/Code/Screens/UScreenMain.pas554
-rw-r--r--Game/Code/Screens/UScreenSing.pas2492
-rw-r--r--Game/Code/Screens/UScreenSingModi.pas1334
-rw-r--r--Game/Code/Screens/UScreenSong.pas4047
-rw-r--r--Game/Code/Screens/UScreenSongMenu.pas1251
-rw-r--r--Game/Code/Screens/UScreenStatMain.pas516
7 files changed, 6265 insertions, 6126 deletions
diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas
index 3b1efc6e..b931f461 100644
--- a/Game/Code/Screens/UScreenCredits.pas
+++ b/Game/Code/Screens/UScreenCredits.pas
@@ -1,1092 +1,1105 @@
-unit UScreenCredits;
-
-interface
-
-uses
- UMenu, SDL, UDisplay, UTexture, OpenGL12, UMusic, UFiles, SysUtils, UThemes, ULCD, ULight, UGraphicClasses;
-
-type
- TCreditsStages=(InitialDelay,Intro,MainPart,Outro);
-
- TScreenCredits = class(TMenu)
- public
-
- Credits_X: Real;
- Credits_Time: Cardinal;
- Credits_Alpha: Cardinal;
- CTime: Cardinal;
- CTime_hold: Cardinal;
- ESC_Alpha: Integer;
-
- credits_entry_tex: TTexture;
- credits_entry_dx_tex: TTexture;
- credits_bg_tex: TTexture;
- credits_bg_ovl: TTexture;
-// credits_bg_logo: TTexture;
- credits_bg_scrollbox_left: TTexture;
- credits_blindguard: TTexture;
- credits_blindy: TTexture;
- credits_canni: TTexture;
- credits_commandio: TTexture;
- credits_lazyjoker: TTexture;
- credits_mog: TTexture;
- credits_mota: TTexture;
- credits_skillmaster: TTexture;
- credits_whiteshark: TTexture;
- intro_layer01: TTexture;
- intro_layer02: TTexture;
- intro_layer03: TTexture;
- intro_layer04: TTexture;
- intro_layer05: TTexture;
- intro_layer06: TTexture;
- intro_layer07: TTexture;
- intro_layer08: TTexture;
- intro_layer09: TTexture;
- outro_bg: TTexture;
- outro_esc: TTexture;
- outro_exd: TTexture;
-
- deluxe_slidein: cardinal;
-
- CurrentScrollText: String;
- NextScrollUpdate: Real;
- EndofLastScrollingPart: Cardinal;
- CurrentScrollStart, CurrentScrollEnd: Integer;
-
- CRDTS_Stage: TCreditsStages;
-
- myTex: glUint;
-
- Fadeout: boolean;
- constructor Create; override;
- function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
- function Draw: boolean; override;
- procedure onShow; override;
- procedure onHide; override;
- procedure DrawCredits;
- procedure Draw_FunkyText;
- end;
-
-const
- Funky_Text: AnsiString =
- 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+
- 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+
- 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+
- 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..';
-
-
- Timings: array[0..21] of Cardinal=(
- 20, // 0 Delay vor Start
-
- 149, // 1 Ende erster Intro Zoom
- 155, // 2 Start 2. Action im Intro
- 170, // 3 Ende Separation im Intro
- 271, // 4 Anfang Zoomout im Intro
- 0, // 5 unused
- 261, // 6 Start fade-to-white im Intro
-
- 271, // 7 Start Main Part
- 280, // 8 Start On-Beat-Sternchen Main Part
-
- 396, // 9 Start BlindGuard
- 666, // 10 Start blindy
- 936, // 11 Start Canni
- 1206, // 12 Start Commandio
- 1476, // 13 Start LazyJoker
- 1746, // 14 Start Mog
- 2016, // 15 Start Mota
- 2286, // 16 Start SkillMaster
- 2556, // 17 Start WhiteShark
- 2826, // 18 Ende Whiteshark
- 3096, // 19 Start FadeOut Mainscreen
- 3366, // 20 Ende Credits Tune
- 60); // 21 start flare im intro
-
-implementation
-
-uses Windows,
- UGraphic,
- UMain,
- UIni,
- USongs,
- Textgl,
- ULanguage,
- UCommon,
- Math;
-
-
-function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
-begin
- Result := true;
- If (PressedDown) Then
- begin // Key Down
- case PressedKey of
-
- SDLK_ESCAPE,
- SDLK_BACKSPACE :
- begin
- FadeTo(@ScreenMain);
- Music.PlayBack;
- end;
-{ SDLK_SPACE:
- begin
- setlength(CTime_hold,length(CTime_hold)+1);
- CTime_hold[high(CTime_hold)]:=CTime;
- end;
-}
- end;//esac
- end; //fi
-end;
-
-constructor TScreenCredits.Create;
-begin
- inherited Create;
- credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0);
- credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0);
-
- credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', 'PNG', 'Font Black', 0);
- credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0);
- credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0);
- credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', 'PNG', 'Font Black', 0);
- credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', 'PNG', 'Font Black', 0);
- credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', 'Font Black', 0);
- credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', 'PNG', 'Font Black', 0);
- credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', 'PNG', 'Font Black', 0);
- credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', 'PNG', 'Font Black', 0);
-
- intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', 'PNG', 'Transparent', 0);
- intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', 'PNG', 'Transparent', 0);
- intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', 'PNG', 'Transparent', 0);
- intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', 'PNG', 'Transparent', 0);
- intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', 'PNG', 'Transparent', 0);
- intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', 'PNG', 'Transparent', 0);
- intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', 'PNG', 'Transparent', 0);
- intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', 'PNG', 'Transparent', 0);
- intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', 'PNG', 'Transparent', 0);
-
- outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0);
- outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0);
- outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Transparent', 0);
-
- CRDTS_Stage:=InitialDelay;
-end;
-
-function TScreenCredits.Draw: boolean;
-begin
- DrawCredits;
- Draw:=true;
-end;
-
-procedure TScreenCredits.onShow;
-begin
- CRDTS_Stage:=InitialDelay;
- Credits_X := 580;
- deluxe_slidein := 0;
- Credits_Alpha := 0;
- //Music.SetLoop(true); Loop looped ned, so ne scheisse
- Music.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!!
-// Music.Play;
- CTime:=0;
-// setlength(CTime_hold,0);
-end;
-
-procedure TScreenCredits.onHide;
-begin
- Music.Stop;
-end;
-
-Procedure TScreenCredits.Draw_FunkyText;
-var
- S: Integer;
- X,Y,A: Real;
- visibleText: PChar;
-begin
- SetFontSize(10);
- //Init ScrollingText
- if (CTime = Timings[7]) then
- begin
- //Set Position of Text
- Credits_X := 600;
- CurrentScrollStart:=1;
- CurrentScrollEnd:=1;
- end;
-
- if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then
- begin
- X:=0;
- visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd));
- for S := 0 to length(visibleText)-1 do begin
- Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi));
- SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000);
- A:=0;
- if (Credits_X+X < 15) then A:=0;
- if (Credits_X+X >=15) then A:=Credits_X+X-15;
- if Credits_X+X > 32 then A:=17;
- glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17);
- glPrintLetter(visibleText[S]);
- X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW;
- end;
- if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin
- Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW;
- inc(CurrentScrollStart);
- end;
- visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd));
- if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin
- inc(CurrentScrollEnd);
- end;
- end;
-{ // timing hack
- X:=5;
- SetFontStyle (2);
- SetFontItalic(False);
- SetFontSize(9);
- glColor4f(1, 1, 1, 1);
- for S:=0 to high(CTime_hold) do begin
- visibleText:=pchar(inttostr(CTime_hold[S]));
- SetFontPos (500, X);
- glPrint (Addr(visibleText[0]));
- X:=X+20;
- end;}
-end;
-
-procedure Start3D;
-begin
- glMatrixMode(GL_PROJECTION);
- glPushMatrix;
- glLoadIdentity;
- glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity;
-end;
-procedure End3D;
-begin
- glMatrixMode(GL_PROJECTION);
- glPopMatrix;
- glMatrixMode(GL_MODELVIEW);
-end;
-
-procedure TScreenCredits.DrawCredits;
-var
- T,I: Cardinal;
- X: Real;
- Ver: PChar;
- RuntimeStr: AnsiString;
- Data: TFFTData;
- j,k,l:cardinal;
- f,g,h: Real;
- STime:cardinal;
- Delay:cardinal;
-
- myPixel: longword;
- myColor: Cardinal;
- myScale: Real;
- myAngle: Real;
-
-
-const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24),
- (154,31),(156,58),(168,32),(203,36),
- (258,34),(251,50),(274,93),(294,84),
- (232,54),(278,62),(319,34),(336,92),
- (347,23),(374,32),(377,58),(361,83),
- (385,91),(405,91),(429,35),(423,51),
- (450,32),(485,34),(444,91),(486,93));
-
-begin
-//dis does teh muiwk y0r
-Data := Music.GetFFTData;
-
-
-
- T := GetTickCount div 33;
- if T <> Credits_Time then
- begin
- Credits_Time := T;
- inc(CTime);
- inc(CTime_hold);
- Credits_X := Credits_X-2;
- if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then
- begin
-// CTime:=Timings[20];
-// CRDTS_Stage:=Outro;
-
- CRDTS_Stage:=Intro;
- CTime:=0;
- Music.Play;
-
- end;
- if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then
- begin
- CRDTS_Stage:=MainPart;
- end;
- if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then
- begin
- CRDTS_Stage:=Outro;
- end;
- end;
-
- //draw background
- if CRDTS_Stage=InitialDelay then
- begin
- glClearColor(0,0,0,0);
- glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
- end
- else
- if CRDTS_Stage=Intro then
- begin
- Start3D;
- glPushMatrix;
-
- glClearColor(0,0,0,0);
- glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
-
- glEnable(GL_TEXTURE_2D);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
-
- if CTime < Timings[1] then begin
- myScale:= 0.5+0.5*(Timings[1]-CTime)/(Timings[1]); // slowly move layers together
- myAngle:=cos((CTime)*pi/((Timings[1])*2)); // and make logo face towards camera
- end else begin // this is the part when the logo stands still
- myScale:=0.5;
- myAngle:=0;
- end;
- if CTime > Timings[2] then begin
- myScale:= 0.5+0.5*(CTime-Timings[2])/(Timings[3]-Timings[2]); // get some space between layers
- myAngle:=0;
- end;
-// if CTime > Timings[3] then myScale:=1; // keep the space between layers
- glTranslatef(0,0,-5+0.5*myScale);
- if CTime > Timings[3] then myScale:=1; // keep the space between layers
- if CTime > Timings[3] then begin // make logo rotate left and grow
-// myScale:=(CTime-Timings[4])/(Timings[7]-Timings[4]);
- glRotatef(20*sqr(CTime-Timings[3])/sqr((Timings[7]-Timings[3])/2),0,0,1);
- glScalef(1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1);
- end;
- if CTime < Timings[2] then
- glRotatef(30*myAngle,0.5*myScale+myScale,1+myScale,0);
-// glScalef(0.5,0.5,0.5);
- glScalef(4/3,-1,1);
- glColor4f(1, 1, 1, 1);
-
- glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex3f(-1, -1, -0.4 * myScale);
- glTexCoord2f(0,1);glVertex3f(-1, 1, -0.4 * myScale);
- glTexCoord2f(1,1); glVertex3f(1, 1, -0.4 * myScale);
- glTexCoord2f(1,0);glVertex3f(1, -1, -0.4 * myScale);
- glEnd;
- glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex3f(-1, -1, -0.3 * myScale);
- glTexCoord2f(0,1);glVertex3f(-1, 1, -0.3 * myScale);
- glTexCoord2f(1,1); glVertex3f(1, 1, -0.3 * myScale);
- glTexCoord2f(1,0);glVertex3f(1, -1, -0.3 * myScale);
- glEnd;
- glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex3f(-1, -1, -0.2 * myScale);
- glTexCoord2f(0,1);glVertex3f(-1, 1, -0.2 * myScale);
- glTexCoord2f(1,1); glVertex3f(1, 1, -0.2 * myScale);
- glTexCoord2f(1,0);glVertex3f(1, -1, -0.2 * myScale);
- glEnd;
- glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex3f(-1, -1, -0.1 * myScale);
- glTexCoord2f(0,1);glVertex3f(-1, 1, -0.1 * myScale);
- glTexCoord2f(1,1); glVertex3f(1, 1, -0.1 * myScale);
- glTexCoord2f(1,0);glVertex3f(1, -1, -0.1 * myScale);
- glEnd;
- glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex3f(-1, -1, 0 * myScale);
- glTexCoord2f(0,1);glVertex3f(-1, 1, 0 * myScale);
- glTexCoord2f(1,1); glVertex3f(1, 1, 0 * myScale);
- glTexCoord2f(1,0);glVertex3f(1, -1, 0 * myScale);
- glEnd;
- glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex3f(-1, -1, 0.1 * myScale);
- glTexCoord2f(0,1);glVertex3f(-1, 1, 0.1 * myScale);
- glTexCoord2f(1,1); glVertex3f(1, 1, 0.1 * myScale);
- glTexCoord2f(1,0);glVertex3f(1, -1, 0.1 * myScale);
- glEnd;
- glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex3f(-1, -1, 0.2 * myScale);
- glTexCoord2f(0,1);glVertex3f(-1, 1, 0.2 * myScale);
- glTexCoord2f(1,1); glVertex3f(1, 1, 0.2 * myScale);
- glTexCoord2f(1,0);glVertex3f(1, -1, 0.2 * myScale);
- glEnd;
- glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex3f(-1, -1, 0.3 * myScale);
- glTexCoord2f(0,1);glVertex3f(-1, 1, 0.3 * myScale);
- glTexCoord2f(1,1); glVertex3f(1, 1, 0.3 * myScale);
- glTexCoord2f(1,0);glVertex3f(1, -1, 0.3 * myScale);
- glEnd;
- glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex3f(-1, -1, 0.22 * myScale);
- glTexCoord2f(0,1);glVertex3f(-1, 1, 0.22 * myScale);
- glTexCoord2f(1,1); glVertex3f(1, 1, 0.22 * myScale);
- glTexCoord2f(1,0);glVertex3f(1, -1, 0.22 * myScale);
- glEnd;
- gldisable(gl_texture_2d);
- glDisable(GL_BLEND);
-
- glPopMatrix;
- End3D;
-
- // do some sparkling effects
- if (CTime < Timings[1]) and (CTime > Timings[21]) then
- begin
- for k:=1 to 3 do begin
- l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5);
- j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301);
- GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0);
- end;
- end;
-
- // fade to white at end
- if Ctime > Timings[6] then
- begin
- glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6]));
- glEnable(GL_BLEND);
- glBegin(GL_QUADS);
- glVertex2f(0,0);
- glVertex2f(0,600);
- glVertex2f(800,600);
- glVertex2f(800,0);
- glEnd;
- glDisable(GL_BLEND);
- end;
-
- end;
- if (CRDTS_Stage=MainPart) then
- // main credits screen background, scroller, logo and girl
- begin
-
- glEnable(GL_TEXTURE_2D);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
-
- glColor4f(1, 1, 1, 1);
- glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(0, 0);
- glTexCoord2f(0,600/1024);glVertex2f(0, 600);
- glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600);
- glTexCoord2f(800/1024,0);glVertex2f(800, 0);
- glEnd;
- glDisable(GL_TEXTURE_2D);
- glDisable(GL_BLEND);
-
- // draw scroller
- Draw_FunkyText;
-
-//#########################################################################
-// draw credits names
-
-// BlindGuard (von links oben reindrehen, nach rechts unten rausdrehen)
- STime:=Timings[9]-10;
- Delay:=Timings[10]-Timings[9];
- if CTime > STime then
- begin
- k:=0;
- ESC_Alpha:=20;
- for j:=0 to 40 do
- if Data[j]>=Data[k] then k:=j;
- if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha);
- if ESC_Alpha >20 then ESC_Alpha:=20;
- if ((CTime-STime)<20) then ESC_Alpha:=20;
- if CTime <=STime+10 then j:=CTime-STime else j:=10;
- if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0;
- glColor4f(1, 1, 1, ESC_Alpha/20*j/10);
-
- if (CTime >= STime+10) and (CTime<=STime+12) then begin
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- end;
-
- glPushMatrix;
- gltranslatef(0,329,0);
- if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end;
- gltranslatef(223,0,0);
- if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin
- gltranslatef(223,0,0);
- glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1);
- gltranslatef(-223,0,0);
- end;
- glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glEnable(GL_TEXTURE_2D);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(-163, -129);
- glTexCoord2f(0,1);glVertex2f(-163, 129);
- glTexCoord2f(1,1); glVertex2f(163, 129);
- glTexCoord2f(1,0);glVertex2f(163, -129);
- glEnd;
- gldisable(gl_texture_2d);
- gldisable(GL_BLEND);
- glPopMatrix;
- end;
-
-// Blindy (zoom von 0 auf volle grösse und drehung, zoom auf doppelte grösse und nach rechts oben schieben)
- STime:=Timings[10]-10;
- Delay:=Timings[11]-Timings[10]+5;
- if CTime > STime then
- begin
- k:=0;
- ESC_Alpha:=20;
- for j:=0 to 40 do
- if Data[j]>=Data[k] then k:=j;
- if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha);
- if ESC_Alpha >20 then ESC_Alpha:=20;
- if ((CTime-STime)<20) then ESC_Alpha:=20;
- if CTime <=STime+10 then j:=CTime-STime else j:=10;
- if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0;
- glColor4f(1, 1, 1, ESC_Alpha/20*j/10);
-
- if (CTime >= STime+20) and (CTime<=STime+22) then begin
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- end;
-
- glPushMatrix;
- gltranslatef(223,329,0);
- if CTime <= STime+20 then begin
- j:=CTime-Stime;
- glscalef(j*j/400,j*j/400,j*j/400);
- glrotatef(j*18.0,0,0,1);
- end;
- if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin
- j:=CTime-(STime+Delay-10);
- f:=j*10.0;
- gltranslatef(f*3,-f,0);
- glscalef(1+j/10,1+j/10,1+j/10);
- glrotatef(j*9.0,0,0,1);
- end;
- glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glEnable(GL_TEXTURE_2D);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(-163, -129);
- glTexCoord2f(0,1);glVertex2f(-163, 129);
- glTexCoord2f(1,1); glVertex2f(163, 129);
- glTexCoord2f(1,0);glVertex2f(163, -129);
- glEnd;
- gldisable(gl_texture_2d);
- gldisable(GL_BLEND);
- glPopMatrix;
- end;
-
-// Canni (von links reinschieben, nach rechts oben rausschieben)
- STime:=Timings[11]-10;
- Delay:=Timings[12]-Timings[11]+5;
- if CTime > STime then
- begin
- k:=0;
- ESC_Alpha:=20;
- for j:=0 to 40 do
- if Data[j]>=Data[k] then k:=j;
- if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha);
- if ESC_Alpha >20 then ESC_Alpha:=20;
- if ((CTime-STime)<20) then ESC_Alpha:=20;
- if CTime <=STime+10 then j:=CTime-STime else j:=10;
- if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0;
- glColor4f(1, 1, 1, ESC_Alpha/20*j/10);
-
- if (CTime >= STime+10) and (CTime<=STime+12) then begin
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- end;
-
- glPushMatrix;
- gltranslatef(223,329,0);
- if CTime <= STime+10 then begin
- gltranslatef(((CTime-STime)*21.0)-210,0,0);
- end;
- if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin
- j:=(CTime-(STime+Delay-10))*21;
- gltranslatef(j,-j/2,0);
- end;
- glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glEnable(GL_TEXTURE_2D);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(-163, -129);
- glTexCoord2f(0,1);glVertex2f(-163, 129);
- glTexCoord2f(1,1); glVertex2f(163, 129);
- glTexCoord2f(1,0);glVertex2f(163, -129);
- glEnd;
- gldisable(gl_texture_2d);
- gldisable(GL_BLEND);
- glPopMatrix;
- end;
-
-// Commandio (von unten reinklappen, nach rechts oben rausklappen)
- STime:=Timings[12]-10;
- Delay:=Timings[13]-Timings[12];
- if CTime > STime then
- begin
- k:=0;
- ESC_Alpha:=20;
- for j:=0 to 40 do
- if Data[j]>=Data[k] then k:=j;
- if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha);
- if ESC_Alpha >20 then ESC_Alpha:=20;
- if ((CTime-STime)<20) then ESC_Alpha:=20;
- if CTime <=STime+10 then j:=CTime-STime else j:=10;
- if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0;
- glColor4f(1, 1, 1, ESC_Alpha/20*j/10);
-
- if (CTime >= STime+10) and (CTime<=STime+12) then begin
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- end;
-
- glPushMatrix;
- gltranslatef(223,329,0);
- if CTime <= STime+10 then
- f:=258.0-25.8*(CTime-STime)
- else
- f:=0;
- g:=0;
- if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin
- j:=CTime-(STime+Delay-10);
- g:=32.6*j;
- end;
- glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glEnable(GL_TEXTURE_2D);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(-163+g-f*1.5, -129+f*1.5-g/2);
- glTexCoord2f(0,1);glVertex2f(-163+g*1.5, 129-(g*1.5*258/326));
- glTexCoord2f(1,1); glVertex2f(163+g, 129+g/4);
- glTexCoord2f(1,0);glVertex2f(163+f*1.5+g/4, -129+f*1.5-g/4);
- glEnd;
- gldisable(gl_texture_2d);
- gldisable(GL_BLEND);
- glPopMatrix;
- end;
-
-// lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing)
- STime:=Timings[13]-35;
- Delay:=Timings[14]-Timings[13]+5;
- if CTime > STime then
- begin
- k:=0;
- for j:=0 to 40 do
- if Data[j]>=Data[k] then k:=j;
- if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha);
- if ESC_Alpha >20 then ESC_Alpha:=20;
- if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20;
- ESC_Alpha:=10;
- f:=CTime-STime;
- if CTime <=STime+40 then j:=CTime-STime else j:=40;
- if (CTime >=STime+Delay-40) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0;
- glColor4f(1, 1, 1, ESC_Alpha/20*j*j/1600);
-
- glPushMatrix;
- gltranslatef(180+(f-70),329,0);
- glBindTexture(GL_TEXTURE_2D, credits_lazyjoker.TexNum);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glEnable(GL_TEXTURE_2D);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(-163, -129);
- glTexCoord2f(0,1);glVertex2f(-163, 129);
- glTexCoord2f(1,1); glVertex2f(163, 129);
- glTexCoord2f(1,0);glVertex2f(163, -129);
- glEnd;
- gldisable(gl_texture_2d);
- gldisable(GL_BLEND);
- glPopMatrix;
- end;
-
-// Mog (von links reinklappen, nach rechts unten rausklappen)
- STime:=Timings[14]-10;
- Delay:=Timings[15]-Timings[14]+5;
- if CTime > STime then
- begin
- k:=0;
- ESC_Alpha:=20;
- for j:=0 to 40 do
- if Data[j]>=Data[k] then k:=j;
- if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha);
- if ESC_Alpha >20 then ESC_Alpha:=20;
- if ((CTime-STime)<20) then ESC_Alpha:=20;
- if CTime <=STime+10 then j:=CTime-STime else j:=10;
- if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0;
- glColor4f(1, 1, 1, ESC_Alpha/20*j/10);
-
- if (CTime >= STime+10) and (CTime<=STime+12) then begin
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- end;
-
- glPushMatrix;
- gltranslatef(223,329,0);
- if CTime <= STime+10 then
- f:=326.0-32.6*(CTime-STime)
- else
- f:=0;
-
- g:=0;
- if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin
- j:=CTime-(STime+Delay-10);
- g:=32.6*j;
- end;
- glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glEnable(GL_TEXTURE_2D);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(-163+g*1.5, -129+g*1.5);
- glTexCoord2f(0,1);glVertex2f(-163+g*1.2, 129+g);
- glTexCoord2f(1,1); glVertex2f(163-f+g/2, 129+f*1.5+g/4);
- glTexCoord2f(1,0);glVertex2f(163-f+g*1.5, -129-f*1.5);
- glEnd;
- gldisable(gl_texture_2d);
- gldisable(GL_BLEND);
- glPopMatrix;
- end;
-
-// Mota (von rechts oben reindrehen, nach links unten rausschieben und verkleinern und dabei drehen)
- STime:=Timings[15]-10;
- Delay:=Timings[16]-Timings[15]+5;
- if CTime > STime then
- begin
- k:=0;
- ESC_Alpha:=20;
- for j:=0 to 40 do
- if Data[j]>=Data[k] then k:=j;
- if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha);
- if ESC_Alpha >20 then ESC_Alpha:=20;
- if ((CTime-STime)<20) then ESC_Alpha:=20;
- if CTime <=STime+10 then j:=CTime-STime else j:=10;
- if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0;
- glColor4f(1, 1, 1, ESC_Alpha/20*j/10);
-
- if (CTime >= STime+10) and (CTime<=STime+12) then begin
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- end;
-
- glPushMatrix;
- gltranslatef(223,329,0);
- if CTime <= STime+10 then begin
- gltranslatef(223,0,0);
- glrotatef((10-(CTime-STime))*9,0,0,1);
- gltranslatef(-223,0,0);
- end;
- if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin
- j:=CTime-(STime+Delay-10);
- f:=j*10.0;
- gltranslatef(-f*2,-f,0);
- glscalef(1-j/10,1-j/10,1-j/10);
- glrotatef(-j*9.0,0,0,1);
- end;
- glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glEnable(GL_TEXTURE_2D);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(-163, -129);
- glTexCoord2f(0,1);glVertex2f(-163, 129);
- glTexCoord2f(1,1); glVertex2f(163, 129);
- glTexCoord2f(1,0);glVertex2f(163, -129);
- glEnd;
- gldisable(gl_texture_2d);
- gldisable(GL_BLEND);
- glPopMatrix;
- end;
-
-// Skillmaster (von rechts unten reinschieben, nach rechts oben rausdrehen)
- STime:=Timings[16]-10;
- Delay:=Timings[17]-Timings[16]+5;
- if CTime > STime then
- begin
- k:=0;
- ESC_Alpha:=20;
- for j:=0 to 40 do
- if Data[j]>=Data[k] then k:=j;
- if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha);
- if ESC_Alpha >20 then ESC_Alpha:=20;
- if ((CTime-STime)<20) then ESC_Alpha:=20;
- if CTime <=STime+10 then j:=CTime-STime else j:=10;
- if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0;
- glColor4f(1, 1, 1, ESC_Alpha/20*j/10);
-
- if (CTime >= STime+10) and (CTime<=STime+12) then begin
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- end;
-
- glPushMatrix;
- gltranslatef(223,329,0);
- if CTime <= STime+10 then begin
- j:=STime+10-CTime;
- f:=j*10.0;
- gltranslatef(+f*2,+f/2,0);
- end;
- if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin
- j:=CTime-(STime+Delay-10);
- gltranslatef(0,-223,0);
- glrotatef(integer(j)*-9,0,0,1);
- gltranslatef(0,223,0);
- glrotatef(j*9,0,0,1);
- end;
- glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glEnable(GL_TEXTURE_2D);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(-163, -129);
- glTexCoord2f(0,1);glVertex2f(-163, 129);
- glTexCoord2f(1,1); glVertex2f(163, 129);
- glTexCoord2f(1,0);glVertex2f(163, -129);
- glEnd;
- gldisable(gl_texture_2d);
- gldisable(GL_BLEND);
- glPopMatrix;
- end;
-
-// WhiteShark (von links unten reinklappen, nach rechts oben rausklappen)
- STime:=Timings[17]-10;
- Delay:=Timings[18]-Timings[17];
- if CTime > STime then
- begin
- k:=0;
- ESC_Alpha:=20;
- for j:=0 to 40 do
- if Data[j]>=Data[k] then k:=j;
- if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha);
- if ESC_Alpha >20 then ESC_Alpha:=20;
- if ((CTime-STime)<20) then ESC_Alpha:=20;
- if CTime <=STime+10 then j:=CTime-STime else j:=10;
- if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0;
- glColor4f(1, 1, 1, ESC_Alpha/20*j/10);
-
- if (CTime >= STime+10) and (CTime<=STime+12) then begin
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
- GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
- end;
-
- glPushMatrix;
- gltranslatef(223,329,0);
- if CTime <= STime+10 then
- f:=326.0-32.6*(CTime-STime)
- else
- f:=0;
-
- if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin
- j:=CTime-(STime+Delay-10);
- g:=32.6*j;
- end else
- g:=0;
- glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glEnable(GL_TEXTURE_2D);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2);
- glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4);
- glTexCoord2f(1,1); glVertex2f(163-f*1.2+g/4, 129+f/2-g/4);
- glTexCoord2f(1,0);glVertex2f(163-f*1.5+g/4, -129+f*1.5+g/4);
- glEnd;
- gldisable(gl_texture_2d);
- gldisable(GL_BLEND);
- glPopMatrix;
- end;
-
-
-// ####################################################################
-// do some twinkle stuff (kinda on beat)
- if (CTime>Timings[8]) and (CTime < Timings[19]) then begin
- k:=0;
- for j:=0 to 40 do
- if Data[j]>=Data[k] then k:=j;
- if Data[k]>0.2 then begin
- l:=RandomRange(6,16);
- j:=RandomRange(0,27);
- GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0);
- end;
- end;
-
-//#################################################
-// draw the rest of the main screen (girl and logo
- glEnable(GL_TEXTURE_2D);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glColor4f(1, 1, 1, 1);
- glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(800-393, 0);
- glTexCoord2f(0,600/1024);glVertex2f(800-393, 600);
- glTexCoord2f(393/512,600/1024); glVertex2f(800, 600);
- glTexCoord2f(393/512,0);glVertex2f(800, 0);
- glEnd;
-{ glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(0, 0);
- glTexCoord2f(0,112/128);glVertex2f(0, 112);
- glTexCoord2f(497/512,112/128); glVertex2f(497, 112);
- glTexCoord2f(497/512,0);glVertex2f(497, 0);
- glEnd;
-}
- gldisable(gl_texture_2d);
- glDisable(GL_BLEND);
-
- // fade out at end of main part
- if Ctime > Timings[19] then
- begin
- glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19]));
- glEnable(GL_BLEND);
- glBegin(GL_QUADS);
- glVertex2f(0,0);
- glVertex2f(0,600);
- glVertex2f(800,600);
- glVertex2f(800,0);
- glEnd;
- glDisable(GL_BLEND);
- end;
- end
- else
- if (CRDTS_Stage=Outro) then
- begin
- if CTime=Timings[20] then begin
- CTime_hold:=0;
- Music.Stop;
- Music.Open(soundpath + 'credits-outro-tune.mp3');
- Music.Play;
- Music.SetVolume(20);
- Music.SetLoop(True);
- end;
- if CTime_hold > 231 then begin
- Music.Play;
- Ctime_hold:=0;
- end;
- glClearColor(0,0,0,0);
- glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
-
- // do something useful
- // outro background
- glEnable(GL_TEXTURE_2D);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
-
- glColor4f(1, 1, 1, 1);
- glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(0, 0);
- glTexCoord2f(0,600/1024);glVertex2f(0, 600);
- glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600);
- glTexCoord2f(800/1024,0);glVertex2f(800, 0);
- glEnd;
-
- //outro overlays
- glColor4f(1, 1, 1, (1+sin(CTime/15))/3+1/3);
- glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(0, 0);
- glTexCoord2f(0,223/256);glVertex2f(0, 223);
- glTexCoord2f(487/512,223/256); glVertex2f(487, 223);
- glTexCoord2f(487/512,0);glVertex2f(487, 0);
- glEnd;
-
- ESC_Alpha:=20;
- if (RandomRange(0,20) > 18) and (ESC_Alpha=20) then
- ESC_Alpha:=0
- else inc(ESC_Alpha);
- if ESC_Alpha > 20 then ESC_Alpha:=20;
- glColor4f(1, 1, 1, ESC_Alpha/20);
- glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum);
- glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(800-310, 600-247);
- glTexCoord2f(0,247/256);glVertex2f(800-310, 600);
- glTexCoord2f(310/512,247/256); glVertex2f(800, 600);
- glTexCoord2f(310/512,0);glVertex2f(800, 600-247);
- glEnd;
- glDisable(GL_TEXTURE_2D);
- glDisable(GL_BLEND);
-
- // outro scrollers?
- // ...
- end;
-
-{ // draw credits runtime counter
- SetFontStyle (2);
- SetFontItalic(False);
- SetFontSize(9);
- SetFontPos (5, 5);
- glColor4f(1, 1, 1, 1);
-// RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10);
- RuntimeStr:='CTime: '+inttostr(CTime);
- glPrint (Addr(RuntimeStr[1]));
-}
- // make the stars shine
- GoldenRec.Draw;
-end;
-
-end.
+unit UScreenCredits;
+
+interface
+
+uses
+ UMenu,
+ SDL,
+ UDisplay,
+ UTexture,
+ OpenGL12,
+ UMusic,
+ UFiles,
+ SysUtils,
+ UThemes,
+ ULCD,
+ ULight,
+ UGraphicClasses;
+
+type
+ TCreditsStages=(InitialDelay,Intro,MainPart,Outro);
+
+ TScreenCredits = class(TMenu)
+ public
+
+ Credits_X: Real;
+ Credits_Time: Cardinal;
+ Credits_Alpha: Cardinal;
+ CTime: Cardinal;
+ CTime_hold: Cardinal;
+ ESC_Alpha: Integer;
+
+ credits_entry_tex: TTexture;
+ credits_entry_dx_tex: TTexture;
+ credits_bg_tex: TTexture;
+ credits_bg_ovl: TTexture;
+// credits_bg_logo: TTexture;
+ credits_bg_scrollbox_left: TTexture;
+ credits_blindguard: TTexture;
+ credits_blindy: TTexture;
+ credits_canni: TTexture;
+ credits_commandio: TTexture;
+ credits_lazyjoker: TTexture;
+ credits_mog: TTexture;
+ credits_mota: TTexture;
+ credits_skillmaster: TTexture;
+ credits_whiteshark: TTexture;
+ intro_layer01: TTexture;
+ intro_layer02: TTexture;
+ intro_layer03: TTexture;
+ intro_layer04: TTexture;
+ intro_layer05: TTexture;
+ intro_layer06: TTexture;
+ intro_layer07: TTexture;
+ intro_layer08: TTexture;
+ intro_layer09: TTexture;
+ outro_bg: TTexture;
+ outro_esc: TTexture;
+ outro_exd: TTexture;
+
+ deluxe_slidein: cardinal;
+
+ CurrentScrollText: String;
+ NextScrollUpdate: Real;
+ EndofLastScrollingPart: Cardinal;
+ CurrentScrollStart, CurrentScrollEnd: Integer;
+
+ CRDTS_Stage: TCreditsStages;
+
+ myTex: glUint;
+
+ Fadeout: boolean;
+ constructor Create; override;
+ function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
+ function Draw: boolean; override;
+ procedure onShow; override;
+ procedure onHide; override;
+ procedure DrawCredits;
+ procedure Draw_FunkyText;
+ end;
+
+const
+ Funky_Text: AnsiString =
+ 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+
+ 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+
+ 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+
+ 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..';
+
+
+ Timings: array[0..21] of Cardinal=(
+ 20, // 0 Delay vor Start
+
+ 149, // 1 Ende erster Intro Zoom
+ 155, // 2 Start 2. Action im Intro
+ 170, // 3 Ende Separation im Intro
+ 271, // 4 Anfang Zoomout im Intro
+ 0, // 5 unused
+ 261, // 6 Start fade-to-white im Intro
+
+ 271, // 7 Start Main Part
+ 280, // 8 Start On-Beat-Sternchen Main Part
+
+ 396, // 9 Start BlindGuard
+ 666, // 10 Start blindy
+ 936, // 11 Start Canni
+ 1206, // 12 Start Commandio
+ 1476, // 13 Start LazyJoker
+ 1746, // 14 Start Mog
+ 2016, // 15 Start Mota
+ 2286, // 16 Start SkillMaster
+ 2556, // 17 Start WhiteShark
+ 2826, // 18 Ende Whiteshark
+ 3096, // 19 Start FadeOut Mainscreen
+ 3366, // 20 Ende Credits Tune
+ 60); // 21 start flare im intro
+
+implementation
+
+uses {$IFDEF win32}
+ windows,
+ {$ELSE}
+ lclintf,
+ {$ENDIF}
+ UGraphic,
+ UMain,
+ UIni,
+ USongs,
+ Textgl,
+ ULanguage,
+ UCommon,
+ Math;
+
+
+function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ FadeTo(@ScreenMain);
+ Music.PlayBack;
+ end;
+{ SDLK_SPACE:
+ begin
+ setlength(CTime_hold,length(CTime_hold)+1);
+ CTime_hold[high(CTime_hold)]:=CTime;
+ end;
+}
+ end;//esac
+ end; //fi
+end;
+
+constructor TScreenCredits.Create;
+begin
+ inherited Create;
+ credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0);
+ credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0);
+
+ credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', 'PNG', 'Font Black', 0);
+ credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0);
+ credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0);
+ credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', 'PNG', 'Font Black', 0);
+ credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', 'PNG', 'Font Black', 0);
+ credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', 'Font Black', 0);
+ credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', 'PNG', 'Font Black', 0);
+ credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', 'PNG', 'Font Black', 0);
+ credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', 'PNG', 'Font Black', 0);
+
+ intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', 'PNG', 'Transparent', 0);
+ intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', 'PNG', 'Transparent', 0);
+ intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', 'PNG', 'Transparent', 0);
+ intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', 'PNG', 'Transparent', 0);
+ intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', 'PNG', 'Transparent', 0);
+ intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', 'PNG', 'Transparent', 0);
+ intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', 'PNG', 'Transparent', 0);
+ intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', 'PNG', 'Transparent', 0);
+ intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', 'PNG', 'Transparent', 0);
+
+ outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0);
+ outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0);
+ outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Transparent', 0);
+
+ CRDTS_Stage:=InitialDelay;
+end;
+
+function TScreenCredits.Draw: boolean;
+begin
+ DrawCredits;
+ Draw:=true;
+end;
+
+procedure TScreenCredits.onShow;
+begin
+ CRDTS_Stage:=InitialDelay;
+ Credits_X := 580;
+ deluxe_slidein := 0;
+ Credits_Alpha := 0;
+ //Music.SetLoop(true); Loop looped ned, so ne scheisse
+ Music.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!!
+// Music.Play;
+ CTime:=0;
+// setlength(CTime_hold,0);
+end;
+
+procedure TScreenCredits.onHide;
+begin
+ Music.Stop;
+end;
+
+Procedure TScreenCredits.Draw_FunkyText;
+var
+ S: Integer;
+ X,Y,A: Real;
+ visibleText: PChar;
+begin
+ SetFontSize(10);
+ //Init ScrollingText
+ if (CTime = Timings[7]) then
+ begin
+ //Set Position of Text
+ Credits_X := 600;
+ CurrentScrollStart:=1;
+ CurrentScrollEnd:=1;
+ end;
+
+ if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then
+ begin
+ X:=0;
+ visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd));
+ for S := 0 to length(visibleText)-1 do begin
+ Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi));
+ SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000);
+ A:=0;
+ if (Credits_X+X < 15) then A:=0;
+ if (Credits_X+X >=15) then A:=Credits_X+X-15;
+ if Credits_X+X > 32 then A:=17;
+ glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17);
+ glPrintLetter(visibleText[S]);
+ X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW;
+ end;
+ if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin
+ Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW;
+ inc(CurrentScrollStart);
+ end;
+ visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd));
+ if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin
+ inc(CurrentScrollEnd);
+ end;
+ end;
+{ // timing hack
+ X:=5;
+ SetFontStyle (2);
+ SetFontItalic(False);
+ SetFontSize(9);
+ glColor4f(1, 1, 1, 1);
+ for S:=0 to high(CTime_hold) do begin
+ visibleText:=pchar(inttostr(CTime_hold[S]));
+ SetFontPos (500, X);
+ glPrint (Addr(visibleText[0]));
+ X:=X+20;
+ end;}
+end;
+
+procedure Start3D;
+begin
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix;
+ glLoadIdentity;
+ glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity;
+end;
+procedure End3D;
+begin
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix;
+ glMatrixMode(GL_MODELVIEW);
+end;
+
+procedure TScreenCredits.DrawCredits;
+var
+ T,I: Cardinal;
+ X: Real;
+ Ver: PChar;
+ RuntimeStr: AnsiString;
+ Data: TFFTData;
+ j,k,l:cardinal;
+ f,g,h: Real;
+ STime:cardinal;
+ Delay:cardinal;
+
+ myPixel: longword;
+ myColor: Cardinal;
+ myScale: Real;
+ myAngle: Real;
+
+
+const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24),
+ (154,31),(156,58),(168,32),(203,36),
+ (258,34),(251,50),(274,93),(294,84),
+ (232,54),(278,62),(319,34),(336,92),
+ (347,23),(374,32),(377,58),(361,83),
+ (385,91),(405,91),(429,35),(423,51),
+ (450,32),(485,34),(444,91),(486,93));
+
+begin
+ //dis does teh muiwk y0r
+ Data := Music.GetFFTData;
+
+ T := GetTickCount div 33;
+ if T <> Credits_Time then
+ begin
+ Credits_Time := T;
+ inc(CTime);
+ inc(CTime_hold);
+ Credits_X := Credits_X-2;
+ if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then
+ begin
+// CTime:=Timings[20];
+// CRDTS_Stage:=Outro;
+
+ CRDTS_Stage:=Intro;
+ CTime:=0;
+ Music.Play;
+
+ end;
+ if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then
+ begin
+ CRDTS_Stage:=MainPart;
+ end;
+ if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then
+ begin
+ CRDTS_Stage:=Outro;
+ end;
+ end;
+
+ //draw background
+ if CRDTS_Stage=InitialDelay then
+ begin
+ glClearColor(0,0,0,0);
+ glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
+ end
+ else
+ if CRDTS_Stage=Intro then
+ begin
+ Start3D;
+ glPushMatrix;
+
+ glClearColor(0,0,0,0);
+ glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
+
+ glEnable(GL_TEXTURE_2D);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+
+ if CTime < Timings[1] then begin
+ myScale:= 0.5+0.5*(Timings[1]-CTime)/(Timings[1]); // slowly move layers together
+ myAngle:=cos((CTime)*pi/((Timings[1])*2)); // and make logo face towards camera
+ end else begin // this is the part when the logo stands still
+ myScale:=0.5;
+ myAngle:=0;
+ end;
+ if CTime > Timings[2] then begin
+ myScale:= 0.5+0.5*(CTime-Timings[2])/(Timings[3]-Timings[2]); // get some space between layers
+ myAngle:=0;
+ end;
+// if CTime > Timings[3] then myScale:=1; // keep the space between layers
+ glTranslatef(0,0,-5+0.5*myScale);
+ if CTime > Timings[3] then myScale:=1; // keep the space between layers
+ if CTime > Timings[3] then begin // make logo rotate left and grow
+// myScale:=(CTime-Timings[4])/(Timings[7]-Timings[4]);
+ glRotatef(20*sqr(CTime-Timings[3])/sqr((Timings[7]-Timings[3])/2),0,0,1);
+ glScalef(1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1);
+ end;
+ if CTime < Timings[2] then
+ glRotatef(30*myAngle,0.5*myScale+myScale,1+myScale,0);
+// glScalef(0.5,0.5,0.5);
+ glScalef(4/3,-1,1);
+ glColor4f(1, 1, 1, 1);
+
+ glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex3f(-1, -1, -0.4 * myScale);
+ glTexCoord2f(0,1);glVertex3f(-1, 1, -0.4 * myScale);
+ glTexCoord2f(1,1); glVertex3f(1, 1, -0.4 * myScale);
+ glTexCoord2f(1,0);glVertex3f(1, -1, -0.4 * myScale);
+ glEnd;
+ glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex3f(-1, -1, -0.3 * myScale);
+ glTexCoord2f(0,1);glVertex3f(-1, 1, -0.3 * myScale);
+ glTexCoord2f(1,1); glVertex3f(1, 1, -0.3 * myScale);
+ glTexCoord2f(1,0);glVertex3f(1, -1, -0.3 * myScale);
+ glEnd;
+ glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex3f(-1, -1, -0.2 * myScale);
+ glTexCoord2f(0,1);glVertex3f(-1, 1, -0.2 * myScale);
+ glTexCoord2f(1,1); glVertex3f(1, 1, -0.2 * myScale);
+ glTexCoord2f(1,0);glVertex3f(1, -1, -0.2 * myScale);
+ glEnd;
+ glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex3f(-1, -1, -0.1 * myScale);
+ glTexCoord2f(0,1);glVertex3f(-1, 1, -0.1 * myScale);
+ glTexCoord2f(1,1); glVertex3f(1, 1, -0.1 * myScale);
+ glTexCoord2f(1,0);glVertex3f(1, -1, -0.1 * myScale);
+ glEnd;
+ glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex3f(-1, -1, 0 * myScale);
+ glTexCoord2f(0,1);glVertex3f(-1, 1, 0 * myScale);
+ glTexCoord2f(1,1); glVertex3f(1, 1, 0 * myScale);
+ glTexCoord2f(1,0);glVertex3f(1, -1, 0 * myScale);
+ glEnd;
+ glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex3f(-1, -1, 0.1 * myScale);
+ glTexCoord2f(0,1);glVertex3f(-1, 1, 0.1 * myScale);
+ glTexCoord2f(1,1); glVertex3f(1, 1, 0.1 * myScale);
+ glTexCoord2f(1,0);glVertex3f(1, -1, 0.1 * myScale);
+ glEnd;
+ glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex3f(-1, -1, 0.2 * myScale);
+ glTexCoord2f(0,1);glVertex3f(-1, 1, 0.2 * myScale);
+ glTexCoord2f(1,1); glVertex3f(1, 1, 0.2 * myScale);
+ glTexCoord2f(1,0);glVertex3f(1, -1, 0.2 * myScale);
+ glEnd;
+ glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex3f(-1, -1, 0.3 * myScale);
+ glTexCoord2f(0,1);glVertex3f(-1, 1, 0.3 * myScale);
+ glTexCoord2f(1,1); glVertex3f(1, 1, 0.3 * myScale);
+ glTexCoord2f(1,0);glVertex3f(1, -1, 0.3 * myScale);
+ glEnd;
+ glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex3f(-1, -1, 0.22 * myScale);
+ glTexCoord2f(0,1);glVertex3f(-1, 1, 0.22 * myScale);
+ glTexCoord2f(1,1); glVertex3f(1, 1, 0.22 * myScale);
+ glTexCoord2f(1,0);glVertex3f(1, -1, 0.22 * myScale);
+ glEnd;
+ gldisable(gl_texture_2d);
+ glDisable(GL_BLEND);
+
+ glPopMatrix;
+ End3D;
+
+ // do some sparkling effects
+ if (CTime < Timings[1]) and (CTime > Timings[21]) then
+ begin
+ for k:=1 to 3 do begin
+ l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5);
+ j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301);
+ GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0);
+ end;
+ end;
+
+ // fade to white at end
+ if Ctime > Timings[6] then
+ begin
+ glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6]));
+ glEnable(GL_BLEND);
+ glBegin(GL_QUADS);
+ glVertex2f(0,0);
+ glVertex2f(0,600);
+ glVertex2f(800,600);
+ glVertex2f(800,0);
+ glEnd;
+ glDisable(GL_BLEND);
+ end;
+
+ end;
+ if (CRDTS_Stage=MainPart) then
+ // main credits screen background, scroller, logo and girl
+ begin
+
+ glEnable(GL_TEXTURE_2D);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+
+ glColor4f(1, 1, 1, 1);
+ glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex2f(0, 0);
+ glTexCoord2f(0,600/1024);glVertex2f(0, 600);
+ glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600);
+ glTexCoord2f(800/1024,0);glVertex2f(800, 0);
+ glEnd;
+ glDisable(GL_TEXTURE_2D);
+ glDisable(GL_BLEND);
+
+ // draw scroller
+ Draw_FunkyText;
+
+//#########################################################################
+// draw credits names
+
+// BlindGuard (von links oben reindrehen, nach rechts unten rausdrehen)
+ STime:=Timings[9]-10;
+ Delay:=Timings[10]-Timings[9];
+ if CTime > STime then
+ begin
+ k:=0;
+ ESC_Alpha:=20;
+ for j:=0 to 40 do
+ if Data[j]>=Data[k] then k:=j;
+ if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha);
+ if ESC_Alpha >20 then ESC_Alpha:=20;
+ if ((CTime-STime)<20) then ESC_Alpha:=20;
+ if CTime <=STime+10 then j:=CTime-STime else j:=10;
+ if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0;
+ glColor4f(1, 1, 1, ESC_Alpha/20*j/10);
+
+ if (CTime >= STime+10) and (CTime<=STime+12) then begin
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ end;
+
+ glPushMatrix;
+ gltranslatef(0,329,0);
+ if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end;
+ gltranslatef(223,0,0);
+ if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin
+ gltranslatef(223,0,0);
+ glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1);
+ gltranslatef(-223,0,0);
+ end;
+ glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glEnable(GL_TEXTURE_2D);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex2f(-163, -129);
+ glTexCoord2f(0,1);glVertex2f(-163, 129);
+ glTexCoord2f(1,1); glVertex2f(163, 129);
+ glTexCoord2f(1,0);glVertex2f(163, -129);
+ glEnd;
+ gldisable(gl_texture_2d);
+ gldisable(GL_BLEND);
+ glPopMatrix;
+ end;
+
+// Blindy (zoom von 0 auf volle grösse und drehung, zoom auf doppelte grösse und nach rechts oben schieben)
+ STime:=Timings[10]-10;
+ Delay:=Timings[11]-Timings[10]+5;
+ if CTime > STime then
+ begin
+ k:=0;
+ ESC_Alpha:=20;
+ for j:=0 to 40 do
+ if Data[j]>=Data[k] then k:=j;
+ if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha);
+ if ESC_Alpha >20 then ESC_Alpha:=20;
+ if ((CTime-STime)<20) then ESC_Alpha:=20;
+ if CTime <=STime+10 then j:=CTime-STime else j:=10;
+ if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0;
+ glColor4f(1, 1, 1, ESC_Alpha/20*j/10);
+
+ if (CTime >= STime+20) and (CTime<=STime+22) then begin
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ end;
+
+ glPushMatrix;
+ gltranslatef(223,329,0);
+ if CTime <= STime+20 then begin
+ j:=CTime-Stime;
+ glscalef(j*j/400,j*j/400,j*j/400);
+ glrotatef(j*18.0,0,0,1);
+ end;
+ if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin
+ j:=CTime-(STime+Delay-10);
+ f:=j*10.0;
+ gltranslatef(f*3,-f,0);
+ glscalef(1+j/10,1+j/10,1+j/10);
+ glrotatef(j*9.0,0,0,1);
+ end;
+ glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glEnable(GL_TEXTURE_2D);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex2f(-163, -129);
+ glTexCoord2f(0,1);glVertex2f(-163, 129);
+ glTexCoord2f(1,1); glVertex2f(163, 129);
+ glTexCoord2f(1,0);glVertex2f(163, -129);
+ glEnd;
+ gldisable(gl_texture_2d);
+ gldisable(GL_BLEND);
+ glPopMatrix;
+ end;
+
+// Canni (von links reinschieben, nach rechts oben rausschieben)
+ STime:=Timings[11]-10;
+ Delay:=Timings[12]-Timings[11]+5;
+ if CTime > STime then
+ begin
+ k:=0;
+ ESC_Alpha:=20;
+ for j:=0 to 40 do
+ if Data[j]>=Data[k] then k:=j;
+ if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha);
+ if ESC_Alpha >20 then ESC_Alpha:=20;
+ if ((CTime-STime)<20) then ESC_Alpha:=20;
+ if CTime <=STime+10 then j:=CTime-STime else j:=10;
+ if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0;
+ glColor4f(1, 1, 1, ESC_Alpha/20*j/10);
+
+ if (CTime >= STime+10) and (CTime<=STime+12) then begin
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ end;
+
+ glPushMatrix;
+ gltranslatef(223,329,0);
+ if CTime <= STime+10 then begin
+ gltranslatef(((CTime-STime)*21.0)-210,0,0);
+ end;
+ if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin
+ j:=(CTime-(STime+Delay-10))*21;
+ gltranslatef(j,-j/2,0);
+ end;
+ glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glEnable(GL_TEXTURE_2D);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex2f(-163, -129);
+ glTexCoord2f(0,1);glVertex2f(-163, 129);
+ glTexCoord2f(1,1); glVertex2f(163, 129);
+ glTexCoord2f(1,0);glVertex2f(163, -129);
+ glEnd;
+ gldisable(gl_texture_2d);
+ gldisable(GL_BLEND);
+ glPopMatrix;
+ end;
+
+// Commandio (von unten reinklappen, nach rechts oben rausklappen)
+ STime:=Timings[12]-10;
+ Delay:=Timings[13]-Timings[12];
+ if CTime > STime then
+ begin
+ k:=0;
+ ESC_Alpha:=20;
+ for j:=0 to 40 do
+ if Data[j]>=Data[k] then k:=j;
+ if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha);
+ if ESC_Alpha >20 then ESC_Alpha:=20;
+ if ((CTime-STime)<20) then ESC_Alpha:=20;
+ if CTime <=STime+10 then j:=CTime-STime else j:=10;
+ if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0;
+ glColor4f(1, 1, 1, ESC_Alpha/20*j/10);
+
+ if (CTime >= STime+10) and (CTime<=STime+12) then begin
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ end;
+
+ glPushMatrix;
+ gltranslatef(223,329,0);
+ if CTime <= STime+10 then
+ f:=258.0-25.8*(CTime-STime)
+ else
+ f:=0;
+ g:=0;
+ if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin
+ j:=CTime-(STime+Delay-10);
+ g:=32.6*j;
+ end;
+ glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glEnable(GL_TEXTURE_2D);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex2f(-163+g-f*1.5, -129+f*1.5-g/2);
+ glTexCoord2f(0,1);glVertex2f(-163+g*1.5, 129-(g*1.5*258/326));
+ glTexCoord2f(1,1); glVertex2f(163+g, 129+g/4);
+ glTexCoord2f(1,0);glVertex2f(163+f*1.5+g/4, -129+f*1.5-g/4);
+ glEnd;
+ gldisable(gl_texture_2d);
+ gldisable(GL_BLEND);
+ glPopMatrix;
+ end;
+
+// lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing)
+ STime:=Timings[13]-35;
+ Delay:=Timings[14]-Timings[13]+5;
+ if CTime > STime then
+ begin
+ k:=0;
+ for j:=0 to 40 do
+ if Data[j]>=Data[k] then k:=j;
+ if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha);
+ if ESC_Alpha >20 then ESC_Alpha:=20;
+ if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20;
+ ESC_Alpha:=10;
+ f:=CTime-STime;
+ if CTime <=STime+40 then j:=CTime-STime else j:=40;
+ if (CTime >=STime+Delay-40) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0;
+ glColor4f(1, 1, 1, ESC_Alpha/20*j*j/1600);
+
+ glPushMatrix;
+ gltranslatef(180+(f-70),329,0);
+ glBindTexture(GL_TEXTURE_2D, credits_lazyjoker.TexNum);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glEnable(GL_TEXTURE_2D);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex2f(-163, -129);
+ glTexCoord2f(0,1);glVertex2f(-163, 129);
+ glTexCoord2f(1,1); glVertex2f(163, 129);
+ glTexCoord2f(1,0);glVertex2f(163, -129);
+ glEnd;
+ gldisable(gl_texture_2d);
+ gldisable(GL_BLEND);
+ glPopMatrix;
+ end;
+
+// Mog (von links reinklappen, nach rechts unten rausklappen)
+ STime:=Timings[14]-10;
+ Delay:=Timings[15]-Timings[14]+5;
+ if CTime > STime then
+ begin
+ k:=0;
+ ESC_Alpha:=20;
+ for j:=0 to 40 do
+ if Data[j]>=Data[k] then k:=j;
+ if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha);
+ if ESC_Alpha >20 then ESC_Alpha:=20;
+ if ((CTime-STime)<20) then ESC_Alpha:=20;
+ if CTime <=STime+10 then j:=CTime-STime else j:=10;
+ if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0;
+ glColor4f(1, 1, 1, ESC_Alpha/20*j/10);
+
+ if (CTime >= STime+10) and (CTime<=STime+12) then begin
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ end;
+
+ glPushMatrix;
+ gltranslatef(223,329,0);
+ if CTime <= STime+10 then
+ f:=326.0-32.6*(CTime-STime)
+ else
+ f:=0;
+
+ g:=0;
+ if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin
+ j:=CTime-(STime+Delay-10);
+ g:=32.6*j;
+ end;
+ glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glEnable(GL_TEXTURE_2D);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex2f(-163+g*1.5, -129+g*1.5);
+ glTexCoord2f(0,1);glVertex2f(-163+g*1.2, 129+g);
+ glTexCoord2f(1,1); glVertex2f(163-f+g/2, 129+f*1.5+g/4);
+ glTexCoord2f(1,0);glVertex2f(163-f+g*1.5, -129-f*1.5);
+ glEnd;
+ gldisable(gl_texture_2d);
+ gldisable(GL_BLEND);
+ glPopMatrix;
+ end;
+
+// Mota (von rechts oben reindrehen, nach links unten rausschieben und verkleinern und dabei drehen)
+ STime:=Timings[15]-10;
+ Delay:=Timings[16]-Timings[15]+5;
+ if CTime > STime then
+ begin
+ k:=0;
+ ESC_Alpha:=20;
+ for j:=0 to 40 do
+ if Data[j]>=Data[k] then k:=j;
+ if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha);
+ if ESC_Alpha >20 then ESC_Alpha:=20;
+ if ((CTime-STime)<20) then ESC_Alpha:=20;
+ if CTime <=STime+10 then j:=CTime-STime else j:=10;
+ if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0;
+ glColor4f(1, 1, 1, ESC_Alpha/20*j/10);
+
+ if (CTime >= STime+10) and (CTime<=STime+12) then begin
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ end;
+
+ glPushMatrix;
+ gltranslatef(223,329,0);
+ if CTime <= STime+10 then begin
+ gltranslatef(223,0,0);
+ glrotatef((10-(CTime-STime))*9,0,0,1);
+ gltranslatef(-223,0,0);
+ end;
+ if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin
+ j:=CTime-(STime+Delay-10);
+ f:=j*10.0;
+ gltranslatef(-f*2,-f,0);
+ glscalef(1-j/10,1-j/10,1-j/10);
+ glrotatef(-j*9.0,0,0,1);
+ end;
+ glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glEnable(GL_TEXTURE_2D);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex2f(-163, -129);
+ glTexCoord2f(0,1);glVertex2f(-163, 129);
+ glTexCoord2f(1,1); glVertex2f(163, 129);
+ glTexCoord2f(1,0);glVertex2f(163, -129);
+ glEnd;
+ gldisable(gl_texture_2d);
+ gldisable(GL_BLEND);
+ glPopMatrix;
+ end;
+
+// Skillmaster (von rechts unten reinschieben, nach rechts oben rausdrehen)
+ STime:=Timings[16]-10;
+ Delay:=Timings[17]-Timings[16]+5;
+ if CTime > STime then
+ begin
+ k:=0;
+ ESC_Alpha:=20;
+ for j:=0 to 40 do
+ if Data[j]>=Data[k] then k:=j;
+ if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha);
+ if ESC_Alpha >20 then ESC_Alpha:=20;
+ if ((CTime-STime)<20) then ESC_Alpha:=20;
+ if CTime <=STime+10 then j:=CTime-STime else j:=10;
+ if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0;
+ glColor4f(1, 1, 1, ESC_Alpha/20*j/10);
+
+ if (CTime >= STime+10) and (CTime<=STime+12) then begin
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ end;
+
+ glPushMatrix;
+ gltranslatef(223,329,0);
+ if CTime <= STime+10 then begin
+ j:=STime+10-CTime;
+ f:=j*10.0;
+ gltranslatef(+f*2,+f/2,0);
+ end;
+ if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin
+ j:=CTime-(STime+Delay-10);
+ gltranslatef(0,-223,0);
+ glrotatef(integer(j)*-9,0,0,1);
+ gltranslatef(0,223,0);
+ glrotatef(j*9,0,0,1);
+ end;
+ glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glEnable(GL_TEXTURE_2D);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex2f(-163, -129);
+ glTexCoord2f(0,1);glVertex2f(-163, 129);
+ glTexCoord2f(1,1); glVertex2f(163, 129);
+ glTexCoord2f(1,0);glVertex2f(163, -129);
+ glEnd;
+ gldisable(gl_texture_2d);
+ gldisable(GL_BLEND);
+ glPopMatrix;
+ end;
+
+// WhiteShark (von links unten reinklappen, nach rechts oben rausklappen)
+ STime:=Timings[17]-10;
+ Delay:=Timings[18]-Timings[17];
+ if CTime > STime then
+ begin
+ k:=0;
+ ESC_Alpha:=20;
+ for j:=0 to 40 do
+ if Data[j]>=Data[k] then k:=j;
+ if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha);
+ if ESC_Alpha >20 then ESC_Alpha:=20;
+ if ((CTime-STime)<20) then ESC_Alpha:=20;
+ if CTime <=STime+10 then j:=CTime-STime else j:=10;
+ if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0;
+ glColor4f(1, 1, 1, ESC_Alpha/20*j/10);
+
+ if (CTime >= STime+10) and (CTime<=STime+12) then begin
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1);
+ GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5);
+ end;
+
+ glPushMatrix;
+ gltranslatef(223,329,0);
+ if CTime <= STime+10 then
+ f:=326.0-32.6*(CTime-STime)
+ else
+ f:=0;
+
+ if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin
+ j:=CTime-(STime+Delay-10);
+ g:=32.6*j;
+ end else
+ g:=0;
+ glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glEnable(GL_TEXTURE_2D);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2);
+ glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4);
+ glTexCoord2f(1,1); glVertex2f(163-f*1.2+g/4, 129+f/2-g/4);
+ glTexCoord2f(1,0);glVertex2f(163-f*1.5+g/4, -129+f*1.5+g/4);
+ glEnd;
+ gldisable(gl_texture_2d);
+ gldisable(GL_BLEND);
+ glPopMatrix;
+ end;
+
+
+// ####################################################################
+// do some twinkle stuff (kinda on beat)
+ if (CTime>Timings[8]) and (CTime < Timings[19]) then begin
+ k:=0;
+ for j:=0 to 40 do
+ if Data[j]>=Data[k] then k:=j;
+ if Data[k]>0.2 then begin
+ l:=RandomRange(6,16);
+ j:=RandomRange(0,27);
+ GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0);
+ end;
+ end;
+
+//#################################################
+// draw the rest of the main screen (girl and logo
+ glEnable(GL_TEXTURE_2D);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glColor4f(1, 1, 1, 1);
+ glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex2f(800-393, 0);
+ glTexCoord2f(0,600/1024);glVertex2f(800-393, 600);
+ glTexCoord2f(393/512,600/1024); glVertex2f(800, 600);
+ glTexCoord2f(393/512,0);glVertex2f(800, 0);
+ glEnd;
+{ glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex2f(0, 0);
+ glTexCoord2f(0,112/128);glVertex2f(0, 112);
+ glTexCoord2f(497/512,112/128); glVertex2f(497, 112);
+ glTexCoord2f(497/512,0);glVertex2f(497, 0);
+ glEnd;
+}
+ gldisable(gl_texture_2d);
+ glDisable(GL_BLEND);
+
+ // fade out at end of main part
+ if Ctime > Timings[19] then
+ begin
+ glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19]));
+ glEnable(GL_BLEND);
+ glBegin(GL_QUADS);
+ glVertex2f(0,0);
+ glVertex2f(0,600);
+ glVertex2f(800,600);
+ glVertex2f(800,0);
+ glEnd;
+ glDisable(GL_BLEND);
+ end;
+ end
+ else
+ if (CRDTS_Stage=Outro) then
+ begin
+ if CTime=Timings[20] then begin
+ CTime_hold:=0;
+ Music.Stop;
+ Music.Open(soundpath + 'credits-outro-tune.mp3');
+ Music.Play;
+ Music.SetVolume(20);
+ Music.SetLoop(True);
+ end;
+ if CTime_hold > 231 then begin
+ Music.Play;
+ Ctime_hold:=0;
+ end;
+ glClearColor(0,0,0,0);
+ glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
+
+ // do something useful
+ // outro background
+ glEnable(GL_TEXTURE_2D);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+
+ glColor4f(1, 1, 1, 1);
+ glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex2f(0, 0);
+ glTexCoord2f(0,600/1024);glVertex2f(0, 600);
+ glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600);
+ glTexCoord2f(800/1024,0);glVertex2f(800, 0);
+ glEnd;
+
+ //outro overlays
+ glColor4f(1, 1, 1, (1+sin(CTime/15))/3+1/3);
+ glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex2f(0, 0);
+ glTexCoord2f(0,223/256);glVertex2f(0, 223);
+ glTexCoord2f(487/512,223/256); glVertex2f(487, 223);
+ glTexCoord2f(487/512,0);glVertex2f(487, 0);
+ glEnd;
+
+ ESC_Alpha:=20;
+ if (RandomRange(0,20) > 18) and (ESC_Alpha=20) then
+ ESC_Alpha:=0
+ else inc(ESC_Alpha);
+ if ESC_Alpha > 20 then ESC_Alpha:=20;
+ glColor4f(1, 1, 1, ESC_Alpha/20);
+ glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0,0);glVertex2f(800-310, 600-247);
+ glTexCoord2f(0,247/256);glVertex2f(800-310, 600);
+ glTexCoord2f(310/512,247/256); glVertex2f(800, 600);
+ glTexCoord2f(310/512,0);glVertex2f(800, 600-247);
+ glEnd;
+ glDisable(GL_TEXTURE_2D);
+ glDisable(GL_BLEND);
+
+ // outro scrollers?
+ // ...
+ end;
+
+{ // draw credits runtime counter
+ SetFontStyle (2);
+ SetFontItalic(False);
+ SetFontSize(9);
+ SetFontPos (5, 5);
+ glColor4f(1, 1, 1, 1);
+// RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10);
+ RuntimeStr:='CTime: '+inttostr(CTime);
+ glPrint (Addr(RuntimeStr[1]));
+}
+ // make the stars shine
+ GoldenRec.Draw;
+end;
+
+end.
diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas
index 5af3d4a6..7bcc9e65 100644
--- a/Game/Code/Screens/UScreenMain.pas
+++ b/Game/Code/Screens/UScreenMain.pas
@@ -1,276 +1,278 @@
-unit UScreenMain;
-
-interface
-
-uses
- UMenu,
- SDL,
- UDisplay,
- UMusic,
- UFiles,
- SysUtils,
- UThemes,
- ULCD,
- ULight;
-
-type
- TScreenMain = class(TMenu)
- public
- TextDescription: integer;
- TextDescriptionLong: integer;
-
- constructor Create; override;
- function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
- procedure onShow; override;
- procedure InteractNext; override;
- procedure InteractPrev; override;
- procedure InteractInc; override;
- procedure InteractDec; override;
- procedure UpdateLCD;
- procedure SetAnimationProgress(Progress: real); override;
- //function Draw: boolean; override;
- end;
-
-implementation
-
-uses Windows,
- UGraphic,
- UMain,
- UIni,
- UTexture,
- USongs,
- Textgl,
-// opengl,
- ULanguage,
- UParty,
- UDLLManager,
- UScreenCredits,
- USkins;
-
-
-function TScreenMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
-var
-I: Integer;
-SDL_ModState: Word;
-begin
- Result := true;
-
- SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT
- + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT);
-
- //Deactivate Credits when Key is pressed
-// if Credits_Visible then
-// begin
-// Credits_Visible := False;
-// exit;
-// end;
-
- If (PressedDown) Then
- begin // Key Down
- case PressedKey of
- SDLK_Q:
- begin
- Result := false;
- end;
-
- SDLK_ESCAPE,
- SDLK_BACKSPACE :
- begin
- Result := False;
- end;
-
- SDLK_C:
- begin
- if (SDL_ModState = KMOD_LALT) then
- begin
- //Credits_Y := 600;
- //Credits_Alpha := 0;
- //Credits_Visible := True;
- Music.PlayStart;
- FadeTo(@ScreenCredits);
- end;
- end;
- SDLK_M:
- begin
- if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then
- begin
- Music.PlayStart;
- FadeTo(@ScreenPartyOptions);
- end;
- end;
-
- SDLK_S:
- begin
- Music.PlayStart;
- FadeTo(@ScreenStatMain);
- end;
-
- SDLK_E:
- begin
- Music.PlayStart;
- FadeTo(@ScreenEdit);
- end;
-
- SDLK_RETURN:
- begin
- //Solo
- if (Interaction = 0) then
- begin
- if (Length(Songs.Song) >= 1) then
- begin
- Music.PlayStart;
- if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1;
- if (Ini.Players = 4) then PlayersPlay := 6;
-
- ScreenName.Goto_SingScreen := False;
- FadeTo(@ScreenName);
- end
- else //show error message
- ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS'));
- end;
-
- //Multi
- if Interaction = 1 then begin
- if (Length(Songs.Song) >= 1) then
- begin
- if (Length(DLLMan.Plugins)>=1) then
- begin
- Music.PlayStart;
- FadeTo(@ScreenPartyOptions);
- end
- else //show error message, No Plugins Loaded
- ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS'));
- end
- else //show error message, No Songs Loaded
- ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS'));
- end;
-
- //Stats
- if Interaction = 2 then begin
- Music.PlayStart;
- FadeTo(@ScreenStatMain);
- end;
-
- //Editor
- if Interaction = 3 then begin
- Music.PlayStart;
- FadeTo(@ScreenEdit);
- end;
-
- //Options
- if Interaction = 4 then begin
- Music.PlayStart;
- FadeTo(@ScreenOptions);
- end;
-
- //Exit
- if Interaction = 5 then begin
- Result := false;
- end;
- end;
- // Up and Down could be done at the same time,
- // but I don't want to declare variables inside
- // functions like this one, called so many times
- SDLK_DOWN: InteractInc;
- SDLK_UP: InteractDec;
- SDLK_RIGHT: InteractNext;
- SDLK_LEFT: InteractPrev;
- end;
- end
- else // Key Up
- case PressedKey of
- SDLK_RETURN :
- begin
- end;
- end;
-end;
-
-constructor TScreenMain.Create;
-var
- I: integer;
-begin
- inherited Create;
-
- //----------------
- //Attention ^^:
- //New Creation Order needed because of LoadFromTheme
- //and Button Collections.
- //At First Custom Texts and Statics
- //Then LoadFromTheme
- //after LoadFromTheme the Buttons and Selects
- //----------------
-
-
- TextDescription := AddText(Theme.Main.TextDescription);
- TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong);
-
- LoadFromTheme(Theme.Main);
-
- AddButton(Theme.Main.ButtonSolo);
- AddButton(Theme.Main.ButtonMulti);
- AddButton(Theme.Main.ButtonStat);
- AddButton(Theme.Main.ButtonEditor);
- AddButton(Theme.Main.ButtonOptions);
- AddButton(Theme.Main.ButtonExit);
-
- Interaction := 0;
-end;
-
-procedure TScreenMain.onShow;
-begin
- LCD.WriteText(1, ' Choose mode: ');
- UpdateLCD;
-end;
-
-procedure TScreenMain.InteractNext;
-begin
- inherited InteractNext;
- Text[TextDescription].Text := Theme.Main.Description[Interaction];
- Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction];
- UpdateLCD;
- Light.LightOne(1, 200);
-end;
-
-procedure TScreenMain.InteractPrev;
-begin
- inherited InteractPrev;
- Text[TextDescription].Text := Theme.Main.Description[Interaction];
- Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction];
- UpdateLCD;
- Light.LightOne(0, 200);
-end;
-
-procedure TScreenMain.InteractDec;
-begin
- inherited InteractDec;
- Text[TextDescription].Text := Theme.Main.Description[Interaction];
- Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction];
- UpdateLCD;
- Light.LightOne(0, 200);
-end;
-
-procedure TScreenMain.InteractInc;
-begin
- inherited InteractInc;
- Text[TextDescription].Text := Theme.Main.Description[Interaction];
- Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction];
- UpdateLCD;
- Light.LightOne(1, 200);
-end;
-
-procedure TScreenMain.UpdateLCD;
-begin
- case Interaction of
- 0: LCD.WriteText(2, ' sing ');
- 1: LCD.WriteText(2, ' editor ');
- 2: LCD.WriteText(2, ' options ');
- 3: LCD.WriteText(2, ' exit ');
- end
-end;
-
-procedure TScreenMain.SetAnimationProgress(Progress: real);
-begin
- Static[0].Texture.ScaleW := Progress;
- Static[0].Texture.ScaleH := Progress;
-end;
-end.
+unit UScreenMain;
+
+interface
+
+uses
+ UMenu,
+ SDL,
+ UDisplay,
+ UMusic,
+ UFiles,
+ SysUtils,
+ UThemes,
+ ULCD,
+ ULight;
+
+type
+ TScreenMain = class(TMenu)
+ public
+ TextDescription: integer;
+ TextDescriptionLong: integer;
+
+ constructor Create; override;
+ function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
+ procedure onShow; override;
+ procedure InteractNext; override;
+ procedure InteractPrev; override;
+ procedure InteractInc; override;
+ procedure InteractDec; override;
+ procedure UpdateLCD;
+ procedure SetAnimationProgress(Progress: real); override;
+ //function Draw: boolean; override;
+ end;
+
+implementation
+
+uses {$IFDEF win32}
+ windows,
+ {$ENDIF}
+ UGraphic,
+ UMain,
+ UIni,
+ UTexture,
+ USongs,
+ Textgl,
+// opengl,
+ ULanguage,
+ UParty,
+ UDLLManager,
+ UScreenCredits,
+ USkins;
+
+
+function TScreenMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+var
+I: Integer;
+SDL_ModState: Word;
+begin
+ Result := true;
+
+ SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT
+ + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT);
+
+ //Deactivate Credits when Key is pressed
+// if Credits_Visible then
+// begin
+// Credits_Visible := False;
+// exit;
+// end;
+
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ Result := False;
+ end;
+
+ SDLK_C:
+ begin
+ if (SDL_ModState = KMOD_LALT) then
+ begin
+ //Credits_Y := 600;
+ //Credits_Alpha := 0;
+ //Credits_Visible := True;
+ Music.PlayStart;
+ FadeTo(@ScreenCredits);
+ end;
+ end;
+ SDLK_M:
+ begin
+ if (Ini.Players >= 1) AND (Length(DLLMan.Plugins)>=1) then
+ begin
+ Music.PlayStart;
+ FadeTo(@ScreenPartyOptions);
+ end;
+ end;
+
+ SDLK_S:
+ begin
+ Music.PlayStart;
+ FadeTo(@ScreenStatMain);
+ end;
+
+ SDLK_E:
+ begin
+ Music.PlayStart;
+ FadeTo(@ScreenEdit);
+ end;
+
+ SDLK_RETURN:
+ begin
+ //Solo
+ if (Interaction = 0) then
+ begin
+ if (Length(Songs.Song) >= 1) then
+ begin
+ Music.PlayStart;
+ if (Ini.Players >= 0) and (Ini.Players <= 3) then PlayersPlay := Ini.Players + 1;
+ if (Ini.Players = 4) then PlayersPlay := 6;
+
+ ScreenName.Goto_SingScreen := False;
+ FadeTo(@ScreenName);
+ end
+ else //show error message
+ ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS'));
+ end;
+
+ //Multi
+ if Interaction = 1 then begin
+ if (Length(Songs.Song) >= 1) then
+ begin
+ if (Length(DLLMan.Plugins)>=1) then
+ begin
+ Music.PlayStart;
+ FadeTo(@ScreenPartyOptions);
+ end
+ else //show error message, No Plugins Loaded
+ ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS'));
+ end
+ else //show error message, No Songs Loaded
+ ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS'));
+ end;
+
+ //Stats
+ if Interaction = 2 then begin
+ Music.PlayStart;
+ FadeTo(@ScreenStatMain);
+ end;
+
+ //Editor
+ if Interaction = 3 then begin
+ Music.PlayStart;
+ FadeTo(@ScreenEdit);
+ end;
+
+ //Options
+ if Interaction = 4 then begin
+ Music.PlayStart;
+ FadeTo(@ScreenOptions);
+ end;
+
+ //Exit
+ if Interaction = 5 then begin
+ Result := false;
+ end;
+ end;
+ // Up and Down could be done at the same time,
+ // but I don't want to declare variables inside
+ // functions like this one, called so many times
+ SDLK_DOWN: InteractInc;
+ SDLK_UP: InteractDec;
+ SDLK_RIGHT: InteractNext;
+ SDLK_LEFT: InteractPrev;
+ end;
+ end
+ else // Key Up
+ case PressedKey of
+ SDLK_RETURN :
+ begin
+ end;
+ end;
+end;
+
+constructor TScreenMain.Create;
+var
+ I: integer;
+begin
+ inherited Create;
+
+ //----------------
+ //Attention ^^:
+ //New Creation Order needed because of LoadFromTheme
+ //and Button Collections.
+ //At First Custom Texts and Statics
+ //Then LoadFromTheme
+ //after LoadFromTheme the Buttons and Selects
+ //----------------
+
+
+ TextDescription := AddText(Theme.Main.TextDescription);
+ TextDescriptionLong := AddText(Theme.Main.TextDescriptionLong);
+
+ LoadFromTheme(Theme.Main);
+
+ AddButton(Theme.Main.ButtonSolo);
+ AddButton(Theme.Main.ButtonMulti);
+ AddButton(Theme.Main.ButtonStat);
+ AddButton(Theme.Main.ButtonEditor);
+ AddButton(Theme.Main.ButtonOptions);
+ AddButton(Theme.Main.ButtonExit);
+
+ Interaction := 0;
+end;
+
+procedure TScreenMain.onShow;
+begin
+ LCD.WriteText(1, ' Choose mode: ');
+ UpdateLCD;
+end;
+
+procedure TScreenMain.InteractNext;
+begin
+ inherited InteractNext;
+ Text[TextDescription].Text := Theme.Main.Description[Interaction];
+ Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction];
+ UpdateLCD;
+ Light.LightOne(1, 200);
+end;
+
+procedure TScreenMain.InteractPrev;
+begin
+ inherited InteractPrev;
+ Text[TextDescription].Text := Theme.Main.Description[Interaction];
+ Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction];
+ UpdateLCD;
+ Light.LightOne(0, 200);
+end;
+
+procedure TScreenMain.InteractDec;
+begin
+ inherited InteractDec;
+ Text[TextDescription].Text := Theme.Main.Description[Interaction];
+ Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction];
+ UpdateLCD;
+ Light.LightOne(0, 200);
+end;
+
+procedure TScreenMain.InteractInc;
+begin
+ inherited InteractInc;
+ Text[TextDescription].Text := Theme.Main.Description[Interaction];
+ Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction];
+ UpdateLCD;
+ Light.LightOne(1, 200);
+end;
+
+procedure TScreenMain.UpdateLCD;
+begin
+ case Interaction of
+ 0: LCD.WriteText(2, ' sing ');
+ 1: LCD.WriteText(2, ' editor ');
+ 2: LCD.WriteText(2, ' options ');
+ 3: LCD.WriteText(2, ' exit ');
+ end
+end;
+
+procedure TScreenMain.SetAnimationProgress(Progress: real);
+begin
+ Static[0].Texture.ScaleW := Progress;
+ Static[0].Texture.ScaleH := Progress;
+end;
+end.
diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas
index 1dd31ae9..343a2e6d 100644
--- a/Game/Code/Screens/UScreenSing.pas
+++ b/Game/Code/Screens/UScreenSing.pas
@@ -1,1236 +1,1256 @@
-unit UScreenSing;
-
-interface
-
-{$IFDEF FPC}
- {$MODE DELPHI}
-{$ENDIF}
-
-
-uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, ULyrics,
- TextGL, OpenGL12, BASS, UThemes, ULCD, UGraphicClasses, UVideo;
-
-type
- TScreenSing = class(TMenu)
- protected
- paused: boolean; //Pause Mod
- PauseTime: Real;
- NumEmptySentences: integer;
- public
- //TextTime: integer;
-
- //TimeBar mod
- StaticTimeProgress: integer;
- TextTimeText: integer;
- //eoa TimeBar mod
-
- StaticP1: integer;
- StaticP1ScoreBG: integer;
- TextP1: integer;
- TextP1Score: integer;
-
- //moveable singbar mod
- StaticP1SingBar: integer;
- StaticP1ThreePSingBar: integer;
- StaticP1TwoPSingBar: integer;
- StaticP2RSingBar: integer;
- StaticP2MSingBar: integer;
- StaticP3SingBar: integer;
- //eoa moveable singbar
-
- //Added for ps3 skin
- //shown when game is in 2/4 player modus
- StaticP1TwoP: integer;
- StaticP1TwoPScoreBG: integer;
- TextP1TwoP: integer;
- TextP1TwoPScore: integer;
- //shown when game is in 3/6 player modus
- StaticP1ThreeP: integer;
- StaticP1ThreePScoreBG: integer;
- TextP1ThreeP: integer;
- TextP1ThreePScore: integer;
- //eoa
-
- StaticP2R: integer;
- StaticP2RScoreBG: integer;
- TextP2R: integer;
- TextP2RScore: integer;
-
- StaticP2M: integer;
- StaticP2MScoreBG: integer;
- TextP2M: integer;
- TextP2MScore: integer;
-
- StaticP3R: integer;
- StaticP3RScoreBG: integer;
- TextP3R: integer;
- TextP3RScore: integer;
-
- Tex_Background: TTexture;
- FadeOut: boolean;
- LyricMain: TLyric;
- LyricSub: TLyric;
-
- constructor Create; override;
- procedure onShow; override;
- procedure onShowFinish; override;
- function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
- function Draw: boolean; override;
- procedure Finish; virtual;
- procedure UpdateLCD;
- procedure Pause; //Pause Mod(Toggles Pause)
-
- //OnSentenceEnd for LineBonus + Singbar
- procedure onSentenceEnd(S: Cardinal);
- //OnSentenceChange (for Golden Notes)
- procedure onSentenceChange(S: Cardinal);
- end;
-
-implementation
-uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math;
-
-// Method for input parsing. If False is returned, GetNextWindow
-// should be checked to know the next window to load;
-function TScreenSing.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
-begin
- Result := true;
- If (PressedDown) Then
- begin // Key Down
- case PressedKey of
- SDLK_Q:
- begin
- //When not ask before Exit then Finish now
- if (Ini.AskbeforeDel <> 1) then
- Finish
- //else just Pause and let the Popup make the Work
- else if not paused then
- Pause;
-
- Result := false;
- end;
-
- SDLK_ESCAPE,
- SDLK_BACKSPACE :
- begin
- //Record Sound Hack:
- //Sound[0].BufferLong
-
- Finish;
- Music.PlayBack;
- FadeTo(@ScreenScore);
- end;
-
- SDLK_P://Pause Mod
- begin
- Pause;
- end;
-
- SDLK_RETURN:
- begin
- end;
-
- // Up and Down could be done at the same time,
- // but I don't want to declare variables inside
- // functions like this one, called so many times
- SDLK_DOWN :
- begin
- end;
- SDLK_UP :
- begin
- end;
- end;
- end;
-end;
-
-//Pause Mod
-procedure TScreenSing.Pause;
-begin
- if not paused then //Pause einschalten
- begin
- // pause Time
- PauseTime := Czas.Teraz;
- Paused := true;
-
- // pause Music
- Music.Pause;
-
- // pause Video
- if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then
- FFmpegTogglePause;
- end
- else //Pause ausschalten
- begin
- Czas.Teraz := PauseTime; //Position of Notes
-
- // Position of Music
- Music.MoveTo (PauseTime);
- // Play Music
- Music.Play;
-
- // Video
- if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then
- FFmpegTogglePause;
- //SkipSmpeg(PauseTime);
-
- Paused := false;
- end;
-end;
-//Pause Mod End
-
-constructor TScreenSing.Create;
-var
- I: integer;
- P: integer;
-begin
- inherited Create;
-
- LoadFromTheme(Theme.Sing);
-
- //TimeBar
- StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress);
- TextTimeText := AddText(Theme.Sing.TextTimeText);
-
-// 1 player | P1
- StaticP1 := AddStatic(Theme.Sing.StaticP1);
- StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG);
- TextP1 := AddText(Theme.Sing.TextP1);
- TextP1Score := AddText(Theme.Sing.TextP1Score);
- StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar);
-
-// 2 or 4 players | P1
- StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP);
- StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG);
- TextP1TwoP := AddText(Theme.Sing.TextP1TwoP);
- TextP1TwoPScore := AddText(Theme.Sing.TextP1TwoPScore);
- StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar);
-
- // | P2
- StaticP2R := AddStatic(Theme.Sing.StaticP2R);
- StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG);
- TextP2R := AddText(Theme.Sing.TextP2R);
- TextP2RScore := AddText(Theme.Sing.TextP2RScore);
- StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar);
-
-// 3 or 6 players | P1
- StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP);
- StaticP1ThreePScoreBG := AddStatic(Theme.Sing.StaticP1ThreePScoreBG);
- TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP);
- TextP1ThreePScore := AddText(Theme.Sing.TextP1ThreePScore);
- StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar);
-
- // | P2
- StaticP2M := AddStatic(Theme.Sing.StaticP2M);
- StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG);
- TextP2M := AddText(Theme.Sing.TextP2M);
- TextP2MScore := AddText(Theme.Sing.TextP2MScore);
- StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar);
-
- // | P3
- StaticP3R := AddStatic(Theme.Sing.StaticP3R);
- StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG);
- TextP3R := AddText(Theme.Sing.TextP3R);
- TextP3RScore := AddText(Theme.Sing.TextP3RScore);
- StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar);
-
- if ScreenAct = 2 then begin
- // katze und affe
-
- end;
-
- LyricMain := TLyric.Create;
- LyricSub := TLyric.Create;
-
- UVideo.Init;
-end;
-
-procedure TScreenSing.onShow;
-var
- P: integer;
- V1: boolean;
- V1TwoP: boolean; //added for ps3 skin
- V1ThreeP: boolean; //added for ps3 skin
- V2R: boolean;
- V2M: boolean;
- V3R: boolean;
- NR: TRecR; //Line Bonus Mod
-begin
- Log.LogStatus('Begin', 'onShow');
- FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented
-
- // prepare players
- SetLength(Player, PlayersPlay);
-// Player[0].ScoreTotalI := 0;
-
- case PlayersPlay of
- 1: begin
- V1 := true;
- V1TwoP := false;
- V1ThreeP := false;
- V2R := false;
- V2M := false;
- V3R := false;
- end;
- 2: begin
- V1 := false;
- V1TwoP := true;
- V1ThreeP := false;
- V2R := true;
- V2M := false;
- V3R := false;
- end;
- 3: begin
- V1 := false;
- V1TwoP := false;
- V1ThreeP := true;
- V2R := false;
- V2M := true;
- V3R := true;
- end;
- 4: begin // double screen
- V1 := false;
- V1TwoP := true;
- V1ThreeP := false;
- V2R := true;
- V2M := false;
- V3R := false;
- end;
- 6: begin // double screen
- V1 := false;
- V1TwoP := false;
- V1ThreeP := true;
- V2R := false;
- V2M := true;
- V3R := true;
- end;
-
- end;
-
- //This one is shown in 1P mode
- Static[StaticP1].Visible := V1;
- Static[StaticP1ScoreBG].Visible := V1;
- Text[TextP1].Visible := V1;
- Text[TextP1Score].Visible := V1;
-
-
- //This one is shown in 2/4P mode
- Static[StaticP1TwoP].Visible := V1TwoP;
- Static[StaticP1TwoPScoreBG].Visible := V1TwoP;
- Text[TextP1TwoP].Visible := V1TwoP;
- Text[TextP1TwoPScore].Visible := V1TwoP;
-
- Static[StaticP2R].Visible := V2R;
- Static[StaticP2RScoreBG].Visible := V2R;
- Text[TextP2R].Visible := V2R;
- Text[TextP2RScore].Visible := V2R;
-
-
- //This one is shown in 3/6P mode
- Static[StaticP1ThreeP].Visible := V1ThreeP;
- Static[StaticP1ThreePScoreBG].Visible := V1ThreeP;
- Text[TextP1ThreeP].Visible := V1ThreeP;
- Text[TextP1ThreePScore].Visible := V1ThreeP;
-
- Static[StaticP2M].Visible := V2M;
- Static[StaticP2MScoreBG].Visible := V2M;
- Text[TextP2M].Visible := V2M;
- Text[TextP2MScore].Visible := V2M;
-
- Static[StaticP3R].Visible := V3R;
- Static[StaticP3RScoreBG].Visible := V3R;
- Text[TextP3R].Visible := V3R;
- Text[TextP3RScore].Visible := V3R;
-
- // load notes
- ResetSingTemp;
-// Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!');
- AktSong := CatSongs.Song[CatSongs.Selected];
- try
- if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName) then
- begin
- //Error Loading Song -> Go back to Song Screen and Show some Error Message
- FadeTo(@ScreenSong);
- //Select New Song in Party Mode
- if ScreenSong.Mode = 1 then
- ScreenSong.SelectRandomSong;
- ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG'));
- Exit;
- end;
- except
- //Error Loading Song -> Go back to Song Screen and Show some Error Message
- FadeTo(@ScreenSong);
- //Select New Song in Party Mode
- if ScreenSong.Mode = 1 then
- ScreenSong.SelectRandomSong;
- ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG'));
- Exit;
- end;
- AktSong.Path := CatSongs.Song[CatSongs.Selected].Path;
-// AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed
-
- // set movie
- if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin
-(* OpenSmpeg(AktSong.Path + AktSong.Video);
- SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*)
-
- // todo: VideoGap and Start time verwursten
- FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video));
- FFmpegSkip(AktSong.VideoGAP + AktSong.Start);
- AktSong.VideoLoaded := true;
- end;
-
- // set background
- if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then
- try
- Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background);
- except
- log.LogError('Background could not be loaded: ' + AktSong.Path + AktSong.Background);
- Tex_Background.TexNum := -1;
- end
- else
- Tex_Background.TexNum := -1;
-
-
-
- // play music (I)
- Music.CaptureStart;
- Music.MoveTo(AktSong.Start);
-// Music.Play;
-
- // prepare timer (I)
-// CountSkipTimeSet;
- Czas.Teraz := AktSong.Start;
- Czas.Razem := Music.Length;
- if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000;
- Czas.OldBeat := -1;
- for P := 0 to High(Player) do
- ClearScores(P);
-
- // main text
- LyricMain.Clear;
- LyricMain.X := 400;
- LyricMain.Y := Skin_LyricsT;
- LyricMain.Scale := 1.4; //1.4
- LyricMain.Align := 1;
-
- // sub text
- LyricSub.Clear;
- LyricSub.X := 400;
- LyricSub.Y := Skin_LyricsT + 35; //42 //40
- LyricSub.Align := 1;
-
- // set custom options
- case Ini.LyricsFont of
- 0:
- begin
- LyricMain.FontStyle := 0;
- LyricSub.FontStyle := 0;
- LyricMain.Size := 14; // 13
- LyricSub.Size := 14; // 13
- LyricMain.ColR := Skin_FontR;
- LyricMain.ColG := Skin_FontG;
- LyricMain.ColB := Skin_FontB; //Change für Crazy Joker
- {LyricMain.ColSR := Skin_FontHighlightR;
- LyricMain.ColSG := Skin_FontHighlightG;
- LyricMain.ColSB := Skin_FontHighlightB;1aa5dc}
- LyricMain.ColSR := 5/255; //26
- LyricMain.ColSG := 163/255; //165
- LyricMain.ColSB := 210/255; //220
-
- LyricSub.ColR := 0.4; //0.6
- LyricSub.ColG := 0.4; //0.6
- LyricSub.ColB := 0.4; //0.6
- end;
- 1:
- begin
- LyricMain.FontStyle := 2;
- LyricSub.FontStyle := 2;
- LyricMain.Size := 14;
- LyricSub.Size := 14;
- LyricMain.ColR := 0.75;
- LyricMain.ColG := 0.75;
- LyricMain.ColB := 1;
- LyricMain.ColSR := 0.5;
- LyricMain.ColSG := 0.5;
- LyricMain.ColSB := 1;
- LyricSub.ColR := 0.8;
- LyricSub.ColG := 0.8;
- LyricSub.ColB := 0.8;
- end;
- 2:
- begin
- LyricMain.FontStyle := 3;
- LyricSub.FontStyle := 3;
- LyricMain.Size := 12;
- LyricSub.Size := 12;
- LyricMain.ColR := 0.75;
- LyricMain.ColG := 0.75;
- LyricMain.ColB := 1;
- LyricMain.ColSR := 0.5;
- LyricMain.ColSG := 0.5;
- LyricMain.ColSB := 1;
- LyricSub.ColR := 0.8;
- LyricSub.ColG := 0.8;
- LyricSub.ColB := 0.8;
- end;
- end; // case
-
- case Ini.LyricsEffect of
- 0: LyricMain.Style := 1; // 0 - one selected, 1 - selected all to the current
- 1: LyricMain.Style := 2;
- 2: LyricMain.Style := 3;
- 3: LyricMain.Style := 4;
- end; // case
-
- // fill texts
- LyricMain.AddCzesc(0);
- LyricMain.Selected := -1;
- LyricSub.AddCzesc(1);
- LyricSub.Selected := -1;
-
- UpdateLCD;
-
- //Deactivate Pause
- Paused := False;
-
- //Kill all Stars not Killed yet
- //GoldenStarsTwinkle Mod
- GoldenRec.SentenceChange;
- //GoldenStarsTwinkle Mod End
-
- //Set Position of Line Bonus - PhrasenBonus
- if (Ini.LineBonus = 1) then //Show Line Bonus at Scores
- begin
- Case PlayersPlay of
- 1: begin
- Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x;
- Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y;
- Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x;
- Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65;
- end;
-
- 2: begin
- //P1
- Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x;
- Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y;
- Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.X;
- Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65;
-
- //P2
- Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.X;
- Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y;
- Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.X;
- Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65;
- end;
-
- 3: begin
- //P1
- Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x;
- Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y;
- Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x;
- Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65;
-
- //P2
- Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x;
- Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y;
- Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x;
- Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65;
-
- //P3
- Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x;
- Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y;
- Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x;
- Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65;
- end;
-
- 4: begin
- //P1
- Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x;
- Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y;
- Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x;
- Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65;
-
- //P2
- Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x;
- Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y;
- Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x;
- Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65;
-
- //P3
- Player[2].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x;
- Player[2].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y;
- Player[2].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x;
- Player[2].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65;
-
- //P4
- Player[3].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x;
- Player[3].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y;
- Player[3].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x;
- Player[3].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65;
- end;
-
- 6: begin
- //P1
- Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x;
- Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y;
- Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x;
- Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65;
-
- //P2
- Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x;
- Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y;
- Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x;
- Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65;
-
- //P3
- Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x;
- Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y;
- Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x;
- Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65;
-
- //P4
- Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x;
- Player[3].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y;
- Player[3].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x;
- Player[3].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65;
-
- //P5
- Player[4].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x;
- Player[4].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y;
- Player[4].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x;
- Player[4].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65;
-
- //P6
- Player[5].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x;
- Player[5].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y;
- Player[5].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x;
- Player[5].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65;
- end;
- end;
- end
- else if (Ini.LineBonus = 2) then //Show Line Bonus at Notes
- begin
-
- // positions
- if Ini.SingWindow = 0 then begin
- NR.Left := 120;
- end else begin
- NR.Left := 20;
- end;
- NR.Right := 780;
-
- NR.Width := NR.Right - NR.Left;
- NR.WMid := NR.Width / 2;
- NR.Mid := NR.Left + NR.WMid;
-
- Case PlayersPlay of
- 1: begin
- Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
- Player[0].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65;
- Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
- Player[0].LineBonus_StartY := Skin_P2_NotesB - 105;
- end;
-
- 2: begin
- //P1
- Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
- Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28;
- Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
- Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28;
-
- //P2
- Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
- Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28;
- Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
- Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28;
- end;
-
- 3: begin
- //P1
- Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
- Player[0].LineBonus_TargetY := 120 - 65 + 28;
- Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
- Player[0].LineBonus_StartY := 120 + 28;
-
- //P2
- Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
- Player[1].LineBonus_TargetY := 245 - 65 + 28;
- Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
- Player[1].LineBonus_StartY := 245 + 28;
-
- //P3
- Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
- Player[2].LineBonus_TargetY := 370 - 65 + 28;
- Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
- Player[2].LineBonus_StartY := 370 + 28;
- end;
-
- 4: begin
- //P1
- Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
- Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28;
- Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
- Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28;
-
- //P2
- Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
- Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28;
- Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
- Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28;
-
- //P3
- Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
- Player[2].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28;
- Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
- Player[2].LineBonus_StartY := Skin_P1_NotesB - 105 + 28;
-
- //P4
- Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
- Player[3].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28;
- Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
- Player[3].LineBonus_StartY := Skin_P2_NotesB - 105 + 28;
- end;
-
- 6: begin
- //P1
- Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
- Player[0].LineBonus_TargetY := 120 - 65 + 28;
- Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
- Player[0].LineBonus_StartY := 120 + 28;
-
- //P2
- Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
- Player[1].LineBonus_TargetY := 245 - 65 + 28;
- Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
- Player[1].LineBonus_StartY := 245 + 28;
-
- //P3
- Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
- Player[2].LineBonus_TargetY := 370 - 65 + 28;
- Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
- Player[2].LineBonus_StartY := 370 + 28;
-
- //P4
- Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
- Player[3].LineBonus_TargetY := 120 - 65 + 28;
- Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
- Player[3].LineBonus_StartY := 120 + 28;
-
- //P5
- Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
- Player[4].LineBonus_TargetY := 245 - 65 + 28;
- Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
- Player[4].LineBonus_StartY := 245 + 28;
-
- //P6
- Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
- Player[5].LineBonus_TargetY := 370 - 65 + 28;
- Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
- Player[5].LineBonus_StartY := 370 + 28;
- end;
- end;
- end;
- //Set Position of Line Bonus - PhrasenBonus End
- //Set Num of Empty Sentences for Phrasen Bonus
- NumEmptySentences := 0;
- for P := low(Czesci[0].Czesc) to high(Czesci[0].Czesc) do
- if Czesci[0].Czesc[P].TotalNotes = 0 then Inc(NumEmptySentences);
-
- Log.LogStatus('End', 'onShow');
-end;
-
-procedure TScreenSing.onShowFinish;
-begin
- // play movie (II)
-
- if AktSong.VideoLoaded then
- begin
- try
- FFmpegGetFrame(Czas.Teraz);
- FFmpegDrawGL(ScreenAct);
-// PlaySmpeg;
- except
- //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video
- AktSong.VideoLoaded := False;
- Log.LogError('Error drawing Video, Video has been disabled for this Song/Session.');
- Log.LogError('Corrupted File: ' + AktSong.Video);
- try
-// CloseSmpeg;
- FFmpegClose;
- except
-
- end;
- end;
- end;
-
- // play music (II)
- Music.Play;
-
- // prepare timer (II)
- CountSkipTimeSet;
-end;
-
-function TScreenSing.Draw: boolean;
-var
- Min: integer;
- Sec: integer;
- Tekst: string;
- Flash: real;
- S: integer;
- T: integer;
-begin
-
-
-
- //ScoreBG Mod | den wirren Scheiss hier brauch mer nimmer, wir haben colorized png's - no need for wirrness also
- // set player colors - macht nichts weiter als die farben des statics zu wechseln, was zu unschönen effekten bei colorized png führt
-{ if PlayersPlay = 4 then begin
- if ScreenAct = 1 then begin
- LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG,
- Static[StaticP1TwoP].Texture.ColB, 'P1Dark');
- LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG,
- Static[StaticP2R].Texture.ColB, 'P2Dark');
-
- LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG,
- Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark');
- LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG,
- Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark');
- end;
- if ScreenAct = 2 then begin
- LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG,
- Static[StaticP1TwoP].Texture.ColB, 'P3Dark');
- LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG,
- Static[StaticP2R].Texture.ColB, 'P4Dark');
-
- LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG,
- Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark');
- LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG,
- Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark');
- end;
- end;
-
- if PlayersPlay = 6 then begin
- if ScreenAct = 1 then begin
- LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG,
- Static[StaticP1ThreeP].Texture.ColB, 'P1Dark');
- LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG,
- Static[StaticP2R].Texture.ColB, 'P2Dark');
- LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG,
- Static[StaticP3R].Texture.ColB, 'P3Dark');
-
- LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG,
- Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark');
- LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG,
- Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark');
- LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG,
- Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark');
- end;
- if ScreenAct = 2 then begin
-
- LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG,
- Static[StaticP1ThreeP].Texture.ColB, 'P4Dark');
- LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG,
- Static[StaticP2R].Texture.ColB, 'P5Dark');
- LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG,
- Static[StaticP3R].Texture.ColB, 'P6Dark');
-
-
- LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG,
- Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark');
- LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG,
- Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark');
- LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG,
- Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark');
- end;
- end;
- }
-
- // set player names (for 2 screens and only Singstar skin)
- if ScreenAct = 1 then begin
- Text[TextP1].Text := 'P1';
- Text[TextP1TwoP].Text := 'P1';
- Text[TextP1ThreeP].Text := 'P1';
- Text[TextP2R].Text := 'P2';
- Text[TextP2M].Text := 'P2';
- Text[TextP3R].Text := 'P3';
- end;
-
- if ScreenAct = 2 then begin
- case PlayersPlay of
-{ 1: begin
- Text[TextP1].Text := 'P2';
- end;
- 2: begin
- Text[TextP1].Text := 'P3';
- Text[TextP2R].Text := 'P4';
- end;
- 3: begin
- Text[TextP1].Text := 'P4';
- Text[TextP2M].Text := 'P5';
- Text[TextP3R].Text := 'P6';
- end;}
-
- 4: begin
- Text[TextP1TwoP].Text := 'P3';
- Text[TextP2R].Text := 'P4';
- end;
- 6: begin
- Text[TextP1ThreeP].Text := 'P4';
- Text[TextP2M].Text := 'P5';
- Text[TextP3R].Text := 'P6';
- end;
- end; // case
- end; // if
-
- // stereo
-
-// weird stuff, maybe this is for "dual screen?", but where is player three then? | okay, i commented the stuff out the other day - nothing was missing on screen w/ 6 players - so do we even need this stuff?
-// okay this stuff appears again some lines beneath this one, I commented it out for testing what it does - seems like it's doing nothing
-// but I might be wrong, so what is this stuff here doing? O.o
- Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX;
- Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX;
-
- Text[TextP1].X := Text[TextP1].X + 10*ScreenX;
- Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;
-
-
- Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX;
- Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX;
-
- Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX;
- Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;
-// end of weird stuff
-
- for S := 1 to 1 do //wtf?
- Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX;
-
- for T := 0 to 1 do
- Text[T].X := Text[T].X + 10*ScreenX;
-
- // update static menu with time ...
- Min := Round(Czas.Teraz) div 60;
- Sec := Round(Czas.Teraz) mod 60;
- Text[TextTimeText].Text := '';
- if Min < 10 then Text[TextTimeText].Text := '0';
- Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':';
- if Sec < 10 then Text[TextTimeText].Text := Text[TextTimeText].Text + '0';
- Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec);
-
- // .. and scores
- if PlayersPlay = 1 then begin
- Tekst := IntToStr(Player[0].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP1Score].Text := Tekst;
- end;
-
- if PlayersPlay = 2 then begin
- Tekst := IntToStr(Player[0].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP1TwoPScore].Text := Tekst;
-
- Tekst := IntToStr(Player[1].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP2RScore].Text := Tekst;
- end;
-
- if PlayersPlay = 3 then begin
- Tekst := IntToStr(Player[0].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP1ThreePScore].Text := Tekst;
-
- Tekst := IntToStr(Player[1].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP2MScore].Text := Tekst;
-
- Tekst := IntToStr(Player[2].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP3RScore].Text := Tekst;
- end;
-
- if PlayersPlay = 4 then begin
- if ScreenAct = 1 then begin
- Tekst := IntToStr(Player[0].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP1TwoPScore].Text := Tekst;
-
- Tekst := IntToStr(Player[1].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP2RScore].Text := Tekst;
- end;
- if ScreenAct = 2 then begin
- Tekst := IntToStr(Player[2].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP1TwoPScore].Text := Tekst;
-
- Tekst := IntToStr(Player[3].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP2RScore].Text := Tekst;
- end;
- end;
-
- if PlayersPlay = 6 then begin
- if ScreenAct = 1 then begin
- Tekst := IntToStr(Player[0].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP1ThreePScore].Text := Tekst;
-
- Tekst := IntToStr(Player[1].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP2MScore].Text := Tekst;
-
- Tekst := IntToStr(Player[2].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP3RScore].Text := Tekst;
- end;
- if ScreenAct = 2 then begin
- Tekst := IntToStr(Player[3].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP1ThreePScore].Text := Tekst;
-
- Tekst := IntToStr(Player[4].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP2MScore].Text := Tekst;
-
- Tekst := IntToStr(Player[5].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP3RScore].Text := Tekst;
- end;
- end;
-
- // draw static menu (BG)
- DrawBG;
- //Draw Background
- SingDrawBackground;
- // update and draw movie
- if ShowFinish and AktSong.VideoLoaded then begin
- try
-// UpdateSmpeg; // this only draws
- // todo: find a way to determine, when a new frame is needed
- // toto: same for the need to skip frames
- FFmpegGetFrame(Czas.Teraz);
- FFmpegDrawGL(ScreenAct);
- except
- //If an Error occurs drawing: prevent Video from being Drawn again and Close Video
- AktSong.VideoLoaded := False;
- log.LogError('Error drawing Video, Video has been disabled for this Song/Session.');
- Log.LogError('Corrupted File: ' + AktSong.Video);
- try
-// CloseSmpeg;
- FFmpegClose;
- except
-
- end;
- end;
- end;
-
- // draw static menu (FG)
- DrawFG;
-
- // check for music finish
-// Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(AktSong.Finish));
- if ShowFinish then begin
- if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin
- //Pause Mod:
- if not Paused then
- Sing(Self); // analyze song
- end else begin
-// Log.LogError('End');
- if not FadeOut then begin
-// Log.LogError('End2');
- Finish;
- FadeOut := true;
- FadeTo(@ScreenScore);
- end;
- end;
- end;
-
- // draw custom items
- SingDraw; // always draw
-
-//GoldenNoteStarsTwinkle Mod
- GoldenRec.SpawnRec;
-//GoldenNoteStarsTwinkle Mod
-
- // back stereo
-
-// weird stuff, maybe this is for "dual screen?", but where is player three then?
-// okay this stuff appears again some lines above this one, I commented it out for testing what it does - seems like it's doing nothing
-// but I might be wrong, so what is this stuff here doing? O.o
- Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX;
- Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX;
-
- Text[TextP1].X := Text[TextP1].X - 10*ScreenX;
- Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX;
-
-
- Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX;
- Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX;
-
- Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX;
- Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX;
-//weird end
-
- for S := 1 to 1 do // wtf?
- Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX;
-
- for T := 0 to 1 do
- Text[T].X := Text[T].X - 10*ScreenX;
-
-end;
-
-procedure TScreenSing.Finish;
-begin
- Music.CaptureStop;
- Music.Stop;
-
- if Ini.SavePlayback = 1 then begin
- Log.BenchmarkStart(0);
- Log.LogVoice(0);
- Log.LogVoice(1);
- Log.LogVoice(2);
- Log.BenchmarkEnd(0);
- Log.LogBenchmark('Creating files', 0);
- end;
-
- if AktSong.VideoLoaded then begin
-// CloseSmpeg;
- FFmpegClose;
- AktSong.VideoLoaded := false; // to prevent drawing closed video
- end;
-
- SetFontItalic (False);
-end;
-
-procedure TScreenSing.UpdateLCD;
-var
- T: string;
-begin
- LCD.HideCursor;
- LCD.Clear;
-
- T := LyricMain.Text;
- if Copy(T, Length(T), 1) <> ' ' then T := T + ' ';
- LCD.AddTextBR(T);
-
- T := LyricSub.Text;
- if Copy(T, Length(T), 1) <> ' ' then T := T + ' ';
- LCD.AddTextBR(T);
-end;
-
-procedure TScreenSing.onSentenceEnd(S: Cardinal);
-var
-I: Integer;
-A: Real;
-B: integer; //Max Points for Notes
-begin
-
- //Check for Empty Sentence
- if (Czesci[0].Czesc[S].TotalNotes<=0) then
- exit;
-
- //Set Max Note Points
- if (Ini.LineBonus > 0) then
- B := 9000
- else
- B := 10000;
-
- for I := 0 to High(Player) do begin
- A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2;
-
- //SingBar Mod
- If ({(Ini.Oscilloscope = 2) and }(Czesci[0].Czesc[S].TotalNotes>0)) then
- begin
- Player[I].ScorePercentTarget := Player[I].ScorePercentTarget + floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 40 - 26);
- if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0;
- if Player[I].ScorePercentTarget > 99 then Player[I].ScorePercentTarget := 99;
-
- //end Singbar Mod
- end;
-
- //PhrasenBonus - Line Bonus Mod
-
- //Generate Steps 0 to 8
- A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8);
-
- If (Ini.LineBonus > 0) then
- begin
-
- //Generate Text
- if A >= 8 then
- Player[I].LineBonus_Text := Theme.Sing.LineBonusText[8]
- else
- Player[I].LineBonus_Text := Theme.Sing.LineBonusText[Floor(A)];
-
- //PhrasenBonus give Points
- Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8);
- Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10;
- //Update Total Score
- Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI;
-
- //Color
- Case Floor(A) of
- 0: begin
- Player[I].LineBonus_Color.R := 1;
- Player[I].LineBonus_Color.G := 0;
- Player[I].LineBonus_Color.B := 0;
- end;
- 1..3: begin
- Player[I].LineBonus_Color.R := 1;
- Player[I].LineBonus_Color.G := (A * 0.25);
- Player[I].LineBonus_Color.B := 0;
- end;
- 4: begin
- Player[I].LineBonus_Color.R := 1;
- Player[I].LineBonus_Color.G := 1;
- Player[I].LineBonus_Color.B := 0;
- end;
- 5..7: begin
- Player[I].LineBonus_Color.R := 1-((a-4)*0.25);
- Player[I].LineBonus_Color.G := 1;
- Player[I].LineBonus_Color.B := 0;
- end;
- 8: begin
- Player[I].LineBonus_Color.R := 0;
- Player[I].LineBonus_Color.G := 1;
- Player[I].LineBonus_Color.B := 0;
- end;
- End; //Case
- //Player[I].LineBonus_Color.B := 0;
- //Player[I].LineBonus_Color.R := (8-A)/8;
- //Player[I].LineBonus_Color.G := A/10;
-
- Player[I].LineBonus_PosX := Player[I].LineBonus_StartX;
- Player[I].LineBonus_PosY := Player[I].LineBonus_StartY;
- Player[I].LineBonus_Alpha := 0.92;
- Player[I].LineBonus_Visible := True;
- Player[I].LineBonus_Age := 1;
- end;
- //PhrasenBonus - Line Bonus Mod End// }
-
- //PerfectLineTwinkle Mod (effect) Pt.1
- If (Ini.EffectSing=1) then
- begin
- if A >= 8 then Player[I].LastSentencePerfect := True
- else Player[I].LastSentencePerfect := False;
- end;
- //PerfectLineTwinkle Mod end
-
- //Refresh LastScore
- Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden;
-
- end;
-
- //PerfectLineTwinkle Mod (effect) Pt.2
- if Ini.EffectSing=1 then
- GoldenRec.SpawnPerfectLineTwinkle;
- //PerfectLineTwinkle Mod end
-end;
-
-//Called on Sentence Change S= New Current Sentence
-procedure TScreenSing.onSentenceChange(S: Cardinal);
-begin
- //GoldenStarsTwinkle Mod
- GoldenRec.SentenceChange;
- //GoldenStarsTwinkle Mod End
-end;
-
-end.
+unit UScreenSing;
+
+interface
+
+{$I switches.inc}
+
+{$IFDEF FPC}
+ {$MODE DELPHI}
+{$ENDIF}
+
+
+uses UMenu,
+ UMusic,
+ SDL,
+ SysUtils,
+ UFiles,
+ UTime,
+ USongs,
+ UIni,
+ ULog,
+ UTexture,
+ ULyrics,
+ TextGL,
+ OpenGL12,
+ {$IFDEF useBASS}
+ bass,
+ {$ENDIF}
+ UThemes,
+ ULCD,
+ UGraphicClasses,
+ UVideo;
+
+type
+ TScreenSing = class(TMenu)
+ protected
+ paused: boolean; //Pause Mod
+ PauseTime: Real;
+ NumEmptySentences: integer;
+ public
+ //TextTime: integer;
+
+ //TimeBar mod
+ StaticTimeProgress: integer;
+ TextTimeText: integer;
+ //eoa TimeBar mod
+
+ StaticP1: integer;
+ StaticP1ScoreBG: integer;
+ TextP1: integer;
+ TextP1Score: integer;
+
+ //moveable singbar mod
+ StaticP1SingBar: integer;
+ StaticP1ThreePSingBar: integer;
+ StaticP1TwoPSingBar: integer;
+ StaticP2RSingBar: integer;
+ StaticP2MSingBar: integer;
+ StaticP3SingBar: integer;
+ //eoa moveable singbar
+
+ //Added for ps3 skin
+ //shown when game is in 2/4 player modus
+ StaticP1TwoP: integer;
+ StaticP1TwoPScoreBG: integer;
+ TextP1TwoP: integer;
+ TextP1TwoPScore: integer;
+ //shown when game is in 3/6 player modus
+ StaticP1ThreeP: integer;
+ StaticP1ThreePScoreBG: integer;
+ TextP1ThreeP: integer;
+ TextP1ThreePScore: integer;
+ //eoa
+
+ StaticP2R: integer;
+ StaticP2RScoreBG: integer;
+ TextP2R: integer;
+ TextP2RScore: integer;
+
+ StaticP2M: integer;
+ StaticP2MScoreBG: integer;
+ TextP2M: integer;
+ TextP2MScore: integer;
+
+ StaticP3R: integer;
+ StaticP3RScoreBG: integer;
+ TextP3R: integer;
+ TextP3RScore: integer;
+
+ Tex_Background: TTexture;
+ FadeOut: boolean;
+ LyricMain: TLyric;
+ LyricSub: TLyric;
+
+ constructor Create; override;
+ procedure onShow; override;
+ procedure onShowFinish; override;
+ function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
+ function Draw: boolean; override;
+ procedure Finish; virtual;
+ procedure UpdateLCD;
+ procedure Pause; //Pause Mod(Toggles Pause)
+
+ //OnSentenceEnd for LineBonus + Singbar
+ procedure onSentenceEnd(S: Cardinal);
+ //OnSentenceChange (for Golden Notes)
+ procedure onSentenceChange(S: Cardinal);
+ end;
+
+implementation
+uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math;
+
+// Method for input parsing. If False is returned, GetNextWindow
+// should be checked to know the next window to load;
+function TScreenSing.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_Q:
+ begin
+ //When not ask before Exit then Finish now
+ if (Ini.AskbeforeDel <> 1) then
+ Finish
+ //else just Pause and let the Popup make the Work
+ else if not paused then
+ Pause;
+
+ Result := false;
+ end;
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ //Record Sound Hack:
+ //Sound[0].BufferLong
+
+ Finish;
+ Music.PlayBack;
+ FadeTo(@ScreenScore);
+ end;
+
+ SDLK_P://Pause Mod
+ begin
+ Pause;
+ end;
+
+ SDLK_RETURN:
+ begin
+ end;
+
+ // Up and Down could be done at the same time,
+ // but I don't want to declare variables inside
+ // functions like this one, called so many times
+ SDLK_DOWN :
+ begin
+ end;
+ SDLK_UP :
+ begin
+ end;
+ end;
+ end;
+end;
+
+//Pause Mod
+procedure TScreenSing.Pause;
+begin
+ if not paused then //Pause einschalten
+ begin
+ // pause Time
+ PauseTime := Czas.Teraz;
+ Paused := true;
+
+ // pause Music
+ Music.Pause;
+
+ // pause Video
+ if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then
+ FFmpegTogglePause;
+ end
+ else //Pause ausschalten
+ begin
+ Czas.Teraz := PauseTime; //Position of Notes
+
+ // Position of Music
+ Music.MoveTo (PauseTime);
+ // Play Music
+ Music.Play;
+
+ // Video
+ if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then
+ FFmpegTogglePause;
+ //SkipSmpeg(PauseTime);
+
+ Paused := false;
+ end;
+end;
+//Pause Mod End
+
+constructor TScreenSing.Create;
+var
+ I: integer;
+ P: integer;
+begin
+ inherited Create;
+
+ LoadFromTheme(Theme.Sing);
+
+ //TimeBar
+ StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress);
+ TextTimeText := AddText(Theme.Sing.TextTimeText);
+
+// 1 player | P1
+ StaticP1 := AddStatic(Theme.Sing.StaticP1);
+ StaticP1ScoreBG := AddStatic(Theme.Sing.StaticP1ScoreBG);
+ TextP1 := AddText(Theme.Sing.TextP1);
+ TextP1Score := AddText(Theme.Sing.TextP1Score);
+ StaticP1SingBar := AddStatic(Theme.Sing.StaticP1SingBar);
+
+// 2 or 4 players | P1
+ StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP);
+ StaticP1TwoPScoreBG := AddStatic(Theme.Sing.StaticP1TwoPScoreBG);
+ TextP1TwoP := AddText(Theme.Sing.TextP1TwoP);
+ TextP1TwoPScore := AddText(Theme.Sing.TextP1TwoPScore);
+ StaticP1TwoPSingBar := AddStatic(Theme.Sing.StaticP2RSingBar);
+
+ // | P2
+ StaticP2R := AddStatic(Theme.Sing.StaticP2R);
+ StaticP2RScoreBG := AddStatic(Theme.Sing.StaticP2RScoreBG);
+ TextP2R := AddText(Theme.Sing.TextP2R);
+ TextP2RScore := AddText(Theme.Sing.TextP2RScore);
+ StaticP2RSingBar := AddStatic(Theme.Sing.StaticP2RSingBar);
+
+// 3 or 6 players | P1
+ StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP);
+ StaticP1ThreePScoreBG := AddStatic(Theme.Sing.StaticP1ThreePScoreBG);
+ TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP);
+ TextP1ThreePScore := AddText(Theme.Sing.TextP1ThreePScore);
+ StaticP1ThreePSingBar := AddStatic(Theme.Sing.StaticP1ThreePSingBar);
+
+ // | P2
+ StaticP2M := AddStatic(Theme.Sing.StaticP2M);
+ StaticP2MScoreBG := AddStatic(Theme.Sing.StaticP2MScoreBG);
+ TextP2M := AddText(Theme.Sing.TextP2M);
+ TextP2MScore := AddText(Theme.Sing.TextP2MScore);
+ StaticP2MSingBar := AddStatic(Theme.Sing.StaticP2MSingBar);
+
+ // | P3
+ StaticP3R := AddStatic(Theme.Sing.StaticP3R);
+ StaticP3RScoreBG := AddStatic(Theme.Sing.StaticP3RScoreBG);
+ TextP3R := AddText(Theme.Sing.TextP3R);
+ TextP3RScore := AddText(Theme.Sing.TextP3RScore);
+ StaticP3SingBar := AddStatic(Theme.Sing.StaticP3SingBar);
+
+ if ScreenAct = 2 then begin
+ // katze und affe
+
+ end;
+
+ LyricMain := TLyric.Create;
+ LyricSub := TLyric.Create;
+
+ UVideo.Init;
+end;
+
+procedure TScreenSing.onShow;
+var
+ P: integer;
+ V1: boolean;
+ V1TwoP: boolean; //added for ps3 skin
+ V1ThreeP: boolean; //added for ps3 skin
+ V2R: boolean;
+ V2M: boolean;
+ V3R: boolean;
+ NR: TRecR; //Line Bonus Mod
+begin
+ Log.LogStatus('Begin', 'onShow');
+ FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented
+
+ // prepare players
+ SetLength(Player, PlayersPlay);
+// Player[0].ScoreTotalI := 0;
+
+ case PlayersPlay of
+ 1: begin
+ V1 := true;
+ V1TwoP := false;
+ V1ThreeP := false;
+ V2R := false;
+ V2M := false;
+ V3R := false;
+ end;
+ 2: begin
+ V1 := false;
+ V1TwoP := true;
+ V1ThreeP := false;
+ V2R := true;
+ V2M := false;
+ V3R := false;
+ end;
+ 3: begin
+ V1 := false;
+ V1TwoP := false;
+ V1ThreeP := true;
+ V2R := false;
+ V2M := true;
+ V3R := true;
+ end;
+ 4: begin // double screen
+ V1 := false;
+ V1TwoP := true;
+ V1ThreeP := false;
+ V2R := true;
+ V2M := false;
+ V3R := false;
+ end;
+ 6: begin // double screen
+ V1 := false;
+ V1TwoP := false;
+ V1ThreeP := true;
+ V2R := false;
+ V2M := true;
+ V3R := true;
+ end;
+
+ end;
+
+ //This one is shown in 1P mode
+ Static[StaticP1].Visible := V1;
+ Static[StaticP1ScoreBG].Visible := V1;
+ Text[TextP1].Visible := V1;
+ Text[TextP1Score].Visible := V1;
+
+
+ //This one is shown in 2/4P mode
+ Static[StaticP1TwoP].Visible := V1TwoP;
+ Static[StaticP1TwoPScoreBG].Visible := V1TwoP;
+ Text[TextP1TwoP].Visible := V1TwoP;
+ Text[TextP1TwoPScore].Visible := V1TwoP;
+
+ Static[StaticP2R].Visible := V2R;
+ Static[StaticP2RScoreBG].Visible := V2R;
+ Text[TextP2R].Visible := V2R;
+ Text[TextP2RScore].Visible := V2R;
+
+
+ //This one is shown in 3/6P mode
+ Static[StaticP1ThreeP].Visible := V1ThreeP;
+ Static[StaticP1ThreePScoreBG].Visible := V1ThreeP;
+ Text[TextP1ThreeP].Visible := V1ThreeP;
+ Text[TextP1ThreePScore].Visible := V1ThreeP;
+
+ Static[StaticP2M].Visible := V2M;
+ Static[StaticP2MScoreBG].Visible := V2M;
+ Text[TextP2M].Visible := V2M;
+ Text[TextP2MScore].Visible := V2M;
+
+ Static[StaticP3R].Visible := V3R;
+ Static[StaticP3RScoreBG].Visible := V3R;
+ Text[TextP3R].Visible := V3R;
+ Text[TextP3RScore].Visible := V3R;
+
+ // load notes
+ ResetSingTemp;
+// Log.LogWarning(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName, '!!!');
+ AktSong := CatSongs.Song[CatSongs.Selected];
+ try
+ if not LoadSong(CatSongs.Song[CatSongs.Selected].Path + CatSongs.Song[CatSongs.Selected].FileName) then
+ begin
+ //Error Loading Song -> Go back to Song Screen and Show some Error Message
+ FadeTo(@ScreenSong);
+ //Select New Song in Party Mode
+ if ScreenSong.Mode = 1 then
+ ScreenSong.SelectRandomSong;
+ ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG'));
+ Exit;
+ end;
+ except
+ //Error Loading Song -> Go back to Song Screen and Show some Error Message
+ FadeTo(@ScreenSong);
+ //Select New Song in Party Mode
+ if ScreenSong.Mode = 1 then
+ ScreenSong.SelectRandomSong;
+ ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG'));
+ Exit;
+ end;
+ AktSong.Path := CatSongs.Song[CatSongs.Selected].Path;
+// AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed
+
+ // set movie
+ if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin
+(* OpenSmpeg(AktSong.Path + AktSong.Video);
+ SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*)
+
+ // todo: VideoGap and Start time verwursten
+ FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video));
+ FFmpegSkip(AktSong.VideoGAP + AktSong.Start);
+ AktSong.VideoLoaded := true;
+ end;
+
+ // set background
+ if (AktSong.Background <> '') and (AktSong.VideoLoaded = false) then
+ try
+ Tex_Background := Texture.LoadTexture(AktSong.Path + AktSong.Background);
+ except
+ log.LogError('Background could not be loaded: ' + AktSong.Path + AktSong.Background);
+ Tex_Background.TexNum := -1;
+ end
+ else
+ Tex_Background.TexNum := -1;
+
+
+
+ // play music (I)
+ Music.CaptureStart;
+ Music.MoveTo(AktSong.Start);
+// Music.Play;
+
+ // prepare timer (I)
+// CountSkipTimeSet;
+ Czas.Teraz := AktSong.Start;
+ Czas.Razem := Music.Length;
+ if (AktSong.Finish > 0) then Czas.Razem := AktSong.Finish / 1000;
+ Czas.OldBeat := -1;
+ for P := 0 to High(Player) do
+ ClearScores(P);
+
+ // main text
+ LyricMain.Clear;
+ LyricMain.X := 400;
+ LyricMain.Y := Skin_LyricsT;
+ LyricMain.Scale := 1.4; //1.4
+ LyricMain.Align := 1;
+
+ // sub text
+ LyricSub.Clear;
+ LyricSub.X := 400;
+ LyricSub.Y := Skin_LyricsT + 35; //42 //40
+ LyricSub.Align := 1;
+
+ // set custom options
+ case Ini.LyricsFont of
+ 0:
+ begin
+ LyricMain.FontStyle := 0;
+ LyricSub.FontStyle := 0;
+ LyricMain.Size := 14; // 13
+ LyricSub.Size := 14; // 13
+ LyricMain.ColR := Skin_FontR;
+ LyricMain.ColG := Skin_FontG;
+ LyricMain.ColB := Skin_FontB; //Change für Crazy Joker
+ {LyricMain.ColSR := Skin_FontHighlightR;
+ LyricMain.ColSG := Skin_FontHighlightG;
+ LyricMain.ColSB := Skin_FontHighlightB;1aa5dc}
+ LyricMain.ColSR := 5/255; //26
+ LyricMain.ColSG := 163/255; //165
+ LyricMain.ColSB := 210/255; //220
+
+ LyricSub.ColR := 0.4; //0.6
+ LyricSub.ColG := 0.4; //0.6
+ LyricSub.ColB := 0.4; //0.6
+ end;
+ 1:
+ begin
+ LyricMain.FontStyle := 2;
+ LyricSub.FontStyle := 2;
+ LyricMain.Size := 14;
+ LyricSub.Size := 14;
+ LyricMain.ColR := 0.75;
+ LyricMain.ColG := 0.75;
+ LyricMain.ColB := 1;
+ LyricMain.ColSR := 0.5;
+ LyricMain.ColSG := 0.5;
+ LyricMain.ColSB := 1;
+ LyricSub.ColR := 0.8;
+ LyricSub.ColG := 0.8;
+ LyricSub.ColB := 0.8;
+ end;
+ 2:
+ begin
+ LyricMain.FontStyle := 3;
+ LyricSub.FontStyle := 3;
+ LyricMain.Size := 12;
+ LyricSub.Size := 12;
+ LyricMain.ColR := 0.75;
+ LyricMain.ColG := 0.75;
+ LyricMain.ColB := 1;
+ LyricMain.ColSR := 0.5;
+ LyricMain.ColSG := 0.5;
+ LyricMain.ColSB := 1;
+ LyricSub.ColR := 0.8;
+ LyricSub.ColG := 0.8;
+ LyricSub.ColB := 0.8;
+ end;
+ end; // case
+
+ case Ini.LyricsEffect of
+ 0: LyricMain.Style := 1; // 0 - one selected, 1 - selected all to the current
+ 1: LyricMain.Style := 2;
+ 2: LyricMain.Style := 3;
+ 3: LyricMain.Style := 4;
+ end; // case
+
+ // fill texts
+ LyricMain.AddCzesc(0);
+ LyricMain.Selected := -1;
+ LyricSub.AddCzesc(1);
+ LyricSub.Selected := -1;
+
+ UpdateLCD;
+
+ //Deactivate Pause
+ Paused := False;
+
+ //Kill all Stars not Killed yet
+ //GoldenStarsTwinkle Mod
+ GoldenRec.SentenceChange;
+ //GoldenStarsTwinkle Mod End
+
+ //Set Position of Line Bonus - PhrasenBonus
+ if (Ini.LineBonus = 1) then //Show Line Bonus at Scores
+ begin
+ Case PlayersPlay of
+ 1: begin
+ Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ScoreBG.x;
+ Player[0].LineBonus_TargetY := Theme.Sing.TextP1Score.Y;
+ Player[0].LineBonus_StartX := Theme.Sing.StaticP1ScoreBG.x;
+ Player[0].LineBonus_StartY := Theme.Sing.TextP1Score.Y + 65;
+ end;
+
+ 2: begin
+ //P1
+ Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x;
+ Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y;
+ Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.X;
+ Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65;
+
+ //P2
+ Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.X;
+ Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y;
+ Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.X;
+ Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65;
+ end;
+
+ 3: begin
+ //P1
+ Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x;
+ Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y;
+ Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x;
+ Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65;
+
+ //P2
+ Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x;
+ Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y;
+ Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x;
+ Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65;
+
+ //P3
+ Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x;
+ Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y;
+ Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x;
+ Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65;
+ end;
+
+ 4: begin
+ //P1
+ Player[0].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x;
+ Player[0].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y;
+ Player[0].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x;
+ Player[0].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65;
+
+ //P2
+ Player[1].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x;
+ Player[1].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y;
+ Player[1].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x;
+ Player[1].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65;
+
+ //P3
+ Player[2].LineBonus_TargetX := Theme.Sing.StaticP1TwoPScoreBG.x;
+ Player[2].LineBonus_TargetY := Theme.Sing.TextP1TwoPScore.Y;
+ Player[2].LineBonus_StartX := Theme.Sing.StaticP1TwoPScoreBG.x;
+ Player[2].LineBonus_StartY := Theme.Sing.TextP1TwoPScore.Y + 65;
+
+ //P4
+ Player[3].LineBonus_TargetX := Theme.Sing.StaticP2RScoreBG.x;
+ Player[3].LineBonus_TargetY := Theme.Sing.TextP2RScore.Y;
+ Player[3].LineBonus_StartX := Theme.Sing.StaticP2RScoreBG.x;
+ Player[3].LineBonus_StartY := Theme.Sing.TextP2RScore.Y + 65;
+ end;
+
+ 6: begin
+ //P1
+ Player[0].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x;
+ Player[0].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y;
+ Player[0].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x;
+ Player[0].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65;
+
+ //P2
+ Player[1].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x;
+ Player[1].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y;
+ Player[1].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x;
+ Player[1].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65;
+
+ //P3
+ Player[2].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x;
+ Player[2].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y;
+ Player[2].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x;
+ Player[2].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65;
+
+ //P4
+ Player[3].LineBonus_TargetX := Theme.Sing.StaticP1ThreePScoreBG.x;
+ Player[3].LineBonus_TargetY := Theme.Sing.TextP1ThreePScore.Y;
+ Player[3].LineBonus_StartX := Theme.Sing.StaticP1ThreePScoreBG.x;
+ Player[3].LineBonus_StartY := Theme.Sing.TextP1ThreePScore.Y + 65;
+
+ //P5
+ Player[4].LineBonus_TargetX := Theme.Sing.StaticP2MScoreBG.x;
+ Player[4].LineBonus_TargetY := Theme.Sing.TextP2MScore.Y;
+ Player[4].LineBonus_StartX := Theme.Sing.StaticP2MScoreBG.x;
+ Player[4].LineBonus_StartY := Theme.Sing.TextP2MScore.Y + 65;
+
+ //P6
+ Player[5].LineBonus_TargetX := Theme.Sing.StaticP3RScoreBG.x;
+ Player[5].LineBonus_TargetY := Theme.Sing.TextP3RScore.Y;
+ Player[5].LineBonus_StartX := Theme.Sing.StaticP3RScoreBG.x;
+ Player[5].LineBonus_StartY := Theme.Sing.TextP3RScore.Y + 65;
+ end;
+ end;
+ end
+ else if (Ini.LineBonus = 2) then //Show Line Bonus at Notes
+ begin
+
+ // positions
+ if Ini.SingWindow = 0 then begin
+ NR.Left := 120;
+ end else begin
+ NR.Left := 20;
+ end;
+ NR.Right := 780;
+
+ NR.Width := NR.Right - NR.Left;
+ NR.WMid := NR.Width / 2;
+ NR.Mid := NR.Left + NR.WMid;
+
+ Case PlayersPlay of
+ 1: begin
+ Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[0].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65;
+ Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[0].LineBonus_StartY := Skin_P2_NotesB - 105;
+ end;
+
+ 2: begin
+ //P1
+ Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28;
+ Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28;
+
+ //P2
+ Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28;
+ Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28;
+ end;
+
+ 3: begin
+ //P1
+ Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[0].LineBonus_TargetY := 120 - 65 + 28;
+ Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[0].LineBonus_StartY := 120 + 28;
+
+ //P2
+ Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[1].LineBonus_TargetY := 245 - 65 + 28;
+ Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[1].LineBonus_StartY := 245 + 28;
+
+ //P3
+ Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[2].LineBonus_TargetY := 370 - 65 + 28;
+ Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[2].LineBonus_StartY := 370 + 28;
+ end;
+
+ 4: begin
+ //P1
+ Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[0].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28;
+ Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[0].LineBonus_StartY := Skin_P1_NotesB - 105 + 28;
+
+ //P2
+ Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[1].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28;
+ Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[1].LineBonus_StartY := Skin_P2_NotesB - 105 + 28;
+
+ //P3
+ Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[2].LineBonus_TargetY := Skin_P1_NotesB - 105 - 65 + 28;
+ Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[2].LineBonus_StartY := Skin_P1_NotesB - 105 + 28;
+
+ //P4
+ Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[3].LineBonus_TargetY := Skin_P2_NotesB - 105 - 65 + 28;
+ Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[3].LineBonus_StartY := Skin_P2_NotesB - 105 + 28;
+ end;
+
+ 6: begin
+ //P1
+ Player[0].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[0].LineBonus_TargetY := 120 - 65 + 28;
+ Player[0].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[0].LineBonus_StartY := 120 + 28;
+
+ //P2
+ Player[1].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[1].LineBonus_TargetY := 245 - 65 + 28;
+ Player[1].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[1].LineBonus_StartY := 245 + 28;
+
+ //P3
+ Player[2].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[2].LineBonus_TargetY := 370 - 65 + 28;
+ Player[2].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[2].LineBonus_StartY := 370 + 28;
+
+ //P4
+ Player[3].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[3].LineBonus_TargetY := 120 - 65 + 28;
+ Player[3].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[3].LineBonus_StartY := 120 + 28;
+
+ //P5
+ Player[4].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[4].LineBonus_TargetY := 245 - 65 + 28;
+ Player[4].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[4].LineBonus_StartY := 245 + 28;
+
+ //P6
+ Player[5].LineBonus_TargetX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[5].LineBonus_TargetY := 370 - 65 + 28;
+ Player[5].LineBonus_StartX := Round(Nr.Right + 10*ScreenX - 100);
+ Player[5].LineBonus_StartY := 370 + 28;
+ end;
+ end;
+ end;
+ //Set Position of Line Bonus - PhrasenBonus End
+ //Set Num of Empty Sentences for Phrasen Bonus
+ NumEmptySentences := 0;
+ for P := low(Czesci[0].Czesc) to high(Czesci[0].Czesc) do
+ if Czesci[0].Czesc[P].TotalNotes = 0 then Inc(NumEmptySentences);
+
+ Log.LogStatus('End', 'onShow');
+end;
+
+procedure TScreenSing.onShowFinish;
+begin
+ // play movie (II)
+
+ if AktSong.VideoLoaded then
+ begin
+ try
+ FFmpegGetFrame(Czas.Teraz);
+ FFmpegDrawGL(ScreenAct);
+// PlaySmpeg;
+ except
+ //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video
+ AktSong.VideoLoaded := False;
+ Log.LogError('Error drawing Video, Video has been disabled for this Song/Session.');
+ Log.LogError('Corrupted File: ' + AktSong.Video);
+ try
+// CloseSmpeg;
+ FFmpegClose;
+ except
+
+ end;
+ end;
+ end;
+
+ // play music (II)
+ Music.Play;
+
+ // prepare timer (II)
+ CountSkipTimeSet;
+end;
+
+function TScreenSing.Draw: boolean;
+var
+ Min: integer;
+ Sec: integer;
+ Tekst: string;
+ Flash: real;
+ S: integer;
+ T: integer;
+begin
+
+
+
+ //ScoreBG Mod | den wirren Scheiss hier brauch mer nimmer, wir haben colorized png's - no need for wirrness also
+ // set player colors - macht nichts weiter als die farben des statics zu wechseln, was zu unschönen effekten bei colorized png führt
+{ if PlayersPlay = 4 then begin
+ if ScreenAct = 1 then begin
+ LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG,
+ Static[StaticP1TwoP].Texture.ColB, 'P1Dark');
+ LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG,
+ Static[StaticP2R].Texture.ColB, 'P2Dark');
+
+ LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG,
+ Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark');
+ LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG,
+ Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark');
+ end;
+ if ScreenAct = 2 then begin
+ LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG,
+ Static[StaticP1TwoP].Texture.ColB, 'P3Dark');
+ LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG,
+ Static[StaticP2R].Texture.ColB, 'P4Dark');
+
+ LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG,
+ Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark');
+ LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG,
+ Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark');
+ end;
+ end;
+
+ if PlayersPlay = 6 then begin
+ if ScreenAct = 1 then begin
+ LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG,
+ Static[StaticP1ThreeP].Texture.ColB, 'P1Dark');
+ LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG,
+ Static[StaticP2R].Texture.ColB, 'P2Dark');
+ LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG,
+ Static[StaticP3R].Texture.ColB, 'P3Dark');
+
+ LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG,
+ Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark');
+ LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG,
+ Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark');
+ LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG,
+ Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark');
+ end;
+ if ScreenAct = 2 then begin
+
+ LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG,
+ Static[StaticP1ThreeP].Texture.ColB, 'P4Dark');
+ LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG,
+ Static[StaticP2R].Texture.ColB, 'P5Dark');
+ LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG,
+ Static[StaticP3R].Texture.ColB, 'P6Dark');
+
+
+ LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG,
+ Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark');
+ LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG,
+ Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark');
+ LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG,
+ Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark');
+ end;
+ end;
+ }
+
+ // set player names (for 2 screens and only Singstar skin)
+ if ScreenAct = 1 then begin
+ Text[TextP1].Text := 'P1';
+ Text[TextP1TwoP].Text := 'P1';
+ Text[TextP1ThreeP].Text := 'P1';
+ Text[TextP2R].Text := 'P2';
+ Text[TextP2M].Text := 'P2';
+ Text[TextP3R].Text := 'P3';
+ end;
+
+ if ScreenAct = 2 then begin
+ case PlayersPlay of
+{ 1: begin
+ Text[TextP1].Text := 'P2';
+ end;
+ 2: begin
+ Text[TextP1].Text := 'P3';
+ Text[TextP2R].Text := 'P4';
+ end;
+ 3: begin
+ Text[TextP1].Text := 'P4';
+ Text[TextP2M].Text := 'P5';
+ Text[TextP3R].Text := 'P6';
+ end;}
+
+ 4: begin
+ Text[TextP1TwoP].Text := 'P3';
+ Text[TextP2R].Text := 'P4';
+ end;
+ 6: begin
+ Text[TextP1ThreeP].Text := 'P4';
+ Text[TextP2M].Text := 'P5';
+ Text[TextP3R].Text := 'P6';
+ end;
+ end; // case
+ end; // if
+
+ // stereo
+
+// weird stuff, maybe this is for "dual screen?", but where is player three then? | okay, i commented the stuff out the other day - nothing was missing on screen w/ 6 players - so do we even need this stuff?
+// okay this stuff appears again some lines beneath this one, I commented it out for testing what it does - seems like it's doing nothing
+// but I might be wrong, so what is this stuff here doing? O.o
+ Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX;
+ Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX;
+
+ Text[TextP1].X := Text[TextP1].X + 10*ScreenX;
+ Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;
+
+
+ Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX;
+ Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX;
+
+ Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX;
+ Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;
+// end of weird stuff
+
+ for S := 1 to 1 do //wtf?
+ Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX;
+
+ for T := 0 to 1 do
+ Text[T].X := Text[T].X + 10*ScreenX;
+
+ // update static menu with time ...
+ Min := Round(Czas.Teraz) div 60;
+ Sec := Round(Czas.Teraz) mod 60;
+ Text[TextTimeText].Text := '';
+ if Min < 10 then Text[TextTimeText].Text := '0';
+ Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':';
+ if Sec < 10 then Text[TextTimeText].Text := Text[TextTimeText].Text + '0';
+ Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec);
+
+ // .. and scores
+ if PlayersPlay = 1 then begin
+ Tekst := IntToStr(Player[0].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP1Score].Text := Tekst;
+ end;
+
+ if PlayersPlay = 2 then begin
+ Tekst := IntToStr(Player[0].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP1TwoPScore].Text := Tekst;
+
+ Tekst := IntToStr(Player[1].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP2RScore].Text := Tekst;
+ end;
+
+ if PlayersPlay = 3 then begin
+ Tekst := IntToStr(Player[0].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP1ThreePScore].Text := Tekst;
+
+ Tekst := IntToStr(Player[1].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP2MScore].Text := Tekst;
+
+ Tekst := IntToStr(Player[2].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP3RScore].Text := Tekst;
+ end;
+
+ if PlayersPlay = 4 then begin
+ if ScreenAct = 1 then begin
+ Tekst := IntToStr(Player[0].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP1TwoPScore].Text := Tekst;
+
+ Tekst := IntToStr(Player[1].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP2RScore].Text := Tekst;
+ end;
+ if ScreenAct = 2 then begin
+ Tekst := IntToStr(Player[2].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP1TwoPScore].Text := Tekst;
+
+ Tekst := IntToStr(Player[3].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP2RScore].Text := Tekst;
+ end;
+ end;
+
+ if PlayersPlay = 6 then begin
+ if ScreenAct = 1 then begin
+ Tekst := IntToStr(Player[0].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP1ThreePScore].Text := Tekst;
+
+ Tekst := IntToStr(Player[1].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP2MScore].Text := Tekst;
+
+ Tekst := IntToStr(Player[2].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP3RScore].Text := Tekst;
+ end;
+ if ScreenAct = 2 then begin
+ Tekst := IntToStr(Player[3].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP1ThreePScore].Text := Tekst;
+
+ Tekst := IntToStr(Player[4].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP2MScore].Text := Tekst;
+
+ Tekst := IntToStr(Player[5].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP3RScore].Text := Tekst;
+ end;
+ end;
+
+ // draw static menu (BG)
+ DrawBG;
+ //Draw Background
+ SingDrawBackground;
+ // update and draw movie
+ if ShowFinish and AktSong.VideoLoaded then begin
+ try
+// UpdateSmpeg; // this only draws
+ // todo: find a way to determine, when a new frame is needed
+ // toto: same for the need to skip frames
+ FFmpegGetFrame(Czas.Teraz);
+ FFmpegDrawGL(ScreenAct);
+ except
+ //If an Error occurs drawing: prevent Video from being Drawn again and Close Video
+ AktSong.VideoLoaded := False;
+ log.LogError('Error drawing Video, Video has been disabled for this Song/Session.');
+ Log.LogError('Corrupted File: ' + AktSong.Video);
+ try
+// CloseSmpeg;
+ FFmpegClose;
+ except
+
+ end;
+ end;
+ end;
+
+ // draw static menu (FG)
+ DrawFG;
+
+ // check for music finish
+// Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(Czas.Teraz*1000) + ' ' + IntToStr(AktSong.Finish));
+ if ShowFinish then begin
+ if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin
+ //Pause Mod:
+ if not Paused then
+ Sing(Self); // analyze song
+ end else begin
+// Log.LogError('End');
+ if not FadeOut then begin
+// Log.LogError('End2');
+ Finish;
+ FadeOut := true;
+ FadeTo(@ScreenScore);
+ end;
+ end;
+ end;
+
+ // draw custom items
+ SingDraw; // always draw
+
+//GoldenNoteStarsTwinkle Mod
+ GoldenRec.SpawnRec;
+//GoldenNoteStarsTwinkle Mod
+
+ // back stereo
+
+// weird stuff, maybe this is for "dual screen?", but where is player three then?
+// okay this stuff appears again some lines above this one, I commented it out for testing what it does - seems like it's doing nothing
+// but I might be wrong, so what is this stuff here doing? O.o
+ Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX;
+ Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX;
+
+ Text[TextP1].X := Text[TextP1].X - 10*ScreenX;
+ Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX;
+
+
+ Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX;
+ Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX;
+
+ Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX;
+ Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX;
+//weird end
+
+ for S := 1 to 1 do // wtf?
+ Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX;
+
+ for T := 0 to 1 do
+ Text[T].X := Text[T].X - 10*ScreenX;
+
+end;
+
+procedure TScreenSing.Finish;
+begin
+ Music.CaptureStop;
+ Music.Stop;
+
+ if Ini.SavePlayback = 1 then begin
+ Log.BenchmarkStart(0);
+ Log.LogVoice(0);
+ Log.LogVoice(1);
+ Log.LogVoice(2);
+ Log.BenchmarkEnd(0);
+ Log.LogBenchmark('Creating files', 0);
+ end;
+
+ if AktSong.VideoLoaded then begin
+// CloseSmpeg;
+ FFmpegClose;
+ AktSong.VideoLoaded := false; // to prevent drawing closed video
+ end;
+
+ SetFontItalic (False);
+end;
+
+procedure TScreenSing.UpdateLCD;
+var
+ T: string;
+begin
+ LCD.HideCursor;
+ LCD.Clear;
+
+ T := LyricMain.Text;
+ if Copy(T, Length(T), 1) <> ' ' then T := T + ' ';
+ LCD.AddTextBR(T);
+
+ T := LyricSub.Text;
+ if Copy(T, Length(T), 1) <> ' ' then T := T + ' ';
+ LCD.AddTextBR(T);
+end;
+
+procedure TScreenSing.onSentenceEnd(S: Cardinal);
+var
+I: Integer;
+A: Real;
+B: integer; //Max Points for Notes
+begin
+
+ //Check for Empty Sentence
+ if (Czesci[0].Czesc[S].TotalNotes<=0) then
+ exit;
+
+ //Set Max Note Points
+ if (Ini.LineBonus > 0) then
+ B := 9000
+ else
+ B := 10000;
+
+ for I := 0 to High(Player) do begin
+ A := Player[I].Score + Player[I].ScoreGolden - Player[I].ScoreLast + 2;
+
+ //SingBar Mod
+ If ({(Ini.Oscilloscope = 2) and }(Czesci[0].Czesc[S].TotalNotes>0)) then
+ begin
+ Player[I].ScorePercentTarget := Player[I].ScorePercentTarget + floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 40 - 26);
+ if Player[I].ScorePercentTarget < 0 then Player[I].ScorePercentTarget := 0;
+ if Player[I].ScorePercentTarget > 99 then Player[I].ScorePercentTarget := 99;
+
+ //end Singbar Mod
+ end;
+
+ //PhrasenBonus - Line Bonus Mod
+
+ //Generate Steps 0 to 8
+ A := Floor(A / (B * Czesci[0].Czesc[S].TotalNotes / Czesci[0].Wartosc) * 8);
+
+ If (Ini.LineBonus > 0) then
+ begin
+
+ //Generate Text
+ if A >= 8 then
+ Player[I].LineBonus_Text := Theme.Sing.LineBonusText[8]
+ else
+ Player[I].LineBonus_Text := Theme.Sing.LineBonusText[Floor(A)];
+
+ //PhrasenBonus give Points
+ Player[I].ScoreLine := Player[I].ScoreLine + (1000 / (Length(Czesci[0].Czesc) - NumEmptySentences) * A / 8);
+ Player[I].ScoreLineI := Round(Player[I].ScoreLine / 10) * 10;
+ //Update Total Score
+ Player[I].ScoreTotalI := Player[I].ScoreI + Player[I].ScoreGoldenI + Player[I].ScoreLineI;
+
+ //Color
+ Case Floor(A) of
+ 0: begin
+ Player[I].LineBonus_Color.R := 1;
+ Player[I].LineBonus_Color.G := 0;
+ Player[I].LineBonus_Color.B := 0;
+ end;
+ 1..3: begin
+ Player[I].LineBonus_Color.R := 1;
+ Player[I].LineBonus_Color.G := (A * 0.25);
+ Player[I].LineBonus_Color.B := 0;
+ end;
+ 4: begin
+ Player[I].LineBonus_Color.R := 1;
+ Player[I].LineBonus_Color.G := 1;
+ Player[I].LineBonus_Color.B := 0;
+ end;
+ 5..7: begin
+ Player[I].LineBonus_Color.R := 1-((a-4)*0.25);
+ Player[I].LineBonus_Color.G := 1;
+ Player[I].LineBonus_Color.B := 0;
+ end;
+ 8: begin
+ Player[I].LineBonus_Color.R := 0;
+ Player[I].LineBonus_Color.G := 1;
+ Player[I].LineBonus_Color.B := 0;
+ end;
+ End; //Case
+ //Player[I].LineBonus_Color.B := 0;
+ //Player[I].LineBonus_Color.R := (8-A)/8;
+ //Player[I].LineBonus_Color.G := A/10;
+
+ Player[I].LineBonus_PosX := Player[I].LineBonus_StartX;
+ Player[I].LineBonus_PosY := Player[I].LineBonus_StartY;
+ Player[I].LineBonus_Alpha := 0.92;
+ Player[I].LineBonus_Visible := True;
+ Player[I].LineBonus_Age := 1;
+ end;
+ //PhrasenBonus - Line Bonus Mod End// }
+
+ //PerfectLineTwinkle Mod (effect) Pt.1
+ If (Ini.EffectSing=1) then
+ begin
+ if A >= 8 then Player[I].LastSentencePerfect := True
+ else Player[I].LastSentencePerfect := False;
+ end;
+ //PerfectLineTwinkle Mod end
+
+ //Refresh LastScore
+ Player[I].ScoreLast := Player[I].Score + Player[I].ScoreGolden;
+
+ end;
+
+ //PerfectLineTwinkle Mod (effect) Pt.2
+ if Ini.EffectSing=1 then
+ GoldenRec.SpawnPerfectLineTwinkle;
+ //PerfectLineTwinkle Mod end
+end;
+
+//Called on Sentence Change S= New Current Sentence
+procedure TScreenSing.onSentenceChange(S: Cardinal);
+begin
+ //GoldenStarsTwinkle Mod
+ GoldenRec.SentenceChange;
+ //GoldenStarsTwinkle Mod End
+end;
+
+end.
diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas
index 6d3add87..455d7b40 100644
--- a/Game/Code/Screens/UScreenSingModi.pas
+++ b/Game/Code/Screens/UScreenSingModi.pas
@@ -1,665 +1,669 @@
-unit UScreenSingModi;
-
-interface
-
-{$IFDEF FPC}
- {$MODE DELPHI}
-{$ENDIF}
-
-uses UMenu,
- UMusic,
- SDL,
- SysUtils,
- UFiles,
- UTime,
- USongs,
- UIni,
- ULog,
- UTexture,
- ULyrics,
- TextGL,
- OpenGL12,
- BASS,
- UThemes,
- ULCD,
- UScreenSing,
- ModiSDK;
-
-type
- TScreenSingModi = class(TScreenSing)
- protected
- //paused: boolean; //Pause Mod
- //PauseTime: Real;
- //NumEmptySentences: integer;
- public
- //TextTime: integer;
-
- //StaticP1: integer;
- //StaticP1ScoreBG: integer;
- //TextP1: integer;
- //TextP1Score: integer;
-
- //StaticP2R: integer;
- //StaticP2RScoreBG: integer;
- //TextP2R: integer;
- //TextP2RScore: integer;
-
- //StaticP2M: integer;
- //StaticP2MScoreBG: integer;
- //TextP2M: integer;
- //TextP2MScore: integer;
-
- //StaticP3R: integer;
- //StaticP3RScoreBG: integer;
- //TextP3R: integer;
- //TextP3RScore: integer;
-
- //Tex_Background: TTexture;
- //FadeOut: boolean;
- //LyricMain: TLyric;
- //LyricSub: TLyric;
- Winner: Byte; //Who Wins
- PlayerInfo: TPlayerInfo;
- TeamInfo: TTeamInfo;
-
- constructor Create; override;
- procedure onShow; override;
- //procedure onShowFinish; override;
- function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
- function Draw: boolean; override;
- procedure Finish; override;
- //procedure UpdateLCD;
- //procedure Pause; //Pause Mod(Toggles Pause)
- end;
-
-//Procedured for Plugin
-function LoadTex (const Name, Typ: PChar): TsmallTexture; stdcall;
-//function Translate (const Name: PChar): PChar; stdcall;
-procedure Print (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text
-function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound
-procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound
-
-//Utilys
-function ToSentences(Const Czeski: TCzesci): TSentences;
-
-implementation
-uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math, UDLLManager, USkins, UGraphicClasses;
-
-// Method for input parsing. If False is returned, GetNextWindow
-// should be checked to know the next window to load;
-function TScreenSingModi.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
-begin
- Result := true;
- If (PressedDown) Then
- begin // Key Down
- case PressedKey of
-
- SDLK_ESCAPE,
- SDLK_BACKSPACE :
- begin
- Finish;
- Music.PlayBack;
- FadeTo(@ScreenPartyScore);
- end;
-
- else
- Result := inherited ParseInput(PressedKey, ScanCode, PressedDown);
- end;
- end;
-end;
-
-constructor TScreenSingModi.Create;
-begin
- inherited Create;
-
-end;
-
-function ToSentences(Const Czeski: TCzesci): TSentences;
-var
- I, J: Integer;
-begin
- Result.Akt := Czeski.Akt;
- Result.High := Czeski.High;
- Result.Ilosc := Czeski.Ilosc;
- Result.Resolution := Czeski.Resolution;
- Result.NotesGAP := Czeski.NotesGAP;
- Result.TotalLength := Czeski.Wartosc;
-
- SetLength(Result.Sentence, Length(Czeski.Czesc));
- for I := low(Result.Sentence) to high(Result.Sentence) do
- begin
- Result.Sentence[I].Start := Czeski.Czesc[I].Start;
- Result.Sentence[I].StartNote := Czeski.Czesc[I].StartNote;
- Result.Sentence[I].Lyric := Czeski.Czesc[I].Lyric;
- Result.Sentence[I].LyricWidth := Czeski.Czesc[I].LyricWidth;
- Result.Sentence[I].Koniec := Czeski.Czesc[I].Koniec;
- Result.Sentence[I].BaseNote := Czeski.Czesc[I].BaseNote;
- Result.Sentence[I].HighNote := Czeski.Czesc[I].HighNut;
- Result.Sentence[I].IlNut := Czeski.Czesc[I].IlNut;
- Result.Sentence[I].TotalNotes := Czeski.Czesc[I].TotalNotes;
-
- SetLength(Result.Sentence[I].Note, Length(Czeski.Czesc[I].Nuta));
- for J := low(Result.Sentence[I].Note) to high(Result.Sentence[I].Note) do
- begin
- Result.Sentence[I].Note[J].Color := Czeski.Czesc[I].Nuta[J].Color;
- Result.Sentence[I].Note[J].Start := Czeski.Czesc[I].Nuta[J].Start;
- Result.Sentence[I].Note[J].Length := Czeski.Czesc[I].Nuta[J].Dlugosc;
- Result.Sentence[I].Note[J].Ton := Czeski.Czesc[I].Nuta[J].Ton;
- Result.Sentence[I].Note[J].TonGamy := Czeski.Czesc[I].Nuta[J].TonGamy;
- //Result.Sentence[I].Note[J].Text := Czeski.Czesc[I].Nuta[J].Tekst;
- Result.Sentence[I].Note[J].FreeStyle := Czeski.Czesc[I].Nuta[J].FreeStyle;
- Result.Sentence[I].Note[J].Typ := Czeski.Czesc[I].Nuta[J].Wartosc;
- end;
- end;
-end;
-
-procedure TScreenSingModi.onShow;
-var
- I: Integer;
-begin
-
- PlayersPlay := TeamInfo.NumTeams;
-
- if DLLMan.Selected.LoadSong then //Start with Song
- begin
- inherited;
- end
- else //Start Without Song
- begin
- Music.CaptureStart;
- end;
-
-//Set Playerinfo
- PlayerInfo.NumPlayers := PlayersPlay;
- for I := 0 to PlayerInfo.NumPlayers-1 do
- begin
- PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]);
- PlayerInfo.Playerinfo[I].Score := 0;
- PlayerInfo.Playerinfo[I].Bar := 50;
- PlayerInfo.Playerinfo[I].Enabled := True;
- end;
-
- for I := PlayerInfo.NumPlayers to high(PlayerInfo.Playerinfo) do
- begin
- PlayerInfo.Playerinfo[I].Score:= 0;
- PlayerInfo.Playerinfo[I].Bar := 0;
- PlayerInfo.Playerinfo[I].Enabled := False;
- end;
-
- Case PlayersPlay of
- 1: begin
- PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X;
- PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H;
- end;
- 2,4: begin
- PlayerInfo.Playerinfo[0].PosX := Static[StaticP1TwoPScoreBG].Texture.X;
- PlayerInfo.Playerinfo[0].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H;
- PlayerInfo.Playerinfo[2].PosX := Static[StaticP1TwoPScoreBG].Texture.X;
- PlayerInfo.Playerinfo[2].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H;
- PlayerInfo.Playerinfo[1].PosX := Static[StaticP2RScoreBG].Texture.X;
- PlayerInfo.Playerinfo[1].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H;
- PlayerInfo.Playerinfo[3].PosX := Static[StaticP2RScoreBG].Texture.X;
- PlayerInfo.Playerinfo[3].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H;
- end;
- 3,6: begin
- PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ThreePScoreBG].Texture.X;
- PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H;
- PlayerInfo.Playerinfo[3].PosX := Static[StaticP1ThreePScoreBG].Texture.X;
- PlayerInfo.Playerinfo[3].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H;
- PlayerInfo.Playerinfo[1].PosX := Static[StaticP2MScoreBG].Texture.X;
- PlayerInfo.Playerinfo[1].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H;
- PlayerInfo.Playerinfo[4].PosX := Static[StaticP2MScoreBG].Texture.X;
- PlayerInfo.Playerinfo[4].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H;
- PlayerInfo.Playerinfo[2].PosX := Static[StaticP3RScoreBG].Texture.X;
- PlayerInfo.Playerinfo[2].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H;
- PlayerInfo.Playerinfo[5].PosX := Static[StaticP3RScoreBG].Texture.X;
- PlayerInfo.Playerinfo[5].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H;
- end;
- end;
-
- // play music (I)
- //Music.CaptureStart;
- //Music.MoveTo(AktSong.Start);
-
- //Init Plugin
- if not DLLMan.PluginInit(TeamInfo, PlayerInfo, ToSentences(Czesci[0]), LoadTex, Print, LoadSound, PlaySound) then
- begin
- //Fehler
- Log.LogError('Could not Init Plugin');
- Halt;
- end;
-
- // Set Background (Little Workaround, maybe change sometime)
- if (DLLMan.Selected.LoadBack) AND (DLLMan.Selected.LoadSong) then
- ScreenSing.Tex_Background := Tex_Background;
-
- Winner := 0;
-
- //Set Score Visibility
- if PlayersPlay = 1 then begin
- Text[TextP1Score].Visible := DLLMan.Selected.ShowScore;
- Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore;
- end;
-
- if (PlayersPlay = 2) OR (PlayersPlay = 4) then begin
- Text[TextP1TwoPScore].Visible := DLLMan.Selected.ShowScore;
- Static[StaticP1TwoPScoreBG].Visible := DLLMan.Selected.ShowScore;
-
- Text[TextP2RScore].Visible := DLLMan.Selected.ShowScore;
- Static[StaticP2RScoreBG].Visible := DLLMan.Selected.ShowScore;
- end;
-
- if (PlayersPlay = 3) OR (PlayersPlay = 6) then begin
- Text[TextP1ThreePScore].Visible := DLLMan.Selected.ShowScore;
- Static[StaticP1ThreePScoreBG].Visible := DLLMan.Selected.ShowScore;
-
- Text[TextP2MScore].Visible := DLLMan.Selected.ShowScore;
- Static[StaticP2MScoreBG].Visible := DLLMan.Selected.ShowScore;
-
- Text[TextP3RScore].Visible := DLLMan.Selected.ShowScore;
- Static[StaticP3RScoreBG].Visible := DLLMan.Selected.ShowScore;
- end;
-end;
-
-function TScreenSingModi.Draw: boolean;
-var
- Min: integer;
- Sec: integer;
- Tekst: string;
- S, I: integer;
- T: integer;
-begin
-//Set Playerinfo
- PlayerInfo.NumPlayers := PlayersPlay;
- for I := 0 to PlayerInfo.NumPlayers-1 do
- begin
- PlayerInfo.Playerinfo[I].Name := PChar(Player[I].Name);
- if PlayerInfo.Playerinfo[I].Enabled then
- begin
- if (Player[I].ScoreTotalI<=10000) then
- PlayerInfo.Playerinfo[I].Score:= Player[I].ScoreTotalI;
- PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent;
- end;
- end;
-
-//Show Score
-if DLLMan.Selected.ShowScore then
-begin
- //ScoreBG Mod
- // set player colors
- if PlayersPlay = 4 then begin
- if ScreenAct = 1 then begin
- LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG,
- Static[StaticP1TwoP].Texture.ColB, 'P1Dark');
- LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG,
- Static[StaticP2R].Texture.ColB, 'P2Dark');
-
-
-
- LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG,
- Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark');
- LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG,
- Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark');
-
-
-
- end;
- if ScreenAct = 2 then begin
- LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG,
- Static[StaticP1TwoP].Texture.ColB, 'P3Dark');
- LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG,
- Static[StaticP2R].Texture.ColB, 'P4Dark');
-
-
-
- LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG,
- Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark');
- LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG,
- Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark');
-
-
-
- end;
- end;
-
- if PlayersPlay = 6 then begin
- if ScreenAct = 1 then begin
- LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG,
- Static[StaticP1ThreeP].Texture.ColB, 'P1Dark');
- LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG,
- Static[StaticP2R].Texture.ColB, 'P2Dark');
- LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG,
- Static[StaticP3R].Texture.ColB, 'P3Dark');
-
-
-
- LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG,
- Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark');
- LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG,
- Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark');
- LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG,
- Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark');
-
-
-
- end;
- if ScreenAct = 2 then begin
- LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG,
- Static[StaticP1ThreeP].Texture.ColB, 'P4Dark');
- LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG,
- Static[StaticP2R].Texture.ColB, 'P5Dark');
- LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG,
- Static[StaticP3R].Texture.ColB, 'P6Dark');
-
-
-
-
- LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG,
- Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark');
- LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG,
- Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark');
- LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG,
- Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark');
-
-
-
-
- end;
- end;
- //end ScoreBG Mod
-
-// set player names (for 2 screens and only Singstar skin)
- if ScreenAct = 1 then begin
- Text[TextP1].Text := 'P1';
- Text[TextP1TwoP].Text := 'P1'; // added for ps3 skin
- Text[TextP1ThreeP].Text := 'P1'; // added for ps3 skin
- Text[TextP2R].Text := 'P2';
- Text[TextP2M].Text := 'P2';
- Text[TextP3R].Text := 'P3';
- end;
-
- if ScreenAct = 2 then begin
- case PlayersPlay of
- 4: begin
- Text[TextP1TwoP].Text := 'P3';
- Text[TextP2R].Text := 'P4';
- end;
- 6: begin
- Text[TextP1ThreeP].Text := 'P4';
- Text[TextP2M].Text := 'P5';
- Text[TextP3R].Text := 'P6';
- end;
- end; // case
- end; // if
-
-
- // stereo <- and where iss P2M? or P3?
- Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX;
- Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX;
-
- Text[TextP1].X := Text[TextP1].X + 10*ScreenX;
- Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;
-
- Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX;
- Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX;
-
- Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX;
- Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;
-
- // .. and scores
- if PlayersPlay = 1 then begin
- Tekst := IntToStr(Player[0].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP1Score].Text := Tekst;
- end;
-
- if PlayersPlay = 2 then begin
- Tekst := IntToStr(Player[0].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP1TwoPScore].Text := Tekst;
-
- Tekst := IntToStr(Player[1].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP2RScore].Text := Tekst;
- end;
-
- if PlayersPlay = 3 then begin
- Tekst := IntToStr(Player[0].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP1ThreePScore].Text := Tekst;
-
- Tekst := IntToStr(Player[1].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP2MScore].Text := Tekst;
-
- Tekst := IntToStr(Player[2].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP3RScore].Text := Tekst;
- end;
-
- if PlayersPlay = 4 then begin
- if ScreenAct = 1 then begin
- Tekst := IntToStr(Player[0].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP1TwoPScore].Text := Tekst;
-
- Tekst := IntToStr(Player[1].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP2RScore].Text := Tekst;
- end;
- if ScreenAct = 2 then begin
- Tekst := IntToStr(Player[2].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP1TwoPScore].Text := Tekst;
-
- Tekst := IntToStr(Player[3].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP2RScore].Text := Tekst;
- end;
- end;
-
- if PlayersPlay = 6 then begin
- if ScreenAct = 1 then begin
- Tekst := IntToStr(Player[0].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP1ThreePScore].Text := Tekst;
-
- Tekst := IntToStr(Player[1].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP2MScore].Text := Tekst;
-
- Tekst := IntToStr(Player[2].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP3RScore].Text := Tekst;
- end;
- if ScreenAct = 2 then begin
- Tekst := IntToStr(Player[3].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP1ThreePScore].Text := Tekst;
-
- Tekst := IntToStr(Player[4].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP2MScore].Text := Tekst;
-
- Tekst := IntToStr(Player[5].ScoreTotalI);
- while Length(Tekst) < 5 do Tekst := '0' + Tekst;
- Text[TextP3RScore].Text := Tekst;
- end;
- end;
-
-end; //ShowScore
-
- for S := 1 to 1 do
- Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX;
-
- for T := 0 to 1 do
- Text[T].X := Text[T].X + 10*ScreenX;
-
-if DLLMan.Selected.LoadSong then
-begin
- // update static menu with time ...
- Min := Round(Czas.Teraz) div 60;
- Sec := Round(Czas.Teraz) mod 60;
- Text[TextTimeText].Text := '';
- if Min < 10 then Text[TextTimeText].Text := '0';
- Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':';
- if Sec < 10 then Text[TextTimeText].Text := Text[TextTimeText].Text + '0';
- Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec);
-end;
-
- // draw static menu (BG)
- DrawBG;
-
- //Draw Background
- if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) then
- SingDrawBackground;
-
- // comment by blindy: wo zum henker wird denn in diesem screen ein video abgespielt?
- // update and draw movie
- // <mog> wie wo wadd? also in der selben funktion in der uscreensing kommt des video in der zeile 995, oder was wollteste wissen? :X
-{ if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin
- UpdateSmpeg; // this only draws
- end;}
-
- // draw static menu (FG)
- DrawFG;
-
- if ShowFinish then begin
- if DllMan.Selected.LoadSong then
- begin
- if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin
- //Pause Mod:
- if not Paused then
- Sing(Self); // analyze song
- end else begin
- if not FadeOut then begin
- Finish;
- FadeOut := true;
- FadeTo(@ScreenPartyScore);
- end;
- end;
- end;
- end;
-
- // draw custom items
- SingModiDraw(PlayerInfo); // always draw
-
- //GoldenNoteStarsTwinkle Mod
- GoldenRec.SpawnRec;
- //GoldenNoteStarsTwinkle Mod
-
- //Update PlayerInfo
- for I := 0 to PlayerInfo.NumPlayers-1 do
- begin
- if PlayerInfo.Playerinfo[I].Enabled then
- begin
- PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent;
- PlayerInfo.Playerinfo[I].Score := Player[I].ScoreTotalI;
- end;
- end;
-
- if ((ShowFinish) AND (NOT Paused)) then
- begin
- if not DLLMan.PluginDraw(Playerinfo, Czesci[0].Akt) then
- begin
- if not FadeOut then begin
- Finish;
- FadeOut := true;
- FadeTo(@ScreenPartyScore);
- end;
- end;
- end;
-
- //Change PlayerInfo/Changeables
- for I := 0 to PlayerInfo.NumPlayers-1 do
- begin
- if (Player[I].ScoreTotalI <> PlayerInfo.Playerinfo[I].Score) then
- begin
- //Player[I].ScoreTotal := Player[I].ScoreTotal + (PlayerInfo.Playerinfo[I].Score - Player[I].ScoreTotalI);
- Player[I].ScoreTotalI := PlayerInfo.Playerinfo[I].Score;
- end;
- if (PlayerInfo.Playerinfo[I].Bar <> Player[I].ScorePercent) then
- Player[I].ScorePercentTarget := PlayerInfo.Playerinfo[I].Bar;
- end;
-
- // back stereo
- Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX;
- Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX;
-
- Text[TextP1].X := Text[TextP1].X - 10*ScreenX;
- Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX;
-
-
- Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX;
- Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX;
-
- Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX;
- Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX;
-
-
- for S := 1 to 1 do
- Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX;
-
- for T := 0 to 1 do
- Text[T].X := Text[T].X - 10*ScreenX;
-
-
-end;
-
-procedure TScreenSingModi.Finish;
-begin
-inherited Finish;
-
-Winner := DllMan.PluginFinish(PlayerInfo);
-
-//Log.LogError('Winner: ' + InttoStr(Winner));
-
-//DLLMan.UnLoadPlugin;
-end;
-
-function LoadTex (const Name, Typ: PChar): TsmallTexture; stdcall;
-var
- Texname, EXT: String;
- Tex: TTexture;
-begin
- //Get texture Name
- TexName := Skin.GetTextureFileName(String(Name));
- //Get File Typ
- Ext := ExtractFileExt(TexName);
- if (uppercase(Ext) = '.JPG') then
- Ext := 'JPG'
- else
- Ext := 'BMP';
-
- Tex := Texture.LoadTexture(PChar(TexName), PChar(Ext), Typ, 0);
-
- Result.TexNum := Tex.TexNum;
- Result.W := Tex.W;
- Result.H := Tex.H;
-end;
-{
-function Translate (const Name: PChar): PChar; stdcall;
-begin
- Result := PChar(Language.Translate(String(Name)));
-end; }
-
-procedure Print (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text
-begin
- SetFontItalic ((Style and 128) = 128);
- SetFontStyle(Style and 7);
- SetFontSize(Size);
- SetFontPos (X, Y);
- glPrint (PChar(Language.Translate(String(Text))));
-end;
-
-function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound
-begin
- Result := Music.LoadCustomSound(String(Name));
-end;
-
-procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound
-begin
- Music.PlayCustomSound(Index);
-end;
-
-end.
+unit UScreenSingModi;
+
+interface
+
+{$I switches.inc}
+
+{$IFDEF FPC}
+ {$MODE DELPHI}
+{$ENDIF}
+
+uses UMenu,
+ UMusic,
+ SDL,
+ SysUtils,
+ UFiles,
+ UTime,
+ USongs,
+ UIni,
+ ULog,
+ UTexture,
+ ULyrics,
+ TextGL,
+ OpenGL12,
+ {$IFDEF useBASS}
+ bass,
+ {$ENDIF}
+ UThemes,
+ ULCD,
+ UScreenSing,
+ ModiSDK;
+
+type
+ TScreenSingModi = class(TScreenSing)
+ protected
+ //paused: boolean; //Pause Mod
+ //PauseTime: Real;
+ //NumEmptySentences: integer;
+ public
+ //TextTime: integer;
+
+ //StaticP1: integer;
+ //StaticP1ScoreBG: integer;
+ //TextP1: integer;
+ //TextP1Score: integer;
+
+ //StaticP2R: integer;
+ //StaticP2RScoreBG: integer;
+ //TextP2R: integer;
+ //TextP2RScore: integer;
+
+ //StaticP2M: integer;
+ //StaticP2MScoreBG: integer;
+ //TextP2M: integer;
+ //TextP2MScore: integer;
+
+ //StaticP3R: integer;
+ //StaticP3RScoreBG: integer;
+ //TextP3R: integer;
+ //TextP3RScore: integer;
+
+ //Tex_Background: TTexture;
+ //FadeOut: boolean;
+ //LyricMain: TLyric;
+ //LyricSub: TLyric;
+ Winner: Byte; //Who Wins
+ PlayerInfo: TPlayerInfo;
+ TeamInfo: TTeamInfo;
+
+ constructor Create; override;
+ procedure onShow; override;
+ //procedure onShowFinish; override;
+ function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
+ function Draw: boolean; override;
+ procedure Finish; override;
+ //procedure UpdateLCD;
+ //procedure Pause; //Pause Mod(Toggles Pause)
+ end;
+
+//Procedured for Plugin
+function LoadTex (const Name, Typ: PChar): TsmallTexture; stdcall;
+//function Translate (const Name: PChar): PChar; stdcall;
+procedure Print (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text
+function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound
+procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound
+
+//Utilys
+function ToSentences(Const Czeski: TCzesci): TSentences;
+
+implementation
+uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math, UDLLManager, USkins, UGraphicClasses;
+
+// Method for input parsing. If False is returned, GetNextWindow
+// should be checked to know the next window to load;
+function TScreenSingModi.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ Finish;
+ Music.PlayBack;
+ FadeTo(@ScreenPartyScore);
+ end;
+
+ else
+ Result := inherited ParseInput(PressedKey, ScanCode, PressedDown);
+ end;
+ end;
+end;
+
+constructor TScreenSingModi.Create;
+begin
+ inherited Create;
+
+end;
+
+function ToSentences(Const Czeski: TCzesci): TSentences;
+var
+ I, J: Integer;
+begin
+ Result.Akt := Czeski.Akt;
+ Result.High := Czeski.High;
+ Result.Ilosc := Czeski.Ilosc;
+ Result.Resolution := Czeski.Resolution;
+ Result.NotesGAP := Czeski.NotesGAP;
+ Result.TotalLength := Czeski.Wartosc;
+
+ SetLength(Result.Sentence, Length(Czeski.Czesc));
+ for I := low(Result.Sentence) to high(Result.Sentence) do
+ begin
+ Result.Sentence[I].Start := Czeski.Czesc[I].Start;
+ Result.Sentence[I].StartNote := Czeski.Czesc[I].StartNote;
+ Result.Sentence[I].Lyric := Czeski.Czesc[I].Lyric;
+ Result.Sentence[I].LyricWidth := Czeski.Czesc[I].LyricWidth;
+ Result.Sentence[I].Koniec := Czeski.Czesc[I].Koniec;
+ Result.Sentence[I].BaseNote := Czeski.Czesc[I].BaseNote;
+ Result.Sentence[I].HighNote := Czeski.Czesc[I].HighNut;
+ Result.Sentence[I].IlNut := Czeski.Czesc[I].IlNut;
+ Result.Sentence[I].TotalNotes := Czeski.Czesc[I].TotalNotes;
+
+ SetLength(Result.Sentence[I].Note, Length(Czeski.Czesc[I].Nuta));
+ for J := low(Result.Sentence[I].Note) to high(Result.Sentence[I].Note) do
+ begin
+ Result.Sentence[I].Note[J].Color := Czeski.Czesc[I].Nuta[J].Color;
+ Result.Sentence[I].Note[J].Start := Czeski.Czesc[I].Nuta[J].Start;
+ Result.Sentence[I].Note[J].Length := Czeski.Czesc[I].Nuta[J].Dlugosc;
+ Result.Sentence[I].Note[J].Ton := Czeski.Czesc[I].Nuta[J].Ton;
+ Result.Sentence[I].Note[J].TonGamy := Czeski.Czesc[I].Nuta[J].TonGamy;
+ //Result.Sentence[I].Note[J].Text := Czeski.Czesc[I].Nuta[J].Tekst;
+ Result.Sentence[I].Note[J].FreeStyle := Czeski.Czesc[I].Nuta[J].FreeStyle;
+ Result.Sentence[I].Note[J].Typ := Czeski.Czesc[I].Nuta[J].Wartosc;
+ end;
+ end;
+end;
+
+procedure TScreenSingModi.onShow;
+var
+ I: Integer;
+begin
+
+ PlayersPlay := TeamInfo.NumTeams;
+
+ if DLLMan.Selected.LoadSong then //Start with Song
+ begin
+ inherited;
+ end
+ else //Start Without Song
+ begin
+ Music.CaptureStart;
+ end;
+
+//Set Playerinfo
+ PlayerInfo.NumPlayers := PlayersPlay;
+ for I := 0 to PlayerInfo.NumPlayers-1 do
+ begin
+ PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]);
+ PlayerInfo.Playerinfo[I].Score := 0;
+ PlayerInfo.Playerinfo[I].Bar := 50;
+ PlayerInfo.Playerinfo[I].Enabled := True;
+ end;
+
+ for I := PlayerInfo.NumPlayers to high(PlayerInfo.Playerinfo) do
+ begin
+ PlayerInfo.Playerinfo[I].Score:= 0;
+ PlayerInfo.Playerinfo[I].Bar := 0;
+ PlayerInfo.Playerinfo[I].Enabled := False;
+ end;
+
+ Case PlayersPlay of
+ 1: begin
+ PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X;
+ PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H;
+ end;
+ 2,4: begin
+ PlayerInfo.Playerinfo[0].PosX := Static[StaticP1TwoPScoreBG].Texture.X;
+ PlayerInfo.Playerinfo[0].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H;
+ PlayerInfo.Playerinfo[2].PosX := Static[StaticP1TwoPScoreBG].Texture.X;
+ PlayerInfo.Playerinfo[2].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H;
+ PlayerInfo.Playerinfo[1].PosX := Static[StaticP2RScoreBG].Texture.X;
+ PlayerInfo.Playerinfo[1].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H;
+ PlayerInfo.Playerinfo[3].PosX := Static[StaticP2RScoreBG].Texture.X;
+ PlayerInfo.Playerinfo[3].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H;
+ end;
+ 3,6: begin
+ PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ThreePScoreBG].Texture.X;
+ PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H;
+ PlayerInfo.Playerinfo[3].PosX := Static[StaticP1ThreePScoreBG].Texture.X;
+ PlayerInfo.Playerinfo[3].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H;
+ PlayerInfo.Playerinfo[1].PosX := Static[StaticP2MScoreBG].Texture.X;
+ PlayerInfo.Playerinfo[1].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H;
+ PlayerInfo.Playerinfo[4].PosX := Static[StaticP2MScoreBG].Texture.X;
+ PlayerInfo.Playerinfo[4].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H;
+ PlayerInfo.Playerinfo[2].PosX := Static[StaticP3RScoreBG].Texture.X;
+ PlayerInfo.Playerinfo[2].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H;
+ PlayerInfo.Playerinfo[5].PosX := Static[StaticP3RScoreBG].Texture.X;
+ PlayerInfo.Playerinfo[5].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H;
+ end;
+ end;
+
+ // play music (I)
+ //Music.CaptureStart;
+ //Music.MoveTo(AktSong.Start);
+
+ //Init Plugin
+ if not DLLMan.PluginInit(TeamInfo, PlayerInfo, ToSentences(Czesci[0]), LoadTex, Print, LoadSound, PlaySound) then
+ begin
+ //Fehler
+ Log.LogError('Could not Init Plugin');
+ Halt;
+ end;
+
+ // Set Background (Little Workaround, maybe change sometime)
+ if (DLLMan.Selected.LoadBack) AND (DLLMan.Selected.LoadSong) then
+ ScreenSing.Tex_Background := Tex_Background;
+
+ Winner := 0;
+
+ //Set Score Visibility
+ if PlayersPlay = 1 then begin
+ Text[TextP1Score].Visible := DLLMan.Selected.ShowScore;
+ Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore;
+ end;
+
+ if (PlayersPlay = 2) OR (PlayersPlay = 4) then begin
+ Text[TextP1TwoPScore].Visible := DLLMan.Selected.ShowScore;
+ Static[StaticP1TwoPScoreBG].Visible := DLLMan.Selected.ShowScore;
+
+ Text[TextP2RScore].Visible := DLLMan.Selected.ShowScore;
+ Static[StaticP2RScoreBG].Visible := DLLMan.Selected.ShowScore;
+ end;
+
+ if (PlayersPlay = 3) OR (PlayersPlay = 6) then begin
+ Text[TextP1ThreePScore].Visible := DLLMan.Selected.ShowScore;
+ Static[StaticP1ThreePScoreBG].Visible := DLLMan.Selected.ShowScore;
+
+ Text[TextP2MScore].Visible := DLLMan.Selected.ShowScore;
+ Static[StaticP2MScoreBG].Visible := DLLMan.Selected.ShowScore;
+
+ Text[TextP3RScore].Visible := DLLMan.Selected.ShowScore;
+ Static[StaticP3RScoreBG].Visible := DLLMan.Selected.ShowScore;
+ end;
+end;
+
+function TScreenSingModi.Draw: boolean;
+var
+ Min: integer;
+ Sec: integer;
+ Tekst: string;
+ S, I: integer;
+ T: integer;
+begin
+//Set Playerinfo
+ PlayerInfo.NumPlayers := PlayersPlay;
+ for I := 0 to PlayerInfo.NumPlayers-1 do
+ begin
+ PlayerInfo.Playerinfo[I].Name := PChar(Player[I].Name);
+ if PlayerInfo.Playerinfo[I].Enabled then
+ begin
+ if (Player[I].ScoreTotalI<=10000) then
+ PlayerInfo.Playerinfo[I].Score:= Player[I].ScoreTotalI;
+ PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent;
+ end;
+ end;
+
+//Show Score
+if DLLMan.Selected.ShowScore then
+begin
+ //ScoreBG Mod
+ // set player colors
+ if PlayersPlay = 4 then begin
+ if ScreenAct = 1 then begin
+ LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG,
+ Static[StaticP1TwoP].Texture.ColB, 'P1Dark');
+ LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG,
+ Static[StaticP2R].Texture.ColB, 'P2Dark');
+
+
+
+ LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG,
+ Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark');
+ LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG,
+ Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark');
+
+
+
+ end;
+ if ScreenAct = 2 then begin
+ LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG,
+ Static[StaticP1TwoP].Texture.ColB, 'P3Dark');
+ LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG,
+ Static[StaticP2R].Texture.ColB, 'P4Dark');
+
+
+
+ LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG,
+ Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark');
+ LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG,
+ Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark');
+
+
+
+ end;
+ end;
+
+ if PlayersPlay = 6 then begin
+ if ScreenAct = 1 then begin
+ LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG,
+ Static[StaticP1ThreeP].Texture.ColB, 'P1Dark');
+ LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG,
+ Static[StaticP2R].Texture.ColB, 'P2Dark');
+ LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG,
+ Static[StaticP3R].Texture.ColB, 'P3Dark');
+
+
+
+ LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG,
+ Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark');
+ LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG,
+ Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark');
+ LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG,
+ Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark');
+
+
+
+ end;
+ if ScreenAct = 2 then begin
+ LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG,
+ Static[StaticP1ThreeP].Texture.ColB, 'P4Dark');
+ LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG,
+ Static[StaticP2R].Texture.ColB, 'P5Dark');
+ LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG,
+ Static[StaticP3R].Texture.ColB, 'P6Dark');
+
+
+
+
+ LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG,
+ Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark');
+ LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG,
+ Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark');
+ LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG,
+ Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark');
+
+
+
+
+ end;
+ end;
+ //end ScoreBG Mod
+
+// set player names (for 2 screens and only Singstar skin)
+ if ScreenAct = 1 then begin
+ Text[TextP1].Text := 'P1';
+ Text[TextP1TwoP].Text := 'P1'; // added for ps3 skin
+ Text[TextP1ThreeP].Text := 'P1'; // added for ps3 skin
+ Text[TextP2R].Text := 'P2';
+ Text[TextP2M].Text := 'P2';
+ Text[TextP3R].Text := 'P3';
+ end;
+
+ if ScreenAct = 2 then begin
+ case PlayersPlay of
+ 4: begin
+ Text[TextP1TwoP].Text := 'P3';
+ Text[TextP2R].Text := 'P4';
+ end;
+ 6: begin
+ Text[TextP1ThreeP].Text := 'P4';
+ Text[TextP2M].Text := 'P5';
+ Text[TextP3R].Text := 'P6';
+ end;
+ end; // case
+ end; // if
+
+
+ // stereo <- and where iss P2M? or P3?
+ Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX;
+ Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX;
+
+ Text[TextP1].X := Text[TextP1].X + 10*ScreenX;
+ Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;
+
+ Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX;
+ Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX;
+
+ Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX;
+ Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;
+
+ // .. and scores
+ if PlayersPlay = 1 then begin
+ Tekst := IntToStr(Player[0].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP1Score].Text := Tekst;
+ end;
+
+ if PlayersPlay = 2 then begin
+ Tekst := IntToStr(Player[0].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP1TwoPScore].Text := Tekst;
+
+ Tekst := IntToStr(Player[1].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP2RScore].Text := Tekst;
+ end;
+
+ if PlayersPlay = 3 then begin
+ Tekst := IntToStr(Player[0].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP1ThreePScore].Text := Tekst;
+
+ Tekst := IntToStr(Player[1].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP2MScore].Text := Tekst;
+
+ Tekst := IntToStr(Player[2].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP3RScore].Text := Tekst;
+ end;
+
+ if PlayersPlay = 4 then begin
+ if ScreenAct = 1 then begin
+ Tekst := IntToStr(Player[0].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP1TwoPScore].Text := Tekst;
+
+ Tekst := IntToStr(Player[1].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP2RScore].Text := Tekst;
+ end;
+ if ScreenAct = 2 then begin
+ Tekst := IntToStr(Player[2].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP1TwoPScore].Text := Tekst;
+
+ Tekst := IntToStr(Player[3].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP2RScore].Text := Tekst;
+ end;
+ end;
+
+ if PlayersPlay = 6 then begin
+ if ScreenAct = 1 then begin
+ Tekst := IntToStr(Player[0].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP1ThreePScore].Text := Tekst;
+
+ Tekst := IntToStr(Player[1].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP2MScore].Text := Tekst;
+
+ Tekst := IntToStr(Player[2].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP3RScore].Text := Tekst;
+ end;
+ if ScreenAct = 2 then begin
+ Tekst := IntToStr(Player[3].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP1ThreePScore].Text := Tekst;
+
+ Tekst := IntToStr(Player[4].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP2MScore].Text := Tekst;
+
+ Tekst := IntToStr(Player[5].ScoreTotalI);
+ while Length(Tekst) < 5 do Tekst := '0' + Tekst;
+ Text[TextP3RScore].Text := Tekst;
+ end;
+ end;
+
+end; //ShowScore
+
+ for S := 1 to 1 do
+ Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX;
+
+ for T := 0 to 1 do
+ Text[T].X := Text[T].X + 10*ScreenX;
+
+if DLLMan.Selected.LoadSong then
+begin
+ // update static menu with time ...
+ Min := Round(Czas.Teraz) div 60;
+ Sec := Round(Czas.Teraz) mod 60;
+ Text[TextTimeText].Text := '';
+ if Min < 10 then Text[TextTimeText].Text := '0';
+ Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':';
+ if Sec < 10 then Text[TextTimeText].Text := Text[TextTimeText].Text + '0';
+ Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec);
+end;
+
+ // draw static menu (BG)
+ DrawBG;
+
+ //Draw Background
+ if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) then
+ SingDrawBackground;
+
+ // comment by blindy: wo zum henker wird denn in diesem screen ein video abgespielt?
+ // update and draw movie
+ // <mog> wie wo wadd? also in der selben funktion in der uscreensing kommt des video in der zeile 995, oder was wollteste wissen? :X
+{ if ShowFinish and AktSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin
+ UpdateSmpeg; // this only draws
+ end;}
+
+ // draw static menu (FG)
+ DrawFG;
+
+ if ShowFinish then begin
+ if DllMan.Selected.LoadSong then
+ begin
+ if (not Music.Finished) and ((AktSong.Finish = 0) or (Czas.Teraz*1000 <= AktSong.Finish)) then begin
+ //Pause Mod:
+ if not Paused then
+ Sing(Self); // analyze song
+ end else begin
+ if not FadeOut then begin
+ Finish;
+ FadeOut := true;
+ FadeTo(@ScreenPartyScore);
+ end;
+ end;
+ end;
+ end;
+
+ // draw custom items
+ SingModiDraw(PlayerInfo); // always draw
+
+ //GoldenNoteStarsTwinkle Mod
+ GoldenRec.SpawnRec;
+ //GoldenNoteStarsTwinkle Mod
+
+ //Update PlayerInfo
+ for I := 0 to PlayerInfo.NumPlayers-1 do
+ begin
+ if PlayerInfo.Playerinfo[I].Enabled then
+ begin
+ PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent;
+ PlayerInfo.Playerinfo[I].Score := Player[I].ScoreTotalI;
+ end;
+ end;
+
+ if ((ShowFinish) AND (NOT Paused)) then
+ begin
+ if not DLLMan.PluginDraw(Playerinfo, Czesci[0].Akt) then
+ begin
+ if not FadeOut then begin
+ Finish;
+ FadeOut := true;
+ FadeTo(@ScreenPartyScore);
+ end;
+ end;
+ end;
+
+ //Change PlayerInfo/Changeables
+ for I := 0 to PlayerInfo.NumPlayers-1 do
+ begin
+ if (Player[I].ScoreTotalI <> PlayerInfo.Playerinfo[I].Score) then
+ begin
+ //Player[I].ScoreTotal := Player[I].ScoreTotal + (PlayerInfo.Playerinfo[I].Score - Player[I].ScoreTotalI);
+ Player[I].ScoreTotalI := PlayerInfo.Playerinfo[I].Score;
+ end;
+ if (PlayerInfo.Playerinfo[I].Bar <> Player[I].ScorePercent) then
+ Player[I].ScorePercentTarget := PlayerInfo.Playerinfo[I].Bar;
+ end;
+
+ // back stereo
+ Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX;
+ Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX;
+
+ Text[TextP1].X := Text[TextP1].X - 10*ScreenX;
+ Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX;
+
+
+ Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX;
+ Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX;
+
+ Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX;
+ Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX;
+
+
+ for S := 1 to 1 do
+ Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX;
+
+ for T := 0 to 1 do
+ Text[T].X := Text[T].X - 10*ScreenX;
+
+
+end;
+
+procedure TScreenSingModi.Finish;
+begin
+inherited Finish;
+
+Winner := DllMan.PluginFinish(PlayerInfo);
+
+//Log.LogError('Winner: ' + InttoStr(Winner));
+
+//DLLMan.UnLoadPlugin;
+end;
+
+function LoadTex (const Name, Typ: PChar): TsmallTexture; stdcall;
+var
+ Texname, EXT: String;
+ Tex: TTexture;
+begin
+ //Get texture Name
+ TexName := Skin.GetTextureFileName(String(Name));
+ //Get File Typ
+ Ext := ExtractFileExt(TexName);
+ if (uppercase(Ext) = '.JPG') then
+ Ext := 'JPG'
+ else
+ Ext := 'BMP';
+
+ Tex := Texture.LoadTexture(PChar(TexName), PChar(Ext), Typ, 0);
+
+ Result.TexNum := Tex.TexNum;
+ Result.W := Tex.W;
+ Result.H := Tex.H;
+end;
+{
+function Translate (const Name: PChar): PChar; stdcall;
+begin
+ Result := PChar(Language.Translate(String(Name)));
+end; }
+
+procedure Print (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text
+begin
+ SetFontItalic ((Style and 128) = 128);
+ SetFontStyle(Style and 7);
+ SetFontSize(Size);
+ SetFontPos (X, Y);
+ glPrint (PChar(Language.Translate(String(Text))));
+end;
+
+function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound
+begin
+ Result := Music.LoadCustomSound(String(Name));
+end;
+
+procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound
+begin
+ Music.PlayCustomSound(Index);
+end;
+
+end.
diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas
index 7b16c315..569645d4 100644
--- a/Game/Code/Screens/UScreenSong.pas
+++ b/Game/Code/Screens/UScreenSong.pas
@@ -1,2007 +1,2040 @@
-unit UScreenSong;
-
-interface
-{$I switches.inc}
-
-uses
- UMenu, SDL, UMusic, UFiles, UTime, UDisplay, USongs, SysUtils, ULog, UThemes, UTexture, ULanguage,
- ULCD, ULight, UIni;
-
-type
- TScreenSong = class(TMenu)
- public
- TextArtist: integer;
- TextTitle: integer;
- TextNumber: integer;
-
- //Video Icon Mod
- VideoIcon: Cardinal;
-
- TextCat: integer;
- StaticCat: integer;
-
- SongCurrent: real;
- SongTarget: real;
-
- HighSpeed: boolean;
- CoverFull: boolean;
- CoverTime: real;
- CoverX: integer;
- CoverY: integer;
- CoverW: integer;
- is_jump: boolean; // Jump to Song Mod
- is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title
-
- EqualizerBands: array of Byte;
- EqualizerTime: Cardinal;
- EqualizerTime2: Byte;
-
- //Party Mod
- Mode: Byte; //0 = Standard, 1= Go to PartyMode after Selection + Change to Random Song at Show
- //party Statics (Joker)
- StaticTeam1Joker1: Cardinal;
- StaticTeam1Joker2: Cardinal;
- StaticTeam1Joker3: Cardinal;
- StaticTeam1Joker4: Cardinal;
- StaticTeam1Joker5: Cardinal;
-
- StaticTeam2Joker1: Cardinal;
- StaticTeam2Joker2: Cardinal;
- StaticTeam2Joker3: Cardinal;
- StaticTeam2Joker4: Cardinal;
- StaticTeam2Joker5: Cardinal;
-
- StaticTeam3Joker1: Cardinal;
- StaticTeam3Joker2: Cardinal;
- StaticTeam3Joker3: Cardinal;
- StaticTeam3Joker4: Cardinal;
- StaticTeam3Joker5: Cardinal;
-
- StaticParty: Array of Cardinal;
- TextParty: Array of Cardinal;
- StaticNonParty: Array of Cardinal;
- TextNonParty: Array of Cardinal;
-
-
- constructor Create; override;
- procedure SetScroll;
- procedure SetScroll1;
- procedure SetScroll2;
- procedure SetScroll3;
- procedure SetScroll4;
- procedure SetScroll5;
- procedure SetScroll6;
- function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
- function Draw: boolean; override;
- procedure onShow; override;
- procedure onHide; override;
- procedure SelectNext;
- procedure SelectPrev;
- procedure UpdateLCD;
- procedure SkipTo(Target: Cardinal);
- procedure FixSelected; //Show Wrong Song when Tabs on Fix
- procedure FixSelected2; //Show Wrong Song when Tabs on Fix
- procedure ShowCatTL(Cat: Integer);// Show Cat in Top left
- procedure ShowCatTLCustom(Caption: String);// Show Custom Text in Top left
- procedure HideCatTL;// Show Cat in Tob left
- procedure Refresh; //Refresh Song Sorting
- procedure DrawEqualizer;
- procedure ChangeMusic;
- //Party Mode
- procedure SelectRandomSong;
- procedure SetJoker;
- procedure SetStatics;
- //procedures for Menu
- procedure StartSong;
- procedure OpenEditor;
- procedure DoJoker(Team: Byte);
- procedure SelectPlayers;
-
- procedure UnLoadDetailedCover;
-
- //Extensions
- procedure DrawExtensions;
- end;
-
-implementation
-uses UGraphic, UMain, UCovers, math, OpenGL12, Windows, USkins, UDLLManager, UParty, UPlaylist, UScreenSongMenu;
-
-// ***** Public methods ****** //
-
-//Show Wrong Song when Tabs on Fix
-procedure TScreenSong.FixSelected;
-var I, I2: Integer;
- begin
- if CatSongs.VisibleSongs > 0 then
- begin
- I2:= 0;
- for I := low(CatSongs.Song) to High(Catsongs.Song) do
- begin
- if CatSongs.Song[I].Visible then
- inc(I2);
-
- if I = Interaction - 1 then
- break;
- end;
-
- SongCurrent := I2;
- SongTarget := I2;
- end;
- end;
-
-procedure TScreenSong.FixSelected2;
-var I, I2: Integer;
- begin
- if CatSongs.VisibleSongs > 0 then
- begin
- I2:= 0;
- for I := low(CatSongs.Song) to High(Catsongs.Song) do
- begin
- if CatSongs.Song[I].Visible then
- inc(I2);
-
- if I = Interaction - 1 then
- break;
- end;
-
- SongTarget := I2;
- end;
- end;
-//Show Wrong Song when Tabs on Fix End
-
- procedure TScreenSong.ShowCatTLCustom(Caption: String);// Show Custom Text in Top left
- begin
- Text[TextCat].Text := Caption;
- Text[TextCat].Visible := true;
- Static[StaticCat].Visible := False;
- end;
-
- //Show Cat in Top Left Mod
- procedure TScreenSong.ShowCatTL(Cat: Integer);
- begin
- //Change
- Text[TextCat].Text := CatSongs.Song[Cat].Artist;
- //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover);
- //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true);
-
- Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true);
- //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false);
- //Button[Cat].
- //Cover
-
-
- //Show
- Text[TextCat].Visible := true;
- Static[StaticCat].Visible := True;
- end;
-
- procedure TScreenSong.HideCatTL;
- begin
- //Hide
- //Text[TextCat].Visible := false;
- Static[StaticCat].Visible := false;
- //New -> Show Text specified in Theme
- Text[TextCat].Visible := True;
- Text[TextCat].Text := Theme.Song.TextCat.Text;
- end;
- //Show Cat in Top Left Mod End
-
-
-// Method for input parsing. If False is returned, GetNextWindow
-// should be checked to know the next window to load;
-function TScreenSong.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
-var
- I: integer;
- I2: integer;
- HS: integer;
- SDL_ModState: Word;
- Letter: Char;
-begin
- Result := true;
-
- //Song Screen Extensions (Jumpto + Menu)
- if (ScreenSongMenu.Visible) then
- begin
- Result := ScreenSongMenu.ParseInput(PressedKey, ScanCode, PressedDown);
- Exit;
- end
- else if (ScreenSongJumpto.Visible) then
- begin
- Result := ScreenSongJumpto.ParseInput(PressedKey, ScanCode, PressedDown);
- Exit;
- end;
-
- If (PressedDown) Then
- begin // Key Down
-
- SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT
- + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT);
-
- //Jump to Artist/Titel
- if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then
- begin
- Letter := UpCase(Chr(ScanCode));
- I2 := Length(CatSongs.Song);
-
- //Jump To Titel
- if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then
- begin
- For I := 1 to high(CatSongs.Song) do
- begin
- if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then
- begin
- SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2));
-
- Music.PlayChange;
-
- ChangeMusic;
- SetScroll4;
- UpdateLCD;
- //Break and Exit
- Exit;
- end;
- end;
- end
- //Jump to Artist
- else if (SDL_ModState = KMOD_LALT) then
- begin
- For I := 1 to high(CatSongs.Song) do
- begin
- if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Artist[1]) = Letter) then
- begin
- SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2));
-
- Music.PlayChange;
-
- ChangeMusic;
- SetScroll4;
- UpdateLCD;
-
- //Break and Exit
- Exit;
- end;
- end;
- end;
- Exit;
- end;
-
- case PressedKey of
- SDLK_Q:
- begin
- Result := false;
- end;
-
- SDLK_ESCAPE,
- SDLK_BACKSPACE :
- begin
- if (Mode = 0) then
- begin
- //On Escape goto Cat-List Hack
- if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then
- begin
- //Find Category
- I := Interaction;
- while not catsongs.Song[I].Main do
- begin
- Dec (I);
- if (I < low(catsongs.Song)) then
- break;
- end;
- if (I<= 1) then
- Interaction := high(catsongs.Song)
- else
- Interaction := I - 1;
-
- //Stop Music
- Music.Stop;
-
- CatSongs.ShowCategoryList;
-
- //Show Cat in Top Left Mod
- HideCatTL;
-
-
- //Show Wrong Song when Tabs on Fix
- SelectNext;
- FixSelected;
- //SelectPrev;
- //CatSongs.Song[0].Visible := False;
- end
- else
- begin
- //On Escape goto Cat-List Hack End
- //Tabs off and in Search or Playlist -> Go back to Song view
- if (CatSongs.CatNumShow < -1) then
- begin
- //Atm: Set Empty Filter
- CatSongs.SetFilter('', 0);
-
- //Show Cat in Top Left Mod
- HideCatTL;
- Interaction := 0;
-
- //Show Wrong Song when Tabs on Fix
- SelectNext;
- FixSelected;
-
- ChangeMusic;
- end
- else
- begin
- Music.Stop;
- Music.PlayBack;
-
- FadeTo(@ScreenMain);
- end;
-
- end;
- end
- //When in party Mode then Ask before Close
- else if (Mode = 1) then
- begin
- Music.PlayBack;
- CheckFadeTo(@ScreenMain,'MSG_END_PARTY');
- end;
- end;
- SDLK_RETURN:
- begin
- if Length(Songs.Song) > 0 then
- begin
- {$IFDEF UseSerialPort}
- // PortWriteB($378, 0);
- {$ENDIF}
- if CatSongs.Song[Interaction].Main then
- begin // clicked on Category Button
-
- //Show Cat in Top Left Mod
- ShowCatTL (Interaction);
-
- //I := CatSongs.VisibleIndex(Interaction);
- CatSongs.ClickCategoryButton(Interaction);
- {I2 := CatSongs.VisibleIndex(Interaction);
- SongCurrent := SongCurrent - I + I2;
- SongTarget := SongTarget - I + I2; }
-
-// if I<>I2 then beep;
- // SetScroll4;
-
- //Show Wrong Song when Tabs on Fix
- SelectNext;
- FixSelected;
-
- //Play Music:
- ChangeMusic;
-
- end else begin // clicked on song
- if (Mode = 0) then //Normal Mode -> Start Song
- begin
- //Do the Action that is specified in Ini
- case Ini.OnSongClick of
- 0: StartSong;
- 1: SelectPlayers;
- 2:begin
- If (CatSongs.CatNumShow = -3) then
- ScreenSongMenu.MenuShow(SM_Playlist)
- else
- ScreenSongMenu.MenuShow(SM_Main);
- end;
- end;
- end
- else if (Mode = 1) then //PartyMode -> Show Menu
- begin
- if (Ini.PartyPopup = 1) then
- ScreenSongMenu.MenuShow(SM_Party_Main)
- else
- ScreenSong.StartSong;
- end;
- end;
- end;
- end;
-
- SDLK_M: //Show SongMenu
- begin
- if (Length(Songs.Song) > 0) then begin
- if (Mode = 0) then begin
- if not CatSongs.Song[Interaction].Main then begin // clicked on Song
- if CatSongs.CatNumShow = -3 then
- ScreenSongMenu.MenuShow(SM_Playlist)
- else
- ScreenSongMenu.MenuShow(SM_Main);
- end
- else
- begin
- ScreenSongMenu.MenuShow(SM_Playlist_Load);
- end;
- end //Party Mode -> Show Party Menu
- else ScreenSongMenu.MenuShow(SM_Party_Main);
- end;
- end;
-
- SDLK_P: //Show Playlist Menu
- begin
- if (Length(Songs.Song) > 0) AND (Mode = 0) then begin
- ScreenSongMenu.MenuShow(SM_Playlist_Load);
- end;
- end;
-
- SDLK_J: //Show Jumpto Menu
- begin
- if (Length(Songs.Song) > 0) AND (Mode = 0) then
- begin
- ScreenSongJumpto.Visible := True;
- end;
- end;
-
- SDLK_DOWN:
- begin
- if (Mode = 0) then
- begin
- //Only Change Cat when not in Playlist or Search Mode
- if (CatSongs.CatNumShow > -2) then
- begin
- //Cat Change Hack
- if Ini.Tabs_at_startup = 1 then
- begin
- I := Interaction;
- if I <= 0 then I := 1;
-
- while not catsongs.Song[I].Main do
- begin
- Inc (I);
- if (I > high(catsongs.Song)) then
- I := low(catsongs.Song);
- end;
-
- Interaction := I;
-
- //Show Cat in Top Left Mod
- ShowCatTL (Interaction);
-
- CatSongs.ClickCategoryButton(Interaction);
- SelectNext;
- FixSelected;
-
- //Play Music:
- Music.PlayChange;
- ChangeMusic;
-
- end;
-
- //
- //Cat Change Hack End}
- end;
- end;
- end;
- SDLK_UP:
- begin
- if (Mode = 0) then
- begin
- //Only Change Cat when not in Playlist or Search Mode
- if (CatSongs.CatNumShow > -2) then
- begin
- //Cat Change Hack
- if Ini.Tabs_at_startup = 1 then
- begin
- I := Interaction;
- I2 := 0;
- if I <= 0 then I := 1;
-
- while not catsongs.Song[I].Main or (I2 = 0) do
- begin
- if catsongs.Song[I].Main then
- Inc(I2);
- Dec (I);
- if (I < low(catsongs.Song)) then
- I := high(catsongs.Song);
- end;
-
- Interaction := I;
-
- //Show Cat in Top Left Mod
- ShowCatTL (I);
-
- CatSongs.ClickCategoryButton(I);
- SelectNext;
- FixSelected;
-
- //Play Music:
- Music.PlayChange;
- ChangeMusic;
- end;
- end;
- //Cat Change Hack End}
- end;
- end;
-
- SDLK_RIGHT:
- begin
- if (Length(Songs.Song) > 0) AND (Mode = 0) then begin
- Music.PlayChange;
- SelectNext;
-// InteractNext;
-// SongTarget := Interaction;
- ChangeMusic;
- SetScroll4;
- UpdateLCD;
- Light.LightOne(1, 200);
- end;
- end;
-
- SDLK_LEFT:
- begin
- if (Length(Songs.Song) > 0)AND (Mode = 0) then begin
- Music.PlayChange;
- SelectPrev;
- ChangeMusic;
- SetScroll4;
- UpdateLCD;
- Light.LightOne(0, 200);
- end;
- end;
-
- SDLK_E:
- begin
- OpenEditor;
- end;
-
- SDLK_R:
- begin
- if (Length(Songs.Song) > 0) AND (Mode = 0) then begin
-
- if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category
- begin
- I2 := 0; //Count Cats
- for I:= low(CatSongs.Song) to high (CatSongs.Song) do
- if CatSongs.Song[I].Main then Inc(I2);
-
- I2 := Random (I2)+1; //Zufall
-
- //Find Cat:
- for I:= low(CatSongs.Song) to high (CatSongs.Song) do
- begin
- if CatSongs.Song[I].Main then
- Dec(I2);
- if (I2<=0) then
- begin
- //Show Cat in Top Left Mod
- ShowCatTL (I);
-
- Interaction := I;
-
- CatSongs.ShowCategoryList;
- CatSongs.ClickCategoryButton(I);
- SelectNext;
- FixSelected;
- break;
- end;
- end;
-
-
- end
- else if (SDL_ModState = KMOD_LCTRL) AND (Ini.Tabs_at_startup = 1) then //random in All Categorys
- begin
- repeat
- I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1;
- until CatSongs.Song[I2].Main = false;
-
- //Search Cat
- for I := I2 downto low(CatSongs.Song) do
- begin
- if CatSongs.Song[I].Main then
- break;
- end;
- //In I ist jetzt die Kategorie in I2 der Song
-
- //Choose Cat
- CatSongs.ShowCategoryList;
-
- //Show Cat in Top Left Mod
- ShowCatTL (I);
-
- CatSongs.ClickCategoryButton(I);
- SelectNext;
-
- //Fix: Not Existing Song selected:
- //if (I+1=I2) then Inc(I2);
-
- //Choose Song
- SkipTo(I2-I);
-
- end
- else //Random in one Category
- begin
- SkipTo(Random(CatSongs.VisibleSongs));
- end;
- Music.PlayChange;
-
- ChangeMusic;
- SetScroll4;
- UpdateLCD;
- end;
- end;
-
- SDLK_1:
- begin //Jocker
- if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then
- begin
- //Joker spielen
- Dec(PartySession.Teams.Teaminfo[0].Joker);
- SelectRandomSong;
- SetJoker;
- end;
- end;
-
- SDLK_2:
- begin //Jocker
- if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then
- begin
- //Joker spielen
- Dec(PartySession.Teams.Teaminfo[1].Joker);
- SelectRandomSong;
- SetJoker;
- end;
- end;
-
- SDLK_3:
- begin //Jocker
- if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then
- begin
- //Joker spielen
- Dec(PartySession.Teams.Teaminfo[2].Joker);
- SelectRandomSong;
- SetJoker;
- end;
- end;
- end;
- end;
-end;
-
-constructor TScreenSong.Create;
-var
- Pet: integer;
- I: integer;
-Label CreateSongButtons;
-begin
- inherited Create;
-
- LoadFromTheme(Theme.Song);
-
- TextArtist := AddText(Theme.Song.TextArtist);
- TextTitle := AddText(Theme.Song.TextTitle);
- TextNumber := AddText(Theme.Song.TextNumber);
-
- //Show Cat in Top Left mod
- TextCat := AddText(Theme.Song.TextCat);
- StaticCat := AddStatic(Theme.Song.StaticCat);
-
- //Show Video Icon Mod
- VideoIcon := AddStatic(Theme.Song.VideoIcon);
-
- //Party Mode
- StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1);
- StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2);
- StaticTeam1Joker3 := AddStatic(Theme.Song.StaticTeam1Joker3);
- StaticTeam1Joker4 := AddStatic(Theme.Song.StaticTeam1Joker4);
- StaticTeam1Joker5 := AddStatic(Theme.Song.StaticTeam1Joker5);
-
- StaticTeam2Joker1 := AddStatic(Theme.Song.StaticTeam2Joker1);
- StaticTeam2Joker2 := AddStatic(Theme.Song.StaticTeam2Joker2);
- StaticTeam2Joker3 := AddStatic(Theme.Song.StaticTeam2Joker3);
- StaticTeam2Joker4 := AddStatic(Theme.Song.StaticTeam2Joker4);
- StaticTeam2Joker5 := AddStatic(Theme.Song.StaticTeam2Joker5);
-
- StaticTeam3Joker1 := AddStatic(Theme.Song.StaticTeam3Joker1);
- StaticTeam3Joker2 := AddStatic(Theme.Song.StaticTeam3Joker2);
- StaticTeam3Joker3 := AddStatic(Theme.Song.StaticTeam3Joker3);
- StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4);
- StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5);
-
- //Load Party or NonParty specific Statics and Texts
- SetLength(StaticParty, Length(Theme.Song.StaticParty));
- for I := 0 to High(Theme.Song.StaticParty) do
- StaticParty[I] := AddStatic(Theme.Song.StaticParty[I]);
-
- SetLength(TextParty, Length(Theme.Song.TextParty));
- for I := 0 to High(Theme.Song.TextParty) do
- TextParty[I] := AddText(Theme.Song.TextParty[I]);
-
- SetLength(StaticNonParty, Length(Theme.Song.StaticNonParty));
- for I := 0 to High(Theme.Song.StaticNonParty) do
- StaticNonParty[I] := AddStatic(Theme.Song.StaticNonParty[I]);
-
- SetLength(TextNonParty, Length(Theme.Song.TextNonParty));
- for I := 0 to High(Theme.Song.TextNonParty) do
- TextNonParty[I] := AddText(Theme.Song.TextNonParty[I]);
-
- // Song List
-// Songs.LoadSongList; // moved to the UltraStar unit
- CatSongs.Refresh;
-
- if (length(CatSongs.Song) > 0) then
- begin
- //Set Length of Button Array one Time Instead of one time for every Song
- SetButtonLength(Length(CatSongs.Song));
-
- I := 0;
- CreateSongButtons:
-
- try
- for Pet := I to High(CatSongs.Song) do begin // creating all buttons
- // new
- Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0
-
- if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then
- CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover'
-
- if CatSongs.Song[Pet].Cover = '' then
- AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections)
- else begin
- // cache texture if there is a need to this
- if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then begin
- Texture.CreateCacheMipmap := true;
- Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap
- Texture.CreateCacheMipmap := false;
-
- // puts this texture to the cache file
- Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover);
-
- // unload full size texture
- Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false);
-
- // we should also add mipmap texture by calling createtexture and use mipmap cache as data source
- end;
-
- // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here)
- AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections);
- end;
- Texture.Limit := 1024*1024;
- I := -1;
- end;
- except
- //When Error is reported the First time for this Song
- if (I <> Pet) then
- begin
- //Some Error reporting:
- Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover);
-
- //Change Cover to NoCover and Continue Loading
- CatSongs.Song[Pet].Cover := '';
- I := Pet;
- end
- else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song
- begin
- Log.LogError('NoCover Cover is damaged!');
- try
- AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections);
- except
- Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK);
- Halt;
- end;
- I := Pet + 1;
- end;
- end;
-
- if (I <> -1) then
- GoTo CreateSongButtons;
-
- end;
-
- // Randomize Patch
- Randomize;
- //Equalizer
- SetLength(EqualizerBands, Theme.Song.Equalizer.Bands);
- //ClearArray
- For I := low(EqualizerBands) to high(EqualizerBands) do
- EqualizerBands[I] := 3;
-
- if (Length(CatSongs.Song) > 0) then
- Interaction := 0;
-end;
-
-procedure TScreenSong.SetScroll;
-var
- VS, B: Integer;
-begin
- VS := CatSongs.VisibleSongs;
- if VS > 0 then
- begin
- //Set Positions
- Case Theme.Song.Cover.Style of
- 3: SetScroll3;
- 5:begin
- if VS > 5 then
- SetScroll5
- else
- SetScroll4;
- end;
- 6: SetScroll6;
- else SetScroll4;
- end;
- //Set Visibility of Video Icon
- Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> '');
-
- //Set Texts:
- Text[TextArtist].Text := CatSongs.Song[Interaction].Artist;
- Text[TextTitle].Text := CatSongs.Song[Interaction].Title;
- if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then
- begin
- Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount);
- Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')';
- end
- else if (CatSongs.CatNumShow = -2) then
- Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS)
- else if (CatSongs.CatNumShow = -3) then
- Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS)
- else if (Ini.Tabs_at_startup = 1) then
- Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber)
- else
- Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song));
- end
- else
- begin
- Text[TextNumber].Text := '0/0';
- Text[TextArtist].Text := '';
- Text[TextTitle].Text := '';
- for B := 0 to High(Button) do
- Button[B].Visible := False;
-
- end;
-end;
-
-procedure TScreenSong.SetScroll1;
-var
- B: integer; // button
- BMin: integer; // button min
- BMax: integer; // button max
- Src: integer;
-// Dst: integer;
- Count: integer; // Dst is not used. Count is used.
- Ready: boolean;
-
- VisCount: integer; // count of visible (or selectable) buttons
- VisInt: integer; // visible position of interacted button
- Typ: integer; // 0 when all songs fits the screen
- Placed: integer; // number of placed visible buttons
-begin
-// Src := 0;
-// Dst := -1;
- Count := 1;
- Typ := 0;
- Ready := false;
- Placed := 0;
-
- VisCount := 0;
- for B := 0 to High(Button) do
- if CatSongs.Song[B].Visible then Inc(VisCount);
-
- VisInt := 0;
- for B := 0 to Interaction-1 do
- if CatSongs.Song[B].Visible then Inc(VisInt);
-
-
- if VisCount <= 6 then begin
- Typ := 0;
- end else begin
- if VisInt <= 3 then begin
- Typ := 1;
- Count := 7;
- Ready := true;
- end;
-
- if (VisCount - VisInt) <= 3 then begin
- Typ := 2;
- Count := 7;
- Ready := true;
- end;
-
- if not Ready then begin
- Typ := 3;
- Src := Interaction;
- end;
- end;
-
-
-
- // hide all buttons
- for B := 0 to High(Button) do begin
- Button[B].Visible := false;
- Button[B].Selectable := CatSongs.Song[B].Visible;
- end;
-
-{ for B := Src to Dst do begin
-// Button[B].Visible := true;
- Button[B].Visible := CatSongs.Song[B].Visible;
- Button[B].Selectable := Button[B].Visible;
- Button[B].Y := 140 + (B-Src) * 60;
- end;}
-
-
- if Typ = 0 then begin
- for B := 0 to High(Button) do begin
- if CatSongs.Song[B].Visible then begin
- Button[B].Visible := true;
- Button[B].Y := 140 + (Placed) * 60;
- Inc(Placed);
- end;
- end;
- end;
-
- if Typ = 1 then begin
- B := 0;
- while (Count > 0) do begin
- if CatSongs.Song[B].Visible then begin
- Button[B].Visible := true;
- Button[B].Y := 140 + (Placed) * 60;
- Inc(Placed);
- Dec(Count);
- end;
- Inc(B);
- end;
- end;
-
- if Typ = 2 then begin
- B := High(Button);
- while (Count > 0) do begin
- if CatSongs.Song[B].Visible then begin
- Button[B].Visible := true;
- Button[B].Y := 140 + (6-Placed) * 60;
- Inc(Placed);
- Dec(Count);
- end;
- Dec(B);
- end;
- end;
-
- if Typ = 3 then begin
- B := Src;
- Count := 4;
- while (Count > 0) do begin
- if CatSongs.Song[B].Visible then begin
- Button[B].Visible := true;
- Button[B].Y := 140 + (3+Placed) * 60;
- Inc(Placed);
- Dec(Count);
- end;
- Inc(B);
- end;
-
- B := Src-1;
- Placed := 0;
- Count := 3;
- while (Count > 0) do begin
- if CatSongs.Song[B].Visible then begin
- Button[B].Visible := true;
- Button[B].Y := 140 + (2-Placed) * 60;
- Inc(Placed);
- Dec(Count);
- end;
- Dec(B);
- end;
-
- end;
-
- if Length(Button) > 0 then
- Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture
-end;
-
-procedure TScreenSong.SetScroll2;
-var
- B: integer;
- Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu
- Wsp2: real;
-begin
- // liniowe
- for B := 0 to High(Button) do
- Button[B].X := 300 + (B - Interaction) * 260;
-
- if Length(Button) >= 3 then begin
- if Interaction = 0 then
- Button[High(Button)].X := 300 - 260;
-
- if Interaction = High(Button) then
- Button[0].X := 300 + 260;
- end;
-
- // kolowe
-{ for B := 0 to High(Button) do begin
- Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd.
- Wsp2 := Wsp / Length(Button);
- Button[B].X := 300 + 10000 * sin(2*pi*Wsp2);
-// Button[B].Y := 140 + 50 * ;
- end;}
-end;
-
-procedure TScreenSong.SetScroll3; // with slide
-var
- B: integer;
- Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu
- Wsp2: real;
-begin
- SongTarget := Interaction;
-
- // liniowe
- for B := 0 to High(Button) do
- begin
- Button[B].X := 300 + (B - SongCurrent) * 260;
- if (Button[B].X < -Button[B].W) OR (Button[B].X > 800) then
- Button[B].Visible := False
- else
- Button[B].Visible := True;
- end;
-
-{ if Length(Button) >= 3 then begin
- if Interaction = 0 then
- Button[High(Button)].X := 300 - 260;
-
- if Interaction = High(Button) then
- Button[0].X := 300 + 260;
- end;}
-
- // kolowe
-{ for B := 0 to High(Button) do begin
- Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd.
- Wsp2 := Wsp / Length(Button);
- Button[B].X := 300 + 10000 * sin(2*pi*Wsp2);
-// Button[B].Y := 140 + 50 * ;
- end;}
-end;
-
-procedure TScreenSong.SetScroll4; // rotate
-var
- B: integer;
- Wsp: real;
- Z, Z2: real;
- VS: integer;
-begin
- VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important
-
- // kolowe
- for B := 0 to High(Button) do begin
- Button[B].Visible := CatSongs.Song[B].Visible; // nowe
- if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed
-
- Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms
-
- Z := (1 + cos(Wsp)) / 2;
- Z2 := (1 + 2*Z) / 3;
-
-
- Button[B].X := Theme.Song.Cover.X + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs
- Button[B].Z := Z / 2 + 0.3;
-
- Button[B].W := Theme.Song.Cover.H * Z2;
-
-// Button[B].Y := {50 +} 140 + 50 - 50 * Z2;
- Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ;
- Button[B].H := Button[B].W;
- end;
- end;
-end;
-
-(*
-procedure TScreenSong.SetScroll4; // rotate
-var
- B: integer;
- Wsp: real;
- Z: real;
- Z2, Z3: real;
- VS: integer;
- function modreal (const X, Y: real):real;
- begin
- Result := Frac(x / y) * y;
- if Result < -3 then
- Result := Result + Y
- else if Result > 3 then
- Result := Result - Y;
- end;
-begin
- VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important
- Z3 := 1;
- if VS < 12 then
- Z2 := VS
- else
- Z2 := 12;
-
- // kolowe
- for B := 0 to High(Button) do begin
- Button[B].Visible := CatSongs.Song[B].Visible; // nowe
- if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed
- if ((ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)>-3) AND (ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)<3)) then
- begin
- if CatSongs.VisibleIndex(B)> SongCurrent then
- Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2
- else
- Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2;
-
- Z3 := 2;
- Z := (1 + cos(Wsp)) / 2;
- //Z2 := (1 + 2*Z) / 3;
- //Z2 := (0.5 + Z/2);
- //Z2 := sin(Wsp);
-
- //Z2 := Power (Z2,Z3);
-
- Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3);
-
- //Button[B].X := Theme.Song.CoverX + ({Theme.Song.CoverX + Theme.Song.CoverW/2 + Theme.Song.CoverW*0.18 * VS {CatSongs.VisibleSongs {Length(Button) * sin(Wsp) {- Theme.Song.CoverX - Theme.Song.CoverW) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs
- if (sin(Wsp)<0) then
- Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W
- else //*Theme.Song.CoverW*0.004*Z3
- Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX;
- Button[B].Z := Z-0.00001;
-
-// Button[B].Y := {50 + 140 + 50 - 50 * Z2;
- // Button[B].Y := (Theme.Song.CoverY + 40 + 50 - 50 * Z2);
- Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W);
- Button[B].H := Button[B].W;
- Button[B].Visible := True;
- end
- {else if (((CatSongs.VisibleIndex(B) - SongCurrent)>-3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) OR ((round (CatSongs.VisibleIndex(B) - SongCurrent) mod VS > -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) then
- begin
- Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / 12 ;// 0.5.0 (II): takes another 16ms
-
- Z := (1 + cos(Wsp)) / 2 -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers
-
- Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3);
-
- if (sin(Wsp)<0) then
- Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W
- else
- Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX;
-
- Button[B].Z := Z;
-
- Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W);
-
- Button[B].H := Button[B].W;
- Button[B].Visible := True;
- end
- else Button[B].Visible := False;
- end;
- end;
-end; *)
-
-procedure TScreenSong.SetScroll5; // rotate
-var
- B: integer;
- Angle: real;
- Pos: Real;
- VS: integer;
- diff: real;
- X: Real;
- helper: real;
-begin
- VS := CatSongs.VisibleSongs; // cache Visible Songs
- {Vars
- Theme.Song.CoverW: Radius des Kreises
- Theme.Song.CoverX: X Pos Linke Kante des gewählten Covers
- Theme.Song.CoverX: Y Pos Obere Kante des gewählten Covers
- Theme.Song.CoverH: Höhe der Cover
-
- (CatSongs.VisibleIndex(B) - SongCurrent)/VS = Abstand zum MIttleren Cover in %
- }
-
- //Change Pos of all Buttons
- for B := low(Button) to high(Button) do
- begin
- Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility
- if Button[B].Visible then //Only Change Pos for Visible Buttons
- begin
- Pos := (CatSongs.VisibleIndex(B) - SongCurrent);
- if (Pos < -VS/2) then
- Pos := Pos + VS
- else if (Pos > VS/2) then
- Pos := Pos - VS;
-
- if (Abs(Pos) < 2.5) then {fixed Positions}
- begin
- Angle := Pi * (Pos / 5);
-// Button[B].Visible := False;
-
- Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3);
-
-// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H;
- Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H;
-
- Button[B].Z := 0.95 - Abs(Pos) * 0.01;
-
- Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5);
-
- Button[B].W := Button[B].H;
-
- Diff := (Button[B].H - Theme.Song.Cover.H)/2;
-
-
- X := Sin(Angle*1.3)*0.9;
-
- Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Diff;
-
- end
- else
- begin {Behind the Front Covers}
-
- // limit-bg-covers hack
- if (abs(abs(Pos)-VS/2)>10) then Button[B].Visible:=False;
- // end of limit-bg-covers hack
-
- if Pos < 0 then
- Pos := (Pos - VS/2)/VS
- else
- Pos := (Pos + VS/2)/VS;
-
- Angle := pi * Pos*2;
- if VS > 24 then
- begin
- if Angle < 0 then helper:=-1 else helper:=1;
- Angle:=2*pi-abs(Angle);
- Angle:=Angle*(VS/24);
- Angle:=(2*pi-Angle)*helper;
- end;
-
- Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers
-
- Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3);
-
- Button[B].W := Button[B].H;
-
- Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75;
-
-// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H;
- Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H;
-
- Diff := (Button[B].H - Theme.Song.Cover.H)/2;
-
- Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*((Theme.Song.Cover.H)*sin(Angle/2)*1.52);
-
- end;
-
- //Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field
-// Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7);
-
- end;
- end;
-end;
-
-procedure TScreenSong.SetScroll6; // rotate (slotmachine style)
-var
- B: integer;
- Angle: real;
- Pos: Real;
- VS: integer;
- diff: real;
- X: Real;
- Wsp: real;
- Z, Z2: real;
-begin
- VS := CatSongs.VisibleSongs; // cache Visible Songs
- if VS <=5 then begin
- // kolowe
- for B := 0 to High(Button) do
- begin
- Button[B].Visible := CatSongs.Song[B].Visible; // nowe
- if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed
-
- Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms
-
- Z := (1 + cos(Wsp)) / 2;
- Z2 := (1 + 2*Z) / 3;
-
-
- Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs
- Button[B].Z := Z / 2 + 0.3;
-
- Button[B].W := Theme.Song.Cover.H * Z2;
-
-// Button[B].Y := {50 +} 140 + 50 - 50 * Z2;
- Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ;
- Button[B].H := Button[B].W;
- end;
- end;
- end
- else begin
-
- //Change Pos of all Buttons
- for B := low(Button) to high(Button) do
- begin
- Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility
- if Button[B].Visible then //Only Change Pos for Visible Buttons
- begin
- Pos := (CatSongs.VisibleIndex(B) - SongCurrent);
- if (Pos < -VS/2) then
- Pos := Pos + VS
- else if (Pos > VS/2) then
- Pos := Pos - VS;
-
- if (Abs(Pos) < 2.5) then {fixed Positions}
- begin
- Angle := Pi * (Pos / 5);
-// Button[B].Visible := False;
-
- Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3);
-
- Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H;
-
- Button[B].Z := 0.95 - Abs(Pos) * 0.01;
-
- Button[B].X := (Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5);
-
- Button[B].W := Button[B].H;
-
- Diff := (Button[B].H - Theme.Song.Cover.H)/2;
-
-
- X := Sin(Angle*1.3)*0.9;
-
- Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff;
- end
- else
- begin {Behind the Front Covers}
-
- // limit-bg-covers hack
- if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False;
- if VS > 25 then VS:=25;
- // end of limit-bg-covers hack
-
- if Pos < 0 then
- Pos := (Pos - VS/2)/VS
- else
- Pos := (Pos + VS/2)/VS;
-
- Angle := pi * Pos*2;
-
- Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers
-
- Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3);
-
- Button[B].W := Button[B].H;
-
- Button[B].X := Theme.Song.Cover.X - (Button[B].H - Theme.Song.Cover.H)*0.5;
-
-
- Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H;
-
- Button[B].Y := Theme.Song.Cover.Y+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*(Theme.Song.Cover.H*sin(Angle/2)*1.52);
- end;
- end;
- end;
- end;
-end;
-
-
-procedure TScreenSong.onShow;
-begin
- Music.Stop;
-
- if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1;
- if Ini.Players = 4 then PlayersPlay := 6;
-
- //Cat Mod etc
- if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then
- begin
- CatSongs.ShowCategoryList;
- FixSelected;
- //Show Cat in Top Left Mod
- HideCatTL;
- end;
-
-
- if Length(CatSongs.Song) > 0 then begin
- //Load Music only when Song Preview is activated
- if (Ini.PreviewVolume <> 0) then
- begin
- Music.SetLoop(false);
- Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3);
- Music.MoveTo(Music.Length / 4);
- Music.Play;
-
- //Set Preview Volume
- Music.SetMusicVolume (Ini.PreviewVolume * 10);
- {//if Music Fade is activated, Set Volume to 0 %
- if (Ini.PreviewFading <> 0) then
- Music.SetMusicVolume(0);}
- end;
-
- SetScroll;
- UpdateLCD;
- end;
-
- //Playlist Mode
- if (Mode = 0) then
- begin
- //If Playlist Shown -> Select Next automatically
- if (CatSongs.CatNumShow = -3) then
- begin
- SelectNext;
- ChangeMusic;
- end;
- end
- //Party Mode
- else if (Mode = 1) then
- begin
-
- SelectRandomSong;
- //Show Menu directly in PartyMode
- //But only if selected in Options
- if (Ini.PartyPopup = 1) then
- begin
- ScreenSongMenu.MenuShow(SM_Party_Main);
- end;
-
-
- end;
-
- SetJoker;
- SetStatics;
-end;
-
-procedure TScreenSong.onHide;
-begin
- //When Music Fading is activated, Turn Music to 100 %
- If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then
- Music.SetMusicVolume(100);
-
- //If Preview is deactivated: Load MUsicfile now
- If (Ini.PreviewVolume = 0) then
- Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3);
-
- //When hide then Stop Music (For Party Mode Popup on Exit)
- if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then
- Music.Stop;
-end;
-
-procedure TScreenSong.DrawExtensions;
-begin
- //Draw Song Menu
- if (ScreenSongMenu.Visible) then
- begin
- ScreenSongMenu.Draw;
- end
- else if (ScreenSongJumpto.Visible) then
- begin
- ScreenSongJumpto.Draw;
- end
-end;
-
-function TScreenSong.Draw: boolean;
-var
- dx: real;
- dt: real;
- I: Integer;
-begin
- dx := SongTarget-SongCurrent;
- dt := TimeSkip*7;
- if dt > 1 then dt := 1;
- SongCurrent := SongCurrent + dx*dt;
-
-{ if SongCurrent > Catsongs.VisibleSongs then begin
- SongCurrent := SongCurrent - Catsongs.VisibleSongs;
- SongTarget := SongTarget - Catsongs.VisibleSongs;
- end;}
-
-// Log.BenchmarkStart(5);
- SetScroll;
-// Log.BenchmarkEnd(5);
-// Log.LogBenchmark('SetScroll4', 5);
-
- //Fading Functions, Only if Covertime is under 5 Seconds
- If (CoverTime < 5) then
- begin
- // 0.5.0: cover fade
- if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin
- // load new texture
- Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false);
- Button[Interaction].Texture.Alpha := 1;
- Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false);
- Button[Interaction].Texture2.Alpha := 1;
- end;
-
- //Song Fade
- if (CatSongs.VisibleSongs > 0) AND (Ini.PreviewVolume <> 0) AND (Not CatSongs.Song[Interaction].Main) AND (Ini.PreviewFading <> 0) then
- begin
- //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling
- if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then
- Music.Play;
-
- //Update Song Volume
- if (CoverTime < Ini.PreviewFading) then
- Music.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10))
- else
- Music.SetMusicVolume(Ini.PreviewVolume * 10);
-
- end;
-
-
- //Update Fading Time
- CoverTime := CoverTime + TimeSkip;
-
- //Update Fading Texture
- Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5;
- if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1;
-
- end;
-
- //inherited Draw;
- //heres a little Hack, that causes the Statics
- //are Drawn after the Buttons because of some Blending Problems.
- //This should cause no Problems because all Buttons on this screen
- //Has Z Position.
- //Draw BG
- DrawBG;
-
- //Instead of Draw FG Procedure:
- //We draw Buttons for our own
- for I := 0 to Length(Button) - 1 do
- Button[I].Draw;
-
- // Statics
- for I := 0 to Length(Static) - 1 do
- Static[I].Draw;
-
- // and texts
- for I := 0 to Length(Text) - 1 do
- Text[I].Draw;
-
-
- //Draw Equalizer
- if Theme.Song.Equalizer.Visible then
- DrawEqualizer;
-
- DrawExtensions;
-
-end;
-
-procedure TScreenSong.SelectNext;
-var
- Skip: integer;
- I: integer;
- VS: Integer;
-begin
- VS := CatSongs.VisibleSongs;
-
- if VS > 0 then
- begin
- UnLoadDetailedCover;
-
- Skip := 1;
-
- // this 1 could be changed by CatSongs.FindNextVisible
- while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip);
-
- SongTarget := SongTarget + 1;//Skip;
-
- Interaction := (Interaction + Skip) mod Length(Interactions);
-
- // try to keep all at the beginning
- if SongTarget > VS-1 then begin
- SongTarget := SongTarget - VS;
- SongCurrent := SongCurrent - VS;
- end;
-
- end;
- // Interaction -> Button, ktorego okladke przeczytamy
- // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture
-end;
-
-procedure TScreenSong.SelectPrev;
-var
- Skip: integer;
- I: integer;
- VS: Integer;
-begin
- VS := CatSongs.VisibleSongs;
-
- if VS > 0 then
- begin
- UnLoadDetailedCover;
-
- Skip := 1;
-
- while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip);
- SongTarget := SongTarget - 1;//Skip;
-
- Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions);
-
- // try to keep all at the beginning
- if SongTarget < 0 then begin
- SongTarget := SongTarget + CatSongs.VisibleSongs;
- SongCurrent := SongCurrent + CatSongs.VisibleSongs;
- end;
-
- // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture
- end;
-end;
-
-procedure TScreenSong.UpdateLCD;
-begin
- LCD.HideCursor;
- LCD.Clear;
- LCD.WriteText(1, Text[TextArtist].Text);
- LCD.WriteText(2, Text[TextTitle].Text);
-end;
-
-//Procedure Change current played Preview
-procedure TScreenSong.ChangeMusic;
-begin
- //When Music Preview is avtivated -> then Change Music
- if (Ini.PreviewVolume <> 0) then
- begin
- if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then
- begin
- Music.Close;
- if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin
- Music.MoveTo(Music.Length / 4);
- //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal
- if (Ini.PreviewFading = 0) then
- Music.Play
- else
- Music.SetMusicVolume(0);
- end;
- end
- else
- Music.Stop;
- end;
-end;
-
-procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0
-var
- Skip: integer;
- I: integer;
-begin
- UnLoadDetailedCover;
-
- Interaction := High(CatSongs.Song);
- SongTarget := 0;
-
- for I := 1 to Target+1 do
- SelectNext;
-
- FixSelected2;
-end;
-
-procedure TScreenSong.DrawEqualizer;
-var
- Data: TFFTData; //Audio Data
- I, J: Integer;
- Res: byte;
- A, B: Integer;
- PosX, PosY: Integer;
- Pos: Real;
-begin
-if (not Music.Finished) AND (Theme.Song.Equalizer.Length > 0) then
-begin
-
-
- A := GetTickCount div 44;
-
- if (A <> EqualizerTime) then
- begin
- EqualizerTime := A;
- Data := Music.GetFFTData;
-
- B:=0;
- Pos := 0;
- Res := ceil(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band
-
- //Change Lengths
- for I := 0 to (Res * Theme.Song.Equalizer.Bands - 1) do
- begin
- A := floor(I/Res);
-
- if (A<>B) then //Band changed
- begin
- if (Pos <= Theme.Song.Equalizer.Length) then
- begin
- if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then
- EqualizerBands[B] := EqualizerBands[B] - 1
- else
- EqualizerBands[B] := floor(Pos);
- end
- else
- EqualizerBands[B] := 1;
-
- B := A;
- Pos := 0;
- end;
-
- if I > 35 then
- Data[i] := Data[i] * 8
- else if I > 11 then
- Data[i] := Data[i] * 4.5
- else
- Data[i] := Data[i] * 1.1;
-
- if (Data[i] >= 1) then
- Data[i] := 0.9999999999999;
-
- if Data[i]*Theme.Song.Equalizer.Length > Pos then
- Pos := Data[i]*Theme.Song.Equalizer.Length;
- end;
-
- //Change Last Band
- if (EqualizerBands[B] <= Theme.Song.Equalizer.Length) then
- begin
- if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then
- EqualizerBands[B] := EqualizerBands[B] - 1
- else
- EqualizerBands[B] := floor(Pos)
- end
- else
- EqualizerBands[B] := 1;
- end;
-
- //Draw every Channel
- glColor4f(Theme.Song.Equalizer.ColR, Theme.Song.Equalizer.ColG, Theme.Song.Equalizer.ColB, Theme.Song.Equalizer.Alpha); //Set Color
- glDisable(GL_TEXTURE_2D);
- glEnable(GL_BLEND);
-
- PosY := Theme.Song.Equalizer.Y;
- PosX := Theme.Song.Equalizer.X;
-
- For I := 0 to Theme.Song.Equalizer.Bands-1 do
- begin
- if Theme.Song.Equalizer.Direction then
- PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length
- else
- PosX := Theme.Song.Equalizer.X;
- //Draw for every visible quad
- for J := 1 to EqualizerBands[I] do
- begin
- glBegin(GL_QUADS);
- glVertex3f(PosX, PosY, Theme.Song.Equalizer.Z);
- glVertex3f(PosX, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z);
- glVertex3f(PosX+Theme.Song.Equalizer.W, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z);
- glVertex3f(PosX+Theme.Song.Equalizer.W, PosY, Theme.Song.Equalizer.Z);
- glEnd;
-
- if Theme.Song.Equalizer.Direction then //Vertically
- PosY := PosY - Theme.Song.Equalizer.H - Theme.Song.Equalizer.Space
- else //Horizontally
- PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space;
- end;
- if Theme.Song.Equalizer.Direction then //Horizontally
- PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space
- else //Vertically
- PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space;
- end;
-end;
-end;
-
-Procedure TScreenSong.SelectRandomSong;
-var
- I, I2: Integer;
-begin
- Case PlaylistMan.Mode of
- 0: //All Songs Just Select Random Song
- begin
- //When Tabs are activated then use Tab Method
- if (Ini.Tabs_at_startup = 1) then
- begin
- repeat
- I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1;
- until CatSongs.Song[I2].Main = false;
-
- //Search Cat
- for I := I2 downto low(CatSongs.Song) do
- begin
- if CatSongs.Song[I].Main then
- break;
- end;
- //In I ist jetzt die Kategorie in I2 der Song
- //I is the CatNum, I2 is the No of the Song within this Cat
-
- //Choose Cat
- CatSongs.ShowCategoryList;
-
- //Show Cat in Top Left Mod
- ShowCatTL (I);
-
- CatSongs.ClickCategoryButton(I);
- SelectNext;
-
- //Choose Song
- SkipTo(I2-I);
- end
- //When Tabs are deactivated use easy Method
- else
- SkipTo(Random(CatSongs.VisibleSongs));
- end;
- 1: //One Category Select Category and Select Random Song
- begin
- CatSongs.ShowCategoryList;
- CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList);
- ShowCatTL(PlaylistMan.CurPlayList);
-
- SelectNext;
- FixSelected2;
-
- SkipTo(Random(CatSongs.VisibleSongs));
- end;
- 2: //Playlist: Select Playlist and Select Random Song
- begin
- PlaylistMan.SetPlayList(PlaylistMan.CurPlayList);
-
- SkipTo(Random(CatSongs.VisibleSongs));
- FixSelected2;
- end;
- end;
-
- Music.PlayChange;
- ChangeMusic;
- SetScroll;
- UpdateLCD;
-end;
-
-procedure TScreenSong.SetJoker;
-begin
- //If Party Mode
- if Mode = 1 then //Show Joker that are available
- begin
- if (PartySession.Teams.NumTeams >= 1) then
- begin
- Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1);
- Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2);
- Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3);
- Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4);
- Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5);
- end
- else
- begin
- Static[StaticTeam1Joker1].Visible := False;
- Static[StaticTeam1Joker2].Visible := False;
- Static[StaticTeam1Joker3].Visible := False;
- Static[StaticTeam1Joker4].Visible := False;
- Static[StaticTeam1Joker5].Visible := False;
- end;
-
- if (PartySession.Teams.NumTeams >= 2) then
- begin
- Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1);
- Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2);
- Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3);
- Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4);
- Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5);
- end
- else
- begin
- Static[StaticTeam2Joker1].Visible := False;
- Static[StaticTeam2Joker2].Visible := False;
- Static[StaticTeam2Joker3].Visible := False;
- Static[StaticTeam2Joker4].Visible := False;
- Static[StaticTeam2Joker5].Visible := False;
- end;
-
- if (PartySession.Teams.NumTeams >= 3) then
- begin
- Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1);
- Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2);
- Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3);
- Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4);
- Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5);
- end
- else
- begin
- Static[StaticTeam3Joker1].Visible := False;
- Static[StaticTeam3Joker2].Visible := False;
- Static[StaticTeam3Joker3].Visible := False;
- Static[StaticTeam3Joker4].Visible := False;
- Static[StaticTeam3Joker5].Visible := False;
- end;
- end
- else
- begin //Hide all
- Static[StaticTeam1Joker1].Visible := False;
- Static[StaticTeam1Joker2].Visible := False;
- Static[StaticTeam1Joker3].Visible := False;
- Static[StaticTeam1Joker4].Visible := False;
- Static[StaticTeam1Joker5].Visible := False;
-
- Static[StaticTeam2Joker1].Visible := False;
- Static[StaticTeam2Joker2].Visible := False;
- Static[StaticTeam2Joker3].Visible := False;
- Static[StaticTeam2Joker4].Visible := False;
- Static[StaticTeam2Joker5].Visible := False;
-
- Static[StaticTeam3Joker1].Visible := False;
- Static[StaticTeam3Joker2].Visible := False;
- Static[StaticTeam3Joker3].Visible := False;
- Static[StaticTeam3Joker4].Visible := False;
- Static[StaticTeam3Joker5].Visible := False;
- end;
-end;
-
-procedure TScreenSong.SetStatics;
-var
- I: Integer;
- Visible: Boolean;
-begin
- //Set Visibility of Party Statics and Text
- Visible := (Mode = 1);
-
- For I := 0 to high(StaticParty) do
- Static[StaticParty[I]].Visible := Visible;
-
- For I := 0 to high(TextParty) do
- Text[TextParty[I]].Visible := Visible;
-
- //Set Visibility of Non Party Statics and Text
- Visible := not Visible;
-
- For I := 0 to high(StaticNonParty) do
- Static[StaticNonParty[I]].Visible := Visible;
-
- For I := 0 to high(TextNonParty) do
- Text[TextNonParty[I]].Visible := Visible;
-end;
-
-//Procedures for Menu
-
-procedure TScreenSong.StartSong;
-begin
- CatSongs.Selected := Interaction;
- Music.Stop;
- //Party Mode
- if (Mode = 1) then
- begin
- FadeTo(@ScreenSingModi);
- end
- else
- begin
- FadeTo(@ScreenSing);
- end;
-end;
-
-procedure TScreenSong.SelectPlayers;
-begin
- CatSongs.Selected := Interaction;
- Music.Stop;
-
- ScreenName.Goto_SingScreen := True;
- FadeTo(@ScreenName);
-end;
-
-procedure TScreenSong.OpenEditor;
-begin
- if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin
- Music.Stop;
- Music.PlayStart;
- ScreenEditSub.Path := CatSongs.Song[Interaction].Path;
- ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName;
- FadeTo(@ScreenEditSub);
- end;
-end;
-
-//Team No of Team (0-5)
-procedure TScreenSong.DoJoker (Team: Byte);
-begin
- if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then
- begin
- //Joker spielen
- Dec(PartySession.Teams.Teaminfo[Team].Joker);
- SelectRandomSong;
- SetJoker;
- end;
-end;
-
-//Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song
-procedure TScreenSong.UnLoadDetailedCover;
-begin
- CoverTime := 0;
-
- Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture
- Button[Interaction].Texture2.Alpha := 0;
-
- if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then
- Texture.UnloadTexture(Button[Interaction].Texture.Name, false);
-end;
-
-procedure TScreenSong.Refresh;
-begin {
-CatSongs.Refresh;
-CatSongs.ShowCategoryList;
-Interaction := 0;
-SelectNext;
-FixSelected; }
-
-end;
-
-end.
+unit UScreenSong;
+
+interface
+{$I switches.inc}
+
+uses
+ UMenu,
+ SDL,
+ UMusic,
+ UFiles,
+ UTime,
+ UDisplay,
+ USongs,
+ SysUtils,
+ ULog,
+ UThemes,
+ UTexture,
+ ULanguage,
+ ULCD,
+ ULight,
+ UIni;
+
+type
+ TScreenSong = class(TMenu)
+ public
+ TextArtist: integer;
+ TextTitle: integer;
+ TextNumber: integer;
+
+ //Video Icon Mod
+ VideoIcon: Cardinal;
+
+ TextCat: integer;
+ StaticCat: integer;
+
+ SongCurrent: real;
+ SongTarget: real;
+
+ HighSpeed: boolean;
+ CoverFull: boolean;
+ CoverTime: real;
+ CoverX: integer;
+ CoverY: integer;
+ CoverW: integer;
+ is_jump: boolean; // Jump to Song Mod
+ is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title
+
+ EqualizerBands: array of Byte;
+ EqualizerTime: Cardinal;
+ EqualizerTime2: Byte;
+
+ //Party Mod
+ Mode: Byte; //0 = Standard, 1= Go to PartyMode after Selection + Change to Random Song at Show
+ //party Statics (Joker)
+ StaticTeam1Joker1: Cardinal;
+ StaticTeam1Joker2: Cardinal;
+ StaticTeam1Joker3: Cardinal;
+ StaticTeam1Joker4: Cardinal;
+ StaticTeam1Joker5: Cardinal;
+
+ StaticTeam2Joker1: Cardinal;
+ StaticTeam2Joker2: Cardinal;
+ StaticTeam2Joker3: Cardinal;
+ StaticTeam2Joker4: Cardinal;
+ StaticTeam2Joker5: Cardinal;
+
+ StaticTeam3Joker1: Cardinal;
+ StaticTeam3Joker2: Cardinal;
+ StaticTeam3Joker3: Cardinal;
+ StaticTeam3Joker4: Cardinal;
+ StaticTeam3Joker5: Cardinal;
+
+ StaticParty: Array of Cardinal;
+ TextParty: Array of Cardinal;
+ StaticNonParty: Array of Cardinal;
+ TextNonParty: Array of Cardinal;
+
+
+ constructor Create; override;
+ procedure SetScroll;
+ procedure SetScroll1;
+ procedure SetScroll2;
+ procedure SetScroll3;
+ procedure SetScroll4;
+ procedure SetScroll5;
+ procedure SetScroll6;
+ function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
+ function Draw: boolean; override;
+ procedure onShow; override;
+ procedure onHide; override;
+ procedure SelectNext;
+ procedure SelectPrev;
+ procedure UpdateLCD;
+ procedure SkipTo(Target: Cardinal);
+ procedure FixSelected; //Show Wrong Song when Tabs on Fix
+ procedure FixSelected2; //Show Wrong Song when Tabs on Fix
+ procedure ShowCatTL(Cat: Integer);// Show Cat in Top left
+ procedure ShowCatTLCustom(Caption: String);// Show Custom Text in Top left
+ procedure HideCatTL;// Show Cat in Tob left
+ procedure Refresh; //Refresh Song Sorting
+ procedure DrawEqualizer;
+ procedure ChangeMusic;
+ //Party Mode
+ procedure SelectRandomSong;
+ procedure SetJoker;
+ procedure SetStatics;
+ //procedures for Menu
+ procedure StartSong;
+ procedure OpenEditor;
+ procedure DoJoker(Team: Byte);
+ procedure SelectPlayers;
+
+ procedure UnLoadDetailedCover;
+
+ //Extensions
+ procedure DrawExtensions;
+ end;
+
+implementation
+uses UGraphic,
+ UMain,
+ UCovers,
+ math,
+ OpenGL12,
+ {$IFDEF win32}
+ windows,
+ {$ELSE}
+ lclintf,
+ {$ENDIF}
+ USkins,
+ UDLLManager,
+ UParty,
+ UPlaylist,
+ UScreenSongMenu;
+
+// ***** Public methods ****** //
+
+//Show Wrong Song when Tabs on Fix
+procedure TScreenSong.FixSelected;
+var I, I2: Integer;
+ begin
+ if CatSongs.VisibleSongs > 0 then
+ begin
+ I2:= 0;
+ for I := low(CatSongs.Song) to High(Catsongs.Song) do
+ begin
+ if CatSongs.Song[I].Visible then
+ inc(I2);
+
+ if I = Interaction - 1 then
+ break;
+ end;
+
+ SongCurrent := I2;
+ SongTarget := I2;
+ end;
+ end;
+
+procedure TScreenSong.FixSelected2;
+var I, I2: Integer;
+ begin
+ if CatSongs.VisibleSongs > 0 then
+ begin
+ I2:= 0;
+ for I := low(CatSongs.Song) to High(Catsongs.Song) do
+ begin
+ if CatSongs.Song[I].Visible then
+ inc(I2);
+
+ if I = Interaction - 1 then
+ break;
+ end;
+
+ SongTarget := I2;
+ end;
+ end;
+//Show Wrong Song when Tabs on Fix End
+
+ procedure TScreenSong.ShowCatTLCustom(Caption: String);// Show Custom Text in Top left
+ begin
+ Text[TextCat].Text := Caption;
+ Text[TextCat].Visible := true;
+ Static[StaticCat].Visible := False;
+ end;
+
+ //Show Cat in Top Left Mod
+ procedure TScreenSong.ShowCatTL(Cat: Integer);
+ begin
+ //Change
+ Text[TextCat].Text := CatSongs.Song[Cat].Artist;
+ //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover);
+ //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true);
+
+ Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true);
+ //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false);
+ //Button[Cat].
+ //Cover
+
+
+ //Show
+ Text[TextCat].Visible := true;
+ Static[StaticCat].Visible := True;
+ end;
+
+ procedure TScreenSong.HideCatTL;
+ begin
+ //Hide
+ //Text[TextCat].Visible := false;
+ Static[StaticCat].Visible := false;
+ //New -> Show Text specified in Theme
+ Text[TextCat].Visible := True;
+ Text[TextCat].Text := Theme.Song.TextCat.Text;
+ end;
+ //Show Cat in Top Left Mod End
+
+
+// Method for input parsing. If False is returned, GetNextWindow
+// should be checked to know the next window to load;
+function TScreenSong.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+var
+ I: integer;
+ I2: integer;
+ HS: integer;
+ SDL_ModState: Word;
+ Letter: Char;
+begin
+ Result := true;
+
+ //Song Screen Extensions (Jumpto + Menu)
+ if (ScreenSongMenu.Visible) then
+ begin
+ Result := ScreenSongMenu.ParseInput(PressedKey, ScanCode, PressedDown);
+ Exit;
+ end
+ else if (ScreenSongJumpto.Visible) then
+ begin
+ Result := ScreenSongJumpto.ParseInput(PressedKey, ScanCode, PressedDown);
+ Exit;
+ end;
+
+ If (PressedDown) Then
+ begin // Key Down
+
+ SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT
+ + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT);
+
+ //Jump to Artist/Titel
+ if (SDL_ModState and KMOD_LALT <> 0) AND (Mode = 0) AND (PressedKey >= SDLK_A) AND (PressedKey <= SDLK_Z) then
+ begin
+ Letter := UpCase(Chr(ScanCode));
+ I2 := Length(CatSongs.Song);
+
+ //Jump To Titel
+ if (SDL_ModState = KMOD_LALT or KMOD_LSHIFT) then
+ begin
+ For I := 1 to high(CatSongs.Song) do
+ begin
+ if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then
+ begin
+ SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2));
+
+ Music.PlayChange;
+
+ ChangeMusic;
+ SetScroll4;
+ UpdateLCD;
+ //Break and Exit
+ Exit;
+ end;
+ end;
+ end
+ //Jump to Artist
+ else if (SDL_ModState = KMOD_LALT) then
+ begin
+ For I := 1 to high(CatSongs.Song) do
+ begin
+ if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Artist[1]) = Letter) then
+ begin
+ SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2));
+
+ Music.PlayChange;
+
+ ChangeMusic;
+ SetScroll4;
+ UpdateLCD;
+
+ //Break and Exit
+ Exit;
+ end;
+ end;
+ end;
+ Exit;
+ end;
+
+ case PressedKey of
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ if (Mode = 0) then
+ begin
+ //On Escape goto Cat-List Hack
+ if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow <> -1) then
+ begin
+ //Find Category
+ I := Interaction;
+ while not catsongs.Song[I].Main do
+ begin
+ Dec (I);
+ if (I < low(catsongs.Song)) then
+ break;
+ end;
+ if (I<= 1) then
+ Interaction := high(catsongs.Song)
+ else
+ Interaction := I - 1;
+
+ //Stop Music
+ Music.Stop;
+
+ CatSongs.ShowCategoryList;
+
+ //Show Cat in Top Left Mod
+ HideCatTL;
+
+
+ //Show Wrong Song when Tabs on Fix
+ SelectNext;
+ FixSelected;
+ //SelectPrev;
+ //CatSongs.Song[0].Visible := False;
+ end
+ else
+ begin
+ //On Escape goto Cat-List Hack End
+ //Tabs off and in Search or Playlist -> Go back to Song view
+ if (CatSongs.CatNumShow < -1) then
+ begin
+ //Atm: Set Empty Filter
+ CatSongs.SetFilter('', 0);
+
+ //Show Cat in Top Left Mod
+ HideCatTL;
+ Interaction := 0;
+
+ //Show Wrong Song when Tabs on Fix
+ SelectNext;
+ FixSelected;
+
+ ChangeMusic;
+ end
+ else
+ begin
+ Music.Stop;
+ Music.PlayBack;
+
+ FadeTo(@ScreenMain);
+ end;
+
+ end;
+ end
+ //When in party Mode then Ask before Close
+ else if (Mode = 1) then
+ begin
+ Music.PlayBack;
+ CheckFadeTo(@ScreenMain,'MSG_END_PARTY');
+ end;
+ end;
+ SDLK_RETURN:
+ begin
+ if Length(Songs.Song) > 0 then
+ begin
+ {$IFDEF UseSerialPort}
+ // PortWriteB($378, 0);
+ {$ENDIF}
+ if CatSongs.Song[Interaction].Main then
+ begin // clicked on Category Button
+
+ //Show Cat in Top Left Mod
+ ShowCatTL (Interaction);
+
+ //I := CatSongs.VisibleIndex(Interaction);
+ CatSongs.ClickCategoryButton(Interaction);
+ {I2 := CatSongs.VisibleIndex(Interaction);
+ SongCurrent := SongCurrent - I + I2;
+ SongTarget := SongTarget - I + I2; }
+
+// if I<>I2 then beep;
+ // SetScroll4;
+
+ //Show Wrong Song when Tabs on Fix
+ SelectNext;
+ FixSelected;
+
+ //Play Music:
+ ChangeMusic;
+
+ end else begin // clicked on song
+ if (Mode = 0) then //Normal Mode -> Start Song
+ begin
+ //Do the Action that is specified in Ini
+ case Ini.OnSongClick of
+ 0: StartSong;
+ 1: SelectPlayers;
+ 2:begin
+ If (CatSongs.CatNumShow = -3) then
+ ScreenSongMenu.MenuShow(SM_Playlist)
+ else
+ ScreenSongMenu.MenuShow(SM_Main);
+ end;
+ end;
+ end
+ else if (Mode = 1) then //PartyMode -> Show Menu
+ begin
+ if (Ini.PartyPopup = 1) then
+ ScreenSongMenu.MenuShow(SM_Party_Main)
+ else
+ ScreenSong.StartSong;
+ end;
+ end;
+ end;
+ end;
+
+ SDLK_M: //Show SongMenu
+ begin
+ if (Length(Songs.Song) > 0) then begin
+ if (Mode = 0) then begin
+ if not CatSongs.Song[Interaction].Main then begin // clicked on Song
+ if CatSongs.CatNumShow = -3 then
+ ScreenSongMenu.MenuShow(SM_Playlist)
+ else
+ ScreenSongMenu.MenuShow(SM_Main);
+ end
+ else
+ begin
+ ScreenSongMenu.MenuShow(SM_Playlist_Load);
+ end;
+ end //Party Mode -> Show Party Menu
+ else ScreenSongMenu.MenuShow(SM_Party_Main);
+ end;
+ end;
+
+ SDLK_P: //Show Playlist Menu
+ begin
+ if (Length(Songs.Song) > 0) AND (Mode = 0) then begin
+ ScreenSongMenu.MenuShow(SM_Playlist_Load);
+ end;
+ end;
+
+ SDLK_J: //Show Jumpto Menu
+ begin
+ if (Length(Songs.Song) > 0) AND (Mode = 0) then
+ begin
+ ScreenSongJumpto.Visible := True;
+ end;
+ end;
+
+ SDLK_DOWN:
+ begin
+ if (Mode = 0) then
+ begin
+ //Only Change Cat when not in Playlist or Search Mode
+ if (CatSongs.CatNumShow > -2) then
+ begin
+ //Cat Change Hack
+ if Ini.Tabs_at_startup = 1 then
+ begin
+ I := Interaction;
+ if I <= 0 then I := 1;
+
+ while not catsongs.Song[I].Main do
+ begin
+ Inc (I);
+ if (I > high(catsongs.Song)) then
+ I := low(catsongs.Song);
+ end;
+
+ Interaction := I;
+
+ //Show Cat in Top Left Mod
+ ShowCatTL (Interaction);
+
+ CatSongs.ClickCategoryButton(Interaction);
+ SelectNext;
+ FixSelected;
+
+ //Play Music:
+ Music.PlayChange;
+ ChangeMusic;
+
+ end;
+
+ //
+ //Cat Change Hack End}
+ end;
+ end;
+ end;
+ SDLK_UP:
+ begin
+ if (Mode = 0) then
+ begin
+ //Only Change Cat when not in Playlist or Search Mode
+ if (CatSongs.CatNumShow > -2) then
+ begin
+ //Cat Change Hack
+ if Ini.Tabs_at_startup = 1 then
+ begin
+ I := Interaction;
+ I2 := 0;
+ if I <= 0 then I := 1;
+
+ while not catsongs.Song[I].Main or (I2 = 0) do
+ begin
+ if catsongs.Song[I].Main then
+ Inc(I2);
+ Dec (I);
+ if (I < low(catsongs.Song)) then
+ I := high(catsongs.Song);
+ end;
+
+ Interaction := I;
+
+ //Show Cat in Top Left Mod
+ ShowCatTL (I);
+
+ CatSongs.ClickCategoryButton(I);
+ SelectNext;
+ FixSelected;
+
+ //Play Music:
+ Music.PlayChange;
+ ChangeMusic;
+ end;
+ end;
+ //Cat Change Hack End}
+ end;
+ end;
+
+ SDLK_RIGHT:
+ begin
+ if (Length(Songs.Song) > 0) AND (Mode = 0) then begin
+ Music.PlayChange;
+ SelectNext;
+// InteractNext;
+// SongTarget := Interaction;
+ ChangeMusic;
+ SetScroll4;
+ UpdateLCD;
+ Light.LightOne(1, 200);
+ end;
+ end;
+
+ SDLK_LEFT:
+ begin
+ if (Length(Songs.Song) > 0)AND (Mode = 0) then begin
+ Music.PlayChange;
+ SelectPrev;
+ ChangeMusic;
+ SetScroll4;
+ UpdateLCD;
+ Light.LightOne(0, 200);
+ end;
+ end;
+
+ SDLK_E:
+ begin
+ OpenEditor;
+ end;
+
+ SDLK_R:
+ begin
+ if (Length(Songs.Song) > 0) AND (Mode = 0) then begin
+
+ if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category
+ begin
+ I2 := 0; //Count Cats
+ for I:= low(CatSongs.Song) to high (CatSongs.Song) do
+ if CatSongs.Song[I].Main then Inc(I2);
+
+ I2 := Random (I2)+1; //Zufall
+
+ //Find Cat:
+ for I:= low(CatSongs.Song) to high (CatSongs.Song) do
+ begin
+ if CatSongs.Song[I].Main then
+ Dec(I2);
+ if (I2<=0) then
+ begin
+ //Show Cat in Top Left Mod
+ ShowCatTL (I);
+
+ Interaction := I;
+
+ CatSongs.ShowCategoryList;
+ CatSongs.ClickCategoryButton(I);
+ SelectNext;
+ FixSelected;
+ break;
+ end;
+ end;
+
+
+ end
+ else if (SDL_ModState = KMOD_LCTRL) AND (Ini.Tabs_at_startup = 1) then //random in All Categorys
+ begin
+ repeat
+ I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1;
+ until CatSongs.Song[I2].Main = false;
+
+ //Search Cat
+ for I := I2 downto low(CatSongs.Song) do
+ begin
+ if CatSongs.Song[I].Main then
+ break;
+ end;
+ //In I ist jetzt die Kategorie in I2 der Song
+
+ //Choose Cat
+ CatSongs.ShowCategoryList;
+
+ //Show Cat in Top Left Mod
+ ShowCatTL (I);
+
+ CatSongs.ClickCategoryButton(I);
+ SelectNext;
+
+ //Fix: Not Existing Song selected:
+ //if (I+1=I2) then Inc(I2);
+
+ //Choose Song
+ SkipTo(I2-I);
+
+ end
+ else //Random in one Category
+ begin
+ SkipTo(Random(CatSongs.VisibleSongs));
+ end;
+ Music.PlayChange;
+
+ ChangeMusic;
+ SetScroll4;
+ UpdateLCD;
+ end;
+ end;
+
+ SDLK_1:
+ begin //Jocker
+ if (Mode = 1) AND (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0) then
+ begin
+ //Joker spielen
+ Dec(PartySession.Teams.Teaminfo[0].Joker);
+ SelectRandomSong;
+ SetJoker;
+ end;
+ end;
+
+ SDLK_2:
+ begin //Jocker
+ if (Mode = 1) AND (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0) then
+ begin
+ //Joker spielen
+ Dec(PartySession.Teams.Teaminfo[1].Joker);
+ SelectRandomSong;
+ SetJoker;
+ end;
+ end;
+
+ SDLK_3:
+ begin //Jocker
+ if (Mode = 1) AND (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0) then
+ begin
+ //Joker spielen
+ Dec(PartySession.Teams.Teaminfo[2].Joker);
+ SelectRandomSong;
+ SetJoker;
+ end;
+ end;
+ end;
+ end;
+end;
+
+constructor TScreenSong.Create;
+var
+ Pet: integer;
+ I: integer;
+Label CreateSongButtons;
+begin
+ inherited Create;
+
+ LoadFromTheme(Theme.Song);
+
+ TextArtist := AddText(Theme.Song.TextArtist);
+ TextTitle := AddText(Theme.Song.TextTitle);
+ TextNumber := AddText(Theme.Song.TextNumber);
+
+ //Show Cat in Top Left mod
+ TextCat := AddText(Theme.Song.TextCat);
+ StaticCat := AddStatic(Theme.Song.StaticCat);
+
+ //Show Video Icon Mod
+ VideoIcon := AddStatic(Theme.Song.VideoIcon);
+
+ //Party Mode
+ StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1);
+ StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2);
+ StaticTeam1Joker3 := AddStatic(Theme.Song.StaticTeam1Joker3);
+ StaticTeam1Joker4 := AddStatic(Theme.Song.StaticTeam1Joker4);
+ StaticTeam1Joker5 := AddStatic(Theme.Song.StaticTeam1Joker5);
+
+ StaticTeam2Joker1 := AddStatic(Theme.Song.StaticTeam2Joker1);
+ StaticTeam2Joker2 := AddStatic(Theme.Song.StaticTeam2Joker2);
+ StaticTeam2Joker3 := AddStatic(Theme.Song.StaticTeam2Joker3);
+ StaticTeam2Joker4 := AddStatic(Theme.Song.StaticTeam2Joker4);
+ StaticTeam2Joker5 := AddStatic(Theme.Song.StaticTeam2Joker5);
+
+ StaticTeam3Joker1 := AddStatic(Theme.Song.StaticTeam3Joker1);
+ StaticTeam3Joker2 := AddStatic(Theme.Song.StaticTeam3Joker2);
+ StaticTeam3Joker3 := AddStatic(Theme.Song.StaticTeam3Joker3);
+ StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4);
+ StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5);
+
+ //Load Party or NonParty specific Statics and Texts
+ SetLength(StaticParty, Length(Theme.Song.StaticParty));
+ for I := 0 to High(Theme.Song.StaticParty) do
+ StaticParty[I] := AddStatic(Theme.Song.StaticParty[I]);
+
+ SetLength(TextParty, Length(Theme.Song.TextParty));
+ for I := 0 to High(Theme.Song.TextParty) do
+ TextParty[I] := AddText(Theme.Song.TextParty[I]);
+
+ SetLength(StaticNonParty, Length(Theme.Song.StaticNonParty));
+ for I := 0 to High(Theme.Song.StaticNonParty) do
+ StaticNonParty[I] := AddStatic(Theme.Song.StaticNonParty[I]);
+
+ SetLength(TextNonParty, Length(Theme.Song.TextNonParty));
+ for I := 0 to High(Theme.Song.TextNonParty) do
+ TextNonParty[I] := AddText(Theme.Song.TextNonParty[I]);
+
+ // Song List
+// Songs.LoadSongList; // moved to the UltraStar unit
+ CatSongs.Refresh;
+
+ if (length(CatSongs.Song) > 0) then
+ begin
+ //Set Length of Button Array one Time Instead of one time for every Song
+ SetButtonLength(Length(CatSongs.Song));
+
+ I := 0;
+ CreateSongButtons:
+
+ try
+ for Pet := I to High(CatSongs.Song) do begin // creating all buttons
+ // new
+ Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0
+
+ if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then
+ CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover'
+
+ if CatSongs.Song[Pet].Cover = '' then
+ AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections)
+ else begin
+ // cache texture if there is a need to this
+ if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then begin
+ Texture.CreateCacheMipmap := true;
+ Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap
+ Texture.CreateCacheMipmap := false;
+
+ // puts this texture to the cache file
+ Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover);
+
+ // unload full size texture
+ Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false);
+
+ // we should also add mipmap texture by calling createtexture and use mipmap cache as data source
+ end;
+
+ // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here)
+ AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections);
+ end;
+ Texture.Limit := 1024*1024;
+ I := -1;
+ end;
+ except
+ //When Error is reported the First time for this Song
+ if (I <> Pet) then
+ begin
+ //Some Error reporting:
+ Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover);
+
+ //Change Cover to NoCover and Continue Loading
+ CatSongs.Song[Pet].Cover := '';
+ I := Pet;
+ end
+ else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song
+ begin
+ Log.LogError('NoCover Cover is damaged!');
+ try
+ AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections);
+ except
+ {$IFDEF win32}
+ Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK);
+ {$ELSE}
+ // TODO : JB_linux - better handle this message and display to user..
+ writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.');
+ Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' );
+ {$ENDIF}
+ Halt;
+ end;
+ I := Pet + 1;
+ end;
+ end;
+
+ if (I <> -1) then
+ GoTo CreateSongButtons;
+
+ end;
+
+ // Randomize Patch
+ Randomize;
+ //Equalizer
+ SetLength(EqualizerBands, Theme.Song.Equalizer.Bands);
+ //ClearArray
+ For I := low(EqualizerBands) to high(EqualizerBands) do
+ EqualizerBands[I] := 3;
+
+ if (Length(CatSongs.Song) > 0) then
+ Interaction := 0;
+end;
+
+procedure TScreenSong.SetScroll;
+var
+ VS, B: Integer;
+begin
+ VS := CatSongs.VisibleSongs;
+ if VS > 0 then
+ begin
+ //Set Positions
+ Case Theme.Song.Cover.Style of
+ 3: SetScroll3;
+ 5:begin
+ if VS > 5 then
+ SetScroll5
+ else
+ SetScroll4;
+ end;
+ 6: SetScroll6;
+ else SetScroll4;
+ end;
+ //Set Visibility of Video Icon
+ Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> '');
+
+ //Set Texts:
+ Text[TextArtist].Text := CatSongs.Song[Interaction].Artist;
+ Text[TextTitle].Text := CatSongs.Song[Interaction].Title;
+ if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then
+ begin
+ Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount);
+ Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')';
+ end
+ else if (CatSongs.CatNumShow = -2) then
+ Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS)
+ else if (CatSongs.CatNumShow = -3) then
+ Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS)
+ else if (Ini.Tabs_at_startup = 1) then
+ Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber)
+ else
+ Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song));
+ end
+ else
+ begin
+ Text[TextNumber].Text := '0/0';
+ Text[TextArtist].Text := '';
+ Text[TextTitle].Text := '';
+ for B := 0 to High(Button) do
+ Button[B].Visible := False;
+
+ end;
+end;
+
+procedure TScreenSong.SetScroll1;
+var
+ B: integer; // button
+ BMin: integer; // button min
+ BMax: integer; // button max
+ Src: integer;
+// Dst: integer;
+ Count: integer; // Dst is not used. Count is used.
+ Ready: boolean;
+
+ VisCount: integer; // count of visible (or selectable) buttons
+ VisInt: integer; // visible position of interacted button
+ Typ: integer; // 0 when all songs fits the screen
+ Placed: integer; // number of placed visible buttons
+begin
+// Src := 0;
+// Dst := -1;
+ Count := 1;
+ Typ := 0;
+ Ready := false;
+ Placed := 0;
+
+ VisCount := 0;
+ for B := 0 to High(Button) do
+ if CatSongs.Song[B].Visible then Inc(VisCount);
+
+ VisInt := 0;
+ for B := 0 to Interaction-1 do
+ if CatSongs.Song[B].Visible then Inc(VisInt);
+
+
+ if VisCount <= 6 then begin
+ Typ := 0;
+ end else begin
+ if VisInt <= 3 then begin
+ Typ := 1;
+ Count := 7;
+ Ready := true;
+ end;
+
+ if (VisCount - VisInt) <= 3 then begin
+ Typ := 2;
+ Count := 7;
+ Ready := true;
+ end;
+
+ if not Ready then begin
+ Typ := 3;
+ Src := Interaction;
+ end;
+ end;
+
+
+
+ // hide all buttons
+ for B := 0 to High(Button) do begin
+ Button[B].Visible := false;
+ Button[B].Selectable := CatSongs.Song[B].Visible;
+ end;
+
+{ for B := Src to Dst do begin
+// Button[B].Visible := true;
+ Button[B].Visible := CatSongs.Song[B].Visible;
+ Button[B].Selectable := Button[B].Visible;
+ Button[B].Y := 140 + (B-Src) * 60;
+ end;}
+
+
+ if Typ = 0 then begin
+ for B := 0 to High(Button) do begin
+ if CatSongs.Song[B].Visible then begin
+ Button[B].Visible := true;
+ Button[B].Y := 140 + (Placed) * 60;
+ Inc(Placed);
+ end;
+ end;
+ end;
+
+ if Typ = 1 then begin
+ B := 0;
+ while (Count > 0) do begin
+ if CatSongs.Song[B].Visible then begin
+ Button[B].Visible := true;
+ Button[B].Y := 140 + (Placed) * 60;
+ Inc(Placed);
+ Dec(Count);
+ end;
+ Inc(B);
+ end;
+ end;
+
+ if Typ = 2 then begin
+ B := High(Button);
+ while (Count > 0) do begin
+ if CatSongs.Song[B].Visible then begin
+ Button[B].Visible := true;
+ Button[B].Y := 140 + (6-Placed) * 60;
+ Inc(Placed);
+ Dec(Count);
+ end;
+ Dec(B);
+ end;
+ end;
+
+ if Typ = 3 then begin
+ B := Src;
+ Count := 4;
+ while (Count > 0) do begin
+ if CatSongs.Song[B].Visible then begin
+ Button[B].Visible := true;
+ Button[B].Y := 140 + (3+Placed) * 60;
+ Inc(Placed);
+ Dec(Count);
+ end;
+ Inc(B);
+ end;
+
+ B := Src-1;
+ Placed := 0;
+ Count := 3;
+ while (Count > 0) do begin
+ if CatSongs.Song[B].Visible then begin
+ Button[B].Visible := true;
+ Button[B].Y := 140 + (2-Placed) * 60;
+ Inc(Placed);
+ Dec(Count);
+ end;
+ Dec(B);
+ end;
+
+ end;
+
+ if Length(Button) > 0 then
+ Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture
+end;
+
+procedure TScreenSong.SetScroll2;
+var
+ B: integer;
+ Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu
+ Wsp2: real;
+begin
+ // liniowe
+ for B := 0 to High(Button) do
+ Button[B].X := 300 + (B - Interaction) * 260;
+
+ if Length(Button) >= 3 then begin
+ if Interaction = 0 then
+ Button[High(Button)].X := 300 - 260;
+
+ if Interaction = High(Button) then
+ Button[0].X := 300 + 260;
+ end;
+
+ // kolowe
+{ for B := 0 to High(Button) do begin
+ Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd.
+ Wsp2 := Wsp / Length(Button);
+ Button[B].X := 300 + 10000 * sin(2*pi*Wsp2);
+// Button[B].Y := 140 + 50 * ;
+ end;}
+end;
+
+procedure TScreenSong.SetScroll3; // with slide
+var
+ B: integer;
+ Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu
+ Wsp2: real;
+begin
+ SongTarget := Interaction;
+
+ // liniowe
+ for B := 0 to High(Button) do
+ begin
+ Button[B].X := 300 + (B - SongCurrent) * 260;
+ if (Button[B].X < -Button[B].W) OR (Button[B].X > 800) then
+ Button[B].Visible := False
+ else
+ Button[B].Visible := True;
+ end;
+
+{ if Length(Button) >= 3 then begin
+ if Interaction = 0 then
+ Button[High(Button)].X := 300 - 260;
+
+ if Interaction = High(Button) then
+ Button[0].X := 300 + 260;
+ end;}
+
+ // kolowe
+{ for B := 0 to High(Button) do begin
+ Wsp := (B - Interaction); // 0 dla srodka, -1 dla lewego, +1 dla prawego itd.
+ Wsp2 := Wsp / Length(Button);
+ Button[B].X := 300 + 10000 * sin(2*pi*Wsp2);
+// Button[B].Y := 140 + 50 * ;
+ end;}
+end;
+
+procedure TScreenSong.SetScroll4; // rotate
+var
+ B: integer;
+ Wsp: real;
+ Z, Z2: real;
+ VS: integer;
+begin
+ VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important
+
+ // kolowe
+ for B := 0 to High(Button) do begin
+ Button[B].Visible := CatSongs.Song[B].Visible; // nowe
+ if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed
+
+ Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms
+
+ Z := (1 + cos(Wsp)) / 2;
+ Z2 := (1 + 2*Z) / 3;
+
+
+ Button[B].X := Theme.Song.Cover.X + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs
+ Button[B].Z := Z / 2 + 0.3;
+
+ Button[B].W := Theme.Song.Cover.H * Z2;
+
+// Button[B].Y := {50 +} 140 + 50 - 50 * Z2;
+ Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ;
+ Button[B].H := Button[B].W;
+ end;
+ end;
+end;
+
+(*
+procedure TScreenSong.SetScroll4; // rotate
+var
+ B: integer;
+ Wsp: real;
+ Z: real;
+ Z2, Z3: real;
+ VS: integer;
+ function modreal (const X, Y: real):real;
+ begin
+ Result := Frac(x / y) * y;
+ if Result < -3 then
+ Result := Result + Y
+ else if Result > 3 then
+ Result := Result - Y;
+ end;
+begin
+ VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important
+ Z3 := 1;
+ if VS < 12 then
+ Z2 := VS
+ else
+ Z2 := 12;
+
+ // kolowe
+ for B := 0 to High(Button) do begin
+ Button[B].Visible := CatSongs.Song[B].Visible; // nowe
+ if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed
+ if ((ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)>-3) AND (ModReal(CatSongs.VisibleIndex(B) - SongCurrent, VS)<3)) then
+ begin
+ if CatSongs.VisibleIndex(B)> SongCurrent then
+ Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2
+ else
+ Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / Z2;
+
+ Z3 := 2;
+ Z := (1 + cos(Wsp)) / 2;
+ //Z2 := (1 + 2*Z) / 3;
+ //Z2 := (0.5 + Z/2);
+ //Z2 := sin(Wsp);
+
+ //Z2 := Power (Z2,Z3);
+
+ Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3);
+
+ //Button[B].X := Theme.Song.CoverX + ({Theme.Song.CoverX + Theme.Song.CoverW/2 + Theme.Song.CoverW*0.18 * VS {CatSongs.VisibleSongs {Length(Button) * sin(Wsp) {- Theme.Song.CoverX - Theme.Song.CoverW) * Z2; // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs
+ if (sin(Wsp)<0) then
+ Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W
+ else //*Theme.Song.CoverW*0.004*Z3
+ Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX;
+ Button[B].Z := Z-0.00001;
+
+// Button[B].Y := {50 + 140 + 50 - 50 * Z2;
+ // Button[B].Y := (Theme.Song.CoverY + 40 + 50 - 50 * Z2);
+ Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W);
+ Button[B].H := Button[B].W;
+ Button[B].Visible := True;
+ end
+ {else if (((CatSongs.VisibleIndex(B) - SongCurrent)>-3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) OR ((round (CatSongs.VisibleIndex(B) - SongCurrent) mod VS > -3) AND ((CatSongs.VisibleIndex(B) - SongCurrent)<3)) then
+ begin
+ Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / 12 ;// 0.5.0 (II): takes another 16ms
+
+ Z := (1 + cos(Wsp)) / 2 -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers
+
+ Button[B].W := Theme.Song.CoverW * Power(cos(Wsp), Z3);//Power(Z2, 3);
+
+ if (sin(Wsp)<0) then
+ Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX + Theme.Song.CoverW - Button[B].W
+ else
+ Button[B].X := sin(Wsp)*Theme.Song.CoverX*Theme.Song.CoverW*0.007 + Theme.Song.CoverX;
+
+ Button[B].Z := Z;
+
+ Button[B].Y := (Theme.Song.CoverY + Theme.Song.CoverW - Button[B].W);
+
+ Button[B].H := Button[B].W;
+ Button[B].Visible := True;
+ end
+ else Button[B].Visible := False;
+ end;
+ end;
+end; *)
+
+procedure TScreenSong.SetScroll5; // rotate
+var
+ B: integer;
+ Angle: real;
+ Pos: Real;
+ VS: integer;
+ diff: real;
+ X: Real;
+ helper: real;
+begin
+ VS := CatSongs.VisibleSongs; // cache Visible Songs
+ {Vars
+ Theme.Song.CoverW: Radius des Kreises
+ Theme.Song.CoverX: X Pos Linke Kante des gewählten Covers
+ Theme.Song.CoverX: Y Pos Obere Kante des gewählten Covers
+ Theme.Song.CoverH: Höhe der Cover
+
+ (CatSongs.VisibleIndex(B) - SongCurrent)/VS = Abstand zum MIttleren Cover in %
+ }
+
+ //Change Pos of all Buttons
+ for B := low(Button) to high(Button) do
+ begin
+ Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility
+ if Button[B].Visible then //Only Change Pos for Visible Buttons
+ begin
+ Pos := (CatSongs.VisibleIndex(B) - SongCurrent);
+ if (Pos < -VS/2) then
+ Pos := Pos + VS
+ else if (Pos > VS/2) then
+ Pos := Pos - VS;
+
+ if (Abs(Pos) < 2.5) then {fixed Positions}
+ begin
+ Angle := Pi * (Pos / 5);
+// Button[B].Visible := False;
+
+ Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3);
+
+// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H;
+ Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H;
+
+ Button[B].Z := 0.95 - Abs(Pos) * 0.01;
+
+ Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5);
+
+ Button[B].W := Button[B].H;
+
+ Diff := (Button[B].H - Theme.Song.Cover.H)/2;
+
+
+ X := Sin(Angle*1.3)*0.9;
+
+ Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Diff;
+
+ end
+ else
+ begin {Behind the Front Covers}
+
+ // limit-bg-covers hack
+ if (abs(abs(Pos)-VS/2)>10) then Button[B].Visible:=False;
+ // end of limit-bg-covers hack
+
+ if Pos < 0 then
+ Pos := (Pos - VS/2)/VS
+ else
+ Pos := (Pos + VS/2)/VS;
+
+ Angle := pi * Pos*2;
+ if VS > 24 then
+ begin
+ if Angle < 0 then helper:=-1 else helper:=1;
+ Angle:=2*pi-abs(Angle);
+ Angle:=Angle*(VS/24);
+ Angle:=(2*pi-Angle)*helper;
+ end;
+
+ Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers
+
+ Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3);
+
+ Button[B].W := Button[B].H;
+
+ Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75;
+
+// Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H;
+ Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H;
+
+ Diff := (Button[B].H - Theme.Song.Cover.H)/2;
+
+ Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*((Theme.Song.Cover.H)*sin(Angle/2)*1.52);
+
+ end;
+
+ //Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H)/1.5); //Cover at down border of the change field
+// Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7);
+
+ end;
+ end;
+end;
+
+procedure TScreenSong.SetScroll6; // rotate (slotmachine style)
+var
+ B: integer;
+ Angle: real;
+ Pos: Real;
+ VS: integer;
+ diff: real;
+ X: Real;
+ Wsp: real;
+ Z, Z2: real;
+begin
+ VS := CatSongs.VisibleSongs; // cache Visible Songs
+ if VS <=5 then begin
+ // kolowe
+ for B := 0 to High(Button) do
+ begin
+ Button[B].Visible := CatSongs.Song[B].Visible; // nowe
+ if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed
+
+ Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms
+
+ Z := (1 + cos(Wsp)) / 2;
+ Z2 := (1 + 2*Z) / 3;
+
+
+ Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Wsp)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs
+ Button[B].Z := Z / 2 + 0.3;
+
+ Button[B].W := Theme.Song.Cover.H * Z2;
+
+// Button[B].Y := {50 +} 140 + 50 - 50 * Z2;
+ Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ;
+ Button[B].H := Button[B].W;
+ end;
+ end;
+ end
+ else begin
+
+ //Change Pos of all Buttons
+ for B := low(Button) to high(Button) do
+ begin
+ Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility
+ if Button[B].Visible then //Only Change Pos for Visible Buttons
+ begin
+ Pos := (CatSongs.VisibleIndex(B) - SongCurrent);
+ if (Pos < -VS/2) then
+ Pos := Pos + VS
+ else if (Pos > VS/2) then
+ Pos := Pos - VS;
+
+ if (Abs(Pos) < 2.5) then {fixed Positions}
+ begin
+ Angle := Pi * (Pos / 5);
+// Button[B].Visible := False;
+
+ Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3);
+
+ Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H;
+
+ Button[B].Z := 0.95 - Abs(Pos) * 0.01;
+
+ Button[B].X := (Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5);
+
+ Button[B].W := Button[B].H;
+
+ Diff := (Button[B].H - Theme.Song.Cover.H)/2;
+
+
+ X := Sin(Angle*1.3)*0.9;
+
+ Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff;
+ end
+ else
+ begin {Behind the Front Covers}
+
+ // limit-bg-covers hack
+ if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False;
+ if VS > 25 then VS:=25;
+ // end of limit-bg-covers hack
+
+ if Pos < 0 then
+ Pos := (Pos - VS/2)/VS
+ else
+ Pos := (Pos + VS/2)/VS;
+
+ Angle := pi * Pos*2;
+
+ Button[B].Z := (0.4 - Abs(Pos/4)) -0.00001; //z < 0.49999 is behind the cover 1 is in front of the covers
+
+ Button[B].H :=0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8));//Power(Z2, 3);
+
+ Button[B].W := Button[B].H;
+
+ Button[B].X := Theme.Song.Cover.X - (Button[B].H - Theme.Song.Cover.H)*0.5;
+
+
+ Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H;
+
+ Button[B].Y := Theme.Song.Cover.Y+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*(Theme.Song.Cover.H*sin(Angle/2)*1.52);
+ end;
+ end;
+ end;
+ end;
+end;
+
+
+procedure TScreenSong.onShow;
+begin
+ Music.Stop;
+
+ if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1;
+ if Ini.Players = 4 then PlayersPlay := 6;
+
+ //Cat Mod etc
+ if (Ini.Tabs_at_startup = 1) AND (CatSongs.CatNumShow = -1) then
+ begin
+ CatSongs.ShowCategoryList;
+ FixSelected;
+ //Show Cat in Top Left Mod
+ HideCatTL;
+ end;
+
+
+ if Length(CatSongs.Song) > 0 then begin
+ //Load Music only when Song Preview is activated
+ if (Ini.PreviewVolume <> 0) then
+ begin
+ Music.SetLoop(false);
+ Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3);
+ Music.MoveTo(Music.Length / 4);
+ Music.Play;
+
+ //Set Preview Volume
+ Music.SetMusicVolume (Ini.PreviewVolume * 10);
+ {//if Music Fade is activated, Set Volume to 0 %
+ if (Ini.PreviewFading <> 0) then
+ Music.SetMusicVolume(0);}
+ end;
+
+ SetScroll;
+ UpdateLCD;
+ end;
+
+ //Playlist Mode
+ if (Mode = 0) then
+ begin
+ //If Playlist Shown -> Select Next automatically
+ if (CatSongs.CatNumShow = -3) then
+ begin
+ SelectNext;
+ ChangeMusic;
+ end;
+ end
+ //Party Mode
+ else if (Mode = 1) then
+ begin
+
+ SelectRandomSong;
+ //Show Menu directly in PartyMode
+ //But only if selected in Options
+ if (Ini.PartyPopup = 1) then
+ begin
+ ScreenSongMenu.MenuShow(SM_Party_Main);
+ end;
+
+
+ end;
+
+ SetJoker;
+ SetStatics;
+end;
+
+procedure TScreenSong.onHide;
+begin
+ //When Music Fading is activated, Turn Music to 100 %
+ If (Ini.PreviewVolume <> 100) or (Ini.PreviewFading <> 0) then
+ Music.SetMusicVolume(100);
+
+ //If Preview is deactivated: Load MUsicfile now
+ If (Ini.PreviewVolume = 0) then
+ Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3);
+
+ //When hide then Stop Music (For Party Mode Popup on Exit)
+ if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (Music <> nil) then
+ Music.Stop;
+end;
+
+procedure TScreenSong.DrawExtensions;
+begin
+ //Draw Song Menu
+ if (ScreenSongMenu.Visible) then
+ begin
+ ScreenSongMenu.Draw;
+ end
+ else if (ScreenSongJumpto.Visible) then
+ begin
+ ScreenSongJumpto.Draw;
+ end
+end;
+
+function TScreenSong.Draw: boolean;
+var
+ dx: real;
+ dt: real;
+ I: Integer;
+begin
+ dx := SongTarget-SongCurrent;
+ dt := TimeSkip*7;
+ if dt > 1 then dt := 1;
+ SongCurrent := SongCurrent + dx*dt;
+
+{ if SongCurrent > Catsongs.VisibleSongs then begin
+ SongCurrent := SongCurrent - Catsongs.VisibleSongs;
+ SongTarget := SongTarget - Catsongs.VisibleSongs;
+ end;}
+
+// Log.BenchmarkStart(5);
+ SetScroll;
+// Log.BenchmarkEnd(5);
+// Log.LogBenchmark('SetScroll4', 5);
+
+ //Fading Functions, Only if Covertime is under 5 Seconds
+ If (CoverTime < 5) then
+ begin
+ // 0.5.0: cover fade
+ if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin
+ // load new texture
+ Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false);
+ Button[Interaction].Texture.Alpha := 1;
+ Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false);
+ Button[Interaction].Texture2.Alpha := 1;
+ end;
+
+ //Song Fade
+ if (CatSongs.VisibleSongs > 0) AND (Ini.PreviewVolume <> 0) AND (Not CatSongs.Song[Interaction].Main) AND (Ini.PreviewFading <> 0) then
+ begin
+ //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling
+ if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then
+ Music.Play;
+
+ //Update Song Volume
+ if (CoverTime < Ini.PreviewFading) then
+ Music.SetMusicVolume(Round (CoverTime * Ini.PreviewVolume / Ini.PreviewFading * 10))
+ else
+ Music.SetMusicVolume(Ini.PreviewVolume * 10);
+
+ end;
+
+
+ //Update Fading Time
+ CoverTime := CoverTime + TimeSkip;
+
+ //Update Fading Texture
+ Button[Interaction].Texture2.Alpha := (CoverTime - 1) * 1.5;
+ if Button[Interaction].Texture2.Alpha > 1 then Button[Interaction].Texture2.Alpha := 1;
+
+ end;
+
+ //inherited Draw;
+ //heres a little Hack, that causes the Statics
+ //are Drawn after the Buttons because of some Blending Problems.
+ //This should cause no Problems because all Buttons on this screen
+ //Has Z Position.
+ //Draw BG
+ DrawBG;
+
+ //Instead of Draw FG Procedure:
+ //We draw Buttons for our own
+ for I := 0 to Length(Button) - 1 do
+ Button[I].Draw;
+
+ // Statics
+ for I := 0 to Length(Static) - 1 do
+ Static[I].Draw;
+
+ // and texts
+ for I := 0 to Length(Text) - 1 do
+ Text[I].Draw;
+
+
+ //Draw Equalizer
+ if Theme.Song.Equalizer.Visible then
+ DrawEqualizer;
+
+ DrawExtensions;
+
+end;
+
+procedure TScreenSong.SelectNext;
+var
+ Skip: integer;
+ I: integer;
+ VS: Integer;
+begin
+ VS := CatSongs.VisibleSongs;
+
+ if VS > 0 then
+ begin
+ UnLoadDetailedCover;
+
+ Skip := 1;
+
+ // this 1 could be changed by CatSongs.FindNextVisible
+ while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip);
+
+ SongTarget := SongTarget + 1;//Skip;
+
+ Interaction := (Interaction + Skip) mod Length(Interactions);
+
+ // try to keep all at the beginning
+ if SongTarget > VS-1 then begin
+ SongTarget := SongTarget - VS;
+ SongCurrent := SongCurrent - VS;
+ end;
+
+ end;
+ // Interaction -> Button, ktorego okladke przeczytamy
+ // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture
+end;
+
+procedure TScreenSong.SelectPrev;
+var
+ Skip: integer;
+ I: integer;
+ VS: Integer;
+begin
+ VS := CatSongs.VisibleSongs;
+
+ if VS > 0 then
+ begin
+ UnLoadDetailedCover;
+
+ Skip := 1;
+
+ while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip);
+ SongTarget := SongTarget - 1;//Skip;
+
+ Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions);
+
+ // try to keep all at the beginning
+ if SongTarget < 0 then begin
+ SongTarget := SongTarget + CatSongs.VisibleSongs;
+ SongCurrent := SongCurrent + CatSongs.VisibleSongs;
+ end;
+
+ // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture
+ end;
+end;
+
+procedure TScreenSong.UpdateLCD;
+begin
+ LCD.HideCursor;
+ LCD.Clear;
+ LCD.WriteText(1, Text[TextArtist].Text);
+ LCD.WriteText(2, Text[TextTitle].Text);
+end;
+
+//Procedure Change current played Preview
+procedure TScreenSong.ChangeMusic;
+begin
+ //When Music Preview is avtivated -> then Change Music
+ if (Ini.PreviewVolume <> 0) then
+ begin
+ if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then
+ begin
+ Music.Close;
+ if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin
+ Music.MoveTo(Music.Length / 4);
+ //If Song Fading is activated then don't Play directly, and Set Volume to Null, else Play normal
+ if (Ini.PreviewFading = 0) then
+ Music.Play
+ else
+ Music.SetMusicVolume(0);
+ end;
+ end
+ else
+ Music.Stop;
+ end;
+end;
+
+procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0
+var
+ Skip: integer;
+ I: integer;
+begin
+ UnLoadDetailedCover;
+
+ Interaction := High(CatSongs.Song);
+ SongTarget := 0;
+
+ for I := 1 to Target+1 do
+ SelectNext;
+
+ FixSelected2;
+end;
+
+procedure TScreenSong.DrawEqualizer;
+var
+ Data: TFFTData; //Audio Data
+ I, J: Integer;
+ Res: byte;
+ A, B: Integer;
+ PosX, PosY: Integer;
+ Pos: Real;
+begin
+if (not Music.Finished) AND (Theme.Song.Equalizer.Length > 0) then
+begin
+
+
+ A := GetTickCount div 44;
+
+ if (A <> EqualizerTime) then
+ begin
+ EqualizerTime := A;
+ Data := Music.GetFFTData;
+
+ B:=0;
+ Pos := 0;
+ Res := ceil(92/Theme.Song.Equalizer.Bands);//How much channels are used for one Band
+
+ //Change Lengths
+ for I := 0 to (Res * Theme.Song.Equalizer.Bands - 1) do
+ begin
+ A := floor(I/Res);
+
+ if (A<>B) then //Band changed
+ begin
+ if (Pos <= Theme.Song.Equalizer.Length) then
+ begin
+ if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then
+ EqualizerBands[B] := EqualizerBands[B] - 1
+ else
+ EqualizerBands[B] := floor(Pos);
+ end
+ else
+ EqualizerBands[B] := 1;
+
+ B := A;
+ Pos := 0;
+ end;
+
+ if I > 35 then
+ Data[i] := Data[i] * 8
+ else if I > 11 then
+ Data[i] := Data[i] * 4.5
+ else
+ Data[i] := Data[i] * 1.1;
+
+ if (Data[i] >= 1) then
+ Data[i] := 0.9999999999999;
+
+ if Data[i]*Theme.Song.Equalizer.Length > Pos then
+ Pos := Data[i]*Theme.Song.Equalizer.Length;
+ end;
+
+ //Change Last Band
+ if (EqualizerBands[B] <= Theme.Song.Equalizer.Length) then
+ begin
+ if ((Pos < EqualizerBands[B]) AND (EqualizerBands[B]>1)) then
+ EqualizerBands[B] := EqualizerBands[B] - 1
+ else
+ EqualizerBands[B] := floor(Pos)
+ end
+ else
+ EqualizerBands[B] := 1;
+ end;
+
+ //Draw every Channel
+ glColor4f(Theme.Song.Equalizer.ColR, Theme.Song.Equalizer.ColG, Theme.Song.Equalizer.ColB, Theme.Song.Equalizer.Alpha); //Set Color
+ glDisable(GL_TEXTURE_2D);
+ glEnable(GL_BLEND);
+
+ PosY := Theme.Song.Equalizer.Y;
+ PosX := Theme.Song.Equalizer.X;
+
+ For I := 0 to Theme.Song.Equalizer.Bands-1 do
+ begin
+ if Theme.Song.Equalizer.Direction then
+ PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length
+ else
+ PosX := Theme.Song.Equalizer.X;
+ //Draw for every visible quad
+ for J := 1 to EqualizerBands[I] do
+ begin
+ glBegin(GL_QUADS);
+ glVertex3f(PosX, PosY, Theme.Song.Equalizer.Z);
+ glVertex3f(PosX, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z);
+ glVertex3f(PosX+Theme.Song.Equalizer.W, PosY+Theme.Song.Equalizer.H, Theme.Song.Equalizer.Z);
+ glVertex3f(PosX+Theme.Song.Equalizer.W, PosY, Theme.Song.Equalizer.Z);
+ glEnd;
+
+ if Theme.Song.Equalizer.Direction then //Vertically
+ PosY := PosY - Theme.Song.Equalizer.H - Theme.Song.Equalizer.Space
+ else //Horizontally
+ PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space;
+ end;
+ if Theme.Song.Equalizer.Direction then //Horizontally
+ PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space
+ else //Vertically
+ PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space;
+ end;
+end;
+end;
+
+Procedure TScreenSong.SelectRandomSong;
+var
+ I, I2: Integer;
+begin
+ Case PlaylistMan.Mode of
+ 0: //All Songs Just Select Random Song
+ begin
+ //When Tabs are activated then use Tab Method
+ if (Ini.Tabs_at_startup = 1) then
+ begin
+ repeat
+ I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1;
+ until CatSongs.Song[I2].Main = false;
+
+ //Search Cat
+ for I := I2 downto low(CatSongs.Song) do
+ begin
+ if CatSongs.Song[I].Main then
+ break;
+ end;
+ //In I ist jetzt die Kategorie in I2 der Song
+ //I is the CatNum, I2 is the No of the Song within this Cat
+
+ //Choose Cat
+ CatSongs.ShowCategoryList;
+
+ //Show Cat in Top Left Mod
+ ShowCatTL (I);
+
+ CatSongs.ClickCategoryButton(I);
+ SelectNext;
+
+ //Choose Song
+ SkipTo(I2-I);
+ end
+ //When Tabs are deactivated use easy Method
+ else
+ SkipTo(Random(CatSongs.VisibleSongs));
+ end;
+ 1: //One Category Select Category and Select Random Song
+ begin
+ CatSongs.ShowCategoryList;
+ CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList);
+ ShowCatTL(PlaylistMan.CurPlayList);
+
+ SelectNext;
+ FixSelected2;
+
+ SkipTo(Random(CatSongs.VisibleSongs));
+ end;
+ 2: //Playlist: Select Playlist and Select Random Song
+ begin
+ PlaylistMan.SetPlayList(PlaylistMan.CurPlayList);
+
+ SkipTo(Random(CatSongs.VisibleSongs));
+ FixSelected2;
+ end;
+ end;
+
+ Music.PlayChange;
+ ChangeMusic;
+ SetScroll;
+ UpdateLCD;
+end;
+
+procedure TScreenSong.SetJoker;
+begin
+ //If Party Mode
+ if Mode = 1 then //Show Joker that are available
+ begin
+ if (PartySession.Teams.NumTeams >= 1) then
+ begin
+ Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1);
+ Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2);
+ Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3);
+ Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4);
+ Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5);
+ end
+ else
+ begin
+ Static[StaticTeam1Joker1].Visible := False;
+ Static[StaticTeam1Joker2].Visible := False;
+ Static[StaticTeam1Joker3].Visible := False;
+ Static[StaticTeam1Joker4].Visible := False;
+ Static[StaticTeam1Joker5].Visible := False;
+ end;
+
+ if (PartySession.Teams.NumTeams >= 2) then
+ begin
+ Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1);
+ Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2);
+ Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3);
+ Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4);
+ Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5);
+ end
+ else
+ begin
+ Static[StaticTeam2Joker1].Visible := False;
+ Static[StaticTeam2Joker2].Visible := False;
+ Static[StaticTeam2Joker3].Visible := False;
+ Static[StaticTeam2Joker4].Visible := False;
+ Static[StaticTeam2Joker5].Visible := False;
+ end;
+
+ if (PartySession.Teams.NumTeams >= 3) then
+ begin
+ Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1);
+ Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2);
+ Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3);
+ Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4);
+ Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5);
+ end
+ else
+ begin
+ Static[StaticTeam3Joker1].Visible := False;
+ Static[StaticTeam3Joker2].Visible := False;
+ Static[StaticTeam3Joker3].Visible := False;
+ Static[StaticTeam3Joker4].Visible := False;
+ Static[StaticTeam3Joker5].Visible := False;
+ end;
+ end
+ else
+ begin //Hide all
+ Static[StaticTeam1Joker1].Visible := False;
+ Static[StaticTeam1Joker2].Visible := False;
+ Static[StaticTeam1Joker3].Visible := False;
+ Static[StaticTeam1Joker4].Visible := False;
+ Static[StaticTeam1Joker5].Visible := False;
+
+ Static[StaticTeam2Joker1].Visible := False;
+ Static[StaticTeam2Joker2].Visible := False;
+ Static[StaticTeam2Joker3].Visible := False;
+ Static[StaticTeam2Joker4].Visible := False;
+ Static[StaticTeam2Joker5].Visible := False;
+
+ Static[StaticTeam3Joker1].Visible := False;
+ Static[StaticTeam3Joker2].Visible := False;
+ Static[StaticTeam3Joker3].Visible := False;
+ Static[StaticTeam3Joker4].Visible := False;
+ Static[StaticTeam3Joker5].Visible := False;
+ end;
+end;
+
+procedure TScreenSong.SetStatics;
+var
+ I: Integer;
+ Visible: Boolean;
+begin
+ //Set Visibility of Party Statics and Text
+ Visible := (Mode = 1);
+
+ For I := 0 to high(StaticParty) do
+ Static[StaticParty[I]].Visible := Visible;
+
+ For I := 0 to high(TextParty) do
+ Text[TextParty[I]].Visible := Visible;
+
+ //Set Visibility of Non Party Statics and Text
+ Visible := not Visible;
+
+ For I := 0 to high(StaticNonParty) do
+ Static[StaticNonParty[I]].Visible := Visible;
+
+ For I := 0 to high(TextNonParty) do
+ Text[TextNonParty[I]].Visible := Visible;
+end;
+
+//Procedures for Menu
+
+procedure TScreenSong.StartSong;
+begin
+ CatSongs.Selected := Interaction;
+ Music.Stop;
+ //Party Mode
+ if (Mode = 1) then
+ begin
+ FadeTo(@ScreenSingModi);
+ end
+ else
+ begin
+ FadeTo(@ScreenSing);
+ end;
+end;
+
+procedure TScreenSong.SelectPlayers;
+begin
+ CatSongs.Selected := Interaction;
+ Music.Stop;
+
+ ScreenName.Goto_SingScreen := True;
+ FadeTo(@ScreenName);
+end;
+
+procedure TScreenSong.OpenEditor;
+begin
+ if (Length(Songs.Song) > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = 0) then begin
+ Music.Stop;
+ Music.PlayStart;
+ ScreenEditSub.Path := CatSongs.Song[Interaction].Path;
+ ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName;
+ FadeTo(@ScreenEditSub);
+ end;
+end;
+
+//Team No of Team (0-5)
+procedure TScreenSong.DoJoker (Team: Byte);
+begin
+ if (Mode = 1) AND (PartySession.Teams.NumTeams >= Team + 1) AND (PartySession.Teams.Teaminfo[Team].Joker > 0) then
+ begin
+ //Joker spielen
+ Dec(PartySession.Teams.Teaminfo[Team].Joker);
+ SelectRandomSong;
+ SetJoker;
+ end;
+end;
+
+//Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song
+procedure TScreenSong.UnLoadDetailedCover;
+begin
+ CoverTime := 0;
+
+ Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture
+ Button[Interaction].Texture2.Alpha := 0;
+
+ if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then
+ Texture.UnloadTexture(Button[Interaction].Texture.Name, false);
+end;
+
+procedure TScreenSong.Refresh;
+begin {
+CatSongs.Refresh;
+CatSongs.ShowCategoryList;
+Interaction := 0;
+SelectNext;
+FixSelected; }
+
+end;
+
+end.
diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas
index 41432356..ce331e2f 100644
--- a/Game/Code/Screens/UScreenSongMenu.pas
+++ b/Game/Code/Screens/UScreenSongMenu.pas
@@ -1,619 +1,632 @@
-unit UScreenSongMenu;
-
-interface
-
-{$IFDEF FPC}
- {$MODE DELPHI}
-{$ENDIF}
-
-uses
- UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes;
-
-type
- TScreenSongMenu = class(TMenu)
- private
- CurMenu: Byte; //Num of the cur. Shown Menu
- public
- Visible: Boolean; //Whether the Menu should be Drawn
-
- constructor Create; override;
- function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
- procedure onShow; override;
- function Draw: boolean; override;
- procedure MenuShow(sMenu: Byte);
- procedure HandleReturn;
- end;
-
-const
- SM_Main = 1;
-
- SM_PlayList = 64 or 1;
- SM_Playlist_Add = 64 or 2;
- SM_Playlist_New = 64 or 3;
-
- SM_Playlist_DelItem = 64 or 5;
-
- SM_Playlist_Load = 64 or 8 or 1;
- SM_Playlist_Del = 64 or 8 or 5;
-
-
- SM_Party_Main = 128 or 1;
- SM_Party_Joker = 128 or 2;
-
-var
- ISelections: Array of String;
- SelectValue: Integer;
-
-
-implementation
-
-uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist, USongs;
-
-function TScreenSongMenu.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
-begin
- Result := true;
- If (PressedDown) Then
- begin // Key Down
- if (CurMenu = SM_Playlist_New) AND (Interaction=0) then
- begin
- case PressedKey of
- SDLK_0..SDLK_9, SDLK_A..SDLK_Z, SDLK_SPACE, SDLK_MINUS, SDLK_EXCLAIM, SDLK_COMMA, SDLK_SLASH, SDLK_ASTERISK, SDLK_QUESTION, SDLK_QUOTE, SDLK_QUOTEDBL:
- begin
- Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + chr(ScanCode);
- exit;
- end;
-
- SDLK_BACKSPACE:
- begin
- Button[Interaction].Text[0].DeleteLastL;
- exit;
- end;
- end;
- end;
-
- case PressedKey of
- SDLK_Q:
- begin
- Result := false;
- end;
-
-
- SDLK_ESCAPE,
- SDLK_BACKSPACE :
- begin
- Music.PlayBack;
- Visible := False;
- end;
-
- SDLK_RETURN:
- begin
- HandleReturn;
- end;
-
- SDLK_DOWN: InteractNext;
- SDLK_UP: InteractPrev;
-
- SDLK_RIGHT:
- begin
- if (Interaction=3) then
- InteractInc;
- end;
- SDLK_LEFT:
- begin
- if (Interaction=3) then
- InteractDec;
- end;
-
- SDLK_1:
- begin //Jocker
- //Joker spielen
- case CurMenu of
- SM_Party_Main:
- begin
- ScreenSong.DoJoker(0)
- end;
- end;
- end;
- SDLK_2:
- begin //Jocker
- //Joker spielen
- case CurMenu of
- SM_Party_Main:
- begin
- ScreenSong.DoJoker(1)
- end;
- end;
- end;
- SDLK_3:
- begin //Jocker
- //Joker spielen
- case CurMenu of
- SM_Party_Main:
- begin
- ScreenSong.DoJoker(2)
- end;
- end;
- end;
-
-
- end;
- end;
-end;
-
-constructor TScreenSongMenu.Create;
-var
- I: integer;
-begin
- inherited Create;
-
- //Create Dummy SelectSlide Entrys
- SetLength(ISelections, 1);
- ISelections[0] := 'Dummy';
-
-
- AddText(Theme.SongMenu.TextMenu);
-
- LoadFromTheme(Theme.SongMenu);
-
- AddButton(Theme.SongMenu.Button1);
- if (Length(Button[0].Text) = 0) then
- AddButtonText(14, 20, 'Button 1');
-
- AddButton(Theme.SongMenu.Button2);
- if (Length(Button[1].Text) = 0) then
- AddButtonText(14, 20, 'Button 2');
-
- AddButton(Theme.SongMenu.Button3);
- if (Length(Button[2].Text) = 0) then
- AddButtonText(14, 20, 'Button 3');
-
- AddSelectSlide(Theme.SongMenu.SelectSlide3, SelectValue, ISelections);
-
- AddButton(Theme.SongMenu.Button4);
- if (Length(Button[3].Text) = 0) then
- AddButtonText(14, 20, 'Button 4');
-
-
- Interaction := 0;
-end;
-
-function TScreenSongMenu.Draw: boolean;
-begin
- inherited Draw;
-end;
-
-procedure TScreenSongMenu.onShow;
-begin
-
-end;
-
-procedure TScreenSongMenu.MenuShow(sMenu: Byte);
-begin
- Interaction := 0; //Reset Interaction
- Visible := True; //Set Visible
- Case sMenu of
- SM_Main:
- begin
- CurMenu := sMenu;
- Text[0].Text := Language.Translate('SONG_MENU_NAME_MAIN');
-
- Button[0].Visible := True;
- Button[1].Visible := True;
- Button[2].Visible := True;
- Button[3].Visible := True;
- SelectsS[0].Visible := False;
-
- Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY');
- Button[1].Text[0].Text := Language.Translate('SONG_MENU_CHANGEPLAYERS');
- Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD');
- Button[3].Text[0].Text := Language.Translate('SONG_MENU_EDIT');
- end;
-
- SM_PlayList:
- begin
- CurMenu := sMenu;
- Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST');
-
- Button[0].Visible := True;
- Button[1].Visible := True;
- Button[2].Visible := True;
- Button[3].Visible := True;
- SelectsS[0].Visible := False;
-
- Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY');
- Button[1].Text[0].Text := Language.Translate('SONG_MENU_CHANGEPLAYERS');
- Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_DEL');
- Button[3].Text[0].Text := Language.Translate('SONG_MENU_EDIT');
- end;
-
- SM_Playlist_Add:
- begin
- CurMenu := sMenu;
- Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_ADD');
-
- Button[0].Visible := True;
- Button[1].Visible := False;
- Button[2].Visible := False;
- Button[3].Visible := True;
- SelectsS[0].Visible := True;
-
- Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD_NEW');
- Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD_EXISTING');
-
- SetLength(ISelections, Length(PlaylistMan.Playlists));
- PlaylistMan.GetNames(ISelections);
-
- if (Length(ISelections)>=1) then
- begin
- UpdateSelectSlideOptions(Theme.SongMenu.SelectSlide3, 0, ISelections, SelectValue);
- end
- else
- begin
- Button[3].Visible := False;
- SelectsS[0].Visible := False;
- Button[2].Visible := True;
- Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING');
- end;
- end;
-
- SM_Playlist_New:
- begin
- CurMenu := sMenu;
- Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_NEW');
-
- Button[0].Visible := True;
- Button[1].Visible := False;
- Button[2].Visible := True;
- Button[3].Visible := True;
- SelectsS[0].Visible := False;
-
- Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NEW_UNNAMED');
- Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NEW_CREATE');
- Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL');
- end;
-
- SM_Playlist_DelItem:
- begin
- CurMenu := sMenu;
- Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_DELITEM');
-
- Button[0].Visible := True;
- Button[1].Visible := False;
- Button[2].Visible := False;
- Button[3].Visible := True;
- SelectsS[0].Visible := False;
-
- Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES');
- Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL');
- end;
-
- SM_Playlist_Load:
- begin
- CurMenu := sMenu;
- Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_LOAD');
-
- //Show Delete Curent Playlist Button when Playlist is opened
- Button[0].Visible := (CatSongs.CatNumShow = -3);
-
- Button[1].Visible := False;
- Button[2].Visible := False;
- Button[3].Visible := True;
- SelectsS[0].Visible := True;
-
- Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_DELCURRENT');
- Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_LOAD');
-
- SetLength(ISelections, Length(PlaylistMan.Playlists));
- PlaylistMan.GetNames(ISelections);
-
- if (Length(ISelections)>=1) then
- begin
- UpdateSelectSlideOptions(Theme.SongMenu.SelectSlide3, 0, ISelections, SelectValue);
- Interaction := 3;
- end
- else
- begin
- Button[3].Visible := False;
- SelectsS[0].Visible := False;
- Button[2].Visible := True;
- Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING');
- Interaction := 2;
- end;
- end;
-
- SM_Playlist_Del:
- begin
- CurMenu := sMenu;
- Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_DEL');
-
- Button[0].Visible := True;
- Button[1].Visible := False;
- Button[2].Visible := False;
- Button[3].Visible := True;
- SelectsS[0].Visible := False;
-
- Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES');
- Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL');
- end;
-
-
- SM_Party_Main:
- begin
- CurMenu := sMenu;
- Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_MAIN');
-
- Button[0].Visible := True;
- Button[1].Visible := False;
- Button[2].Visible := False;
- Button[3].Visible := True;
- SelectsS[0].Visible := False;
-
- Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY');
- //Button[1].Text[0].Text := Language.Translate('SONG_MENU_JOKER');
- //Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYMODI');
- Button[3].Text[0].Text := Language.Translate('SONG_MENU_JOKER');
- end;
-
- SM_Party_Joker:
- begin
- CurMenu := sMenu;
- Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_JOKER');
-
- Button[0].Visible := (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0);
- Button[1].Visible := (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0);
- Button[2].Visible := (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0);
- Button[3].Visible := True;
- SelectsS[0].Visible := False;
-
- Button[0].Text[0].Text := String(PartySession.Teams.Teaminfo[0].Name);
- Button[1].Text[0].Text := String(PartySession.Teams.Teaminfo[1].Name);
- Button[2].Text[0].Text := String(PartySession.Teams.Teaminfo[2].Name);
- Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL');
-
- //Set right Interaction
- if (not Button[0].Visible) then
- begin
- if (not Button[1].Visible) then
- begin
- if (not Button[2].Visible) then
- begin
- Interaction := 4;
- end
- else Interaction := 2;
- end
- else Interaction := 1;
- end;
-
- end;
- end;
-end;
-
-procedure TScreenSongMenu.HandleReturn;
-begin
- Case CurMenu of
- SM_Main:
- begin
- Case Interaction of
- 0: //Button 1
- begin
- ScreenSong.StartSong;
- Visible := False;
- end;
-
- 1: //Button 2
- begin
- //Select New Players then Sing:
- ScreenSong.SelectPlayers;
- Visible := False;
- end;
-
- 2: //Button 3
- begin
- //Show add to Playlist Menu
- MenuShow(SM_Playlist_Add);
- end;
-
- 3: //SelectSlide 3
- begin
- //Dummy
- end;
-
- 4: //Button 4
- begin
- ScreenSong.OpenEditor;
- Visible := False;
- end;
- end;
- end;
-
- SM_PlayList:
- begin
- Visible := False;
- Case Interaction of
- 0: //Button 1
- begin
- ScreenSong.StartSong;
- Visible := False;
- end;
-
- 1: //Button 2
- begin
- //Select New Players then Sing:
- ScreenSong.SelectPlayers;
- Visible := False;
- end;
-
- 2: //Button 3
- begin
- //Show add to Playlist Menu
- MenuShow(SM_Playlist_DelItem);
- end;
-
- 3: //SelectSlide 3
- begin
- //Dummy
- end;
-
- 4: //Button 4
- begin
- ScreenSong.OpenEditor;
- Visible := False;
- end;
- end;
- end;
-
- SM_Playlist_Add:
- begin
- Case Interaction of
- 0: //Button 1
- begin
- MenuShow(SM_Playlist_New);
- end;
-
- 3: //SelectSlide 3
- begin
- //Dummy
- end;
-
- 4: //Button 4
- begin
- PlaylistMan.AddItem(ScreenSong.Interaction, SelectValue);
- Visible := False;
- end;
- end;
- end;
-
- SM_Playlist_New:
- begin
- Case Interaction of
- 0: //Button 1
- begin
- //Nothing, Button for Entering Name
- end;
-
- 2: //Button 3
- begin
- //Create Playlist and Add Song
- PlaylistMan.AddItem(
- ScreenSong.Interaction,
- PlaylistMan.AddPlaylist(Button[0].Text[0].Text));
- Visible := False;
- end;
-
- 3: //SelectSlide 3
- begin
- //Cancel -> Go back to Add screen
- MenuShow(SM_Playlist_Add);
- end;
-
- 4: //Button 4
- begin
- Visible := False;
- end;
- end;
- end;
-
- SM_Playlist_DelItem:
- begin
- Visible := False;
- Case Interaction of
- 0: //Button 1
- begin
- //Delete
- PlayListMan.DelItem(PlayListMan.GetIndexbySongID(ScreenSong.Interaction));
- Visible := False;
- end;
-
- 4: //Button 4
- begin
- MenuShow(SM_Playlist);
- end;
- end;
- end;
-
- SM_Playlist_Load:
- begin
- Case Interaction of
- 0: //Button 1 (Delete Playlist)
- begin
- MenuShow(SM_Playlist_Del);
- end;
- 4: //Button 4
- begin
- //Load Playlist
- PlaylistMan.SetPlayList(SelectValue);
- Visible := False;
- end;
- end;
- end;
-
- SM_Playlist_Del:
- begin
- Visible := False;
- Case Interaction of
- 0: //Button 1
- begin
- //Delete
- PlayListMan.DelPlaylist(PlaylistMan.CurPlayList);
- Visible := False;
- end;
-
- 4: //Button 4
- begin
- MenuShow(SM_Playlist_Load);
- end;
- end;
- end;
-
- SM_Party_Main:
- begin
- Case Interaction of
- 0: //Button 1
- begin
- //Start Singing
- ScreenSong.StartSong;
- Visible := False;
- end;
-
- 4: //Button 4
- begin
- //Joker
- MenuShow(SM_Party_Joker);
- end;
- end;
- end;
-
- SM_Party_Joker:
- begin
- Visible := False;
- Case Interaction of
- 0: //Button 1
- begin
- //Joker Team 1
- ScreenSong.DoJoker(0);
- end;
-
- 1: //Button 2
- begin
- //Joker Team 2
- ScreenSong.DoJoker(1);
- end;
-
- 2: //Button 3
- begin
- //Joker Team 3
- ScreenSong.DoJoker(2);
- end;
-
- 4: //Button 4
- begin
- //Cancel... (Fo back to old Menu)
- MenuShow(SM_Party_Main);
- end;
- end;
- end;
- end;
-end;
-
-end.
-
+unit UScreenSongMenu;
+
+interface
+
+{$IFDEF FPC}
+ {$MODE DELPHI}
+{$ENDIF}
+
+uses
+ UMenu,
+ SDL,
+ UDisplay,
+ UMusic,
+ UFiles,
+ SysUtils,
+ UThemes;
+
+type
+ TScreenSongMenu = class(TMenu)
+ private
+ CurMenu: Byte; //Num of the cur. Shown Menu
+ public
+ Visible: Boolean; //Whether the Menu should be Drawn
+
+ constructor Create; override;
+ function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
+ procedure onShow; override;
+ function Draw: boolean; override;
+ procedure MenuShow(sMenu: Byte);
+ procedure HandleReturn;
+ end;
+
+const
+ SM_Main = 1;
+
+ SM_PlayList = 64 or 1;
+ SM_Playlist_Add = 64 or 2;
+ SM_Playlist_New = 64 or 3;
+
+ SM_Playlist_DelItem = 64 or 5;
+
+ SM_Playlist_Load = 64 or 8 or 1;
+ SM_Playlist_Del = 64 or 8 or 5;
+
+
+ SM_Party_Main = 128 or 1;
+ SM_Party_Joker = 128 or 2;
+
+var
+ ISelections: Array of String;
+ SelectValue: Integer;
+
+
+implementation
+
+uses UGraphic,
+ UMain,
+ UIni,
+ UTexture,
+ ULanguage,
+ UParty,
+ UPlaylist,
+ USongs;
+
+function TScreenSongMenu.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ if (CurMenu = SM_Playlist_New) AND (Interaction=0) then
+ begin
+ case PressedKey of
+ SDLK_0..SDLK_9, SDLK_A..SDLK_Z, SDLK_SPACE, SDLK_MINUS, SDLK_EXCLAIM, SDLK_COMMA, SDLK_SLASH, SDLK_ASTERISK, SDLK_QUESTION, SDLK_QUOTE, SDLK_QUOTEDBL:
+ begin
+ Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + chr(ScanCode);
+ exit;
+ end;
+
+ SDLK_BACKSPACE:
+ begin
+ Button[Interaction].Text[0].DeleteLastL;
+ exit;
+ end;
+ end;
+ end;
+
+ case PressedKey of
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ Music.PlayBack;
+ Visible := False;
+ end;
+
+ SDLK_RETURN:
+ begin
+ HandleReturn;
+ end;
+
+ SDLK_DOWN: InteractNext;
+ SDLK_UP: InteractPrev;
+
+ SDLK_RIGHT:
+ begin
+ if (Interaction=3) then
+ InteractInc;
+ end;
+ SDLK_LEFT:
+ begin
+ if (Interaction=3) then
+ InteractDec;
+ end;
+
+ SDLK_1:
+ begin //Jocker
+ //Joker spielen
+ case CurMenu of
+ SM_Party_Main:
+ begin
+ ScreenSong.DoJoker(0)
+ end;
+ end;
+ end;
+ SDLK_2:
+ begin //Jocker
+ //Joker spielen
+ case CurMenu of
+ SM_Party_Main:
+ begin
+ ScreenSong.DoJoker(1)
+ end;
+ end;
+ end;
+ SDLK_3:
+ begin //Jocker
+ //Joker spielen
+ case CurMenu of
+ SM_Party_Main:
+ begin
+ ScreenSong.DoJoker(2)
+ end;
+ end;
+ end;
+
+
+ end;
+ end;
+end;
+
+constructor TScreenSongMenu.Create;
+var
+ I: integer;
+begin
+ inherited Create;
+
+ //Create Dummy SelectSlide Entrys
+ SetLength(ISelections, 1);
+ ISelections[0] := 'Dummy';
+
+
+ AddText(Theme.SongMenu.TextMenu);
+
+ LoadFromTheme(Theme.SongMenu);
+
+ AddButton(Theme.SongMenu.Button1);
+ if (Length(Button[0].Text) = 0) then
+ AddButtonText(14, 20, 'Button 1');
+
+ AddButton(Theme.SongMenu.Button2);
+ if (Length(Button[1].Text) = 0) then
+ AddButtonText(14, 20, 'Button 2');
+
+ AddButton(Theme.SongMenu.Button3);
+ if (Length(Button[2].Text) = 0) then
+ AddButtonText(14, 20, 'Button 3');
+
+ AddSelectSlide(Theme.SongMenu.SelectSlide3, SelectValue, ISelections);
+
+ AddButton(Theme.SongMenu.Button4);
+ if (Length(Button[3].Text) = 0) then
+ AddButtonText(14, 20, 'Button 4');
+
+
+ Interaction := 0;
+end;
+
+function TScreenSongMenu.Draw: boolean;
+begin
+ inherited Draw;
+end;
+
+procedure TScreenSongMenu.onShow;
+begin
+
+end;
+
+procedure TScreenSongMenu.MenuShow(sMenu: Byte);
+begin
+ Interaction := 0; //Reset Interaction
+ Visible := True; //Set Visible
+ Case sMenu of
+ SM_Main:
+ begin
+ CurMenu := sMenu;
+ Text[0].Text := Language.Translate('SONG_MENU_NAME_MAIN');
+
+ Button[0].Visible := True;
+ Button[1].Visible := True;
+ Button[2].Visible := True;
+ Button[3].Visible := True;
+ SelectsS[0].Visible := False;
+
+ Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY');
+ Button[1].Text[0].Text := Language.Translate('SONG_MENU_CHANGEPLAYERS');
+ Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD');
+ Button[3].Text[0].Text := Language.Translate('SONG_MENU_EDIT');
+ end;
+
+ SM_PlayList:
+ begin
+ CurMenu := sMenu;
+ Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST');
+
+ Button[0].Visible := True;
+ Button[1].Visible := True;
+ Button[2].Visible := True;
+ Button[3].Visible := True;
+ SelectsS[0].Visible := False;
+
+ Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY');
+ Button[1].Text[0].Text := Language.Translate('SONG_MENU_CHANGEPLAYERS');
+ Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_DEL');
+ Button[3].Text[0].Text := Language.Translate('SONG_MENU_EDIT');
+ end;
+
+ SM_Playlist_Add:
+ begin
+ CurMenu := sMenu;
+ Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_ADD');
+
+ Button[0].Visible := True;
+ Button[1].Visible := False;
+ Button[2].Visible := False;
+ Button[3].Visible := True;
+ SelectsS[0].Visible := True;
+
+ Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD_NEW');
+ Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_ADD_EXISTING');
+
+ SetLength(ISelections, Length(PlaylistMan.Playlists));
+ PlaylistMan.GetNames(ISelections);
+
+ if (Length(ISelections)>=1) then
+ begin
+ UpdateSelectSlideOptions(Theme.SongMenu.SelectSlide3, 0, ISelections, SelectValue);
+ end
+ else
+ begin
+ Button[3].Visible := False;
+ SelectsS[0].Visible := False;
+ Button[2].Visible := True;
+ Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING');
+ end;
+ end;
+
+ SM_Playlist_New:
+ begin
+ CurMenu := sMenu;
+ Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_NEW');
+
+ Button[0].Visible := True;
+ Button[1].Visible := False;
+ Button[2].Visible := True;
+ Button[3].Visible := True;
+ SelectsS[0].Visible := False;
+
+ Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NEW_UNNAMED');
+ Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NEW_CREATE');
+ Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL');
+ end;
+
+ SM_Playlist_DelItem:
+ begin
+ CurMenu := sMenu;
+ Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_DELITEM');
+
+ Button[0].Visible := True;
+ Button[1].Visible := False;
+ Button[2].Visible := False;
+ Button[3].Visible := True;
+ SelectsS[0].Visible := False;
+
+ Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES');
+ Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL');
+ end;
+
+ SM_Playlist_Load:
+ begin
+ CurMenu := sMenu;
+ Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_LOAD');
+
+ //Show Delete Curent Playlist Button when Playlist is opened
+ Button[0].Visible := (CatSongs.CatNumShow = -3);
+
+ Button[1].Visible := False;
+ Button[2].Visible := False;
+ Button[3].Visible := True;
+ SelectsS[0].Visible := True;
+
+ Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_DELCURRENT');
+ Button[3].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_LOAD');
+
+ SetLength(ISelections, Length(PlaylistMan.Playlists));
+ PlaylistMan.GetNames(ISelections);
+
+ if (Length(ISelections)>=1) then
+ begin
+ UpdateSelectSlideOptions(Theme.SongMenu.SelectSlide3, 0, ISelections, SelectValue);
+ Interaction := 3;
+ end
+ else
+ begin
+ Button[3].Visible := False;
+ SelectsS[0].Visible := False;
+ Button[2].Visible := True;
+ Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYLIST_NOEXISTING');
+ Interaction := 2;
+ end;
+ end;
+
+ SM_Playlist_Del:
+ begin
+ CurMenu := sMenu;
+ Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_DEL');
+
+ Button[0].Visible := True;
+ Button[1].Visible := False;
+ Button[2].Visible := False;
+ Button[3].Visible := True;
+ SelectsS[0].Visible := False;
+
+ Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES');
+ Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL');
+ end;
+
+
+ SM_Party_Main:
+ begin
+ CurMenu := sMenu;
+ Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_MAIN');
+
+ Button[0].Visible := True;
+ Button[1].Visible := False;
+ Button[2].Visible := False;
+ Button[3].Visible := True;
+ SelectsS[0].Visible := False;
+
+ Button[0].Text[0].Text := Language.Translate('SONG_MENU_PLAY');
+ //Button[1].Text[0].Text := Language.Translate('SONG_MENU_JOKER');
+ //Button[2].Text[0].Text := Language.Translate('SONG_MENU_PLAYMODI');
+ Button[3].Text[0].Text := Language.Translate('SONG_MENU_JOKER');
+ end;
+
+ SM_Party_Joker:
+ begin
+ CurMenu := sMenu;
+ Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_JOKER');
+
+ Button[0].Visible := (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0);
+ Button[1].Visible := (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0);
+ Button[2].Visible := (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0);
+ Button[3].Visible := True;
+ SelectsS[0].Visible := False;
+
+ Button[0].Text[0].Text := String(PartySession.Teams.Teaminfo[0].Name);
+ Button[1].Text[0].Text := String(PartySession.Teams.Teaminfo[1].Name);
+ Button[2].Text[0].Text := String(PartySession.Teams.Teaminfo[2].Name);
+ Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL');
+
+ //Set right Interaction
+ if (not Button[0].Visible) then
+ begin
+ if (not Button[1].Visible) then
+ begin
+ if (not Button[2].Visible) then
+ begin
+ Interaction := 4;
+ end
+ else Interaction := 2;
+ end
+ else Interaction := 1;
+ end;
+
+ end;
+ end;
+end;
+
+procedure TScreenSongMenu.HandleReturn;
+begin
+ Case CurMenu of
+ SM_Main:
+ begin
+ Case Interaction of
+ 0: //Button 1
+ begin
+ ScreenSong.StartSong;
+ Visible := False;
+ end;
+
+ 1: //Button 2
+ begin
+ //Select New Players then Sing:
+ ScreenSong.SelectPlayers;
+ Visible := False;
+ end;
+
+ 2: //Button 3
+ begin
+ //Show add to Playlist Menu
+ MenuShow(SM_Playlist_Add);
+ end;
+
+ 3: //SelectSlide 3
+ begin
+ //Dummy
+ end;
+
+ 4: //Button 4
+ begin
+ ScreenSong.OpenEditor;
+ Visible := False;
+ end;
+ end;
+ end;
+
+ SM_PlayList:
+ begin
+ Visible := False;
+ Case Interaction of
+ 0: //Button 1
+ begin
+ ScreenSong.StartSong;
+ Visible := False;
+ end;
+
+ 1: //Button 2
+ begin
+ //Select New Players then Sing:
+ ScreenSong.SelectPlayers;
+ Visible := False;
+ end;
+
+ 2: //Button 3
+ begin
+ //Show add to Playlist Menu
+ MenuShow(SM_Playlist_DelItem);
+ end;
+
+ 3: //SelectSlide 3
+ begin
+ //Dummy
+ end;
+
+ 4: //Button 4
+ begin
+ ScreenSong.OpenEditor;
+ Visible := False;
+ end;
+ end;
+ end;
+
+ SM_Playlist_Add:
+ begin
+ Case Interaction of
+ 0: //Button 1
+ begin
+ MenuShow(SM_Playlist_New);
+ end;
+
+ 3: //SelectSlide 3
+ begin
+ //Dummy
+ end;
+
+ 4: //Button 4
+ begin
+ PlaylistMan.AddItem(ScreenSong.Interaction, SelectValue);
+ Visible := False;
+ end;
+ end;
+ end;
+
+ SM_Playlist_New:
+ begin
+ Case Interaction of
+ 0: //Button 1
+ begin
+ //Nothing, Button for Entering Name
+ end;
+
+ 2: //Button 3
+ begin
+ //Create Playlist and Add Song
+ PlaylistMan.AddItem(
+ ScreenSong.Interaction,
+ PlaylistMan.AddPlaylist(Button[0].Text[0].Text));
+ Visible := False;
+ end;
+
+ 3: //SelectSlide 3
+ begin
+ //Cancel -> Go back to Add screen
+ MenuShow(SM_Playlist_Add);
+ end;
+
+ 4: //Button 4
+ begin
+ Visible := False;
+ end;
+ end;
+ end;
+
+ SM_Playlist_DelItem:
+ begin
+ Visible := False;
+ Case Interaction of
+ 0: //Button 1
+ begin
+ //Delete
+ PlayListMan.DelItem(PlayListMan.GetIndexbySongID(ScreenSong.Interaction));
+ Visible := False;
+ end;
+
+ 4: //Button 4
+ begin
+ MenuShow(SM_Playlist);
+ end;
+ end;
+ end;
+
+ SM_Playlist_Load:
+ begin
+ Case Interaction of
+ 0: //Button 1 (Delete Playlist)
+ begin
+ MenuShow(SM_Playlist_Del);
+ end;
+ 4: //Button 4
+ begin
+ //Load Playlist
+ PlaylistMan.SetPlayList(SelectValue);
+ Visible := False;
+ end;
+ end;
+ end;
+
+ SM_Playlist_Del:
+ begin
+ Visible := False;
+ Case Interaction of
+ 0: //Button 1
+ begin
+ //Delete
+ PlayListMan.DelPlaylist(PlaylistMan.CurPlayList);
+ Visible := False;
+ end;
+
+ 4: //Button 4
+ begin
+ MenuShow(SM_Playlist_Load);
+ end;
+ end;
+ end;
+
+ SM_Party_Main:
+ begin
+ Case Interaction of
+ 0: //Button 1
+ begin
+ //Start Singing
+ ScreenSong.StartSong;
+ Visible := False;
+ end;
+
+ 4: //Button 4
+ begin
+ //Joker
+ MenuShow(SM_Party_Joker);
+ end;
+ end;
+ end;
+
+ SM_Party_Joker:
+ begin
+ Visible := False;
+ Case Interaction of
+ 0: //Button 1
+ begin
+ //Joker Team 1
+ ScreenSong.DoJoker(0);
+ end;
+
+ 1: //Button 2
+ begin
+ //Joker Team 2
+ ScreenSong.DoJoker(1);
+ end;
+
+ 2: //Button 3
+ begin
+ //Joker Team 3
+ ScreenSong.DoJoker(2);
+ end;
+
+ 4: //Button 4
+ begin
+ //Cancel... (Fo back to old Menu)
+ MenuShow(SM_Party_Main);
+ end;
+ end;
+ end;
+ end;
+end;
+
+end.
+
diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas
index f7961727..223ad2b2 100644
--- a/Game/Code/Screens/UScreenStatMain.pas
+++ b/Game/Code/Screens/UScreenStatMain.pas
@@ -1,231 +1,285 @@
-unit UScreenStatMain;
-
-interface
-
-{$IFDEF FPC}
- {$MODE DELPHI}
-{$ENDIF}
-
-
-uses
- UMenu, SDL, SysUtils, UDisplay, UMusic, UIni, UThemes;
-
-type
- TScreenStatMain = class(TMenu)
- private
- //Some Stat Value that don't need to be calculated 2 times
- SongswithVid: Cardinal;
- public
- TextOverview: integer;
- constructor Create; override;
- function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
- procedure onShow; override;
- procedure SetAnimationProgress(Progress: real); override;
-
- procedure SetOverview;
- end;
-
-implementation
-
-uses UGraphic, UDataBase, USongs, ULanguage, windows, ULog;
-
-function TScreenStatMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
-begin
- Result := true;
- If (PressedDown) Then
- begin // Key Down
- case PressedKey of
- SDLK_Q:
- begin
- Result := false;
- end;
-
- SDLK_ESCAPE,
- SDLK_BACKSPACE :
- begin
- Ini.Save;
- Music.PlayBack;
- FadeTo(@ScreenMain);
- end;
- SDLK_RETURN:
- begin
- //Exit Button Pressed
- if Interaction = 4 then begin
- Music.PlayBack;
- FadeTo(@ScreenMain);
- end
- else //One of the Stats Buttons Pressed
- begin
- Music.PlayBack;
- ScreenStatDetail.Typ := Interaction;
- FadeTo(@ScreenStatDetail);
- end;
- end;
- SDLK_LEFT:
- begin
- InteractPrev;
- end;
- SDLK_RIGHT:
- begin
- InteractNext;
- end;
- SDLK_UP:
- begin
- InteractPrev;
- end;
- SDLK_DOWN:
- begin
- InteractNext;
- end;
- end;
- end;
-end;
-
-constructor TScreenStatMain.Create;
-var
- I: integer;
-begin
- inherited Create;
-
- TextOverview := AddText(Theme.StatMain.TextOverview);
-
- LoadFromTheme(Theme.StatMain);
-
- AddButton(Theme.StatMain.ButtonScores);
- if (Length(Button[0].Text)=0) then
- AddButtonText(14, 20, Theme.StatDetail.Description[0]);
-
- AddButton(Theme.StatMain.ButtonSingers);
- if (Length(Button[1].Text)=0) then
- AddButtonText(14, 20, Theme.StatDetail.Description[1]);
-
- AddButton(Theme.StatMain.ButtonSongs);
- if (Length(Button[2].Text)=0) then
- AddButtonText(14, 20, Theme.StatDetail.Description[2]);
-
- AddButton(Theme.StatMain.ButtonBands);
- if (Length(Button[3].Text)=0) then
- AddButtonText(14, 20, Theme.StatDetail.Description[3]);
-
- AddButton(Theme.StatMain.ButtonExit);
- if (Length(Button[4].Text)=0) then
- AddButtonText(14, 20, Theme.Options.Description[4]);
-
- Interaction := 0;
-
- //Set Songs with Vid
- SongswithVid := 0;
- For I := 0 to high(Songs.Song) do
- if (Songs.Song[I].Video <> '') then
- Inc(SongswithVid);
-end;
-
-procedure TScreenStatMain.onShow;
-begin
- //Set Overview Text:
- SetOverview;
-end;
-
-procedure TScreenStatMain.SetOverview;
-var
- Overview, Formatstr: String;
- I: Integer;
- //Some Vars to Save Attributes to
- A1, A2, A3: Integer;
- A4, A5: String;
- Result1, Result2: AStatResult;
- ResetTime: TSystemTime;
- function GetFileCreation(Filename: String): TSystemTime;
- var
- FindData: TWin32FindData;
- Handle: THandle;
- begin
- Handle := FindFirstFile(PChar(Filename), FindData);
- if Handle <> INVALID_HANDLE_VALUE then
- begin
- FileTimeToSystemTime(FindData.ftCreationTime, Result);
- Windows.FindClose(Handle);
- end;
- end;
-begin
- //Song Overview
-
- //Introduction
- Formatstr := Language.Translate ('STAT_OVERVIEW_INTRO');
- {Format:
- %0:d Ultrastar Version
- %1:d Day of Reset (A1)
- %2:d Month of Reset (A2)
- %3:d Year of Reset (A3)}
-
- ResetTime := GetFileCreation(Database.Filename);
-
- A1 := ResetTime.wDay;
- A2 := ResetTime.wMonth;
- A3 := ResetTime.wYear;
- try
- Overview := Format(Formatstr, [Language.Translate('US_VERSION'), A1, A2, A3]);
- except
- on E: EConvertError do
- Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_INTRO": ' + E.Message);
- end;
-
- Formatstr := Language.Translate ('STAT_OVERVIEW_SONG');
- {Format:
- %0:d Count Songs (A1)
- %1:d Count of Sung Songs (A2)
- %2:d Count of UnSung Songs
- %3:d Count of Songs with Video (A3)
- %4:s Name of the most popular Song}
- A1 := Length(Songs.Song);
- A2 := Database.GetTotalEntrys(2);
-
- A3 := SongswithVid;
-
- SetLength(Result1, 1);
- Database.GetStats(Result1, 2, 1, 0, False);
- A4 := Result1[0].Artist;
- A5 := Result1[0].Title;
-
- try
- Overview := Overview + '\n \n' + Format(Formatstr, [A1, A2, A1-A2, A3, A4, A5]);
- except
- on E: EConvertError do
- Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_SONG": ' + E.Message);
- end;
-
- //Player Overview
- Formatstr := Language.Translate ('STAT_OVERVIEW_PLAYER');
- {Format:
- %0:d Count Players (A1)
- %1:s Best Player (Result)
- %2:d Best Players Score
- %3:s Best Score Player (Result2)
- %4:d Best Score}
- A1 := Database.GetTotalEntrys(1);
-
- SetLength(Result1, 1);
- Database.GetStats(Result1, 1, 1, 0, False);
-
- SetLength(Result2, 1);
- Database.GetStats(Result2, 0, 1, 0, False);
-
- try
- Overview := Overview + '\n \n' + Format(Formatstr, [A1, Result1[0].Player, Result1[0].AverageScore, Result2[0].Singer, Result2[0].Score]);
- except
- on E: EConvertError do
- Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_PLAYER": ' + E.Message);
- end;
-
- Text[0].Text := Overview;
-end;
-
-
-procedure TScreenStatMain.SetAnimationProgress(Progress: real);
-var I: Integer;
-begin
- For I := 0 to high(Button) do
- Button[I].Texture.ScaleW := Progress;
-end;
-
-end.
+unit UScreenStatMain;
+
+interface
+
+{$IFDEF FPC}
+ {$MODE DELPHI}
+{$ENDIF}
+
+
+uses
+ UMenu,
+ SDL,
+ SysUtils,
+ UDisplay,
+ UMusic,
+ UIni,
+ UThemes;
+
+type
+ TScreenStatMain = class(TMenu)
+ private
+ //Some Stat Value that don't need to be calculated 2 times
+ SongswithVid: Cardinal;
+ public
+ TextOverview: integer;
+ constructor Create; override;
+ function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
+ procedure onShow; override;
+ procedure SetAnimationProgress(Progress: real); override;
+
+ procedure SetOverview;
+ end;
+
+implementation
+
+uses UGraphic,
+ UDataBase,
+ USongs,
+ ULanguage,
+ UCommon,
+ {$IFDEF win32}
+ windows,
+ {$ELSE}
+ sysconst,
+ {$ENDIF}
+ ULog;
+
+function TScreenStatMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean;
+begin
+ Result := true;
+ If (PressedDown) Then
+ begin // Key Down
+ case PressedKey of
+ SDLK_Q:
+ begin
+ Result := false;
+ end;
+
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ Ini.Save;
+ Music.PlayBack;
+ FadeTo(@ScreenMain);
+ end;
+ SDLK_RETURN:
+ begin
+ //Exit Button Pressed
+ if Interaction = 4 then begin
+ Music.PlayBack;
+ FadeTo(@ScreenMain);
+ end
+ else //One of the Stats Buttons Pressed
+ begin
+ Music.PlayBack;
+ ScreenStatDetail.Typ := Interaction;
+ FadeTo(@ScreenStatDetail);
+ end;
+ end;
+ SDLK_LEFT:
+ begin
+ InteractPrev;
+ end;
+ SDLK_RIGHT:
+ begin
+ InteractNext;
+ end;
+ SDLK_UP:
+ begin
+ InteractPrev;
+ end;
+ SDLK_DOWN:
+ begin
+ InteractNext;
+ end;
+ end;
+ end;
+end;
+
+constructor TScreenStatMain.Create;
+var
+ I: integer;
+begin
+ inherited Create;
+
+ TextOverview := AddText(Theme.StatMain.TextOverview);
+
+ LoadFromTheme(Theme.StatMain);
+
+ AddButton(Theme.StatMain.ButtonScores);
+ if (Length(Button[0].Text)=0) then
+ AddButtonText(14, 20, Theme.StatDetail.Description[0]);
+
+ AddButton(Theme.StatMain.ButtonSingers);
+ if (Length(Button[1].Text)=0) then
+ AddButtonText(14, 20, Theme.StatDetail.Description[1]);
+
+ AddButton(Theme.StatMain.ButtonSongs);
+ if (Length(Button[2].Text)=0) then
+ AddButtonText(14, 20, Theme.StatDetail.Description[2]);
+
+ AddButton(Theme.StatMain.ButtonBands);
+ if (Length(Button[3].Text)=0) then
+ AddButtonText(14, 20, Theme.StatDetail.Description[3]);
+
+ AddButton(Theme.StatMain.ButtonExit);
+ if (Length(Button[4].Text)=0) then
+ AddButtonText(14, 20, Theme.Options.Description[4]);
+
+ Interaction := 0;
+
+ //Set Songs with Vid
+ SongswithVid := 0;
+ For I := 0 to high(Songs.Song) do
+ if (Songs.Song[I].Video <> '') then
+ Inc(SongswithVid);
+end;
+
+procedure TScreenStatMain.onShow;
+begin
+ //Set Overview Text:
+ SetOverview;
+end;
+
+procedure TScreenStatMain.SetOverview;
+type
+ TwSystemTime = record
+ wYear,
+ wMonth,
+ wDayOfWeek,
+ wDay,
+ wHour,
+ wMinute,
+ wSecond,
+ wMilliseconds: Word;
+ end;
+var
+ Overview, Formatstr: String;
+ I: Integer;
+ //Some Vars to Save Attributes to
+ A1, A2, A3: Integer;
+ A4, A5: String;
+ Result1, Result2: AStatResult;
+ ResetTime: TSystemTime;
+
+ {$IFDEF win32}
+ function GetFileCreation(Filename: String): TSystemTime;
+ var
+ FindData: TWin32FindData;
+ Handle: THandle;
+ begin
+ Handle := FindFirstFile(PChar(Filename), FindData);
+ if Handle <> INVALID_HANDLE_VALUE then
+ begin
+ FileTimeToSystemTime(FindData.ftCreationTime, Result);
+ windows.FindClose(Handle);
+ end;
+ end;
+
+ {$ELSE}
+
+ function GetFileCreation(Filename: String): TSystemTime;
+ Var
+ F,D : Longint;
+ Begin
+ F:=FileCreate( Filename );
+ try
+ D:=FileGetDate(F);
+ DateTimeToSystemTime( FileDateToDateTime(D) , result);
+ finally
+ FileClose(F);
+ end;
+ end;
+ {$ENDIF}
+
+begin
+ //Song Overview
+
+ //Introduction
+ Formatstr := Language.Translate ('STAT_OVERVIEW_INTRO');
+ (*Format:
+ %0:d Ultrastar Version
+ %1:d Day of Reset (A1)
+ %2:d Month of Reset (A2)
+ %3:d Year of Reset (A3)*)
+
+ ResetTime := GetFileCreation(Database.Filename);
+
+ {$IFDEF win32}
+ A1 := ResetTime.wDay;
+ A2 := ResetTime.wMonth;
+ A3 := ResetTime.wYear;
+ {$ELSE}
+ A1 := ResetTime.Day;
+ A2 := ResetTime.Month;
+ A3 := ResetTime.Year;
+ {$ENDIF}
+
+
+ try
+ Overview := Format(Formatstr, [Language.Translate('US_VERSION'), A1, A2, A3]);
+ except
+ on E: EConvertError do
+ Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_INTRO": ' + E.Message);
+ end;
+
+ Formatstr := Language.Translate ('STAT_OVERVIEW_SONG');
+ {Format:
+ %0:d Count Songs (A1)
+ %1:d Count of Sung Songs (A2)
+ %2:d Count of UnSung Songs
+ %3:d Count of Songs with Video (A3)
+ %4:s Name of the most popular Song}
+ A1 := Length(Songs.Song);
+ A2 := Database.GetTotalEntrys(2);
+
+ A3 := SongswithVid;
+
+ SetLength(Result1, 1);
+ Database.GetStats(Result1, 2, 1, 0, False);
+ A4 := Result1[0].Artist;
+ A5 := Result1[0].Title;
+
+ try
+ Overview := Overview + '\n \n' + Format(Formatstr, [A1, A2, A1-A2, A3, A4, A5]);
+ except
+ on E: EConvertError do
+ Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_SONG": ' + E.Message);
+ end;
+
+ //Player Overview
+ Formatstr := Language.Translate ('STAT_OVERVIEW_PLAYER');
+ {Format:
+ %0:d Count Players (A1)
+ %1:s Best Player (Result)
+ %2:d Best Players Score
+ %3:s Best Score Player (Result2)
+ %4:d Best Score}
+ A1 := Database.GetTotalEntrys(1);
+
+ SetLength(Result1, 1);
+ Database.GetStats(Result1, 1, 1, 0, False);
+
+ SetLength(Result2, 1);
+ Database.GetStats(Result2, 0, 1, 0, False);
+
+ try
+ Overview := Overview + '\n \n' + Format(Formatstr, [A1, Result1[0].Player, Result1[0].AverageScore, Result2[0].Singer, Result2[0].Score]);
+ except
+ on E: EConvertError do
+ Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_PLAYER": ' + E.Message);
+ end;
+
+ Text[0].Text := Overview;
+end;
+
+
+procedure TScreenStatMain.SetAnimationProgress(Progress: real);
+var I: Integer;
+begin
+ For I := 0 to high(Button) do
+ Button[I].Texture.ScaleW := Progress;
+end;
+
+end.